hamcast  Version 0.7
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
hamcast::ipc::message Class Reference

#include <message.hpp>

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

Public Types

typedef intrusive_ptr< messageptr
 

Public Member Functions

message_type type () const
 
boost::uint32_t content_size () const
 
const char * content () const
 
size_t size () const
 
- Public Member Functions inherited from hamcast::ref_counted
long ref_count ()
 

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 Member Functions inherited from hamcast::ref_counted
static void add_ref (ref_counted *rc)
 
static void release (ref_counted *rc)
 

Static Public Attributes

static const size_t header_size
 

Additional Inherited Members

- Protected Member Functions inherited from hamcast::ref_counted
 ref_counted ()
 
void ref ()
 
bool deref ()
 

Detailed Description

Describes a single IPC message.

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

Member Typedef Documentation

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
mtypeThe type of this IPC message.
field1First message field (16 bit).
field2Second message field (32 bit).
field3Third message field (32 bit).
ct_sizeThe size of ct.
ctThe 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
mtypeThe type of this IPC message.
field1First message field (16 bit).
field2Second message field (32 bit).
field3Third message field (32 bit).
ctA 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: