Describes a single IPC message. More...
#include <message.hpp>
Public Types | |
typedef boost::intrusive_ptr < message > | ptr |
Public Member Functions | |
message_type | type () const |
boost::uint32_t | content_size () const |
const char * | content () const |
size_t | size () const |
Static Public Member Functions | |
static ptr | create (message_type mtype, boost::uint16_t field1, boost::uint32_t field2, boost::uint32_t field3, boost::uint32_t ct_size, char *ct) |
static ptr | create (message_type mtype, boost::uint16_t field1, boost::uint32_t field2, boost::uint32_t field3, const std::pair< size_t, void * > &ct) |
Static Public Attributes | |
static const size_t | header_size |
Describes a single IPC message.
See Structure of an IPC message for detailed description and usage.
typedef boost::intrusive_ptr<message> hamcast::ipc::message::ptr |
A smart pointer to an instance of message.
const char* hamcast::ipc::message::content | ( | ) | const |
Get the content of this message.
boost::uint32_t hamcast::ipc::message::content_size | ( | ) | const |
message::ptr hamcast::ipc::message::create | ( | message_type | mtype, | |
boost::uint16_t | field1, | |||
boost::uint32_t | field2, | |||
boost::uint32_t | field3, | |||
boost::uint32_t | ct_size, | |||
char * | ct | |||
) | [static] |
Create an IPC message.
mtype | The type of this IPC message. | |
field1 | First message field (16 bit). | |
field2 | Second message field (32 bit). | |
field3 | Third message field (32 bit). | |
ct_size | The size of ct . | |
ct | The content of this IPC message. |
(ct != NULL && ct_size > 0)
or (ct == NULL && ct_size == 0)
. mtype
is a valid message type. ct
if ct != NULL
ct
should be allocated with new char[...]
because the dtor calls delete[] ct;
. static ptr hamcast::ipc::message::create | ( | message_type | mtype, | |
boost::uint16_t | field1, | |||
boost::uint32_t | field2, | |||
boost::uint32_t | field3, | |||
const std::pair< size_t, void * > & | ct | |||
) | [static] |
Create an IPC message.
This is a convenient function that calls create(mtype, field1, field2, field3, ct.first, ct.second).
mtype | The type of this IPC message. | |
field1 | First message field (16 bit). | |
field2 | Second message field (32 bit). | |
field3 | Third message field (32 bit). | |
ct | A pair describing the content as {size, data}. |
size_t hamcast::ipc::message::size | ( | ) | const |
Get the full size of this message (content + header).
header_size + content_size()
message_type hamcast::ipc::message::type | ( | ) | const |
Get the value of the message type
field.
this
. const size_t hamcast::ipc::message::header_size [static] |
(2 * sizeof(boost::uint16_t)) + (3 * sizeof(boost::uint32_t))
The size of an IPC message header in bytes.