Ocean
|
This class implements a maintenance manager. More...
Data Structures | |
class | Connector |
This class is the base class for all maintenance connectors. More... | |
class | Element |
This class implements a maintenance data element. More... | |
Public Types | |
typedef std::vector< unsigned char > | Buffer |
Definition of a vector holding bytes. More... | |
Public Member Functions | |
bool | isActive () const |
Returns whether the maintenance manager is active or not. More... | |
std::string | name () const |
Returns the name of this maintenance manager. More... | |
unsigned long long | id () const |
Returns a random id of this maintenance manager. More... | |
bool | isEmpty () const |
Returns whether this maintenance manager is currently empty (does not hold any maintenance data, information or messages). More... | |
size_t | size () const |
Returns the number of maintenance data, information or messages which are currently stored in this manager. More... | |
void | setActive (const bool state) |
Activates or deactivates this maintenance manager. More... | |
void | setName (const std::string &name) |
Sets the name of this maintenance manager which should be a readable name of the application in which this manager is used. More... | |
bool | send (const std::string &tag, const void *data, const size_t size, const Timestamp timestamp=Timestamp(true)) |
Sends new maintenance data to this manager. More... | |
bool | send (const std::string &tag, const Buffer &buffer, const Timestamp timestamp=Timestamp(true)) |
Sends new maintenance data to this manager. More... | |
bool | send (const std::string &tag, Buffer &&buffer, const Timestamp timestamp=Timestamp(true)) |
Sends new maintenance data to this manager. More... | |
bool | receive (std::string &name, unsigned long long &id, std::string &tag, Buffer &buffer, Timestamp ×tamp) |
Receives the oldest maintenance data from this manager and pops it from the manager. More... | |
Static Public Member Functions | |
static Buffer | combine (const Buffer &firstBuffer, const Buffer &secondBuffer) |
Combines two buffers. More... | |
static void | appendBuffer (Buffer &firstBuffer, const Buffer &secondBuffer) |
Appends a second buffer to a first buffer. More... | |
Static Public Member Functions inherited from Ocean::Singleton< Maintenance > | |
static Maintenance & | get () |
Returns a reference to the unique object. More... | |
Protected Types | |
typedef std::queue< Element > | ElementQueue |
Definition of a vector holding maintenance data elements. More... | |
Protected Member Functions | |
Maintenance () | |
Creates a new maintenance manager object. More... | |
bool | place (const std::string &name, const unsigned long long id, const std::string &tag, Buffer &&buffer, const Timestamp timestamp) |
Explicitly places a maintenance data, information, message into this manager. More... | |
Protected Member Functions inherited from Ocean::Singleton< Maintenance > | |
Singleton ()=default | |
Default constructor. More... | |
Protected Attributes | |
bool | maintenanceActive |
The activation statement of this manager. More... | |
std::string | maintenanceName |
The readable name of this manager. More... | |
unsigned long long | maintenanceId |
The random id of this manager. More... | |
ElementQueue | maintenanceElementQueue |
The maintenance element queue. More... | |
Lock | maintenanceLock |
The maintenance lock. More... | |
Friends | |
class | Singleton< Maintenance > |
This class implements a maintenance manager.
The maintenance manager allows to transport maintenance data, maintenance information or maintenance messages from an arbitrary component to a central component handling or forwarding the data.
Further, the maintenance manager can receive data, information or massages from a connector that receives arbitrary maintenance information from a remote component so that it can be distributed by this maintenance manager.
An application can have at most one instance of a maintenance manager.
Beware: The maintenance manager accepts data only if the manager is active (the manager is deactivated by default).
Due to performance issues: Check whether the manager is active before preparing maintenance information to save computational time.
typedef std::vector<unsigned char> Ocean::Maintenance::Buffer |
Definition of a vector holding bytes.
|
protected |
Definition of a vector holding maintenance data elements.
|
inlineprotected |
Creates a new maintenance manager object.
|
inlinestatic |
Appends a second buffer to a first buffer.
firstBuffer | The first buffer to which the second buffer will be appended |
secondBuffer | The second buffer |
|
inlinestatic |
Combines two buffers.
firstBuffer | The first buffer |
secondBuffer | The second buffer |
|
inline |
Returns a random id of this maintenance manager.
The id provides a random 64 bit number allowing to distinguish between individual maintenance managers with same name (e.g., distributed in a large system connected by a network).
|
inline |
Returns whether the maintenance manager is active or not.
Check whether the manager is active before preparing information which will be forwarded to this manager.
|
inline |
Returns whether this maintenance manager is currently empty (does not hold any maintenance data, information or messages).
|
inline |
Returns the name of this maintenance manager.
|
protected |
Explicitly places a maintenance data, information, message into this manager.
Explicit maintenance data can be set even if the manager is not active.
name | The name of the maintenance manager belonging to the data which will be placed |
id | The id of the maintenance manager belonging to the data which will be placed |
tag | The tag of the maintenance data |
buffer | The buffer of the maintenance data, which will be moved |
timestamp | The timestamp of the maintenance data |
bool Ocean::Maintenance::receive | ( | std::string & | name, |
unsigned long long & | id, | ||
std::string & | tag, | ||
Buffer & | buffer, | ||
Timestamp & | timestamp | ||
) |
Receives the oldest maintenance data from this manager and pops it from the manager.
Maintenance data can be received even if the manager is not active.
name | The name of the maintenance manager to which the data has been sent |
id | The id of the maintenance manager to which the data has been sent |
tag | The tag of the maintenance data |
buffer | The maintenance data as buffer |
timestamp | The timestamp of the maintenance data |
bool Ocean::Maintenance::send | ( | const std::string & | tag, |
Buffer && | buffer, | ||
const Timestamp | timestamp = Timestamp(true) |
||
) |
Sends new maintenance data to this manager.
Check whether this manager is active before.
tag | A tag specifying purpose of the provided data |
buffer | The data buffer to be sent, which will be moved |
timestamp | The timestamp of the maintenance data |
bool Ocean::Maintenance::send | ( | const std::string & | tag, |
const Buffer & | buffer, | ||
const Timestamp | timestamp = Timestamp(true) |
||
) |
Sends new maintenance data to this manager.
Check whether this manager is active before.
tag | A tag specifying purpose of the provided data |
buffer | The data buffer to be sent |
timestamp | The timestamp of the maintenance data |
bool Ocean::Maintenance::send | ( | const std::string & | tag, |
const void * | data, | ||
const size_t | size, | ||
const Timestamp | timestamp = Timestamp(true) |
||
) |
Sends new maintenance data to this manager.
Check whether this manager is active before.
tag | A tag specifying purpose of the provided data |
data | The data to be sent |
size | The size of the data to be sent, in bytes |
timestamp | The timestamp of the maintenance data |
|
inline |
Activates or deactivates this maintenance manager.
By default this manager is deactivates and thus will not accept any data, information or messages.
state | True, to activate this manager; False; to deactivate this manager |
|
inline |
Sets the name of this maintenance manager which should be a readable name of the application in which this manager is used.
The name should be set once at application start.
name | The readable name to set |
|
inline |
Returns the number of maintenance data, information or messages which are currently stored in this manager.
|
friend |
|
protected |
The activation statement of this manager.
|
protected |
The maintenance element queue.
|
protected |
The random id of this manager.
|
mutableprotected |
The maintenance lock.
|
protected |
The readable name of this manager.