NLNET::CMessage Class Reference

#include <message.h>

Inheritance diagram for NLNET::CMessage:

NLMISC::CMemStream NLMISC::IStream

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 58 of file message.h.

Seek fonctionnality

enum  TSeekOrigin { begin, current, end }
virtual std::string getStreamName () const

Public Types

enum  TStreamFormat { UseDefault, Binary, String }

Public Member Functions

void assignFromSubMessage (const CMessage &msgin)
const uint8buffer () const
uint8bufferToFill (uint32 msgsize)
void changeType (const std::string &name)
void clear ()
 Clears the message.

 CMessage (const CMessage &other)
 Copy constructor.

 CMessage (NLMISC::CMemStream &memstr)
 CMessage (const std::string &name="", bool inputStream=false, TStreamFormat streamformat=UseDefault, uint32 defaultCapacity=1000)
 CMessage (NLMISC::CStringIdArray &sida, const std::string &name="", bool inputStream=false, TStreamFormat streamformat=UseDefault, uint32 defaultCapacity=1000)
NLMISC::CMemStream extractStreamFromPos (sint32 pos)
 Return an input stream containing the stream beginning in the message at the specified pos.

template<class T> void fastRead (T &value)
template<class T> void fastSerial (T &val)
template<class T> void fastWrite (const T &value)
void fill (const uint8 *srcbuf, uint32 len)
uint32 getHeaderSize ()
 Returns the size, in byte of the header that contains the type name of the message or the type number.

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

std::string getName () const
sint32 getPos () const
 Const and not-virtual getPos(), for direct use. Caution: should not be overloaded in a child class.

virtual sint32 getPos () throw (EStream)
bool hasLockedSubMessage () const
 Return true if a sub message has been locked.

void increaseBufferIfNecessary (uint32 len)
 Increase the buffer size if 'len' can't enter, otherwise, do nothing.

void invert ()
bool isReading () const
 Is this stream a Read/Input stream?

bool isXML () const
virtual uint32 length () const
uint32 lengthR () const
 Returns the "read" message size (number of bytes to read) (note: see comment about _LengthR).

std::string lockSubMessage (uint32 subMsgSize)
CMessageoperator= (const CMessage &other)
 Assignment operator.

template<class T> void poke (T value, sint32 pos)
void readType ()
std::string readTypeAtCurrentPos ()
 Get the message name (input message only) and advance the current pos.

sint32 reserve (uint len)
void resetBufPos ()
void resetPtrTable ()
 Force to reset the ptr table.

void resize (uint32 size)
 Resize the buffer.

virtual bool seek (sint32 offset, TSeekOrigin origin) throw (EStream)
template<class T0, class T1, class T2, class T3, class T4, class T5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
template<class T0, class T1, class T2, class T3, class T4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<class T0, class T1, class T2, class T3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<class T0, class T1, class T2> void serial (T0 &a, T1 &b, T2 &c)
template<class T0, class T1> void serial (T0 &a, T1 &b)
template<class T> void serial (T &obj)
 Template serialisation (should take the one from IStream).

virtual void serialBit (bool &bit)
 Method inherited from IStream.

virtual void serialBuffer (uint8 *buf, uint len)
 Method inherited from IStream.

virtual void serialBufferWithSize (uint8 *buf, uint32 len)
virtual void serialCont (std::vector< bool > &cont)
 Specialisation of serialCont() for vector<bool>.

virtual void serialCont (std::vector< sint8 > &cont)
 Specialisation of serialCont() for vector<sint8>.

virtual void serialCont (std::vector< uint8 > &cont)
 Specialisation of serialCont() for vector<uint8>.

template<class K, class T> void serialCont (std::multimap< K, T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class K, class T> void serialCont (std::map< K, T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::multiset< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::set< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::deque< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::list< T > &cont)
 Specialisation of serialCont() for vector<bool>.

template<class T> void serialCont (std::vector< T > &cont)
template<class T> void serialEnum (T &em)
 Template enum serialisation. Serialized as a sint32.

virtual void serialMemStream (CMemStream &b)
 Serial memstream, bitmemstream...

void serialMessage (CMessage &msg)
 Encapsulate/decapsulate another message inside the current message.

void setStringMode (bool stringmode)
 Set string mode.

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.

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.

uint32 size () const
 Returns the size of the buffer (can be greater than the length, especially in output mode).

bool stringMode () const
 Return string mode.

std::string toString () const
bool typeIsSet () const
void unlockSubMessage ()
String-specific methods
virtual void serialHex (uint32 &b)
 Serialisation in hexadecimal.

uint serialSeparatedBufferIn (uint8 *buf, uint len)
 Input: read len bytes at most from the stream until the next separator, and return the number of bytes read. The separator is then skipped.

void serialSeparatedBufferOut (uint8 *buf, uint len)
 Output: writes len bytes from buf into the stream.

Base types serialisation, redefined for string mode
Those method are a specialisation of template method "void serial(T&)".

virtual void serial (ucstring &b)
virtual void serial (std::string &b)
virtual void serial (char &b)
virtual void serial (bool &b)
virtual void serial (double &b)
virtual void serial (float &b)
virtual void serial (sint64 &b)
virtual void serial (uint64 &b)
virtual void serial (sint32 &b)
virtual void serial (uint32 &b)
virtual void serial (sint16 &b)
virtual void serial (uint16 &b)
virtual void serial (sint8 &b)
virtual void serial (uint8 &b)
String-specific methods
virtual void serialHex (uint32 &b)
 Serialisation in hexadecimal.

uint serialSeparatedBufferIn (uint8 *buf, uint len)
 Input: read len bytes at most from the stream until the next separator, and return the number of bytes read. The separator is then skipped.

void serialSeparatedBufferOut (uint8 *buf, uint len)
 Output: writes len bytes from buf into the stream.

Base types serialisation, redefined for string mode
Those method are a specialisation of template method "void serial(T&)".

virtual void serial (ucstring &b)
virtual void serial (std::string &b)
virtual void serial (char &b)
virtual void serial (bool &b)
virtual void serial (double &b)
virtual void serial (float &b)
virtual void serial (sint64 &b)
virtual void serial (uint64 &b)
virtual void serial (sint32 &b)
virtual void serial (uint32 &b)
virtual void serial (sint16 &b)
virtual void serial (uint16 &b)
virtual void serial (sint8 &b)
virtual void serial (uint8 &b)
String-specific methods
virtual void serialHex (uint32 &b)
 Serialisation in hexadecimal.

uint serialSeparatedBufferIn (uint8 *buf, uint len)
 Input: read len bytes at most from the stream until the next separator, and return the number of bytes read. The separator is then skipped.

void serialSeparatedBufferOut (uint8 *buf, uint len)
 Output: writes len bytes from buf into the stream.


Static Public Member Functions

void getVersionException (bool &throwOnOlder, bool &throwOnNewer)
void setDefaultStringMode (bool stringmode)
 Set default stream mode.

void setVersionException (bool throwOnOlder, bool throwOnNewer)

Data Fields

bool TypeHasAName
bool TypeHasAnId

Protected Member Functions

void init (const std::string &name, TStreamFormat streamformat)
 Utility method.

uint32 lengthS () const
 Returns the serialized length (number of bytes written or read).

void resetSubMessageInternals ()
 Utility method.

template<class T> void serialVector (T &cont)

Protected Attributes

CObjectVector< uint8, false > _Buffer
uint8_BufPos
uint32 _DefaultCapacity
bool _StringMode

Private Attributes

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

Static Private Attributes

bool _DefaultStringMode = false


Member Enumeration Documentation

enum NLMISC::IStream::TSeekOrigin [inherited]
 

Parameters for seek(). begin seek from the begining of the stream. current seek from the current location of the stream pointer. end seek from the end of the stream.

Enumeration values:
begin 
current 
end 

Definition at line 549 of file stream.h.

00549 { begin, current, end };

enum NLNET::CMessage::TStreamFormat
 

Enumeration values:
UseDefault 
Binary 
String 

Definition at line 62 of file message.h.

00062 { UseDefault, Binary, String };


Constructor & Destructor Documentation

NLNET::CMessage::CMessage NLMISC::CStringIdArray sida,
const std::string &  name = "",
bool  inputStream = false,
TStreamFormat  streamformat = UseDefault,
uint32  defaultCapacity = 1000
 

Definition at line 50 of file message.cpp.

References init(), and uint32.

00050                                                                                                                                            :
00051         NLMISC::CMemStream (inputStream, false, defaultCapacity),
00052         TypeHasAnId(false), TypeHasAName(false), _SIDA (&sida), _SubMessagePosR(0), _LengthR(0), _HeaderSize(0xFFFFFFFF), _TypeSet (false)
00053 {
00054         init( name, streamformat );
00055 }

NLNET::CMessage::CMessage const std::string &  name = "",
bool  inputStream = false,
TStreamFormat  streamformat = UseDefault,
uint32  defaultCapacity = 1000
 

Definition at line 61 of file message.cpp.

References init(), and uint32.

00061                                                                                                                :
00062         NLMISC::CMemStream (inputStream, false, defaultCapacity),
00063         TypeHasAnId(false), TypeHasAName(false), _SIDA (NULL), _SubMessagePosR(0), _LengthR(0), _HeaderSize(0xFFFFFFFF), _TypeSet (false)
00064 {
00065         init( name, streamformat );
00066 }

NLNET::CMessage::CMessage NLMISC::CMemStream memstr  ) 
 

Definition at line 91 of file message.cpp.

References NLMISC::CMemStream::getPos(), invert(), NLMISC::IStream::isReading(), readType(), NLMISC::CMemStream::seek(), and sint32.

00091                                             :
00092         NLMISC::CMemStream( memstr ),
00093         TypeHasAnId(false), TypeHasAName(false), _SIDA (NULL), _SubMessagePosR(0), _LengthR(0), _HeaderSize(0xFFFFFFFF), _TypeSet (false)
00094 {
00095         sint32 pos = getPos();
00096         bool reading = isReading();
00097         if ( reading ) // force input mode to read the type
00098                 readType(); // sets _TypeSet, _HeaderSize and _LengthR
00099         else
00100                 invert(); // calls readType()
00101         if ( ! reading )
00102                 invert(); // set ouput mode back if necessary
00103         seek( pos, begin ); // sets the same position as the one in the memstream
00104 }

NLNET::CMessage::CMessage const CMessage other  ) 
 

Copy constructor.

Definition at line 110 of file message.cpp.

References operator=().

00111 {
00112         operator= (other);
00113 }


Member Function Documentation

void NLNET::CMessage::assignFromSubMessage const CMessage msgin  ) 
 

Similar to operator=, but makes the current message contain *only* the locked sub message in msgin or the whole msgin if it is not locked

Preconditions:

  • msgin is an input message (isReading())
  • The current message is blank (new or reset with clear())

Postconditions:

  • If msgin has been locked using lockSubMessage(), the current message contains only the locked sub message in msgin, otherwise the current message is exactly msgin
  • The current message is an input message, it is not locked

Definition at line 151 of file message.cpp.

References _LengthR, _SubMessagePosR, _TypeSet, NLMISC::CMemStream::buffer(), NLMISC::CMemStream::fill(), hasLockedSubMessage(), invert(), NLMISC::IStream::isReading(), nlassert, operator=(), and readType().

00152 {
00153         nlassert( msgin.isReading() );
00154         nlassert( ! _TypeSet );
00155         if ( ! isReading() )
00156                 invert();
00157 
00158         if ( msgin.hasLockedSubMessage() )
00159         {
00160                 fill( msgin.buffer() + msgin._SubMessagePosR, msgin._LengthR-msgin._SubMessagePosR );
00161                 readType();
00162         }
00163         else
00164         {
00165                 operator=( msgin );
00166         }
00167 }

const uint8* NLMISC::CMemStream::buffer  )  const [inline, inherited]
 

Returns a pointer to the message buffer (read only) Returns NULL if the buffer is empty

Definition at line 238 of file mem_stream.h.

References NLMISC::CObjectVector< uint8, false >::getPtr(), and uint8.

Referenced by assignFromSubMessage(), NLMISC::displayBitStream(), extractStreamFromPos(), NLNET::TMessageRecord::serial(), NLMISC::IStream::serialMemStream(), NLMISC::CBitMemStream::serialMemStream(), and serialMessage().

00239         {
00240                 return _Buffer.getPtr();
00241 /*              if ( _Buffer.empty() )
00242                 {
00243                         return NULL;
00244                 }
00245                 else
00246                 {
00247                         return &(*_Buffer.begin());
00248                 }*/
00249         }

uint8* NLMISC::CMemStream::bufferToFill uint32  msgsize  )  [inline, inherited]
 

Resize the stream with the specified size, set the current position at the beginning of the stream and return a pointer to the stream buffer.

Precondition: the stream is an input stream.

Suggested usage: construct an input stream, resize and get the buffer using bufferToFillAndRead(), fill it with raw data using any filling function (warning: don't fill more than 'msgsize' bytes!), then you are ready to read, using serial(), the data you've just filled.

Reimplemented in NLMISC::CBitMemStream.

Definition at line 306 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), nlassert, NLMISC::CObjectVector< uint8, false >::resize(), uint32, and uint8.

Referenced by extractStreamFromPos(), NLPACS::CGlobalRetriever::CLrLoader::run(), NLNET::TMessageRecord::serial(), NLMISC::IStream::serialMemStream(), and serialMessage().

00307         {
00308 #ifdef NL_DEBUG
00309                 nlassert( isReading() );
00310 #endif
00311                 if ( msgsize == 0 )
00312                         return NULL;
00313 
00314                 _Buffer.resize( msgsize );
00315                 _BufPos = _Buffer.getPtr();
00316                 /*if ( ! isReading() )
00317                         _BufPos += msgsize;*/
00318                 return _Buffer.getPtr();
00319         }

void NLNET::CMessage::changeType const std::string &  name  ) 
 

Definition at line 297 of file message.cpp.

References NLMISC::CMemStream::getPos(), NLMISC::CMemStream::seek(), NLMISC::CMemStream::serial(), sint32, uint32, and uint8.

00298 {
00299         sint32 prevPos = getPos();
00300         seek( sizeof(uint32)+sizeof(uint8), begin );
00301         serial ((std::string&)name);
00302         seek( prevPos, begin );
00303 }

void NLNET::CMessage::clear void   )  [virtual]
 

Clears the message.

Reimplemented from NLMISC::CMemStream.

Definition at line 398 of file message.cpp.

References _LengthR, _SubMessagePosR, _TypeSet, hasLockedSubMessage(), NLMISC::IStream::isReading(), NLNET::LockedSubMessageError, and nlassertex.

Referenced by NLNET::CPacsClient::initMessage().

00399 {
00400         nlassertex( (!isReading()) || (!hasLockedSubMessage()), ("Clearing %s", LockedSubMessageError) );
00401 
00402         CMemStream::clear ();
00403         _TypeSet = false;
00404         _SubMessagePosR = 0;
00405         _LengthR = 0;
00406 }

NLMISC::CMemStream NLNET::CMessage::extractStreamFromPos sint32  pos  ) 
 

Return an input stream containing the stream beginning in the message at the specified pos.

Definition at line 460 of file message.cpp.

References NLMISC::CMemStream::buffer(), NLMISC::CMemStream::bufferToFill(), len, length(), and sint32.

00461 {
00462         NLMISC::CMemStream msg( true );
00463         sint32 len = length() - pos;
00464         memcpy( msg.bufferToFill( len ), buffer() + pos, len );
00465         return msg;
00466 }

template<class T>
void NLMISC::CMemStream::fastRead T &  value  )  [inline, inherited]
 

Definition at line 404 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::length(), NLMISC::CMemStream::lengthS(), and value.

00405         {
00406                 //nldebug( "MEMSTREAM: Reading %u-byte value in %p at pos %u", sizeof(value), this, _BufPos - _Buffer.getPtr() );
00407                 // Check that we don't read more than there is to read
00408                 if ( lengthS()+sizeof(value) > length() ) // calls virtual length (cf. sub messages)
00409                 {
00410                         throw EStreamOverflow();
00411                 }
00412                 // Serialize in
00413                 value = *(T*)_BufPos;
00414                 _BufPos += sizeof(value);
00415         }

template<class T>
void NLMISC::CMemStream::fastSerial T &  val  )  [inline, inherited]
 

Definition at line 371 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::increaseBufferIfNecessary(), NLMISC::IStream::isReading(), NLMISC::CMemStream::length(), and NLMISC::CMemStream::lengthS().

Referenced by NLMISC::CMemStream::serial().

00372         {
00373 #ifdef NL_LITTLE_ENDIAN
00374                 if(isReading())
00375                 {
00376                         // Check that we don't read more than there is to read
00377                         // TODO OPTIM we can remove the check if we want to be faster (50ms->43ms for 1 million serial)
00378                         if ( lengthS()+sizeof(T) > length() ) // calls virtual length (cf. sub messages)
00379                                 throw EStreamOverflow();
00380                         // Serialize in
00381                         val = *(T*)_BufPos;
00382                 }
00383                 else
00384                 {
00385                         increaseBufferIfNecessary (sizeof(T));
00386                         *(T*)_BufPos = val;
00387                 }
00388                 _BufPos += sizeof (T);
00389 #else // NL_LITTLE_ENDIAN
00390                 IStream::serial( val );
00391 #endif // NL_LITTLE_ENDIAN
00392         }

template<class T>
void NLMISC::CMemStream::fastWrite const T &  value  )  [inline, inherited]
 

Definition at line 395 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::increaseBufferIfNecessary(), and value.

00396         {
00397                 //nldebug( "MEMSTREAM: Writing %u-byte value in %p at pos %u", sizeof(value), this, _BufPos - _Buffer.getPtr() );
00398                 increaseBufferIfNecessary (sizeof(T));
00399                 *(T*)_BufPos = value;
00400                 _BufPos += sizeof (T);
00401         }

void NLMISC::CMemStream::fill const uint8 srcbuf,
uint32  len
[inline, inherited]
 

Resize the message buffer and fill data at position 0. Input stream: the current position is set at the beginning; Output stream: the current position is set after the filled data.

Reimplemented in NLMISC::CBitMemStream.

Definition at line 277 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), len, NLMISC::CObjectVector< uint8, false >::resize(), NLMISC::CObjectVector< uint8, false >::size(), uint32, and uint8.

Referenced by assignFromSubMessage(), and NL3D::CTextureMem::doGenerate().

00278         {
00279                 if (len == 0) return;
00280 
00281                 _Buffer.resize( len );
00282                 CFastMem::memcpy( _Buffer.getPtr(), srcbuf, len );
00283                 if (isReading())
00284                 {
00285                         _BufPos = _Buffer.getPtr();
00286                 }
00287                 else
00288                 {
00289                         _BufPos = _Buffer.getPtr() + _Buffer.size();
00290                 }
00291         }

uint32 NLNET::CMessage::getHeaderSize  ) 
 

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

Definition at line 309 of file message.cpp.

References _HeaderSize, nlassert, and uint32.

Referenced by NLNET::getNameOfMessageOrTransportClass().

00310 {
00311         nlassert (_HeaderSize != 0xFFFFFFFF);
00312         return _HeaderSize;
00313 }

NLMISC::CStringIdArray::TStringId NLNET::CMessage::getId  )  const
 

Returns the type id of this message is available.

Definition at line 432 of file message.cpp.

References _TypeSet, nlassert, NLMISC::CStringIdArray::TStringId, and TypeHasAnId.

Referenced by NLNET::CCallbackNetBase::processOneMessage().

00433 {
00434         nlassert (_TypeSet && TypeHasAnId);
00435         return _Id;
00436 }

std::string NLNET::CMessage::getName  )  const
 

Returns the type name in string if available. Be sure that the message have the name of the message type In a callback driven by message name, getName() does not necessarily return the right name.

Definition at line 411 of file message.cpp.

References _SubMessagePosR, _TypeSet, NLMISC::CMemStream::getPos(), hasLockedSubMessage(), nlassert, readTypeAtCurrentPos(), NLMISC::CMemStream::seek(), sint32, and TypeHasAName.

Referenced by NLNET::getNameOfMessageOrTransportClass(), NLNET::CCallbackNetBase::processOneMessage(), NLNET::CUnifiedNetwork::send(), NLNET::uncbMsgProcessing(), and unlockSubMessage().

00412 {
00413         if ( hasLockedSubMessage() )
00414         {
00415                 CMessage& notconstMsg = const_cast<CMessage&>(*this);
00416                 sint32 savedPos = notconstMsg.getPos();
00417                 notconstMsg.seek( _SubMessagePosR, begin ); // not really const... but removing the const from getName() would need too many const changes elsewhere
00418                 std::string name = notconstMsg.readTypeAtCurrentPos();
00419                 notconstMsg.seek( savedPos, begin );
00420                 return name;
00421         }
00422         else
00423         {
00424                 nlassert (_TypeSet && TypeHasAName);
00425                 return _Name;
00426         }
00427 }

sint32 NLMISC::CMemStream::getPos void   )  const [inline, inherited]
 

Const and not-virtual getPos(), for direct use. Caution: should not be overloaded in a child class.

Definition at line 159 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), and sint32.

00160         {
00161                 return _BufPos - _Buffer.getPtr();
00162         }

virtual sint32 NLMISC::CMemStream::getPos void   )  throw (EStream) [inline, virtual, inherited]
 

Get the location of the stream pointer.

NB: If the stream doesn't support the seek fonctionnality, it throws ESeekNotSupported. Default implementation: { throw ESeekNotSupported; }

Parameters:
offset is the wanted offset from the origin.
origin is the origin of the seek
Returns:
the new offset regarding from the origin.
See also:
ESeekNotSupported SeekOrigin seek

Reimplemented from NLMISC::IStream.

Definition at line 153 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), and sint32.

Referenced by changeType(), CMessage(), getName(), lockSubMessage(), readType(), readTypeAtCurrentPos(), NLMISC::CBitMemStream::serial(), NLMISC::CBitMemStream::serialCont(), NLMISC::CBitMemStream::serialMemStream(), setType(), and unlockSubMessage().

00154         {
00155                 return _BufPos - _Buffer.getPtr();
00156         }

string NLMISC::IStream::getStreamName  )  const [virtual, inherited]
 

Get a name for this stream. maybe a fileName if FileStream. Default is to return "".

Reimplemented in NLMISC::CIFile, and NLMISC::COFile.

Definition at line 420 of file stream.cpp.

Referenced by NLMISC::EStream::EStream().

00421 {
00422         return "";
00423 }

void NLMISC::IStream::getVersionException bool &  throwOnOlder,
bool &  throwOnNewer
[static, inherited]
 

Get the behavior of IStream regarding input stream that are older/newer than the class.

See also:
serialVersion() setVersionException()

Definition at line 78 of file stream.cpp.

References NLMISC::IStream::_ThrowOnNewer, and NLMISC::IStream::_ThrowOnOlder.

00079 {
00080         throwOnOlder=_ThrowOnOlder;
00081         throwOnNewer=_ThrowOnNewer;
00082 }

bool NLNET::CMessage::hasLockedSubMessage  )  const [inline]
 

Return true if a sub message has been locked.

Definition at line 175 of file message.h.

References _SubMessagePosR.

Referenced by assignFromSubMessage(), clear(), getName(), invert(), operator=(), and unlockSubMessage().

00176         {
00177                 return (_SubMessagePosR != 0);
00178         }

void NLMISC::CMemStream::increaseBufferIfNecessary uint32  len  )  [inline, inherited]
 

Increase the buffer size if 'len' can't enter, otherwise, do nothing.

Definition at line 358 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), len, NLMISC::CObjectVector< uint8, false >::resize(), NLMISC::CObjectVector< uint8, false >::size(), and uint32.

Referenced by NLMISC::CMemStream::fastSerial(), NLMISC::CMemStream::fastWrite(), NLMISC::CMemStream::reserve(), and NLMISC::CMemStream::serialBuffer().

00359         {
00360                 uint32 oldBufferSize = _Buffer.size();
00361                 if (_BufPos - _Buffer.getPtr() + len > oldBufferSize)
00362                 {
00363                         // need to increase the buffer size
00364                         uint32 pos = _BufPos - _Buffer.getPtr();
00365                         _Buffer.resize(oldBufferSize*2 + len);
00366                         _BufPos = _Buffer.getPtr() + pos;
00367                 }
00368         }

void NLNET::CMessage::init const std::string &  name,
TStreamFormat  streamformat
[protected]
 

Utility method.

Definition at line 72 of file message.cpp.

References _DefaultStringMode, NLMISC::CMemStream::setStringMode(), setType(), and UseDefault.

Referenced by CMessage().

00073 {
00074         if ( streamformat == UseDefault )
00075         {
00076                 setStringMode( _DefaultStringMode );
00077         }
00078         else
00079         {
00080                 setStringMode( streamformat == String );
00081         }
00082 
00083         if (!name.empty())
00084                 setType (name);
00085 }

void NLNET::CMessage::invert  )  [inline, virtual]
 

Transforms the message from input to output or from output to input

Reimplemented from NLMISC::CMemStream.

Definition at line 198 of file message.h.

References _TypeSet, hasLockedSubMessage(), NLMISC::IStream::isReading(), NLNET::LockedSubMessageError, nlassertex, and readType().

Referenced by assignFromSubMessage(), CMessage(), NLNET::NLMISC_COMMAND(), and serialMessage().

00199         {
00200                 nlassertex( (!isReading()) || (!hasLockedSubMessage()), ("Inverting %s", LockedSubMessageError) );
00201 
00202                 CMemStream::invert();
00203 
00204                 if ( isReading() )
00205                 {
00206                         // Write -> Read: skip the header 
00207                         _TypeSet = false;
00208                         if ( _Buffer.size() != 0 )
00209                                 readType();
00210                 }
00211                 // For Read -> Write, please use clear()
00212         }

bool NLMISC::IStream::isReading  )  const [inline, inherited]
 

Is this stream a Read/Input stream?

Definition at line 64 of file stream_inline.h.

References NLMISC::IStream::_InputStream.

Referenced by assignFromSubMessage(), NLMISC::CMemStream::bufferToFill(), NL3D::CParticleSystemShape::buildFromPS(), clear(), NLMISC::CMemStream::clear(), CMessage(), NLMISC::CBitMemStream::displayStream(), NLMISC::CMemStream::fastSerial(), NLMISC::CMemStream::fill(), NL3D::CParticleSystemShape::flushTextures(), NLMISC::CBitMemStream::getSerialItem(), NLMISC::CBitMemStream::increaseBufferIfNecessary(), NLMISC::COXml::init(), NL3D::CParticleSystemShape::instanciatePS(), NLMISC::CBitMemStream::internalSerial(), invert(), NLMISC::CMemStream::invert(), NLMISC::CBitMemStream::invert(), length(), NLMISC::CMemStream::length(), NLMISC::CBitMemStream::length(), NLMISC::CBitmap::load(), NLMISC::CBitmap::loadSize(), lockSubMessage(), operator=(), NLMISC::CBitMemStream::pointNextByte(), NLMISC::CMemStream::poke(), NLMISC::CBitMemStream::poke(), NLMISC::CBitMemStream::pokeBits(), NLMISC::CBitMemStream::readBits(), NLMISC::CBitmap::readTGA(), readTypeAtCurrentPos(), NLMISC::CMemStream::reserve(), NLMISC::CBitMemStream::reserveBits(), NLMISC::CBitMemStream::resetBufPos(), NLPACS::CGlobalRetriever::CLrLoader::run(), NL3D::CZone::serial(), NL3D::CVegetableShape::serial(), NLPACS::CSurfaceQuadTree::serial(), NLPACS::CQuadBranch::serial(), NL3D::CSurfaceLightGrid::CCellCorner::serial(), NLMISC::CStringStream::serial(), NLMISC::IStream::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NL3D::CPSAttrib< T >::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamed::serial(), NL3D::CPointLight::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::COXml::serial(), NLNET::TMessageRecord::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NLMISC::CMemStream::serial(), NLMISC::CMatrix::serial(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NLNET::CInetAddress::serial(), NL3D::CHLSTextureBank::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CEdgeQuad::serial(), NL3D::CCluster::serial(), NLPACS::CChainQuad::serial(), NLPACS::COrderedChain::serial(), NLMISC::CBitSet::serial(), NLMISC::CBitMemStream::serial(), NL3D::CMaterialBase::CAnimatedTexture::serial(), NLMISC::CAABBoxExt::serial(), NL3D::CMaterial::CLightMap::serial2(), NLMISC::CStringStream::serialBit(), NLMISC::CMemStream::serialBit(), NLMISC::CBitMemStream::serialBit(), NLMISC::CMemStream::serialBuffer(), NLMISC::CBitMemStream::serialBuffer(), NLMISC::IStream::serialCheck(), NLMISC::CStringStream::serialCont(), NLMISC::IStream::serialCont(), NLMISC::CBitMemStream::serialCont(), NLMISC::IStream::serialEnum(), NL3D::CVertexBuffer::serialHeader(), NLMISC::CStringStream::serialHex(), NLMISC::CMemStream::serialHex(), NLMISC::IStream::serialIStreamable(), NL3D::CMeshMRMGeom::serialLodVertexData(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMemStream(), NLMISC::CBitMemStream::serialMemStream(), serialMessage(), NLMISC::IStream::serialMultimap(), NL3D::CVertexBuffer::serialOldV1Minus(), NLMISC::IStream::serialPtr(), NLMISC::CStringStream::serialSeparatedBufferIn(), NLMISC::CMemStream::serialSeparatedBufferIn(), NLMISC::CStringStream::serialSeparatedBufferOut(), NLMISC::COXml::serialSeparatedBufferOut(), NLMISC::CMemStream::serialSeparatedBufferOut(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialSTLContLenPolyPtr(), NLMISC::IStream::serialSTLContLenPtr(), NLMISC::IStream::serialSTLContPolyPtr(), NLMISC::IStream::serialSTLContPtr(), NL3D::CVertexBuffer::serialSubset(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), NLMISC::IStream::serialVectorPtr(), NLMISC::IStream::serialVersion(), setType(), unlockSubMessage(), NLMISC::CBitmap::writeTGA(), NLMISC::COXml::xmlBreakLineInternal(), NLMISC::COXml::xmlCommentInternal(), NLMISC::COXml::xmlPopInternal(), NLMISC::COXml::xmlPushBeginInternal(), NLMISC::COXml::xmlPushEndInternal(), and NLMISC::COXml::xmlSetAttribInternal().

00065 {
00066         return _InputStream;
00067 }

bool NLMISC::IStream::isXML  )  const [inline, inherited]
 

Definition at line 221 of file stream.h.

References NLMISC::IStream::_XML.

Referenced by NLMISC::CMemStream::serial().

00221 { return _XML; }        

virtual uint32 NLNET::CMessage::length  )  const [inline, virtual]
 

Returns the length (size) of the message, in bytes. If isReading(), it is the number of bytes that can be read, otherwise it is the number of bytes that have been written. Overloaded because uses a specific version of lengthR().

Reimplemented from NLMISC::CMemStream.

Definition at line 104 of file message.h.

References NLMISC::IStream::isReading(), lengthR(), NLMISC::CMemStream::lengthS(), and uint32.

Referenced by extractStreamFromPos(), NLNET::CCallbackNetBase::processOneMessage(), NLNET::TMessageRecord::serial(), and serialMessage().

00105         {
00106                 if ( isReading() )
00107                 {
00108                         return lengthR();
00109                 }
00110                 else
00111                 {
00112                         return lengthS();
00113                 }
00114         }

uint32 NLNET::CMessage::lengthR  )  const [inline]
 

Returns the "read" message size (number of bytes to read) (note: see comment about _LengthR).

Reimplemented from NLMISC::CMemStream.

Definition at line 117 of file message.h.

References _LengthR, and uint32.

Referenced by length(), and lockSubMessage().

00118         {
00119                 return _LengthR;
00120         }

uint32 NLMISC::CMemStream::lengthS  )  const [inline, protected, inherited]
 

Returns the serialized length (number of bytes written or read).

Definition at line 502 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), and uint32.

Referenced by NLMISC::CMemStream::fastRead(), NLMISC::CMemStream::fastSerial(), length(), NLMISC::CMemStream::length(), NLMISC::CBitMemStream::length(), NLMISC::CMemStream::operator=(), NLMISC::CMemStream::serialBuffer(), NLMISC::CStringStream::serialSeparatedBufferIn(), and NLMISC::CMemStream::serialSeparatedBufferIn().

00503         {
00504                 return _BufPos - _Buffer.getPtr(); // not calling getPos() because virtual and not const!
00505         }

std::string NLNET::CMessage::lockSubMessage uint32  subMsgSize  )  [inline]
 

Set an input message to look like, from a message callback's scope, as if it began at the current pos and ended at the current pos + msgSize, and read the header and return the name of the sub message.

This method provides a way to pass a big message containing a set of sub messages to their message callback, without copying each sub message to a new message. If you need to perform some actions that are not allowed with a locked message (see postconditions), use assignFromSubMessage(): the locked sub message in M1 can be copied to a new message M2 with 'M2.assignFromSubMessage( M1 )'.

Preconditions:

Postconditions:

  • The sub message is ready to be read from
  • length() returns the size of the sub message
  • getName() return the name of the sub message
  • Unless you call unlockSubMessage(), the following actions will assert or raise an exception: Serializing more than the sub message size, clear(), operator=() (from/to), invert().

Definition at line 143 of file message.h.

References _LengthR, _SubMessagePosR, NLMISC::CMemStream::getPos(), NLMISC::IStream::isReading(), lengthR(), nlassertex, readTypeAtCurrentPos(), and uint32.

00144         {
00145                 uint32 subMsgBeginPos = getPos();
00146                 uint32 subMsgEndPos = subMsgBeginPos + subMsgSize;
00147                 nlassertex( isReading() && (subMsgEndPos <= lengthR()), ("%s %u %u", isReading()?"R":"W", subMsgEndPos, lengthR()) );
00148                 std::string name = readTypeAtCurrentPos();
00149                 _SubMessagePosR = subMsgBeginPos;
00150                 _LengthR = subMsgEndPos;
00151                 return name;
00152         }

CMessage & NLNET::CMessage::operator= const CMessage other  ) 
 

Assignment operator.

Definition at line 118 of file message.cpp.

References _HeaderSize, _Id, _LengthR, _Name, _SIDA, _SubMessagePosR, _TypeSet, hasLockedSubMessage(), NLMISC::IStream::isReading(), NLNET::LockedSubMessageError, nlassertex, TypeHasAName, and TypeHasAnId.

Referenced by assignFromSubMessage(), and CMessage().

00119 {
00120         nlassertex( (!other.isReading()) || (!other.hasLockedSubMessage()), ("Storing %s", LockedSubMessageError) );
00121         nlassertex( (!isReading()) || (!hasLockedSubMessage()), ("Assigning %s", LockedSubMessageError) );
00122 
00123         CMemStream::operator= (other);
00124         _TypeSet = other._TypeSet;
00125         _SIDA = other._SIDA;
00126         TypeHasAnId = other.TypeHasAnId;
00127         TypeHasAName = other.TypeHasAName;
00128         _Name = other._Name;
00129         _Id = other._Id;
00130         _HeaderSize = other._HeaderSize;
00131         _SubMessagePosR = other._SubMessagePosR;
00132         _LengthR = other._LengthR;
00133         return *this;
00134 
00135 }

template<class T>
void NLMISC::CMemStream::poke value,
sint32  pos
[inline, inherited]
 

When writing, fill a value previously reserved by reserve() (warning: you MUST have called reserve() with sizeof(T) before poking). Usually it's an alternative to use serialCont with a vector. Example: uint8 counter=0; sint32 counterPos = msgout.reserve( sizeof(counter) ); counter = serialSelectedItems( msgout ); msgout.poke( counter, counterPos );

Definition at line 190 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), nlassert, sint32, uint8, and value.

00191         {
00192                 if ( ! isReading() )
00193                 {
00194                         uint8 *pokeBufPos = _Buffer.getPtr() + pos;
00195                         nlassert( pokeBufPos + sizeof(T) <= _BufPos );
00196                         *(T*)pokeBufPos = value;
00197                 }
00198         }

void NLNET::CMessage::readType  ) 
 

The message was filled with an CMemStream, Now, we'll get the message type on this buffer. This method updates _LengthR with the actual size of the buffer (it calls resetLengthR()).

Definition at line 319 of file message.cpp.

References _HeaderSize, format, NLMISC::CMemStream::getPos(), nlassert, resetSubMessageInternals(), NLMISC::CMemStream::seek(), NLMISC::CMemStream::serial(), setType(), NLMISC::CStringIdArray::TStringId, uint, and uint8.

Referenced by assignFromSubMessage(), CMessage(), invert(), and serialMessage().

00320 {
00321         nlassert (isReading ());
00322 
00323         // debug features, we number all packet to be sure that they are all sent and received
00324         // \todo remove this debug feature when ok
00325 
00326         // we remove the message from the message
00327         resetSubMessageInternals();
00328         const uint HeaderSize = 4;
00329         seek (HeaderSize, begin);
00330 //              uint32 zeroValue;
00331 //              serial (zeroValue);
00332 
00333         // Force binary mode for header
00334         _StringMode = false;
00335 
00336         uint8 format;
00337         serial (format);
00338         //nldebug( "IN format = %hu", (uint16)format );
00339         bool LongFormat = (format & 1);
00340 
00341         // Set mode for the following of the buffer
00342         _StringMode = (format >> 1) & 1;
00343         if (LongFormat)
00344         {
00345                 std::string name;
00346                 serial (name);
00347                 setType (name);
00348         }
00349         else
00350         {
00351                 NLMISC::CStringIdArray::TStringId id;
00352                 serial (id);
00353                 setType (id);
00354         }
00355         _HeaderSize = getPos();
00356 }

std::string NLNET::CMessage::readTypeAtCurrentPos  ) 
 

Get the message name (input message only) and advance the current pos.

Definition at line 362 of file message.cpp.

References format, NLMISC::CMemStream::getPos(), NLMISC::IStream::isReading(), nlassert, nlerror, NLMISC::CMemStream::seek(), NLMISC::CMemStream::serial(), uint, and uint8.

Referenced by getName(), and lockSubMessage().

00363 {
00364         nlassert( isReading() );
00365 
00366         const uint HeaderSize = 4;
00367         seek( getPos() + HeaderSize, begin );
00368 
00369         bool sm = _StringMode;
00370         _StringMode = false;
00371 
00372         uint8 format;
00373         serial( format );
00374         bool LongFormat = (format & 1);
00375         _StringMode = (format >> 1) & 1;
00376         if ( LongFormat )
00377         {
00378                 std::string name;
00379                 serial( name );
00380                 _StringMode = sm;
00381                 return name;
00382         }
00383         else
00384                 nlerror( "Id not supported" );
00385 
00386         _StringMode = sm;
00387         return "";
00388 }

sint32 NLMISC::CMemStream::reserve uint  len  )  [inline, inherited]
 

When writing, skip 'len' bytes and return the position of the blank space for a future poke(). Warning: this has nothing to do with the semantics of reserve() in std::vector!

Definition at line 168 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::CMemStream::increaseBufferIfNecessary(), NLMISC::IStream::isReading(), len, sint32, and uint.

00169         {
00170                 sint32 pos = _BufPos - _Buffer.getPtr();
00171                 if ( ! isReading() )
00172                 {
00173                         increaseBufferIfNecessary( len );
00174                         _BufPos += len;
00175                 }
00176                 return pos;
00177         }

void NLMISC::CMemStream::resetBufPos  )  [inline, inherited]
 

When you fill the buffer externaly (using bufferAsVector) you have to reset the BufPos calling this method

If you are using the stream only in output mode, you can use this method as a faster version of clear() *if you don't serialize pointers*.

Reimplemented in NLMISC::CBitMemStream.

Definition at line 270 of file mem_stream.h.

References NLMISC::CMemStream::_BufPos, and NLMISC::CObjectVector< uint8, false >::getPtr().

Referenced by NLMISC::IStream::serialMemStream().

00270 { _BufPos = _Buffer.getPtr(); }

void NLMISC::CMemStream::resetPtrTable  )  [inline, inherited]
 

Force to reset the ptr table.

Reimplemented from NLMISC::IStream.

Definition at line 352 of file mem_stream.h.

Referenced by NLMISC::CMemStream::clear(), NL3D::CParticleSystemShape::flushTextures(), NL3D::CParticleSystemShape::instanciatePS(), and NLMISC::CMemStream::invert().

00352 { IStream::resetPtrTable() ; }

void NLNET::CMessage::resetSubMessageInternals  )  [inline, protected]
 

Utility method.

Definition at line 248 of file message.h.

References _LengthR, and _SubMessagePosR.

Referenced by readType(), and unlockSubMessage().

00249         {
00250                 _SubMessagePosR = 0;
00251                 _LengthR = _Buffer.size();
00252         }

void NLMISC::CMemStream::resize uint32  size  )  [inherited]
 

Resize the buffer.

Definition at line 235 of file mem_stream.cpp.

References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::CMemStream::length(), NLMISC::CObjectVector< uint8, false >::resize(), size, and uint32.

00236 {
00237         if (size == length()) return;
00238         // need to increase the buffer size
00239         uint32 pos = _BufPos - _Buffer.getPtr();
00240         _Buffer.resize(size);
00241         _BufPos = _Buffer.getPtr() + pos;
00242 }

bool NLMISC::CMemStream::seek sint32  offset,
TSeekOrigin  origin
throw (EStream) [virtual, inherited]
 

Moves the stream pointer to a specified location.

Warning: in output mode, seek(end) does not point to the end of the serialized data, but on the end of the whole allocated buffer (see size()). If you seek back and want to return to the end of the serialized data, you have to store the position (a better way is to use reserve()/poke()).

NB: If the stream doesn't support the seek fonctionnality, it throws ESeekNotSupported. Default implementation: { throw ESeekNotSupported; }

Parameters:
offset is the wanted offset from the origin.
origin is the origin of the seek
Returns:
true if seek sucessfull.
See also:
ESeekNotSupported SeekOrigin getPos

Reimplemented from NLMISC::IStream.

Definition at line 177 of file mem_stream.cpp.

References offset, sint, and sint32.

Referenced by changeType(), CMessage(), NL3D::CParticleSystemShape::flushTextures(), getName(), NLNET::getNameOfMessageOrTransportClass(), NL3D::CParticleSystemShape::instanciatePS(), readType(), readTypeAtCurrentPos(), serialMessage(), and unlockSubMessage().

00178 {
00179         switch (origin)
00180         {
00181         case begin:
00182                 if (offset > (sint)length())
00183                         return false;
00184                 if (offset < 0)
00185                         return false;
00186                 _BufPos=_Buffer.getPtr()+offset;
00187                 break;
00188         case current:
00189                 if (getPos ()+offset > (sint)length())
00190                         return false;
00191                 if (getPos ()+offset < 0)
00192                         return false;
00193                 _BufPos+=offset;
00194                 break;
00195         case end:
00196                 if (offset < -(sint)length())
00197                         return false;
00198                 if (offset > 0)
00199                         return false;
00200                 _BufPos=_Buffer.getPtr()+_Buffer.size()+offset;
00201                 break;
00202         }
00203         return true;
00204 }

void NLMISC::CMemStream::serial ucstring b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 863 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::IStream::isReading(), len, NLMISC::SEPARATOR, NLMISC::CMemStream::serial(), NLMISC::CMemStream::serialBuffer(), sint, sint32, and uint8.

00864 {
00865         if ( _StringMode )
00866         {
00867                 sint32  len=0;
00868                 // Read/Write the length.
00869                 if(isReading())
00870                 {
00871                         serial(len);
00872                         b.resize(len);
00873                 }
00874                 else
00875                 {
00876                         len= b.size();
00877                         serial(len);
00878                 }
00879                 // Read/Write the string.
00880                 for(sint i=0;i<len;i++)
00881                         serialBuffer( (uint8*)&b[i], sizeof( sizeof(b[i]) ) );
00882 
00883                 char sep = SEPARATOR;
00884                 serialBuffer( (uint8*)&sep, 1 );
00885         }
00886         else
00887         {
00888                 IStream::serial( b );
00889         }
00890 }

void NLMISC::CMemStream::serial std::string &  b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 803 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), NLMISC::IStream::isXML(), len, nlassert, nlwarning, NLMISC::SEPARATOR, NLMISC::CMemStream::serial(), NLMISC::CMemStream::serialBuffer(), sint, sint32, and uint8.

00804 {
00805         if ( _StringMode )
00806         {
00807                 sint32  len=0;
00808                 // Read/Write the length.
00809                 if(isReading())
00810                 {
00811                         serial(len);
00812                         nlassert( len<1000000 ); // limiting string size
00813                         b.resize(len);
00814                 }
00815                 else
00816                 {
00817                         len= b.size();
00818                         serial(len);
00819                 }
00820                 
00821                 // Read/Write the string.
00822                 for(sint i=0;i<len;i++)
00823                         serialBuffer( (uint8*)&(b[i]), sizeof(b[i]) );
00824 
00825                 char sep = SEPARATOR;
00826                 serialBuffer( (uint8*)&sep, 1 );
00827         }
00828         else
00829         {
00830                 if (isReading())
00831                 {
00832                         if (sizeof(char) == 1 && !isXML())
00833                         {                       
00834                                 sint32  len=0;                  
00835                                 fastSerial(len);
00836                                 //              nlassert( len<1000000 ); // limiting string size
00837                                 if (len>1000000)
00838                                 {
00839                                         nlwarning("Trying to serialize a string of %u character !", len);
00840                                         throw NLMISC::EStreamOverflow();
00841                                 }
00842                                 b.resize(len);
00843                                 if (len > 0)
00844                                 {                               
00845                                         // can serial all in a single call to serialBuffer, since sizeof(char) == 1
00846                                         serialBuffer((uint8 *) &b[0], len);
00847                                 }
00848                         }
00849                         else
00850                         {
00851                                 IStream::serial( b );
00852                         }
00853                 }
00854                 else
00855                 {               
00856                         IStream::serial( b );
00857                 }
00858         }
00859 }

void NLMISC::CMemStream::serial char &  b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 778 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), NLMISC::SEPARATOR, NLMISC::CMemStream::serialBuffer(), and uint8.

00779 {
00780         if ( _StringMode )
00781         {
00782                 char buff [2];
00783                 if ( isReading() )
00784                 {
00785                         serialBuffer( (uint8*)buff, 2 );
00786                         b = buff[0];
00787                 }
00788                 else
00789                 {
00790                         buff[0] = b;
00791                         buff[1] = SEPARATOR;
00792                         serialBuffer( (uint8*)buff, 2 );
00793                 }
00794         }
00795         else
00796         {
00797                 fastSerial (b);
00798         }
00799 }

void NLMISC::CMemStream::serial bool &  b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 763 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), and NLMISC::CMemStream::serialBit().

00764 {
00765         if ( _StringMode )
00766         {
00767                 serialBit(b);
00768         }
00769         else
00770         {
00771                 fastSerial (b);
00772         }
00773 }

void NLMISC::CMemStream::serial double &  b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 743 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, and writenumber.

00744 {
00745         if ( _StringMode )
00746         {
00747                 if ( isReading() )
00748                 {
00749                         readnumber( b, double, 128, atof ); //
00750                 }
00751                 else
00752                 {
00753                         writenumber( b, "%f", 128 );
00754                 }
00755         }
00756         else
00757         {
00758                 fastSerial (b);
00759         }
00760 }

void NLMISC::CMemStream::serial float &  b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 723 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, and writenumber.

00724 {
00725         if ( _StringMode )
00726         {
00727                 if ( isReading() )
00728                 {
00729                         readnumber( b, float, 128, atof ); // ?
00730                 }
00731                 else
00732                 {
00733                         writenumber( (double)b, "%f", 128 );
00734                 }
00735         }
00736         else
00737         {
00738                 fastSerial (b);
00739         }
00740 }

void NLMISC::CMemStream::serial sint64 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 703 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), NL_I64, readnumber, sint64, and writenumber.

00704 {
00705         if ( _StringMode )
00706         {
00707                 if ( isReading() )
00708                 {
00709                         readnumber( b, sint64, 20, atoiInt64 ); // -9223372036854775808
00710                 }
00711                 else
00712                 {
00713                         writenumber( b, "%"NL_I64"d", 20 );
00714                 }
00715         }
00716         else
00717         {
00718                 fastSerial (b);
00719         }
00720 }

void NLMISC::CMemStream::serial uint64 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 683 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), NL_I64, readnumber, uint64, and writenumber.

00684 {
00685         if ( _StringMode )
00686         {
00687                 if ( isReading() )
00688                 {
00689                         readnumber( b, uint64, 20, atoiInt64 ); // 18446744073709551615
00690                 }
00691                 else
00692                 {
00693                         writenumber( b, "%"NL_I64"u", 20 );
00694                 }
00695         }
00696         else
00697         {
00698                 fastSerial (b);
00699         }
00700 }

void NLMISC::CMemStream::serial sint32 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 663 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, sint32, and writenumber.

00664 {
00665         if ( _StringMode )
00666         {
00667                 if ( isReading() )
00668                 {
00669                         readnumber( b, sint32, 11, atoi ); // -2147483648
00670                 }
00671                 else
00672                 {
00673                         writenumber( b, "%d", 11 );
00674                 }
00675         }
00676         else
00677         {
00678                 fastSerial (b);
00679         }
00680 }

void NLMISC::CMemStream::serial uint32 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 642 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::atoui(), NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, uint32, and writenumber.

00643 {
00644         if ( _StringMode )
00645         {
00646                 if ( isReading() )
00647                 {
00648                         readnumber( b, uint32, 10, atoui ); // 4294967295
00649                 }
00650                 else
00651                 {
00652                         writenumber( b, "%u", 10 );
00653                 }
00654         }
00655         else
00656         {
00657                 fastSerial (b);
00658         }
00659 }

void NLMISC::CMemStream::serial sint16 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 622 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, sint16, and writenumber.

00623 {
00624         if ( _StringMode )
00625         {
00626                 if ( isReading() )
00627                 {
00628                         readnumber( b, sint16, 6, atoi ); // -32768
00629                 }
00630                 else
00631                 {
00632                         writenumber( b, "%hd", 6 );
00633                 }
00634         }
00635         else
00636         {
00637                 fastSerial (b);
00638         }
00639 }

void NLMISC::CMemStream::serial uint16 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 601 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, uint16, and writenumber.

00602 {
00603         if ( _StringMode )
00604         {
00605                 // No byte swapping in text mode
00606                 if ( isReading() )
00607                 {
00608                         readnumber( b, uint16, 5, atoi ); // 65535
00609                 }
00610                 else
00611                 {
00612                         writenumber( b, "%hu", 5 );
00613                 }
00614         }
00615         else
00616         {
00617                 fastSerial (b);
00618         }
00619 }

void NLMISC::CMemStream::serial sint8 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 581 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, sint16, sint8, and writenumber.

00582 {
00583         if ( _StringMode )
00584         {
00585                 if ( isReading() )
00586                 {
00587                         readnumber( b, sint8, 4, atoi ); // -128
00588                 }
00589                 else
00590                 {
00591                         writenumber( (sint16)b, "%hd", 4 );
00592                 }
00593         }
00594         else
00595         {
00596                 fastSerial (b);
00597         }
00598 }

void NLMISC::CMemStream::serial uint8 b  )  [inline, virtual, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 561 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::CMemStream::fastSerial(), NLMISC::IStream::isReading(), readnumber, uint16, uint8, and writenumber.

00562 {
00563         if ( _StringMode )
00564         {
00565                 if ( isReading() )
00566                 {
00567                         readnumber( b, uint8, 3, atoi ); // 255
00568                 }
00569                 else
00570                 {
00571                         writenumber( (uint16)b,"%hu", 3 );
00572                 }
00573         }
00574         else
00575         {
00576                 fastSerial (b);
00577         }
00578 }

template<class T0, class T1, class T2, class T3, class T4, class T5>
void NLMISC::CMemStream::serial T0 &  a,
T1 &  b,
T2 &  c,
T3 &  d,
T4 &  e,
T5 &  f
[inline, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CStringStream.

Definition at line 459 of file mem_stream.h.

References NLMISC::CMemStream::serial().

00460         { serial(a); serial(b); serial(c); serial(d); serial(e); serial(f);}

template<class T0, class T1, class T2, class T3, class T4>
void NLMISC::CMemStream::serial T0 &  a,
T1 &  b,
T2 &  c,
T3 &  d,
T4 &  e
[inline, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CStringStream.

Definition at line 456 of file mem_stream.h.

References NLMISC::CMemStream::serial().

00457         { serial(a); serial(b); serial(c); serial(d); serial(e);}

template<class T0, class T1, class T2, class T3>
void NLMISC::CMemStream::serial T0 &  a,
T1 &  b,
T2 &  c,
T3 &  d
[inline, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CStringStream.

Definition at line 453 of file mem_stream.h.

References NLMISC::CMemStream::serial().

00454         { serial(a); serial(b); serial(c); serial(d);}

template<class T0, class T1, class T2>
void NLMISC::CMemStream::serial T0 &  a,
T1 &  b,
T2 &  c
[inline, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CStringStream.

Definition at line 450 of file mem_stream.h.

References NLMISC::CMemStream::serial().

00451         { serial(a); serial(b); serial(c);}

template<class T0, class T1>
void NLMISC::CMemStream::serial T0 &  a,
T1 &  b
[inline, inherited]
 

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CStringStream.

Definition at line 447 of file mem_stream.h.

References NLMISC::CMemStream::serial().

00448         { serial(a); serial(b);}

template<class T>
void NLMISC::CMemStream::serial T &  obj  )  [inline, inherited]
 

Template serialisation (should take the one from IStream).

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 420 of file mem_stream.h.

Referenced by NLNET::CPacsClient::addPrimitive(), NLNET::CUnifiedNetwork::addService(), NLNET::CCallbackNetBase::baseUpdate(), NLNET::cbAESConnection(), NLNET::cbClientGetUniversalTime(), NLNET::cbExecCommand(), NLNET::cbGetUniversalTime(), NLNET::cbnbMessageAskAssociations(), NLNET::cbnbMessageRecvAssociations(), NLNET::cbPacsAnswer(), NLNET::cbQueryPort(), NLNET::cbReceiveShardId(), NLNET::cbRegister(), NLNET::cbRegisterBroadcast(), NLNET::cbServerAskUniversalTime(), NLNET::cbServGetView(), NLNET::cbShardValidate(), NLNET::cbShardValidation(), NLNET::cbTCReceiveOtherSideClass(), NLNET::cbUnregisterBroadcast(), NLNET::cbWSChooseShard(), NLNET::cbWSDisconnectClient(), changeType(), NLNET::cleanRequest(), NLNET::CLoginServer::clientDisconnected(), NLNET::CCallbackClient::connect(), NLNET::CLoginClient::connectToShard(), NLNET::createMessage(), NLNET::CNetDisplayer::doDisplay(), NLNET::CPacsClient::evalCollision(), NLLOGIC::CLogicState::exitState(), NLNET::getNameOfMessageOrTransportClass(), NLNET::CPacsClient::getPositionSpeed(), NLNET::CPacsClient::globalMove(), NLNET::CPacsClient::rayTest(), readType(), readTypeAtCurrentPos(), NLNET::CNamingClient::registerService(), NLNET::CNamingClient::registerServiceWithSId(), NLNET::CPacsClient::relativeMove(), NLNET::CPacsClient::removePrimitive(), NLNET::CMessageRecorder::replayConnectionAttempt(), NLNET::CNamingClient::resendRegisteration(), NLNET::sendAdminEmail(), NLNET::CCallbackServer::sendAllMyAssociations(), NLNET::CPacsClient::sendMessage(), NLNET::TMessageRecord::serial(), NLMISC::CMemStream::serial(), NLNET::CInetAddress::serial(), NLMISC::CMemStream::serialBit(), serialMessage(), NLNET::CPacsClient::setAbsorption(), NLNET::CPacsClient::setCollisionMask(), NLNET::CPacsClient::setCurrentPrimitive(), NLNET::CPacsClient::setHeight(), NLNET::CPacsClient::setObstacle(), NLNET::CPacsClient::setOcclusionMask(), NLNET::CPacsClient::setOrientation(), NLNET::CPacsClient::setPrimitiveType(), NLNET::CPacsClient::setRadius(), NLNET::CPacsClient::setReactionType(), NLNET::CPacsClient::setSize(), NLNET::CPacsClient::setTriggerType(), setType(), NLNET::CPacsClient::testMove(), NLLOGIC::CLogicState::trySendEntryMessages(), NLLOGIC::CLogicState::trySendEventMessages(), NLNET::uncbServiceIdentification(), NLNET::CNamingClient::unregisterService(), NLNET::CUnifiedNetwork::update(), and NLNET::updateAdmin().

00420 { obj.serial(*this); }

void NLMISC::CMemStream::serialBit bool &  bit  )  [virtual, inherited]
 

Method inherited from IStream.

Implements NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 117 of file mem_stream.cpp.

References NLMISC::IStream::isReading(), NLMISC::CMemStream::serial(), and uint8.

Referenced by NLMISC::CMemStream::serial().

00118 {
00119 /*      if ( _StringMode )
00120         {
00121 */              uint8 u;
00122                 if ( isReading() )
00123                 {
00124                         serial( u );
00125                         bit = (u!=0);
00126                 }
00127                 else
00128                 {
00129                         u = (uint8)bit;
00130                         serial( u );
00131                 }
00132 /*      }
00133         else
00134         {
00135                 uint len = sizeof(uint8);
00136                 uint8 thebuf;
00137 
00138                 if ( isReading() )
00139                 {
00140                         // Check that we don't read more than there is to read
00141                         if ( lengthS()+len > length() ) // calls virtual length (cf. sub messages)
00142                         {
00143                                 throw EStreamOverflow();
00144                         }
00145                         // Serialize in
00146                         memcpy( &thebuf, &(*_BufPos), len );
00147                         _BufPos += len;
00148                         bit = (thebuf!=0);
00149                 }
00150                 else
00151                 {
00152                         thebuf = (uint8)bit;
00153                         // Serialize out
00154                         _Buffer.resize( _Buffer.size() + len );
00155                         _BufPos = _Buffer.end() - len;
00156                         memcpy( &(*_BufPos), &thebuf, len );
00157                         _BufPos = _Buffer.end();
00158                 }
00159         }*/
00160 }

uint16 NLMISC::IStream::serialBitField16 uint16  bf  )  [inline, inherited]
 

Serialisation of bitfield <=16 bits.

Definition at line 332 of file stream_inline.h.

References NLMISC::IStream::serial(), and uint16.

00333 {
00334         serial(bf);
00335         return bf;
00336 }

uint32 NLMISC::IStream::serialBitField32 uint32  bf  )  [inline, inherited]
 

Serialisation of bitfield <=32 bits.

Definition at line 338 of file stream_inline.h.

References NLMISC::IStream::serial(), and uint32.

00339 {
00340         serial(bf);
00341         return bf;
00342 }

uint8 NLMISC::IStream::serialBitField8 uint8  bf  )  [inline, inherited]
 

Serialisation of bitfield <=8 bits.

Definition at line 326 of file stream_inline.h.

References NLMISC::IStream::serial(), and uint8.

Referenced by NL3D::CMaterial::CTexEnv::serial().

00327 {
00328         serial(bf);
00329         return bf;
00330 }

void NLMISC::CMemStream::serialBuffer uint8 buf,
uint  len
[virtual, inherited]
 

Method inherited from IStream.

Implements NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream.

Definition at line 73 of file mem_stream.cpp.

References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::increaseBufferIfNecessary(), NLMISC::IStream::isReading(), len, NLMISC::CMemStream::length(), NLMISC::CMemStream::lengthS(), nlassert, uint, and uint8.

Referenced by NLMISC::CStringStream::serial(), NLNET::TMessageRecord::serial(), NLMISC::CMemStream::serial(), and serialMessage().

00074 {
00075         // commented for optimum performance
00076         nlassert (len > 0);
00077         nlassert (buf != NULL);
00078 
00079         if ( isReading() )
00080         {
00081                 // Check that we don't read more than there is to read
00082                 if ( lengthS()+len > length() ) // calls virtual length (cf. sub messages)
00083                 {
00084                         throw EStreamOverflow();
00085                 }
00086                 // Serialize in
00087                 CFastMem::memcpy( buf, _BufPos, len );
00088                 _BufPos += len;
00089         }
00090         else
00091         {
00092                 // Serialize out
00093 
00094                 increaseBufferIfNecessary (len);
00095 /*              uint32 oldBufferSize = _Buffer.size();
00096                 if (_BufPos - _Buffer.getPtr() + len > oldBufferSize)
00097                 {
00098                         // need to increase the buffer size
00099                         uint32 pos = _BufPos - _Buffer.getPtr();
00100                         _Buffer.resize(oldBufferSize*2 + len);
00101                         _BufPos = _Buffer.getPtr() + pos;
00102                 }
00103 */
00104                 CFastMem::memcpy( _BufPos, buf, len );
00105                 _BufPos += len;
00106 
00107 /*              _Buffer.resize( size );
00108                 _BufPos = _Buffer.end() - len;
00109                 CFastMem::memcpy( &(*_BufPos), buf, len );
00110                 _BufPos = _Buffer.end();*/
00111         }
00112 }

virtual void NLMISC::IStream::serialBufferWithSize uint8 buf,
uint32  len
[inline, virtual, inherited]
 

This method first serializes the size of the buffer and after the buffer itself, it enables the possibility to serial with a serialCont() on the other side.

Definition at line 877 of file stream.h.

References len, NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), uint32, and uint8.

00878         {
00879                 serial (len);
00880                 serialBuffer (buf, len);
00881         }

template<class T>
void NLMISC::IStream::serialCheck const T &  value  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 520 of file stream.h.

References NLMISC::IStream::isReading(), NLMISC::IStream::serial(), value, NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

Referenced by NLNET::cbPacsAnswer(), NLNET::CPacsClient::initMessage(), loadForm(), NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CVegetableShape::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShapeBuild::serial(), NL3D::CAnimationSet::serial(), and NL3D::CAnimation::serial().

00521         {
00522                 // Open a node
00523                 xmlPush ("CHECK");
00524 
00525                 if (isReading()) 
00526                 { 
00527                         T read;
00528                         serial (read); 
00529                         if (read!=value) 
00530                                 throw EInvalidDataStream(*this); 
00531                 } 
00532                 else 
00533                 { 
00534                         serial (const_cast<T&>(value)); 
00535                 }
00536 
00537                 // Close the node 
00538                 xmlPop ();
00539         }

template<class T, class Allocator>
void NLMISC::IStream::serialCont std::vector< T, Allocator > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Definition at line 324 of file stream.h.

References NLMISC::IStream::serialVector().

Referenced by NL3D::H_AUTO_DECL(), NLAISCRIPT::CLdbHeapMemberiOpCode::load(), NLAISCRIPT::CLdbStackMemberiOpCode::load(), NLAISCRIPT::CLdbMemberiOpCode::load(), NLAISCRIPT::CCallMethodi::load(), NLAISCRIPT::CCallStackMethodi::load(), NLAISCRIPT::CCallHeapMethodi::load(), NLAISCRIPT::CLibStackMemberMethod::load(), NLAISCRIPT::CLibCallMethodi::load(), NLAISCRIPT::CLibMemberMethodi::load(), NLAISCRIPT::CAffMemberiOpCode::load(), NLAISCRIPT::CAffHeapMemberiOpCode::load(), NLAISCRIPT::CLoadHeapObject::load(), NLAISCRIPT::CLoadStackObject::load(), NLAISCRIPT::CLoadSelfObject::load(), NLMISC::CEntityIdTranslator::load(), NLSOUND::CBackgroundSoundManager::load(), loadForm(), NLAISCRIPT::CLdbHeapMemberiOpCode::save(), NLAISCRIPT::CLdbStackMemberiOpCode::save(), NLAISCRIPT::CLdbMemberiOpCode::save(), NLAISCRIPT::CCallMethodi::save(), NLAISCRIPT::CCallStackMethodi::save(), NLAISCRIPT::CCallHeapMethodi::save(), NLAISCRIPT::CLibStackMemberMethod::save(), NLAISCRIPT::CLibCallMethodi::save(), NLAISCRIPT::CLibMemberMethodi::save(), NLAISCRIPT::CAffMemberiOpCode::save(), NLAISCRIPT::CAffHeapMemberiOpCode::save(), NLAISCRIPT::CLoadHeapObject::save(), NLAISCRIPT::CLoadStackObject::save(), NLAISCRIPT::CLoadSelfObject::save(), NLMISC::CEntityIdTranslator::save(), NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CVegetableShape::serial(), NL3D::CTileVegetableDesc::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NLPACS::CRetrievableSurface::TLoop::serial(), NLPACS::CRetrievableSurface::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamedArray::serial(), NL3D::CPatch::serial(), NLMISC::CNoiseColorGradient::serial(), NL3D::CMeshMRMSkinnedGeom::CRdrPass::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NL3D::CMeshBase::CLightMapInfoList::serial(), NL3D::CMeshBase::CLightInfoMapListV7::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMaterial::serial(), NL3D::CLodCharacterTexture::serial(), NL3D::CLodCharacterShapeBank::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShape::CBoneInfluence::serial(), NL3D::CLodCharacterShape::CAnim::serial(), NL3D::CLodCharacterShapeBuild::serial(), NLPACS::CLocalRetriever::CTopology::serial(), NLPACS::CLocalRetriever::CTip::serial(), NLPACS::CLocalRetriever::serial(), NL3D::CIGSurfaceLight::serial(), NL3D::CHLSTextureBank::serial(), NL3D::CHLSColorTexture::serial(), NL3D::CHLSColorTexture::CMask::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::serial(), NLPACS::CEdgeQuad::serial(), NLPACS::CCollisionMeshBuild::serial(), NL3D::CCluster::serial(), NLPACS::CChain::serial(), NLPACS::COrderedChain::serial(), NLPACS::COrderedChain3f::serial(), NLMISC::CBitSet::serial(), CAutomataDesc::CState::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimation::serial(), NL3D::CMaterialBase::serial(), and NLMISC::ICommand::serialCommands().

00324 {serialVector(cont);}

virtual void NLMISC::CMemStream::serialCont std::vector< bool > &  cont  )  [inline, virtual, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 442 of file mem_stream.h.

00442 {IStream::serialCont(cont);} 

virtual void NLMISC::CMemStream::serialCont std::vector< sint8 > &  cont  )  [inline, virtual, inherited]
 

Specialisation of serialCont() for vector<sint8>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 440 of file mem_stream.h.

00440 {IStream::serialCont(cont);} 

virtual void NLMISC::CMemStream::serialCont std::vector< uint8 > &  cont  )  [inline, virtual, inherited]
 

Specialisation of serialCont() for vector<uint8>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 438 of file mem_stream.h.

00438 {IStream::serialCont(cont);} 

template<class K, class T>
void NLMISC::CMemStream::serialCont std::multimap< K, T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 435 of file mem_stream.h.

00435 {IStream::serialCont(cont);}

template<class K, class T>
void NLMISC::CMemStream::serialCont std::map< K, T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 433 of file mem_stream.h.

00433 {IStream::serialCont(cont);}

template<class T>
void NLMISC::CMemStream::serialCont std::multiset< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 431 of file mem_stream.h.

00431 {IStream::serialCont(cont);}

template<class T>
void NLMISC::CMemStream::serialCont std::set< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 429 of file mem_stream.h.

00429 {IStream::serialCont(cont);}

template<class T>
void NLMISC::CMemStream::serialCont std::deque< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 427 of file mem_stream.h.

00427 {IStream::serialCont(cont);}

template<class T>
void NLMISC::CMemStream::serialCont std::list< T > &  cont  )  [inline, inherited]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented from NLMISC::IStream.

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 425 of file mem_stream.h.

00425 {IStream::serialCont(cont);}

template<class T>
void NLMISC::CMemStream::serialCont std::vector< T > &  cont  )  [inline, inherited]
 

Reimplemented in NLMISC::CBitMemStream, and NLMISC::CStringStream.

Definition at line 423 of file mem_stream.h.

Referenced by NLNET::cbInfo(), NLNET::cbPacsAnswer(), NLNET::cbRegisterBroadcast(), NLNET::cleanRequest(), NLNET::CNamingClient::registerService(), NLNET::CNamingClient::registerServiceWithSId(), and NLNET::CNamingClient::resendRegisteration().

00423 {IStream::serialCont(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::multiset< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 379 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00379 {serialSTLContPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::set< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 377 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00377 {serialSTLContPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::deque< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 375 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00375 {serialSTLContPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPolyPtr std::list< T > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 373 of file stream.h.

References NLMISC::IStream::serialSTLContPolyPtr().

00373 {serialSTLContPolyPtr(cont);}

template<class T, class Allocator>
void NLMISC::IStream::serialContPolyPtr std::vector< T, Allocator > &  cont  )  [inline, inherited]
 

Serialize a check value. An object can stream a check value to check integrity or format of filed or streamed data. Just call serial check with a const value. Write will serial the value. Read will check the value is the same. If it is not, it will throw EInvalidDataStream exception.

NB: The type of the value must implement an operator == and must be serializable.

Parameters:
value the value used to the check.
See also:
EInvalidDataStream

Definition at line 371 of file stream.h.

References NLMISC::IStream::serialVectorPolyPtr().

Referenced by NL3D::CAnimation::serial().

00371 {serialVectorPolyPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::multiset< T > &  cont  )  [inline, inherited]
 

Definition at line 362 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00362 {serialSTLContPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::set< T > &  cont  )  [inline, inherited]
 

Definition at line 360 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00360 {serialSTLContPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::deque< T > &  cont  )  [inline, inherited]
 

Definition at line 358 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00358 {serialSTLContPtr(cont);}

template<class T>
void NLMISC::IStream::serialContPtr std::list< T > &  cont  )  [inline, inherited]
 

Definition at line 356 of file stream.h.

References NLMISC::IStream::serialSTLContPtr().

00356 {serialSTLContPtr(cont);}

template<class T, class Allocator>
void NLMISC::IStream::serialContPtr std::vector< T, Allocator > &  cont  )  [inline, inherited]
 

Definition at line 354 of file stream.h.

References NLMISC::IStream::serialVectorPtr().

Referenced by NL3D::CAnimationSet::serial().

00354 {serialVectorPtr(cont);}

template<class T>
void NLMISC::IStream::serialEnum T &  em  )  [inline, inherited]
 

Template enum serialisation. Serialized as a sint32.

Definition at line 261 of file stream.h.

References NLMISC::IStream::isReading(), NLMISC::IStream::serial(), and sint32.

Referenced by NLNET::cbTCReceiveOtherSideClass(), NL3D::CVegetableShape::serial(), NL3D::CVegetable::serial(), NLPACS::CRetrieverInstance::serial(), NL3D::CPointLight::serial(), NL3D::CMaterial::serial(), NLPACS::CLocalRetriever::serial(), NLMISC::CSerialCommand::serial(), and NL3D::CAnimationPlaylist::serial().

00262         {
00263                 sint32  i;
00264                 if(isReading())
00265                 {
00266                         serial(i);
00267                         em = (T)i;
00268                 }
00269                 else
00270                 {
00271                         i = em;
00272                         serial(i);
00273                 }
00274         }

void NLMISC::CMemStream::serialHex uint32 b  )  [inline, virtual, inherited]
 

Serialisation in hexadecimal.

Reimplemented in NLMISC::CStringStream.

Definition at line 929 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode, NLMISC::atoihex(), NLMISC::IStream::isReading(), readnumber, uint32, and writenumber.

Referenced by NLNET::TMessageRecord::serial().

00930 {
00931         if ( _StringMode )
00932         {
00933                 if ( isReading() )
00934                 {
00935                         readnumber( b, uint32, 10, atoihex ); // 4294967295
00936                 }
00937                 else
00938                 {
00939                         writenumber( b, "%x", 10 );
00940                 }
00941                 }
00942         else
00943         {
00944                 IStream::serial( b );
00945         }
00946 }

void NLMISC::IStream::serialMemStream CMemStream b  )  [virtual, inherited]
 

Serial memstream, bitmemstream...

Definition at line 436 of file stream.cpp.

References NLMISC::CMemStream::buffer(), NLMISC::CMemStream::bufferToFill(), NLMISC::IStream::isReading(), len, NLMISC::CMemStream::length(), NLMISC::CMemStream::resetBufPos(), NLMISC::IStream::serial(), NLMISC::IStream::serialBuffer(), uint32, and uint8.

00437 {
00438         uint32 len=0;
00439 
00440         // Serialize length
00441         if ( isReading() )
00442         {
00443                 // fill b with data from this
00444                 serial (len);
00445                 serialBuffer (b.bufferToFill (len), len);
00446                 b.resetBufPos ();
00447         }
00448         else
00449         {
00450                 // fill this with data from b
00451                 len = b.length();
00452 
00453                 serial( len );
00454                 serialBuffer( (uint8*) b.buffer (), len );
00455         }
00456 }

void NLNET::CMessage::serialMessage CMessage msg  ) 
 

Encapsulate/decapsulate another message inside the current message.

Definition at line 472 of file message.cpp.

References NLMISC::CMemStream::buffer(), NLMISC::CMemStream::bufferToFill(), invert(), NLMISC::IStream::isReading(), len, length(), readType(), NLMISC::CMemStream::seek(), NLMISC::CMemStream::serial(), NLMISC::CMemStream::serialBuffer(), and uint32.

00473 {
00474         if ( isReading() )
00475         {
00476                 // Init 'msg' with the contents serialised from 'this'
00477                 uint32 len;
00478                 serial( len );
00479                 if ( ! msg.isReading() )
00480                         msg.invert();
00481                 serialBuffer( msg.bufferToFill( len ), len );
00482                 msg.readType();
00483                 msg.invert();
00484                 msg.seek( 0, CMemStream::end );
00485         }
00486         else
00487         {
00488                 // Store into 'this' the contents of 'msg'
00489                 uint32 len = msg.length();
00490                 serial( len );
00491                 serialBuffer( const_cast<uint8*>(msg.buffer()), msg.length() );
00492         }
00493 }

template<class T>
void NLMISC::IStream::serialPolyPtr T *&  ptr  )  [inline, inherited]
 

Serialize Polymorphic Objet Ptr. Works with NULL pointers. If the same object is found mutliple time in the stream, ONLY ONE instance is written! NB: The ptr is serialised as a uint64 (64 bit compliant).

Parameters:
ptr a pointer on a IStreamable object.
See also:
resetPtrTable()

Definition at line 492 of file stream.h.

References NLMISC::IStream::serialIStreamable().

Referenced by NL3D::CAnimationOptimizer::cloneTrack(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NL3D::CMaterialBase::CAnimatedTexture::serial(), NL3D::CMaterial::CLightMap::serial2(), and NLMISC::IStream::serialSTLContLenPolyPtr().

00493         { IStreamable *p=ptr; serialIStreamable(p); ptr= static_cast<T*>(p);}

template<class T>
void NLMISC::IStream::serialPtr T *&  ptr  )  [inline, inherited]
 

Serialize Non Polymorphic Objet Ptr. Works with NULL pointers. If the same object is found mutliple time in the stream, ONLY ONE instance is written! NB: The ptr is serialised as a uint64 (64 bit compliant).

Parameters:
ptr a pointer on a base type or an object.
See also:
resetPtrTable()

Definition at line 390 of file stream.h.

References NLMISC::IStream::_IdMap, NLMISC::IStream::_NextSerialPtrId, NLMISC::IStream::isReading(), NLMISC::IStream::ItIdMap, NLMISC::IStream::serial(), uint, uint64, NLMISC::IStream::ValueIdMap, NLMISC::IStream::xmlPop(), NLMISC::IStream::xmlPushBegin(), NLMISC::IStream::xmlPushEnd(), and NLMISC::IStream::xmlSetAttrib().

Referenced by NL3D::CParticleSystemShape::buildFromPS(), NL3D::CParticleSystemShape::flushTextures(), NL3D::CParticleSystemShape::instanciatePS(), and NLMISC::IStream::serialSTLContLenPtr().

00391         {
00392                 uint64  node;
00393 
00394                 // Open the node header
00395                 xmlPushBegin ("PTR");
00396 
00397                 xmlSetAttrib ("id");
00398 
00399                 if(isReading())
00400                 {
00401                         serial(node);
00402 
00403                         // Close the header
00404                         xmlPushEnd ();
00405 
00406                         if(node==0)
00407                                 ptr=NULL;
00408                         else
00409                         {
00410                                 ItIdMap it;
00411                                 it= _IdMap.find(node);
00412 
00413                                 // Test if object already created/read.
00414                                 if( it==_IdMap.end() )
00415                                 {
00416                                         // Construct object.                                    
00417                                         ptr= new T;
00418                                         if(ptr==NULL)
00419                                                 throw EStream();
00420 
00421                                         // Insert the node.
00422                                         _IdMap.insert( ValueIdMap(node, ptr) );
00423 
00424                                         // Read the object!
00425                                         serial(*ptr);
00426                                 }
00427                                 else
00428                                         ptr= static_cast<T*>(it->second);
00429                         }
00430                 }
00431                 else
00432                 {
00433                         if(ptr==NULL)
00434                         {
00435                                 node= 0;
00436                                 serial(node);
00437 
00438                                 // Close the header
00439                                 xmlPushEnd ();
00440                         }
00441                         else
00442                         {
00443                                 ItIdMap it;
00444                                 it = _IdMap.find((uint64)(uint)ptr);
00445 
00446                                 // Test if object has been already written
00447                                 if( it==_IdMap.end() )
00448                                 {
00449                                         // Not yet written
00450 
00451                                         // Get the next available ID
00452                                         node = _NextSerialPtrId++;
00453 
00454                                         // Serial the id
00455                                         serial(node);
00456 
00457                                         // Insert the pointer in the map with the id
00458                                         _IdMap.insert( ValueIdMap((uint64)(uint)ptr, (void*)(uint)node) );
00459 
00460                                         // Close the header
00461                                         xmlPushEnd ();
00462 
00463                                         // Write the object
00464                                         serial(*ptr);
00465                                 }
00466                                 else
00467                                 {
00468                                         // Write only the object id
00469                                         node = (uint64)(uint)(it->second);
00470 
00471                                         serial(node);
00472                 
00473                                         // Close the header
00474                                         xmlPushEnd ();
00475                                 }
00476                         }
00477                 }
00478 
00479                 // Close the node
00480                 xmlPop ();
00481         }

uint NLMISC::CMemStream::serialSeparatedBufferIn uint8 buf,
uint  len
[inherited]
 

Input: read len bytes at most from the stream until the next separator, and return the number of bytes read. The separator is then skipped.

Reimplemented in NLMISC::CStringStream.

Definition at line 307 of file mem_stream.cpp.

References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::_StringMode, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), len, NLMISC::CMemStream::length(), NLMISC::CMemStream::lengthS(), nlassert, NLMISC::SEP_SIZE, NLMISC::SEPARATOR, NLMISC::CObjectVector< uint8, false >::size(), uint, uint32, and uint8.

00308 {
00309         nlassert( _StringMode && isReading() );
00310 
00311         // Check that we don't read more than there is to read
00312         if ( ( _BufPos == _Buffer.getPtr()+_Buffer.size() ) || // we are at the end
00313                  ( lengthS()+len+SEP_SIZE > length() ) && (_Buffer[_Buffer.size()-1] != SEPARATOR ) ) // we are before the end // calls virtual length (cf. sub messages)
00314         {
00315                 throw EStreamOverflow();
00316         }
00317         // Serialize in
00318         uint32 i = 0;
00319         while ( (i<len) && (*_BufPos) != SEPARATOR )
00320         {
00321                 *(buf+i) = *_BufPos;
00322                 i++;
00323                 _BufPos++;
00324         }
00325         // Exceeds len
00326         if ( (*_BufPos) != SEPARATOR )
00327         {
00328                 throw EStreamOverflow();
00329         }
00330         _BufPos += SEP_SIZE;
00331         return i;
00332 }

void NLMISC::CMemStream::serialSeparatedBufferOut uint8 buf,
uint  len
[inherited]
 

Output: writes len bytes from buf into the stream.

Reimplemented in NLMISC::CStringStream.

Definition at line 338 of file mem_stream.cpp.

References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::_StringMode, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), len, nlassert, NLMISC::CObjectVector< uint8, false >::resize(), NLMISC::SEP_SIZE, NLMISC::SEPARATOR, NLMISC::CObjectVector< uint8, false >::size(), uint, uint32, and uint8.

00339 {
00340         nlassert( _StringMode && (!isReading()) );
00341         
00342         // Serialize out
00343         uint32 oldBufferSize = _Buffer.size();
00344         if (_BufPos - _Buffer.getPtr() + (len + SEP_SIZE) > oldBufferSize)
00345         {
00346                 // need to increase the buffer size
00347                 _Buffer.resize(oldBufferSize*2 + len + SEP_SIZE);
00348                 _BufPos = _Buffer.getPtr() + oldBufferSize;
00349         }
00350 
00351         CFastMem::memcpy( _BufPos, buf, len );
00352         _BufPos += len;
00353         *(_BufPos++) = SEPARATOR;
00354 
00355         // Serialize out
00356 /*      _Buffer.resize( _Buffer.size() + len + SEP_SIZE );
00357         _BufPos = _Buffer.end() - len - SEP_SIZE;
00358         CFastMem::memcpy( &(*_BufPos), buf, len );
00359         _Buffer[_Buffer.size()-1] = SEPARATOR;
00360         _BufPos = _Buffer.end();
00361 */}

template<class T>
void NLMISC::IStream::serialVector T &  cont  )  [inline, protected, inherited]
 

special version for serializing a vector. Support up to sint32 length containers.

Definition at line 992 of file stream.h.

References NLMISC::contReset(), NLMISC::IStream::isReading(), len, NLMISC::IStream::serial(), sint, sint32, NLMISC::IStream::xmlPop(), NLMISC::IStream::xmlPush(), NLMISC::IStream::xmlPushBegin(), NLMISC::IStream::xmlPushEnd(), and NLMISC::IStream::xmlSetAttrib().

Referenced by NLMISC::CStringStream::serialCont(), NLMISC::IStream::serialCont(), and NLMISC::CBitMemStream::serialCont().

00993         {
00994                 typedef typename T::value_type __value_type;
00995                 typedef typename T::iterator __iterator;
00996 
00997                 // Open a node header
00998                 xmlPushBegin ("VECTOR");
00999 
01000                 // Attrib size
01001                 xmlSetAttrib ("size");
01002 
01003                 sint32  len=0;
01004                 if(isReading())
01005                 {
01006                         serial(len);
01007 
01008                         // Open a node header
01009                         xmlPushEnd ();
01010 
01011                         // special version for vector: adjut good size.
01012                         contReset(cont);
01013                         cont.resize (len);
01014 
01015                         // Read the vector
01016                         for(sint i=0;i<len;i++)
01017                         {
01018                                 xmlPush ("ELM");
01019 
01020                                 serial(cont[i]);
01021 
01022                                 xmlPop ();
01023                         }
01024                 }
01025                 else
01026                 {
01027                         len= cont.size();
01028                         serial(len);
01029 
01030                         // Close the node header
01031                         xmlPushEnd ();
01032 
01033                         // Write the vector
01034                         __iterator              it= cont.begin();
01035                         for(sint i=0;i<len;i++, it++)
01036                         {
01037                                 xmlPush ("ELM");
01038 
01039                                 serial(const_cast<__value_type&>(*it));
01040 
01041                                 xmlPop ();
01042                         }
01043                 }
01044 
01045                 // Close the node
01046                 xmlPop ();
01047         }

uint NLMISC::IStream::serialVersion uint  currentVersion  )  [inherited]
 

Serialize a version number. Each object should store/read first a version number, using this method. Then he can use the streamVersion returned to see how he should serialise himself.

NB: Version Number is read/store as a uint8, or uint32 if too bigger..

Parameters:
currentVersion the current version of the class, provided by user.
Returns:
the version of the stream. If the stream is an Output stream, currentVersion is returned.
See also:
setVersionException() getVersionException()

Definition at line 266 of file stream.cpp.

References NLMISC::IStream::_ThrowOnNewer, NLMISC::IStream::_ThrowOnOlder, NLMISC::IStream::isReading(), NLMISC::IStream::serial(), uint, uint32, uint8, v, NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

Referenced by NL3D::H_AUTO_DECL(), NLMISC::CEntityIdTranslator::load(), loadForm(), NLMISC::CEntityIdTranslator::save(), NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneRegion::SZoneUnit2::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CPatchInfo::CBindInfo::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CBorderVertex::serial(), NL3D::CVertexBuffer::serial(), NL3D::CVegetableShape::serial(), NL3D::CVegetable::serial(), NL3D::CTrackSampledVector::serial(), NL3D::CTrackSampledQuat::serial(), NL3D::CTrackSampledCommon::CTimeBlock::serial(), NL3D::CTileVegetableDesc::serial(), NL3D::CTileNoiseMap::serial(), NL3D::CTileNoise::serial(), NLPACS::CSurfaceQuadTree::serial(), NL3D::CSurfaceLightGrid::CCellCorner::serial(), NL3D::CSurfaceLightGrid::serial(), NL3D::CSkeletonWeight::CNode::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NLPACS::CRetrievableSurface::serial(), NL3D::CPSAttrib< T >::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPointLightNamedArray::CPointLightGroup::serial(), NL3D::CPointLightNamedArray::serial(), NL3D::CPointLightNamed::serial(), NL3D::CPointLight::serial(), NL3D::CPatch::serial(), NLMISC::CNoiseColorGradient::serial(), NLMISC::CNoiseValue::serial(), NL3D::CMeshMRMSkinnedGeom::CRdrPass::serial(), NL3D::CMeshMRMSkinnedGeom::CShadowVertex::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::CPackedVertex::serial(), NL3D::CMeshMRMSkinnedGeom::CPackedVertexBuffer::serial(), NL3D::CMeshMRMSkinned::serial(), NL3D::CMeshMRMSkinnedGeom::serial(), NL3D::CMeshMRMGeom::CLodInfo::serial(), NL3D::CMeshMRMGeom::CRdrPass::serial(), NL3D::CMeshMRMGeom::CShadowVertex::serial(), NL3D::CMeshBase::CLightMapInfoList::serial(), NL3D::CMeshBase::CLightMapInfoList::CMatStage::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMeshGeom::CRdrPass::serial(), NLMISC::CMatrix::serial(), NL3D::CMaterial::serial(), NL3D::CLodCharacterTexture::serial(), NL3D::CLodCharacterShapeBank::serial(), NL3D::CLodCharacterShape::serial(), NL3D::CLodCharacterShape::CBoneInfluence::serial(), NL3D::CLodCharacterShape::CAnim::serial(), NL3D::CLodCharacterShapeBuild::serial(), NLPACS::CLocalRetriever::serial(), NL3D::CIGSurfaceLight::CRetrieverLightGrid::serial(), NL3D::CIGSurfaceLight::serial(), NL3D::CHLSTextureBank::CTextureInstance::serial(), NL3D::CHLSTextureBank::serial(), NL3D::CHLSColorTexture::serial(), NL3D::CHLSColorTexture::CMask::serial(), NL3D::CHLSColorDelta::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::serial(), NLPACS::CEdgeQuad::serial(), NL3D::CCluster::serial(), NLPACS::CChainQuad::serial(), NLPACS::CChain::serial(), NLPACS::COrderedChain::serial(), NLPACS::COrderedChain3f::serial(), NL3D::CBoneBase::serial(), NLMISC::CBitSet::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimationPlaylist::serial(), NL3D::CAnimation::serial(), NL3D::CMaterialBase::CTexAnimTracks::serial(), NL3D::CMaterialBase::serial(), NLMISC::CAABBox::serial(), NL3D::CMaterial::CLightMap::serial2(), NL3D::CTrackSampledCommon::serialCommon(), NL3D::CVertexBuffer::serialHeader(), NL3D::CMeshMRMGeom::serialLodVertexData(), and NL3D::CVertexBuffer::serialSubset().

00267 {
00268         uint8   b=0;
00269         uint32  v=0;
00270         uint    streamVersion;
00271 
00272         // Open the node
00273         xmlPush ("VERSION");
00274 
00275         if(isReading())
00276         {
00277                 serial(b);
00278                 if(b==0xFF)
00279                         serial(v);
00280                 else
00281                         v=b;
00282                 streamVersion=v;
00283 
00284                 // Exception test.
00285                 if(_ThrowOnOlder && streamVersion < currentVersion)
00286                         throw EOlderStream(*this);
00287                 if(_ThrowOnNewer && streamVersion > currentVersion)
00288                         throw ENewerStream(*this);
00289         }
00290         else
00291         {
00292                 v= streamVersion=currentVersion;
00293                 if(v>=0xFF)
00294                 {
00295                         b=0xFF;
00296                         serial(b);
00297                         serial(v);
00298                 }
00299                 else
00300                 {
00301                         b= (uint8)v;
00302                         serial(b);
00303                 }
00304         }
00305 
00306         // Close the node
00307         xmlPop ();
00308 
00309         return streamVersion;
00310 }

void NLNET::CMessage::setDefaultStringMode bool  stringmode  )  [inline, static]
 

Set default stream mode.

Definition at line 231 of file message.h.

References _DefaultStringMode.

00231 { _DefaultStringMode = stringmode; }

void NLMISC::IStream::setInOut bool  inputStream  )  [protected, inherited]
 

Change, in live, the state of the inputStream. This could be usefull in certain case. The deriver which would want to do such a thing must call this method, and implement his own behavior. In certain case, it should call resetPtrTable() if he want to reset the stream ptr info (maybe always)...

Definition at line 413 of file stream.cpp.

References NLMISC::IStream::_InputStream.

Referenced by NLMISC::CBitMemStream::getSerialItem(), and NLMISC::CMemStream::invert().

00414 {
00415         _InputStream= inputStream;
00416 }

void NLMISC::CMemStream::setStringMode bool  stringmode  )  [inline, inherited]
 

Set string mode.

Definition at line 113 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode.

Referenced by init().

00113 { _StringMode = stringmode; }

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 229 of file message.cpp.

References _HeaderSize, _TypeSet, format, FormatLong, FormatShort, NLMISC::CMemStream::getPos(), NLMISC::IStream::isReading(), nlassert, NLMISC::CMemStream::serial(), NLMISC::CStringIdArray::TStringId, TypeHasAName, TypeHasAnId, uint32, and uint8.

00230 {
00231         // check if we already do a setType ()
00232         nlassert (!_TypeSet);
00233         // don't accept empty string
00234         nlassert (!name.empty ());
00235 
00236         _Name = name;
00237         TypeHasAnId = false;
00238         TypeHasAName = true;
00239 
00240         if (!isReading ())
00241         {
00242                 // check if they don't already serial some stuffs
00243                 nlassert (length () == 0);
00244 
00245                 // if we can send the id instead of the string, "just do it" (c)nike!
00246                 //NLMISC::CStringIdArray::TStringId id = _SIDA->getId (name);
00247 
00248                 // PATCH: always send in full text
00249                 NLMISC::CStringIdArray::TStringId id = -1;
00250 
00251                 // Force binary mode for header
00252                 bool msgmode = _StringMode;
00253                 _StringMode = false;
00254 
00255                 // debug features, we number all packet to be sure that they are all sent and received
00256                 // \todo remove this debug feature when ok
00257                 // this value will be fill after in the callback function
00258                 uint32 zeroValue = 123;
00259                 serial (zeroValue);
00260 
00261                 if (id == -1)
00262                 {
00263                         uint8 format = FormatLong | (msgmode << 1);
00264                         //nldebug( "OUT format = %hu", (uint16)format );
00265                         serial (format);
00266 
00267                         // End of binary header
00268                         _StringMode = msgmode;
00269 
00270                         serial ((std::string&)name);
00271                 }
00272                 else
00273                 {
00274                         uint8 format = FormatShort | (msgmode << 1);
00275                         //nldebug( "MSG: OUT format = %hu", (uint16)format );
00276                         serial (format);
00277 
00278                         // End of binary header
00279                         _StringMode = msgmode;
00280 
00281                         serial (id);
00282 
00283                         _Id = id;
00284                         TypeHasAnId = true;
00285                 }
00286                 _HeaderSize = getPos ();
00287         }
00288 
00289         _TypeSet = true;
00290 }

void NLNET::CMessage::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.

Definition at line 173 of file message.cpp.

References _HeaderSize, _SIDA, _TypeSet, format, FormatLong, NLMISC::CMemStream::getPos(), NLMISC::CStringIdArray::getString(), NLMISC::IStream::isReading(), nlassert, nlstop, NLMISC::CMemStream::serial(), NLMISC::CStringIdArray::TStringId, TypeHasAName, TypeHasAnId, uint32, and uint8.

Referenced by init(), NLNET::CPacsClient::initMessage(), and readType().

00174 {
00175         // PATCH: the id system is not available
00176         nlstop;
00177 
00178         // check if we already do a setType ()
00179         nlassert (!_TypeSet);
00180         // don't accept negative value
00181         nlassert (id >= 0 && id < pow(2, sizeof (NLMISC::CStringIdArray::TStringId)*8));
00182 
00183         _Id = id;
00184         TypeHasAnId = true;
00185         TypeHasAName = false;
00186 
00187         if (!isReading ())
00188         {
00189                 // check if they don't already serial some stuffs
00190                 nlassert (length () == 0);
00191 
00192                 uint8 format = FormatLong | (_StringMode << 1);
00193                 //nlinfo( "MSG: OUT format = %hu", (uint16)format );
00194 
00195                 // Force binary mode for header
00196                 bool msgmode = _StringMode;
00197                 _StringMode = false;
00198 
00199                 // debug features, we number all packet to be sure that they are all sent and received
00200                 // \todo remove this debug feature when ok
00201                 // this value will be fill after in the callback function
00202                 uint32 zeroValue = 123;
00203                 serial (zeroValue);
00204 
00205                 serial (format);
00206 
00207                 // End of binary header
00208                 _StringMode = msgmode;
00209 
00210                 serial (id);
00211                 _HeaderSize = getPos ();
00212         }
00213         else
00214         {
00215                 // we set the id, now, we try to set the name if available in the sida
00216                 if (_SIDA != NULL)
00217                 {
00218                         _Name = _SIDA->getString (id);
00219                         TypeHasAName = true;
00220                 }
00221         }
00222 
00223         _TypeSet = true;
00224 }

void NLMISC::IStream::setVersionException bool  throwOnOlder,
bool  throwOnNewer
[static, inherited]
 

Set the behavior of IStream regarding input stream that are older/newer than the class. If throwOnOlder==true, IStream throws a EOlderStream when needed. If throwOnNewer==true, IStream throws a ENewerStream when needed.

By default, the behavior is throwOnOlder=false, throwOnNewer=true.

See also:
serialVersion() getVersionException()

Definition at line 71 of file stream.cpp.

References NLMISC::IStream::_ThrowOnNewer, and NLMISC::IStream::_ThrowOnOlder.

00072 {
00073         _ThrowOnOlder=throwOnOlder;
00074         _ThrowOnNewer=throwOnNewer;
00075 }

void NLMISC::IStream::setXMLMode bool  on  )  [protected, inherited]
 

Set the XML mode is true to enable XML mode else false

Definition at line 427 of file stream.cpp.

References NLMISC::IStream::_XML.

Referenced by NLMISC::COXml::COXml(), and NLMISC::COXml::init().

00428 {
00429         _XML = on;
00430 }

uint32 NLMISC::CMemStream::size  )  const [inline, inherited]
 

Returns the size of the buffer (can be greater than the length, especially in output mode).

Definition at line 230 of file mem_stream.h.

References NLMISC::CObjectVector< uint8, false >::size(), and uint32.

Referenced by NLMISC::CMemStream::lengthR().

00231         {
00232                 return _Buffer.size();
00233         }

bool NLMISC::CMemStream::stringMode  )  const [inline, inherited]
 

Return string mode.

Definition at line 116 of file mem_stream.h.

References NLMISC::CMemStream::_StringMode.

Referenced by NLNET::TMessageRecord::serial(), and NLNET::CInetAddress::serial().

00116 { return _StringMode; }

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 441 of file message.cpp.

References _SIDA, _TypeSet, NLMISC::CStringIdArray::getId(), NLMISC::CStringIdArray::getString(), nlassert, NLMISC::toString(), TypeHasAName, and TypeHasAnId.

Referenced by NLNET::CCallbackNetBase::processOneMessage().

00442 {
00443         nlassert (_TypeSet);
00444 //      std::stringstream s;
00445 //      if (TypeHasAName && TypeHasAnId) s << "('" << _Name << "'," << _Id << ")";
00446 //      else if (TypeHasAName) s << "('" << _Name << "'," << _SIDA->getId (_Name, true) << ")";
00447 //      else if (TypeHasAnId) s << "('" << _SIDA->getString (_Id) << "'," << _Id << "')";
00448 //      return s.str();
00449         std::string str;
00450         if (TypeHasAName && TypeHasAnId) str += "('" + _Name + "'," + NLMISC::toString(_Id) + ")";
00451         else if (TypeHasAName) str += "('" + _Name + "'," + NLMISC::toString(_SIDA->getId (_Name, true)) + ")";
00452         else if (TypeHasAnId) str += "('" + _SIDA->getString (_Id) + "'," + NLMISC::toString(_Id) + "')";
00453         return str;
00454 }

bool NLNET::CMessage::typeIsSet  )  const
 

Definition at line 392 of file message.cpp.

References _TypeSet.

00393 {
00394         return _TypeSet;
00395 }

void NLNET::CMessage::unlockSubMessage  )  [inline]
 

Exit from sub message locking, and skip the whole sub message.

Preconditions:

  • The message is an input message (isReading()) and has been locked using lockSubMessage()
  • The reading pos is within or at the end of the previous sub message (if any) (see nlassertex)

Postconditions:

  • The current pos is the next byte after the sub message

Definition at line 164 of file message.h.

References _LengthR, getName(), NLMISC::CMemStream::getPos(), hasLockedSubMessage(), NLMISC::IStream::isReading(), nlassert, nlassertex, resetSubMessageInternals(), NLMISC::CMemStream::seek(), sint32, and uint32.

00165         {
00166                 nlassert( isReading() && hasLockedSubMessage() );
00167                 nlassertex( getPos() <= (sint32)_LengthR, ("The callback for msg %s read more data than there is in the message (pos=%d len=%u)", getName().c_str(), getPos(), _LengthR) );
00168 
00169                 uint32 subMsgEndPos = _LengthR;
00170                 resetSubMessageInternals();
00171                 seek( subMsgEndPos, IStream::begin );
00172         }

bool NLMISC::IStream::xmlBreakLine  )  [inline, inherited]
 

xmlBreakLine() insert a break line in the XML stream.

Returns:
true if the break line is added, return false if no node is opened.

Definition at line 794 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlBreakLineInternal().

00795         {
00796                 // XML Mode ?
00797                 if (_XML)
00798                 {
00799                         return xmlBreakLineInternal ();
00800                 }
00801 
00802                 // Return ok
00803                 return true;
00804         }

virtual bool NLMISC::IStream::xmlBreakLineInternal  )  [inline, protected, virtual, inherited]
 

xmlBreakLine implementation

Reimplemented in NLMISC::COXml.

Definition at line 845 of file stream.h.

Referenced by NLMISC::IStream::xmlBreakLine().

00845 { return true; };

bool NLMISC::IStream::xmlComment const char *  comment  )  [inline, inherited]
 

xmlComment() insert a comment line in the XML stream.

Returns:
true if the comment is added, return false if no node is opened.

Definition at line 811 of file stream.h.

References NLMISC::IStream::_XML, comment(), and NLMISC::IStream::xmlCommentInternal().

00812         {
00813                 // XML Mode ?
00814                 if (_XML)
00815                 {
00816                         return xmlCommentInternal (comment);
00817                 }
00818 
00819                 // Return ok
00820                 return true;
00821         }

virtual bool NLMISC::IStream::xmlCommentInternal const char *  comment  )  [inline, protected, virtual, inherited]
 

xmlComment implementation

Reimplemented in NLMISC::COXml.

Definition at line 848 of file stream.h.

Referenced by NLMISC::IStream::xmlComment().

00848 { return true; };

bool NLMISC::IStream::xmlPop  )  [inline, inherited]
 

xmlPop() close the node.

Returns:
true if you can close the node, false if the node can't be closed (its header is still opened) or if there is no node to close.

Definition at line 759 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlPopInternal().

Referenced by NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::COXml::serial(), NLMISC::COXml::serialBuffer(), NLMISC::IStream::serialCheck(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), NLMISC::IStream::serialVectorPtr(), NLMISC::IStream::serialVersion(), and NLMISC::IStream::xmlSerial().

00760         {
00761                 // XML Mode ?
00762                 if (_XML)
00763                 {
00764                         return xmlPopInternal ();
00765                 }
00766 
00767                 // Return ok
00768                 return true;
00769         }

virtual bool NLMISC::IStream::xmlPopInternal  )  [inline, protected, virtual, inherited]
 

xmlPop implementation

Reimplemented in NLMISC::COXml.

Definition at line 839 of file stream.h.

Referenced by NLMISC::IStream::xmlPop().

00839 { return true; };

bool NLMISC::IStream::xmlPush const char *  name  )  [inline, inherited]
 

Definition at line 701 of file stream.h.

References NLMISC::IStream::_XML, res, NLMISC::IStream::xmlPushBeginInternal(), and NLMISC::IStream::xmlPushEndInternal().

Referenced by NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneBankElement::serial(), NL3D::CZone::serial(), NL3D::CPatch::serial(), NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::COXml::serial(), NLMISC::COXml::serialBuffer(), NLMISC::IStream::serialCheck(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialSTLContLen(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVersion(), and NLMISC::IStream::xmlSerial().

00702         {
00703                 // XML Mode ?
00704                 if (_XML)
00705                 {
00706                         // Open the header
00707                         bool res=xmlPushBeginInternal (name);
00708                         if (res)
00709                                 // close the header
00710                                 xmlPushEndInternal ();
00711                         // Return the result
00712                         return res;
00713                 }
00714 
00715                 // Return ok
00716                 return true;
00717         }

bool NLMISC::IStream::xmlPushBegin const char *  name  )  [inline, inherited]
 

xmlBreakLine() insert a break line in the XML stream.

Returns:
true if the break line is added, return false if no node is opened.

Definition at line 725 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlPushBeginInternal().

Referenced by NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), and NLMISC::IStream::serialVectorPtr().

00726         {
00727                 // XML Mode ?
00728                 if (_XML)
00729                 {
00730                         return xmlPushBeginInternal (name);
00731                 }
00732 
00733                 // Return ok
00734                 return true;
00735         }

virtual bool NLMISC::IStream::xmlPushBeginInternal const char *  name  )  [inline, protected, virtual, inherited]
 

xmlPushBegin implementation

Reimplemented in NLMISC::COXml.

Definition at line 833 of file stream.h.

Referenced by NLMISC::IStream::xmlPush(), and NLMISC::IStream::xmlPushBegin().

00833 { return true; };

bool NLMISC::IStream::xmlPushEnd  )  [inline, inherited]
 

xmlPushEnd() close the node header.

Returns:
true if you can close the node header, false if no node header have been opened with xmlPushBegin().

Definition at line 742 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlPushEndInternal().

Referenced by NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), and NLMISC::IStream::serialVectorPtr().

00743         {
00744                 // XML Mode ?
00745                 if (_XML)
00746                 {
00747                         return xmlPushEndInternal ();
00748                 }
00749 
00750                 // Return ok
00751                 return true;
00752         }

virtual bool NLMISC::IStream::xmlPushEndInternal  )  [inline, protected, virtual, inherited]
 

xmlPushEnd implementation

Reimplemented in NLMISC::COXml.

Definition at line 836 of file stream.h.

Referenced by NLMISC::IStream::xmlPush(), and NLMISC::IStream::xmlPushEnd().

00836 { return true; };

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
T &  value1,
T &  value2,
T &  value3,
const char *  nodeName
[inline, inherited]
 

Definition at line 683 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00684         {
00685                 // Open the node
00686                 xmlPush (nodeName);
00687                 
00688                 // Serial the values
00689                 serial (value0, value1, value2, value3);
00690 
00691                 // Close the node
00692                 xmlPop ();
00693         }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
T &  value1,
T &  value2,
const char *  nodeName
[inline, inherited]
 

Definition at line 671 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00672         {
00673                 // Open the node
00674                 xmlPush (nodeName);
00675                 
00676                 // Serial the values
00677                 serial (value0, value1, value2);
00678 
00679                 // Close the node
00680                 xmlPop ();
00681         }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
T &  value1,
const char *  nodeName
[inline, inherited]
 

Definition at line 659 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

00660         {
00661                 // Open the node
00662                 xmlPush (nodeName);
00663                 
00664                 // Serial the values
00665                 serial (value0, value1);
00666 
00667                 // Close the node
00668                 xmlPop ();
00669         }

template<class T>
void NLMISC::IStream::xmlSerial T &  value0,
const char *  nodeName
[inline, inherited]
 

xmlSerial() serial a values into a node.

Definition at line 647 of file stream.h.

References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().

Referenced by NLLIGO::CZoneRegion::serial(), NLLIGO::CZoneRegion::SZoneUnit2::serial(), NLLIGO::CZoneRegion::SZoneUnit::serial(), NL3D::CZone::serial(), NL3D::CPatchInfo::CBindInfo::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CBorderVertex::serial(), NL3D::CTileElement::serial(), NL3D::CTileColorOldPatchVersion6::serial(), NL3D::CTileColor::serial(), and NL3D::CPatch::serial().

00648         {
00649                 // Open the node
00650                 xmlPush (nodeName);
00651                 
00652                 // Serial the value
00653                 serial (value0);
00654 
00655                 // Close the node
00656                 xmlPop ();
00657         }

bool NLMISC::IStream::xmlSetAttrib const char *  name  )  [inline, inherited]
 

xmlSetAttrib() set the name of the next node header attribute serialised.

is the name of the node header attribute serialised.

Returns:
true if the attribute name have been set, false if the node header is not open (the call is not between xmlPushBegin and xmlPushEnd)

Definition at line 777 of file stream.h.

References NLMISC::IStream::_XML, and NLMISC::IStream::xmlSetAttribInternal().

Referenced by NLMISC::CObjectVector< sint8, false >::serial(), NLMISC::IStream::serialIStreamable(), NLMISC::IStream::serialMap(), NLMISC::IStream::serialMultimap(), NLMISC::IStream::serialPtr(), NLMISC::IStream::serialSTLCont(), NLMISC::IStream::serialSTLContPtr(), NLMISC::IStream::serialVector(), NLMISC::IStream::serialVectorPolyPtr(), and NLMISC::IStream::serialVectorPtr().

00778         {
00779                 // XML Mode ?
00780                 if (_XML)
00781                 {
00782                         return xmlSetAttribInternal (name);
00783                 }
00784 
00785                 // Return ok
00786                 return true;
00787         }

virtual bool NLMISC::IStream::xmlSetAttribInternal const char *  name  )  [inline, protected, virtual, inherited]
 

xmlBreakLine implementation

Reimplemented in NLMISC::COXml.

Definition at line 842 of file stream.h.

Referenced by NLMISC::IStream::xmlSetAttrib().

00842 { return true; };


Field Documentation

CObjectVector<uint8, false> NLMISC::CMemStream::_Buffer [protected, inherited]
 

Definition at line 516 of file mem_stream.h.

Referenced by NLMISC::CMemStream::operator=().

uint8* NLMISC::CMemStream::_BufPos [protected, inherited]
 

Definition at line 517 of file mem_stream.h.

Referenced by NLMISC::CMemStream::bufferToFill(), NLMISC::CMemStream::clear(), NLMISC::CMemStream::CMemStream(), NLMISC::CMemStream::fastRead(), NLMISC::CMemStream::fastSerial(), NLMISC::CMemStream::fastWrite(), NLMISC::CMemStream::fill(), NLMISC::CMemStream::getPos(), NLMISC::CMemStream::increaseBufferIfNecessary(), NLMISC::CMemStream::invert(), NLMISC::CMemStream::lengthS(), NLMISC::CMemStream::operator=(), NLMISC::CMemStream::poke(), NLMISC::CMemStream::reserve(), NLMISC::CMemStream::resetBufPos(), NLMISC::CMemStream::resize(), NLMISC::CMemStream::serialBuffer(), NLMISC::CMemStream::serialSeparatedBufferIn(), and NLMISC::CMemStream::serialSeparatedBufferOut().

uint32 NLMISC::CMemStream::_DefaultCapacity [protected, inherited]
 

Definition at line 521 of file mem_stream.h.

Referenced by NLMISC::CMemStream::clear(), NLMISC::CMemStream::CMemStream(), and NLMISC::CMemStream::operator=().

bool NLNET::CMessage::_DefaultStringMode = false [static, private]
 

Definition at line 39 of file message.cpp.

Referenced by init(), and setDefaultStringMode().

uint32 NLNET::CMessage::_HeaderSize [private]
 

Definition at line 266 of file message.h.

Referenced by getHeaderSize(), operator=(), readType(), and setType().

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

Definition at line 268 of file message.h.

Referenced by operator=().

uint32 NLNET::CMessage::_LengthR [private]
 

Definition at line 263 of file message.h.

Referenced by assignFromSubMessage(), clear(), lengthR(), lockSubMessage(), operator=(), resetSubMessageInternals(), and unlockSubMessage().

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

Definition at line 257 of file message.h.

Referenced by operator=().

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

Definition at line 255 of file message.h.

Referenced by operator=(), setType(), and toString().

bool NLMISC::CMemStream::_StringMode [protected, inherited]
 

Definition at line 519 of file mem_stream.h.

Referenced by NLMISC::CMemStream::CMemStream(), NLMISC::CMemStream::operator=(), NLMISC::CMemStream::serial(), NLMISC::CMemStream::serialHex(), NLMISC::CMemStream::serialSeparatedBufferIn(), NLMISC::CMemStream::serialSeparatedBufferOut(), NLMISC::CMemStream::setStringMode(), and NLMISC::CMemStream::stringMode().

uint32 NLNET::CMessage::_SubMessagePosR [private]
 

Definition at line 260 of file message.h.

Referenced by assignFromSubMessage(), clear(), getName(), hasLockedSubMessage(), lockSubMessage(), operator=(), and resetSubMessageInternals().

bool NLNET::CMessage::_TypeSet [private]
 

Definition at line 270 of file message.h.

Referenced by assignFromSubMessage(), clear(), getId(), getName(), invert(), operator=(), setType(), toString(), and typeIsSet().

bool NLNET::CMessage::TypeHasAName
 

Definition at line 240 of file message.h.

Referenced by getName(), operator=(), setType(), and toString().

bool NLNET::CMessage::TypeHasAnId
 

Definition at line 239 of file message.h.

Referenced by getId(), operator=(), NLNET::CCallbackNetBase::processOneMessage(), setType(), and toString().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 13:59:58 2004 for NeL by doxygen 1.3.6