|
|
|
|
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 ReferenceMessage memory stream for network.
More...
#include <message.h>
Inheritance diagram for NLNET::CMessage:
List of all members.
Public Types |
enum | TStreamFormat { UseDefault,
Binary,
String
} |
Public Methods |
| CMessage (NLMISC::CStringIdArray &sida, const std::string &name="", bool inputStream=false, TStreamFormat streamformat=UseDefault, uint32 defaultCapacity=1000) |
| CMessage (const std::string &name="", bool inputStream=false, TStreamFormat streamformat=UseDefault, uint32 defaultCapacity=1000) |
| CMessage (NLMISC::CMemStream &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 | invert () |
| Transforms the message from input to output or from output to input. More...
|
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...
|
Static Public Methods |
void | setDefaultStringMode (bool stringmode) |
| Set default stream mode. More...
|
Public Attributes |
bool | TypeHasAnId |
bool | TypeHasAName |
Protected Methods |
void | init (const std::string &name, TStreamFormat streamformat) |
| Utility method. More...
|
Private Attributes |
bool | _TypeSet |
NLMISC::CStringIdArray * | _SIDA |
std::string | _Name |
NLMISC::CStringIdArray::TStringId | _Id |
uint32 | _HeaderSize |
Static Private Attributes |
bool | _DefaultStringMode = false |
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 Warning: THE ASSOCIATION Id<->String SYSTEM FOR THE MESSAGE TYPE IS DISABLED BECAUSE 2 DIFFERENT CLIENTS COULD HAVE SAME STRING ASSOC AND DIFFERENT ID SO WE HAVE TO PUT ONE SIDA TABLE PER CONNECTION AND NOT PER NET_BASE
-
Author:
-
Vianney Lecroart , Nevrax France
-
Date:
-
2001
Definition at line 56 of file message.h.
Member Enumeration Documentation
enum NLNET::CMessage::TStreamFormat
|
|
|
-
Enumeration values:
-
Definition at line 60 of file message.h. |
Constructor & Destructor Documentation
NLNET::CMessage::CMessage |
( |
const std::string & |
name = "", |
|
|
bool |
inputStream = false, |
|
|
TStreamFormat |
streamformat = UseDefault, |
|
|
uint32 |
defaultCapacity = 1000 |
|
) |
|
|
NLNET::CMessage::CMessage |
( |
const CMessage & |
other |
) |
|
|
Member Function Documentation
void NLNET::CMessage::clear |
( |
|
) |
[virtual] |
|
uint32 NLNET::CMessage::getHeaderSize |
( |
|
) |
|
|
std::string NLNET::CMessage::getName |
( |
|
) |
const |
|
void NLNET::CMessage::init |
( |
const std::string & |
name, |
|
|
TStreamFormat |
streamformat |
|
) |
[protected] |
|
void NLNET::CMessage::invert |
( |
|
) |
[inline, virtual] |
|
CMessage & NLNET::CMessage::operator= |
( |
const CMessage & |
other |
) |
|
|
void NLNET::CMessage::readType |
( |
|
) |
|
|
void NLNET::CMessage::setDefaultStringMode |
( |
bool |
stringmode |
) |
[inline, static] |
|
void NLNET::CMessage::setType |
( |
const std::string & |
name |
) |
|
|
|
Sets the message type as a string and put it in the buffer if we are in writing mode.
Definition at line 178 of file message.cpp.
References _HeaderSize, _Id, _Name, NLMISC::CMemStream::_StringMode, _TypeSet, format, FormatLong, FormatShort, NLMISC::CMemStream::getPos, id, NLMISC::IStream::isReading, NLMISC::CMemStream::length, nlassert, NLMISC::CMemStream::serial, NLMISC::CStringIdArray::TStringId, TypeHasAName, and TypeHasAnId. |
|
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 124 of file message.cpp.
References _HeaderSize, _Id, _Name, _SIDA, NLMISC::CMemStream::_StringMode, _TypeSet, format, FormatLong, NLMISC::CMemStream::getPos, NLMISC::CStringIdArray::getString, id, NLMISC::IStream::isReading, NLMISC::CMemStream::length, nlassert, nlinfo, nlstop, NLMISC::CMemStream::serial, NLMISC::CStringIdArray::TStringId, TypeHasAName, and TypeHasAnId.
Referenced by CMessage, init, and readType. |
std::string NLNET::CMessage::toString |
( |
|
) |
const |
|
|
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 317 of file message.cpp.
References _Id, _Name, _SIDA, _TypeSet, NLMISC::CStringIdArray::getId, NLMISC::CStringIdArray::getString, nlassert, s, TypeHasAName, and TypeHasAnId. |
bool NLNET::CMessage::typeIsSet |
( |
|
) |
const |
|
Member Data Documentation
bool NLNET::CMessage::_DefaultStringMode = false [static, private]
|
|
uint32 NLNET::CMessage::_HeaderSize [private]
|
|
std::string NLNET::CMessage::_Name [private]
|
|
bool NLNET::CMessage::_TypeSet [private]
|
|
bool NLNET::CMessage::TypeHasAName
|
|
bool NLNET::CMessage::TypeHasAnId
|
|
The documentation for this class was generated from the following files:
|
|