# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLNET::CMessage Class Reference

Message memory stream for network. More...

#include <message.h>

Inheritance diagram for NLNET::CMessage

Inheritance graph
[legend]
Collaboration diagram for NLNET::CMessage:

Collaboration graph
[legend]
List of all members.

Public Methods

 CMessage (NLMISC::CStringIdArray &sida, const std::string &name = "", bool inputStream = false, uint32 defaultCapacity = 0)
 CMessage (const std::string &name = "", bool inputStream = false, uint32 defaultCapacity = 0)
 CMessage ( NLMISC::CStringStream &memstr)
 CMessage (const CMessage &other)
 Copy constructor. More...

CMessage& operator= (const CMessage &other)
 Assignment operator. More...

void setType (NLMISC::CStringIdArray::TStringId id)
 Sets the message type as a number (in range 0..32767) and put it in the buffer if we are in writing mode. More...

void setType (const std::string &name)
 Sets the message type as a string and put it in the buffer if we are in writing mode. More...

uint32 getHeaderSize ()
 Returns the size, in byte of the header that contains the type name of the message or the type number. More...

void readType ()
bool typeIsSet () const
void clear ()
 Clears the message. More...

std::string getName () const
 Returns the type name in string if available. Be sure that the message have the name of the message type. More...

NLMISC::CStringIdArray::TStringId getId () const
 Returns the type id of this message is available. More...

std::string toString () const
 Returns a readable string to display it to the screen. More...


Public Attributes

bool TypeHasAnId
bool TypeHasAName

Private Attributes

bool _TypeSet
NLMISC::CStringIdArray_SIDA
std::string _Name
NLMISC::CStringIdArray::TStringId _Id
uint32 _HeaderSize

Detailed Description

Message memory stream for network.

Can be serialized to/from (see SerialBuffer()). Can be sent or received over a network, using the NeL network engine. If MESSAGES_PLAIN_TEXT is defined, the messages will be serialized to/from plain text (human-readable), instead of binary. Warning: if you don't give a "sida", the message type will not be associated with id so, it'll not be optimized

Author(s):
Vianney Lecroart , Nevrax France
Date:
2001

Definition at line 66 of file message.h.


Constructor & Destructor Documentation

NLNET::CMessage::CMessage ( NLMISC::CStringIdArray & sida,
const std::string & name = "",
bool inputStream = false,
uint32 defaultCapacity = 0 ) [inline]
 

Definition at line 73 of file message.h.

NLNET::CMessage::CMessage ( const std::string & name = "",
bool inputStream = false,
uint32 defaultCapacity = 0 ) [inline]
 

Definition at line 85 of file message.h.

NLNET::CMessage::CMessage ( NLMISC::CStringStream & memstr ) [inline]
 

Definition at line 98 of file message.h.

NLNET::CMessage::CMessage ( const CMessage & other ) [inline]
 

Copy constructor.

Definition at line 124 of file message.h.


Member Function Documentation

void NLNET::CMessage::clear ( void ) [inline, virtual]
 

Clears the message.

Reimplemented from NLMISC::CMemStream.

Definition at line 250 of file message.h.

uint32 NLNET::CMessage::getHeaderSize ( ) [inline]
 

Returns the size, in byte of the header that contains the type name of the message or the type number.

Definition at line 215 of file message.h.

NLMISC::CStringIdArray::TStringId NLNET::CMessage::getId ( ) const [inline]
 

Returns the type id of this message is available.

Definition at line 260 of file message.h.

std::string NLNET::CMessage::getName ( ) const [inline]
 

Returns the type name in string if available. Be sure that the message have the name of the message type.

Definition at line 257 of file message.h.

CMessage & NLNET::CMessage::operator= ( const CMessage & other ) [inline]
 

Assignment operator.

Definition at line 130 of file message.h.

void NLNET::CMessage::readType ( ) [inline]
 

Definition at line 223 of file message.h.

void NLNET::CMessage::setType ( const std::string & name ) [inline]
 

Sets the message type as a string and put it in the buffer if we are in writing mode.

Definition at line 174 of file message.h.

void NLNET::CMessage::setType ( NLMISC::CStringIdArray::TStringId id ) [inline]
 

Sets the message type as a number (in range 0..32767) and put it in the buffer if we are in writing mode.

Definition at line 139 of file message.h.

std::string NLNET::CMessage::toString ( ) const [inline]
 

Returns a readable string to display it to the screen.

It's only for debugging purpose! Don't use it for anything else than to debugging, the string format could change in the futur

Definition at line 265 of file message.h.

bool NLNET::CMessage::typeIsSet ( ) const [inline]
 

Definition at line 244 of file message.h.


Member Data Documentation

bool NLNET::CMessage::TypeHasAName
 

Definition at line 277 of file message.h.

bool NLNET::CMessage::TypeHasAnId
 

Definition at line 276 of file message.h.

uint32 NLNET::CMessage::_HeaderSize [private]
 

Definition at line 287 of file message.h.

NLMISC::CStringIdArray::TStringId NLNET::CMessage::_Id [private]
 

Definition at line 284 of file message.h.

std::string NLNET::CMessage::_Name [private]
 

Definition at line 283 of file message.h.

NLMISC::CStringIdArray * NLNET::CMessage::_SIDA [private]
 

Definition at line 281 of file message.h.

bool NLNET::CMessage::_TypeSet [private]
 

Definition at line 280 of file message.h.


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