Ocean
Ocean::Maintenance Class Reference

This class implements a maintenance manager. More...

Inheritance diagram for Ocean::Maintenance:

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 &timestamp)
 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 Maintenanceget ()
 Returns a reference to the unique object. More...
 

Protected Types

typedef std::queue< ElementElementQueue
 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 >
 

Detailed Description

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.

Member Typedef Documentation

◆ Buffer

typedef std::vector<unsigned char> Ocean::Maintenance::Buffer

Definition of a vector holding bytes.

◆ ElementQueue

typedef std::queue<Element> Ocean::Maintenance::ElementQueue
protected

Definition of a vector holding maintenance data elements.

Constructor & Destructor Documentation

◆ Maintenance()

Ocean::Maintenance::Maintenance ( )
inlineprotected

Creates a new maintenance manager object.

Member Function Documentation

◆ appendBuffer()

void Ocean::Maintenance::appendBuffer ( Buffer firstBuffer,
const Buffer secondBuffer 
)
inlinestatic

Appends a second buffer to a first buffer.

Parameters
firstBufferThe first buffer to which the second buffer will be appended
secondBufferThe second buffer

◆ combine()

Maintenance::Buffer Ocean::Maintenance::combine ( const Buffer firstBuffer,
const Buffer secondBuffer 
)
inlinestatic

Combines two buffers.

Parameters
firstBufferThe first buffer
secondBufferThe second buffer
Returns
The resulting combined buffer

◆ id()

unsigned long long Ocean::Maintenance::id ( ) const
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).

Returns
The random id of this manager

◆ isActive()

bool Ocean::Maintenance::isActive ( ) const
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.

Returns
True, if so
See also
setActive().

◆ isEmpty()

bool Ocean::Maintenance::isEmpty ( ) const
inline

Returns whether this maintenance manager is currently empty (does not hold any maintenance data, information or messages).

Returns
True, if so

◆ name()

std::string Ocean::Maintenance::name ( ) const
inline

Returns the name of this maintenance manager.

Returns
The readable name of this manager
See also
setName().

◆ place()

bool Ocean::Maintenance::place ( const std::string &  name,
const unsigned long long  id,
const std::string &  tag,
Buffer &&  buffer,
const Timestamp  timestamp 
)
protected

Explicitly places a maintenance data, information, message into this manager.

Explicit maintenance data can be set even if the manager is not active.

Parameters
nameThe name of the maintenance manager belonging to the data which will be placed
idThe id of the maintenance manager belonging to the data which will be placed
tagThe tag of the maintenance data
bufferThe buffer of the maintenance data, which will be moved
timestampThe timestamp of the maintenance data
Returns
True, if succeeded
See also
Connector::place().

◆ receive()

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.

Parameters
nameThe name of the maintenance manager to which the data has been sent
idThe id of the maintenance manager to which the data has been sent
tagThe tag of the maintenance data
bufferThe maintenance data as buffer
timestampThe timestamp of the maintenance data
Returns
True, this manager had data which has been received

◆ send() [1/3]

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.

Parameters
tagA tag specifying purpose of the provided data
bufferThe data buffer to be sent, which will be moved
timestampThe timestamp of the maintenance data
Returns
True, if the data could be sent

◆ send() [2/3]

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.

Parameters
tagA tag specifying purpose of the provided data
bufferThe data buffer to be sent
timestampThe timestamp of the maintenance data
Returns
True, if the data could be sent

◆ send() [3/3]

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.

Parameters
tagA tag specifying purpose of the provided data
dataThe data to be sent
sizeThe size of the data to be sent, in bytes
timestampThe timestamp of the maintenance data
Returns
True, if the data could be sent

◆ setActive()

void Ocean::Maintenance::setActive ( const bool  state)
inline

Activates or deactivates this maintenance manager.

By default this manager is deactivates and thus will not accept any data, information or messages.

Parameters
stateTrue, to activate this manager; False; to deactivate this manager
See also
active().

◆ setName()

void Ocean::Maintenance::setName ( const std::string &  name)
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.

Parameters
nameThe readable name to set
See also
name().

◆ size()

size_t Ocean::Maintenance::size ( ) const
inline

Returns the number of maintenance data, information or messages which are currently stored in this manager.

Returns
The number of maintenance messages

Friends And Related Function Documentation

◆ Singleton< Maintenance >

friend class Singleton< Maintenance >
friend

Field Documentation

◆ maintenanceActive

bool Ocean::Maintenance::maintenanceActive
protected

The activation statement of this manager.

◆ maintenanceElementQueue

ElementQueue Ocean::Maintenance::maintenanceElementQueue
protected

The maintenance element queue.

◆ maintenanceId

unsigned long long Ocean::Maintenance::maintenanceId
protected

The random id of this manager.

◆ maintenanceLock

Lock Ocean::Maintenance::maintenanceLock
mutableprotected

The maintenance lock.

◆ maintenanceName

std::string Ocean::Maintenance::maintenanceName
protected

The readable name of this manager.


The documentation for this class was generated from the following file: