Collage
0.6.1
|
A class for sending commands with data to local and external nodes. More...
#include <oCommand.h>
Public Member Functions | |
CO_API | OCommand (const Connections &receivers, const uint32_t cmd, const uint32_t type=COMMANDTYPE_NODE) |
Construct a command which is send & dispatched typically to a co::Node. | |
CO_API | OCommand (Dispatcher *const dispatcher, LocalNodePtr localNode, const uint32_t cmd, const uint32_t type=COMMANDTYPE_NODE) |
Construct a command which is dispatched locally typically to a co::Node. | |
CO_API | OCommand (const OCommand &rhs) |
virtual CO_API | ~OCommand () |
Send or dispatch this command during destruction. | |
CO_API void | sendHeader (const uint64_t additionalSize) |
Allow external send of data along with this command. | |
Static Public Member Functions | |
static CO_API size_t | getSize () |
Protected Member Functions | |
virtual CO_API void | sendData (const void *buffer, const uint64_t size, const bool last) |
Send a data buffer (packet) to the receivers. |
A class for sending commands with data to local and external nodes.
The data to this command is added via the interface provided by DataOStream. The command is send or dispatched after it goes out of scope, i.e. during destruction.
Definition at line 37 of file oCommand.h.
CO_API co::OCommand::OCommand | ( | const Connections & | receivers, |
const uint32_t | cmd, | ||
const uint32_t | type = COMMANDTYPE_NODE |
||
) |
Construct a command which is send & dispatched typically to a co::Node.
receivers | list of connections where to send the command to. |
cmd | the command. |
type | the command type for dispatching. |
CO_API co::OCommand::OCommand | ( | Dispatcher *const | dispatcher, |
LocalNodePtr | localNode, | ||
const uint32_t | cmd, | ||
const uint32_t | type = COMMANDTYPE_NODE |
||
) |
Construct a command which is dispatched locally typically to a co::Node.
dispatcher | the dispatcher to dispatch this command. |
localNode | the local node that holds the command cache. |
cmd | the command. |
type | the command type for dispatching. |
virtual CO_API co::OCommand::~OCommand | ( | ) | [virtual] |
Send or dispatch this command during destruction.
static CO_API size_t co::OCommand::getSize | ( | ) | [static] |
virtual CO_API void co::OCommand::sendData | ( | const void * | buffer, |
const uint64_t | size, | ||
const bool | last | ||
) | [protected, virtual] |
Send a data buffer (packet) to the receivers.
Implements co::DataOStream.
CO_API void co::OCommand::sendHeader | ( | const uint64_t | additionalSize | ) |
Allow external send of data along with this command.
Locks all connections, which will be unlocked in the dtor after potentially send padding to fill up the send to Buffer::getMinSize().
additionalSize | size in bytes of additional data after header. |