Main Page | Class Hierarchy | Class List | Directories | File List | Class Members

RNReplicaNet::MessageHelper Class Reference

#include <MessageHelper.h>

List of all members.

Public Member Functions

 MessageHelper ()
virtual ~MessageHelper ()
void SetBuffer (void *const buffer)
void AddVariable (const void *variable, const int size)
void AddData (const void *data, const int size)
void GetVariable (void *const variable, const int size)
void GetData (void *const data, const int size)
int GetSize (void)
void SetSize (const int size)
void AddInteger (const int value)
void AddFloat (const float value)
int GetInteger (void)
float GetFloat (void)

Static Public Member Functions

static std::string DumpAsHex (const void *data, const int size)


Detailed Description

A simple message helper class that helps to construct and deconstruct sequences of variables. This routine is endian safe and should be used where data needs to be endian safe


Constructor & Destructor Documentation

RNReplicaNet::MessageHelper::MessageHelper  ) 
 

The ctor performs some basic initialisation

virtual RNReplicaNet::MessageHelper::~MessageHelper  )  [virtual]
 

The dtor makes sure everything is tidy


Member Function Documentation

void RNReplicaNet::MessageHelper::AddData const void *  data,
const int  size
 

Adds a data block of a specified size to the message buffer without using any endian checking

Parameters:
data the pointer to the data
size the size of the data

void RNReplicaNet::MessageHelper::AddFloat const float  value  ) 
 

Adds a float to the message buffer

Parameters:
value the value to add

void RNReplicaNet::MessageHelper::AddInteger const int  value  ) 
 

Adds an integer to the message buffer

Parameters:
value the value to add

void RNReplicaNet::MessageHelper::AddVariable const void *  variable,
const int  size
 

Adds a variable of a specified size to the message buffer while using an endian check to preserve the value between platforms with different endian formats

Parameters:
variable the pointer to the variable
size the size of the data

static std::string RNReplicaNet::MessageHelper::DumpAsHex const void *  data,
const int  size
[static]
 

This produces a hex dump of any length of data

void RNReplicaNet::MessageHelper::GetData void *const   data,
const int  size
 

Gets data of a specified size from the message buffer

Parameters:
data the pointer to the data
size the size of the data

float RNReplicaNet::MessageHelper::GetFloat void   ) 
 

Gets a float from the message buffer

Parameters:
value the value to get

int RNReplicaNet::MessageHelper::GetInteger void   ) 
 

Gets an integer from the message buffer

Parameters:
value the value to get

int RNReplicaNet::MessageHelper::GetSize void   ) 
 

Returns the current size of the message in bytes

Returns:
returns the size of the message buffer in bytes

void RNReplicaNet::MessageHelper::GetVariable void *const   variable,
const int  size
 

Gets a variable of a specified size from the message buffer

Parameters:
variable the pointer to the variable
size the size of the data

void RNReplicaNet::MessageHelper::SetBuffer void *const   buffer  ) 
 

Sets the data buffer pointer to use while constructing or deconstructing this message. This also causes the length of the buffer to revert to zero.

Parameters:
buffer the buffer pointer to set

void RNReplicaNet::MessageHelper::SetSize const int  size  ) 
 

Sets the current size of the message in bytes

Parameters:
the size of the message in bytes


The documentation for this class was generated from the following file:
Generated on Sun Oct 30 01:12:31 2005 for Platform by  doxygen 1.4.1