Alchemy  1.0
A framework to robustly process network messages and structured data
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | Static Public Attributes | List of all members
Hg::basic_msg< MsgT, StorageT > Class Template Reference

An object that defines and manages access to a formatted message buffer. More...

#include <Hg.h>

Inherits MsgT.

Public Member Functions

 basic_msg ()
 Default Constructor.
 
 basic_msg (const basic_msg &rhs)
 Copy Constructor. More...
 
 basic_msg (const_pointer p, size_t n)
 Value constructor. Constructs an initialized message from a raw data buffer. More...
 
void assign (const_pointer pBuffer, size_t n)
 Assigns the contents of an incoming raw memory buffer to the message. More...
 
void clear ()
 Releases any reference to internal memory buffers. The message will be MT after this call.
 
const_pointer data () const
 Returns a pointer to the memory buffer that contains the packed message.
 
void data (pointer pBuffer, size_t n)
 Copies the data from this object.
 
bool empty () const
 Indicates if the buffer has allocated space. More...
 
basic_msgoperator= (const message_type &rhs)
 Assignment Operator. More...
 
size_t size () const
 Indicates the number of bytes required by this message. More...
 
const_reference values () const
 Returns a const reference to the underlying collection of value objects.
 
reference values ()
 Returns a reference to the underlying collection of value objects.
 

Static Public Attributes

static const bool k_has_dynamic = has_dynamic<format_type>::value
 Indicates if the format of this message contains fields that are potentially dynamically allocated.
 

Detailed Description

template<typename MsgT, typename StorageT>
class Hg::basic_msg< MsgT, StorageT >

An object that defines and manages access to a formatted message buffer.

MsgT A message description that has defined the format and utilities for field access. The MsgT must define these member-types: format_type: TypeList defines the format StorageT StoragePolicy that manages access rules for the buffer.

Note
The HG declaration MACROs define a template format that is compatible with Hg::basic_msg.

Definition at line 19 of file msg_view_iterator.h.

Constructor & Destructor Documentation

template<typename MsgT, typename StorageT>
Hg::basic_msg< MsgT, StorageT >::basic_msg ( const basic_msg< MsgT, StorageT > &  rhs)
inline

Copy Constructor.

Parameters
rhsThe Hg message object from which data is copied.

Definition at line 249 of file Hg.h.

template<typename MsgT, typename StorageT>
Hg::basic_msg< MsgT, StorageT >::basic_msg ( const_pointer  p,
size_t  n 
)
inline

Value constructor. Constructs an initialized message from a raw data buffer.

Parameters
pThe initialization data. The contents will only be verified for validity of the pointer if the size n is larger than zero.
nThe size of the buffer in sp.

Definition at line 262 of file Hg.h.

Member Function Documentation

template<typename MsgT, typename StorageT>
void Hg::basic_msg< MsgT, StorageT >::assign ( const_pointer  pBuffer,
size_t  n 
)
inline

Assigns the contents of an incoming raw memory buffer to the message.

Parameters
pBufferA memory buffer whose contents will be assigned to this message object. The values of the buffer are copied into the message.
nThe number of bytes held in p_buffer.

Definition at line 315 of file Hg.h.

template<typename MsgT, typename StorageT>
bool Hg::basic_msg< MsgT, StorageT >::empty ( ) const
inline

Indicates if the buffer has allocated space.

Returns
true - Buffer space has been allocated for the message. false - There is no buffer space allocated.

Definition at line 290 of file Hg.h.

template<typename MsgT, typename StorageT>
basic_msg& Hg::basic_msg< MsgT, StorageT >::operator= ( const message_type &  rhs)
inline

Assignment Operator.

Parameters
rhsBasic message values to initialize this instance.

Definition at line 273 of file Hg.h.

template<typename MsgT, typename StorageT>
size_t Hg::basic_msg< MsgT, StorageT >::size ( ) const
inline

Indicates the number of bytes required by this message.

Returns
The number of bytes that are used to pack this message.

Definition at line 300 of file Hg.h.


The documentation for this class was generated from the following files: