A class that translates raw binary data to network messages and vice versa. More...
#include <message_translator.hpp>
Public Types | |
typedef function< MessagePackageSharedPtr()> | CreationFunction |
Creator function for network message types. | |
typedef vector< char > | MtDataBuffer |
Container type for raw data. | |
Public Member Functions | |
virtual MessagePackageSharedPtr | createMessage (const string &type) |
Creates message of given type. | |
virtual void | getRaw (MtDataBuffer &data) |
Translates outgoing message queue to raw data that can be serialized across network. | |
MessageTranslator (MessagePackage::SerializationFormat format=MessagePackage::SerializationFormatBinary) | |
Constructor. | |
virtual void | receive (int clientId, MessageArray &messages) |
Translates received data in incoming data pool to messages. | |
MessagePackage::SerializationFormat & | serializationFormat () |
Returns the serialization type of an attached network adapter. | |
virtual void | setRaw (const MtDataBuffer &data) |
Copies given data to incoming data pool that can be later on translated to network messages. | |
virtual bool | transmit (const MessagePackage &message) |
Pushes given message to outgoing message queue that will be processed later on. | |
virtual | ~MessageTranslator () |
Destructor. | |
Protected Types | |
typedef map< string, CreationFunction > | CreatorContainer |
Container type for message creators. | |
Protected Attributes | |
CreatorContainer | m_creators |
Registered message creators. | |
MessagePackage::SerializationFormat | m_format |
mutex | m_mutex |
Synchronization variable. | |
MtDataBuffer | m_receiveData |
Incoming data buffers. | |
MtDataBuffer | m_receiveDataProcessing |
MtDataBuffer | m_reconstructData |
size_t | m_reconstructSize { 0 } |
unique_ptr< MessageContainer > | m_sendData |
Outgoing message buffers. | |
unique_ptr< MessageContainer > | m_sendDataProcessing |
A class that translates raw binary data to network messages and vice versa.
typedef function<MessagePackageSharedPtr()> kanzi::connect::MessageTranslator::CreationFunction |
Creator function for network message types.
|
protected |
Container type for message creators.
typedef vector<char> kanzi::connect::MessageTranslator::MtDataBuffer |
Container type for raw data.
kanzi::connect::MessageTranslator::MessageTranslator | ( | MessagePackage::SerializationFormat | format = MessagePackage::SerializationFormatBinary | ) |
Constructor.
|
virtual |
Destructor.
|
virtual |
Creates message of given type.
type | Type of the message. |
|
virtual |
Translates outgoing message queue to raw data that can be serialized across network.
data | Output raw data buffer. |
|
virtual |
Translates received data in incoming data pool to messages.
clientId | Id of the client that sent the messages. |
messages | Container for incoming messages. |
|
inline |
Returns the serialization type of an attached network adapter.
|
virtual |
Copies given data to incoming data pool that can be later on translated to network messages.
data | Incoming raw data buffer. |
|
virtual |
Pushes given message to outgoing message queue that will be processed later on.
|
protected |
Registered message creators.
|
protected |
|
protected |
Synchronization variable.
|
protected |
Incoming data buffers.
|
protected |
|
protected |
|
protected |
|
protected |
Outgoing message buffers.
|
protected |