Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes

hamcast::ipc::message Class Reference
[Inter-process communication.]

Describes a single IPC message. More...

#include <message.hpp>

Inheritance diagram for hamcast::ipc::message:
hamcast::ref_counted hamcast::util::comparable< message, message >

List of all members.

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

Detailed Description

Describes a single IPC message.

See Structure of an IPC message for detailed description and usage.


Member Typedef Documentation

typedef boost::intrusive_ptr<message> hamcast::ipc::message::ptr

A smart pointer to an instance of message.


Member Function Documentation

const char* hamcast::ipc::message::content (  )  const

Get the content of this message.

Returns:
The internal C-buffer.
boost::uint32_t hamcast::ipc::message::content_size (  )  const

Get the size of content().

Returns:
The size of content() in bytes.
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.

Parameters:
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.
Precondition:
(ct != NULL && ct_size > 0) or (ct == NULL && ct_size == 0).
mtype is a valid message type.
Warning:
ipc_message takes ownership of ct if ct != NULL
ct should be allocated with new char[...] because the dtor calls delete[] ct;.
Returns:
A smart pointer to the newly created message object.
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).

Parameters:
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}.
Returns:
A smart pointer to the newly created message object.
size_t hamcast::ipc::message::size (  )  const

Get the full size of this message (content + header).

Returns:
header_size + content_size()
message_type hamcast::ipc::message::type (  )  const

Get the value of the message type field.

Returns:
The message_type of this.

Member Data Documentation

const size_t hamcast::ipc::message::header_size [static]
Initial value:
            (2 * sizeof(boost::uint16_t)) + (3 * sizeof(boost::uint32_t))

The size of an IPC message header in bytes.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator