Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

osg::BinaryMessage Class Reference
[OpenSG network support]

Little-, Big endian independent message buffer. More...

#include <OSGBinaryMessage.h>

Inheritance diagram for osg::BinaryMessage:

Inheritance graph
[legend]
Collaboration diagram for osg::BinaryMessage:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< UInt8BufferType

Public Methods

Constructors
 BinaryMessage (void)
 BinaryMessage (const BinaryMessage &source)
 Copy constructor.

Destructor
virtual ~BinaryMessage (void)
 Destructor.

Get
virtual UInt32 getSize (void)
 Get message size.

virtual MemoryHandle getBuffer (void)
 Get buffer address.

Misc
virtual void setSize (UInt32 size)
 Set message size.

void clear (void)
 Clear message buffer.

void reset (void)
 Reset buffer for reading.

write message
void putUInt32 (const UInt32 value)
void putInt32 (const Int32 value)
void putUInt16 (const UInt16 value)
void putInt16 (const Int16 value)
void putUInt8 (const UInt8 value)
void putInt8 (const Int8 value)
void putString (const string &value)
void putReal32 (const Real32 value)
read message
void getUInt32 (UInt32 &value)
void getInt32 (Int32 &value)
void getUInt16 (UInt16 &value)
void getInt16 (Int16 &value)
void getUInt8 (UInt8 &value)
void getInt8 (Int8 &value)
void getString (string &value)
void getReal32 (Real32 &value)
UInt32 getUInt32 (void)
Int32 getInt32 (void)
UInt16 getUInt16 (void)
Int16 getInt16 (void)
UInt8 getUInt8 (void)
Int8 getInt8 (void)
string getString (void)
Real32 getReal32 (void)
Assignment
BinaryMessage & operator= (const BinaryMessage &source)

Protected Attributes

Member
BufferType _buffer
UInt32 _pos

Private Types

typedef NetworkMessage Inherited

Detailed Description

Little-, Big endian independent message buffer.

Author:
Marcus Roth
Little-, Big endian independent message buffer.

Example:

 
 // send
 BinSockMessage msg;
 msg.clear();              // if not already empty
 msg.putUInt32(220);
 msg.putInt32 (221);
 msg.putUInt16(222);
 msg.putInt16 (223);
 msg.putUInt8 (224);
 msg.putInt8  (225);
 msg.putReal32(226.0);
 msg.putString("227");
 socket.send(msg);
 // receive
 string str;
 socket.recv(msg);
 str = msg.getString();
 msg.getString(str);        // avoid one copy
 


Member Typedef Documentation

typedef std::vector<UInt8> osg::BinaryMessage::BufferType
 

typedef NetworkMessage osg::BinaryMessage::Inherited [private]
 


Constructor & Destructor Documentation

BinaryMessage::BinaryMessage void   
 

Constructor

BinaryMessage::BinaryMessage const BinaryMessage &    source
 

Copy constructor.

BinaryMessage::~BinaryMessage void    [virtual]
 

Destructor.


Member Function Documentation

UInt32 BinaryMessage::getSize void    [virtual]
 

Get message size.

Returns:
message size in bytes

Implements osg::NetworkMessage.

MemoryHandle BinaryMessage::getBuffer void    [virtual]
 

Get buffer address.

Returns:
pointer to the begin of the buffer

Implements osg::NetworkMessage.

void BinaryMessage::setSize UInt32    size [virtual]
 

Set message size.

Set message size. This is called by the socket to get enough space to read a message.

Parameters:
size  New message size

Implements osg::NetworkMessage.

void BinaryMessage::clear void   
 

Clear message buffer.

void BinaryMessage::reset void   
 

Reset buffer for reading.

Reset readpointer to the beginn of the buffer

void osg::BinaryMessage::putUInt32 const UInt32    value [inline]
 

void osg::BinaryMessage::putInt32 const Int32    value [inline]
 

void osg::BinaryMessage::putUInt16 const UInt16    value [inline]
 

void osg::BinaryMessage::putInt16 const Int16    value [inline]
 

void osg::BinaryMessage::putUInt8 const UInt8    value [inline]
 

void osg::BinaryMessage::putInt8 const Int8    value [inline]
 

void osg::BinaryMessage::putString const string &    value [inline]
 

void osg::BinaryMessage::putReal32 const Real32    value [inline]
 

void osg::BinaryMessage::getUInt32 UInt32   value [inline]
 

void osg::BinaryMessage::getInt32 Int32   value [inline]
 

void osg::BinaryMessage::getUInt16 UInt16   value [inline]
 

void osg::BinaryMessage::getInt16 Int16   value [inline]
 

void osg::BinaryMessage::getUInt8 UInt8   value [inline]
 

void osg::BinaryMessage::getInt8 Int8   value [inline]
 

void osg::BinaryMessage::getString string &    value [inline]
 

void osg::BinaryMessage::getReal32 Real32   value [inline]
 

UInt32 osg::BinaryMessage::getUInt32 void    [inline]
 

Int32 osg::BinaryMessage::getInt32 void    [inline]
 

UInt16 osg::BinaryMessage::getUInt16 void    [inline]
 

Int16 osg::BinaryMessage::getInt16 void    [inline]
 

UInt8 osg::BinaryMessage::getUInt8 void    [inline]
 

Int8 osg::BinaryMessage::getInt8 void    [inline]
 

string osg::BinaryMessage::getString void    [inline]
 

Real32 osg::BinaryMessage::getReal32 void    [inline]
 

BinaryMessage & BinaryMessage::operator= const BinaryMessage &    source
 

assignment


Member Data Documentation

BufferType osg::BinaryMessage::_buffer [protected]
 

UInt32 osg::BinaryMessage::_pos [protected]
 


The documentation for this class was generated from the following files:
Generated on Wed Jul 3 16:32:26 2002 for OpenSG by doxygen1.2.16