Ocean
Loading...
Searching...
No Matches
Ocean::Maintenance::Connector Class Reference

This class is the base class for all maintenance connectors. More...

#include <Maintenance.h>

Inheritance diagram for Ocean::Maintenance::Connector:

Protected Member Functions

 Connector ()
 Creates a new connector.
 

Static Protected Member Functions

static bool place (const std::string &name, const uint64_t id, const std::string &tag, Buffer &&buffer, const Timestamp timestamp)
 Explicitly places a maintenance data, information, message into the local maintenance manager.
 
static void encodeData (const std::string &name, const uint64_t id, const std::string &tag, const Buffer &buffer, const Timestamp timestamp, const size_t reservedHeaderSize, Buffer &encodedBuffer)
 Encodes a maintenance data to one combined package.
 
static bool decodeData (const void *encodedBuffer, const size_t encodedBufferSize, std::string &name, uint64_t &id, std::string &tag, Buffer &buffer, Timestamp &timestamp)
 Decodes a package buffer to maintenance data with corresponding information.
 

Detailed Description

This class is the base class for all maintenance connectors.

A maintenance connector connects a local maintenance manager with a remote maintenance manager to transmit the information.
The actual implementation of any maintenance connector must be done in a derived class, thus individual connectors with individual capabilities can be implemented.

Constructor & Destructor Documentation

◆ Connector()

Ocean::Maintenance::Connector::Connector ( )
inlineprotected

Creates a new connector.

Member Function Documentation

◆ decodeData()

static bool Ocean::Maintenance::Connector::decodeData ( const void *  encodedBuffer,
const size_t  encodedBufferSize,
std::string &  name,
uint64_t &  id,
std::string &  tag,
Buffer buffer,
Timestamp timestamp 
)
staticprotected

Decodes a package buffer to maintenance data with corresponding information.

Parameters
encodedBufferThe encoded network package buffer
encodedBufferSizeThe size of the encoded buffer in bytes
nameThe resulting name of the maintenance manager to which the data has been sent originally
idThe result id of the maintenance manager to which the data has been sent originally
tagThe tag of the maintenance data
bufferThe buffer of the maintenance data
timestampThe timestamp of the maintenance data
Returns
True, if succeeded

◆ encodeData()

static void Ocean::Maintenance::Connector::encodeData ( const std::string &  name,
const uint64_t  id,
const std::string &  tag,
const Buffer buffer,
const Timestamp  timestamp,
const size_t  reservedHeaderSize,
Buffer encodedBuffer 
)
staticprotected

Encodes a maintenance data to one combined package.

The resulting buffer holds the optional header followed by the payload, all fields in host byte order:

|<- reservedHeaderSize ->|<-------------------------------------------------- payload -------------------------------------------------->|
+------------------------+-----------+------------+-----------------+--------+-----------+----------------+------------+-----------------+
| header, left untouched | timestamp | nameLength | name | id | tagLength | tag | bufferSize | buffer |
| | 8 byte | 8 byte | nameLength byte | 8 byte | 8 byte | tagLength byte | 8 byte | bufferSize byte |
+------------------------+-----------+------------+-----------------+--------+-----------+----------------+------------+-----------------+
std::string name() const
Returns the name of this maintenance manager.
Definition Maintenance.h:473

timestamp is the timestamp of the maintenance data, a Timestamp and therefore a double. name is the readable name of the maintenance manager the data originated from, e.g. the application name. id is the random 64 bit id of that manager, which distinguishes two managers that happen to share a name. tag describes what the payload is and is what a receiver dispatches on. buffer is the maintenance payload itself. nameLength, tagLength and bufferSize each give the byte count of the variable length field which follows it. None of the strings is null terminated on the wire. The first reservedHeaderSize bytes are left untouched for a transport to write its own header into. This is how MaintenanceTCPConnector places its length prefix without copying the payload again.

Parameters
nameThe name of the maintenance manager providing the data
idThe id of the maintenance manager providing the data
tagThe tag of the maintenance data
bufferThe maintenance data as buffer
timestampThe timestamp of the maintenance data
reservedHeaderSizeThe number of bytes which will be reserved for the header, so that the resulting buffer has an optional header followed by the payload data
encodedBufferThe resulting encoded package

◆ place()

static bool Ocean::Maintenance::Connector::place ( const std::string &  name,
const uint64_t  id,
const std::string &  tag,
Buffer &&  buffer,
const Timestamp  timestamp 
)
staticprotected

Explicitly places a maintenance data, information, message into the local maintenance 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
Maintenance::place().

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