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

NLMISC::IStream Class Reference

A IO stream interface. More...

#include <stream.h>

Inheritance diagram for NLMISC::IStream

Inheritance graph
[legend]
List of all members.

Public Types

enum  TSeekOrigin {
  begin,
  current,
  end
}
 Parameters for seek(). More...


Public Methods

 IStream (bool inputStream, bool needSwap)
 Constructor. More...

virtual ~IStream ()
 Destructor. More...

 IStream ( const IStream& other )
 Copy constructor. More...

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

bool isReading () const
 Is this stream a Read/Input stream? More...

template<classT> void serial (T &obj)
 Template Object serialisation. More...

template<classT> void serialEnum (T &em)
 Template enum serialisation. Serialized as a sint32. More...

template<classT> void serialCont (std::vector<T> &cont)
template<classT> void serialCont (std::list<T> &cont)
template<classT> void serialCont (std::deque<T> &cont)
template<classT> void serialCont (std::set<T> &cont)
template<classT> void serialCont (std::multiset<T> &cont)
template<classK, classT> void serialCont (std::map<K, T> &cont)
template<classK, classT> void serialCont (std::multimap<K, T> &cont)
virtual void serialCont (std::vector<uint8> &cont)
 Specialisation of serialCont() for vector<uint8>. More...

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

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

template<classT> void serialContPtr (std::vector<T> &cont)
template<classT> void serialContPtr (std::list<T> &cont)
template<classT> void serialContPtr (std::deque<T> &cont)
template<classT> void serialContPtr (std::set<T> &cont)
template<classT> void serialContPtr (std::multiset<T> &cont)
template<classT> void serialContPolyPtr (std::vector<T> &cont)
template<classT> void serialContPolyPtr (std::list<T> &cont)
template<classT> void serialContPolyPtr (std::deque<T> &cont)
template<classT> void serialContPolyPtr (std::set<T> &cont)
template<classT> void serialContPolyPtr (std::multiset<T> &cont)
template<classT> void serialPtr (T* &ptr)
 Serialize Non Polymorphic Objet Ptr. More...

template<classT> void serialPolyPtr (T* &ptr)
 Serialize Polymorphic Objet Ptr. More...

uint serialVersion (uint currentVersion)
 Serialize a version number. More...

template<classT> void serialCheck (const T& value)
 Serialize a check value. More...

virtual bool seek (sint32 offset, TSeekOrigin origin)
 Moves the stream pointer to a specified location. More...

virtual sint32 getPos ()
 Get the location of the stream pointer. More...

Base type serialisation.
Those method are a specialisation of template method "void serial(T&)".

virtual void serial (uint8 &b)
virtual void serial (sint8 &b)
virtual void serial (uint16 &b)
virtual void serial (sint16 &b)
virtual void serial (uint32 &b)
virtual void serial (sint32 &b)
virtual void serial (uint64 &b)
virtual void serial (sint64 &b)
virtual void serial (float &b)
virtual void serial (double &b)
virtual void serial (bool &b)
virtual void serial (char &b)
virtual void serial (std::string &b)
virtual void serial (ucstring &b)
BitField serialisation.
Unlike other serial method, The reading bitfield is returned!! If !this->isReading(), bf is returned.

MUST use it simply like this: a= serialBitFieldX(a); // where X== 8, 16 or 32.

NB: Performance warning: the data is stored as an uint8, uint16 or uint32, according to the method you use.

uint8 serialBitField8 (uint8 bf)
 Serialisation of bitfield <=8 bits. More...

uint16 serialBitField16 (uint16 bf)
 Serialisation of bitfield <=16 bits. More...

uint32 serialBitField32 (uint32 bf)
 Serialisation of bitfield <=32 bits. More...

Multiple serialisation.
Template for easy multiple serialisation.

template<classT0, classT1> void serial (T0 &a, T1 &b)
template<classT0, classT1, classT2> void serial (T0 &a, T1 &b, T2 &c)
template<classT0, classT1, classT2, classT3> void serial (T0 &a, T1 &b, T2 &c, T3 &d)
template<classT0, classT1, classT2, classT3, classT4> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e)
template<classT0, classT1, classT2, classT3, classT4, classT5> void serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f)
standard STL containers serialisation. Elements must be pointers on a IStreamable object.
Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.

See also:
serialCont() serialContPtr()


virtual void serialBuffer (uint8 *buf, uint len) = 0
 Method to be specified by the Deriver. More...

virtual void serialBit (bool &bit) = 0

Static Public Methods

void setVersionException (bool throwOnOlder, bool throwOnNewer)
 Set the behavior of IStream regarding input stream that are older/newer than the class. More...

void getVersionException (bool &throwOnOlder, bool &throwOnNewer)
 Get the behavior of IStream regarding input stream that are older/newer than the class. More...


Protected Methods

void resetPtrTable ()
 for Deriver: reset the PtrTable in the stream. More...

void setInOut (bool inputStream)
 Change, in live, the state of the inputStream. More...

template<classT> void serialVector (T &cont)
 special version for serializing a vector. More...


Private Types

typedef std::map<uint64, void*>::iterator ItIdMap
typedef std::map<uint64, void*>::value_type ValueIdMap

Private Methods

void serialIStreamable (IStreamable* &ptr)
template<classT> void serialSTLContLen (T &cont, sint32 len)
 standard STL containers serialisation. More...

template<classT> void serialSTLCont (T &cont)
 standard STL containers serialisation. More...

template<classT> void serialSTLContLenPtr (T &cont, sint32 len)
 standard STL containers serialisation. More...

template<classT> void serialSTLContPtr (T &cont)
 standard STL containers serialisation. More...

template<classT> void serialVectorPtr (T &cont)
 special version for serializing a vector. More...

template<classT> void serialSTLContLenPolyPtr (T &cont, sint32 len)
 standard STL containers serialisation. More...

template<classT> void serialSTLContPolyPtr (T &cont)
 standard STL containers serialisation. More...

template<classT> void serialVectorPolyPtr (T &cont)
 special version for serializing a vector. More...

template<classT> void serialMap (T &cont)
 STL map<> and multimap<> serialisation. More...


Private Attributes

bool _InputStream
bool _NeedSwap
std::map<uint64, void*> _IdMap

Static Private Attributes

bool _ThrowOnOlder = false
bool _ThrowOnNewer = true

Detailed Description

A IO stream interface.

This is the base interface for stream objects. Differents kind of streams may be implemented, by specifying serialBuffer() methods.

Deriver Use:

The deriver must:

  • construct object specifying his type, see IStream(). A stream may be setup Input or Output at construction, but cannot change during his life.
  • specify serialBuffer(), to save or load pack of bytes.
  • specify serialBit(), to save or load a bit.
  • call resetPtrTable() when the stream reset itself (e.g.: CIFile::close() )
Sample of streams: COutMemoryStream, CInFileStream ...

Client Use:

An object which can be serialized, must provide a "void serial(IStream &)" method. In this method, he can use any of the IStream method to help himself like:

  • serial() with a base type (uint32, string, char...), or even with an object which provide "void serial(IStream &)"
  • template serial(T0&, T1&, ...) to serialize multiple object/variables in one call (up to 6).
  • serialCont() to serialize containers.
  • serialVersion() to check/store a version number of his class.
  • serialPtr() to use the ptr support of IStream (see serialPtr() for more information)
  • isReading() to know if he write in the stream, or if he read.
The using is very simple as shown in this example:

 class A
 {
 public:
        float   x;
        uint32  y;
        Class1  a;              // this class must provide a serial() method too...
        Base    *c,*d;  // Base must derive from IStreamable
        vector<Class2>  tab;

 public:
        void    serial(IStream &f)
        {
                sint    streamver= f.serialVersion(3);
                f.serial(x,y,a);
                f.serialPtr(c);
                f.serialCont(tab);
                if(streamver>=2)
                        f.serialPtr(d);
        }
 };

NB: YOU CANNOT use serial with a int / uint / sint type, since those type have unspecified length.

Author(s):
Lionel Berenguier , Vianney Lecroart , Nevrax France
Date:
2000

Definition at line 156 of file stream.h.


Member Typedef Documentation

typedef std::map<uint64, void*>::iterator NLMISC::IStream::ItIdMap [private]
 

Definition at line 547 of file stream.h.

typedef std::map<uint64, void*>::value_type NLMISC::IStream::ValueIdMap [private]
 

Definition at line 548 of file stream.h.


Member Enumeration Documentation

enum NLMISC::IStream::TSeekOrigin
 

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 482 of file stream.h.


Constructor & Destructor Documentation

NLMISC::IStream::IStream ( bool inputStream,
bool needSwap ) [inline]
 

Constructor.

You must set needSwap only if your stream need it (a CMemoryStream may not need it). IStream::IStream() force needSwap=false if NL_LITTLE_ENDIAN defined! Notice that those behavior can be set at construction only.

Parameters:
inputStream   is the stream an Input (read) stream?
needSwap   is the stream need endian swapping?

Definition at line 53 of file stream_inline.h.

NLMISC::IStream::~IStream ( ) [inline, virtual]
 

Destructor.

Definition at line 188 of file stream.h.

NLMISC::IStream::IStream ( const IStream & other )
 

Copy constructor.

Definition at line 66 of file stream.cpp.


Member Function Documentation

sint32 NLMISC::IStream::getPos ( ) [virtual]
 

Get the location of the stream pointer.

NB: If the stream doesn't support the seek fonctionnality, it throw 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 in NLMISC::CIFile, NLMISC::COFile, and NLMISC::CMemStream.

Definition at line 296 of file stream.cpp.

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

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

See also:
serialVersion() setVersionException()

Definition at line 55 of file stream.cpp.

bool NLMISC::IStream::isReading ( ) const [inline]
 

Is this stream a Read/Input stream?

Definition at line 65 of file stream_inline.h.

Referenced by NLSOUND::CSound::load(), NLSOUND::CEnvSoundUser::load(), NLSOUND::CEnvEffect::load(), NLMISC::CBitmap::load(), NLMISC::CBitmap::loadSize(), NLMISC::CBitmap::readTGA(), NLSOUND::CSound::save(), NLSOUND::CEnvSoundUser::save(), NLSOUND::CEnvEffect::save(), NL3D::CZone::serial(), NLAISCRIPT::COperandSimpleListOr::serial(), NLAISCRIPT::COperandSimple::serial(), NL3D::CTextureFile::serial(), NLPACS::CSurfaceQuadTree::serial(), NLPACS::CQuadBranch::serial(), NLSOUND::CSourceUser::serial(), NLSOUND::CSound::serial(), NL3D::CInstanceGroup::serial(), NLPACS::CRetrieverInstance::serial(), NL3D::CPortal::serial(), CObjectViewer::serial(), NLNET::TMessageRecord::serial(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NLNET::CLoginCookie::serial(), NLNET::CInetAddress::serial(), NLAIC::CIdentTypeAlloc::serial(), NLPACS::CGlobalRetriever::serial(), NLSOUND::CEnvSoundUser::serial(), NLPACS::CEdgeQuad::serial(), NLPACS::CChainQuad::serial(), NL3D::CMaterialBase::CAnimatedTexture::serial(), NLMISC::CAABBoxExt::serial(), NL3D::CVertexBuffer::serialHeader(), NL3D::CMeshMRMGeom::serialLodVertexData(), NL3D::CVertexBuffer::serialOldV1Minus(), NL3D::CVertexBuffer::serialSubset(), and NLMISC::CBitmap::writeTGA().

IStream & NLMISC::IStream::operator= ( const IStream & other )
 

Assignment operator.

Definition at line 75 of file stream.cpp.

void NLMISC::IStream::resetPtrTable ( ) [protected]
 

for Deriver: reset the PtrTable in the stream.

If Derived stream provide reset()-like methods, they must call this method in their reset() methods. For example, CFile::close() must call it, so it will work correctly with next serialPtr()

Reimplemented in NLMISC::CMemStream.

Definition at line 159 of file stream.cpp.

bool NLMISC::IStream::seek ( sint32 offset,
TSeekOrigin origin ) [virtual]
 

Moves the stream pointer to a specified location.

NB: If the stream doesn't support the seek fonctionnality, it throw 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 in NLMISC::CMemStream.

Definition at line 290 of file stream.cpp.

Referenced by NLMISC::CBitmap::load(), NL3D::CMeshMRMGeom::loadNextLod(), NLMISC::CBitmap::loadSize(), and NLMISC::CBitmap::readTGA().

template<classT0, classT1, classT2, classT3, classT4, classT5>
void NLMISC::IStream::serial ( T0 & a,
T1 & b,
T2 & c,
T3 & d,
T4 & e,
T5 & f ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 288 of file stream.h.

template<classT0, classT1, classT2, classT3, classT4>
void NLMISC::IStream::serial ( T0 & a,
T1 & b,
T2 & c,
T3 & d,
T4 & e ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 285 of file stream.h.

template<classT0, classT1, classT2, classT3>
void NLMISC::IStream::serial ( T0 & a,
T1 & b,
T2 & c,
T3 & d ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 282 of file stream.h.

template<classT0, classT1, classT2>
void NLMISC::IStream::serial ( T0 & a,
T1 & b,
T2 & c ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 279 of file stream.h.

template<classT0, classT1>
void NLMISC::IStream::serial ( T0 & a,
T1 & b ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 276 of file stream.h.

void NLMISC::IStream::serial ( ucstring & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 324 of file stream_inline.h.

void NLMISC::IStream::serial ( std::string & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 302 of file stream_inline.h.

void NLMISC::IStream::serial ( char & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 295 of file stream_inline.h.

void NLMISC::IStream::serial ( bool & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 288 of file stream_inline.h.

void NLMISC::IStream::serial ( double & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 263 of file stream_inline.h.

void NLMISC::IStream::serial ( float & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 238 of file stream_inline.h.

void NLMISC::IStream::serial ( sint64 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 213 of file stream_inline.h.

void NLMISC::IStream::serial ( uint64 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 188 of file stream_inline.h.

void NLMISC::IStream::serial ( sint32 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 163 of file stream_inline.h.

void NLMISC::IStream::serial ( uint32 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 138 of file stream_inline.h.

void NLMISC::IStream::serial ( sint16 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 113 of file stream_inline.h.

void NLMISC::IStream::serial ( uint16 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 88 of file stream_inline.h.

void NLMISC::IStream::serial ( sint8 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 82 of file stream_inline.h.

void NLMISC::IStream::serial ( uint8 & b ) [inline, virtual]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 76 of file stream_inline.h.

template<classT>
void NLMISC::IStream::serial ( T & obj ) [inline]
 

Template Object serialisation.

Parameters:
obj   any object providing a "void serial(IStream&)" method. The object doesn't have to derive from IStreamable.

the VC++ error "error C2228: left of '.serial' must have class/struct/union type" means you don't provide a serial() method to your object. Or you may have use serial with a int / uint / sint type. REMEMBER YOU CANNOT do this, since those type have unspecified length.

Reimplemented in NLMISC::CStringStream.

Definition at line 209 of file stream.h.

Referenced by NLAIAGENT::CAgentNumber::CAgentNumber(), NLAIAGENT::CIdent::CIdent(), NL3D::CAnimationSetUser::addAnimation(), NL3D::CAnimationSetUser::addSkeletonWeight(), CExportNel::buildShape(), NLAIAGENT::IConnectIA::connectLoadStream(), NL3D::UAnimation::createAnimation(), NLAISCRIPT::CVarPStackParam::load(), NLAISCRIPT::CVarPStack::load(), NLAILOGIC::CVarSet::load(), NLAILOGIC::CVar::load(), NLAILOGIC::CValueSet::load(), NLSOUND::CSound::load(), NLAISCRIPT::CScriptDebugSourceMemory::load(), NLAISCRIPT::CScriptDebugSourceFile::load(), NLAIC::CBinaryType::load(), NLAILOGIC::IBaseOperator::load(), NLAISCRIPT::CLdbRefOpCode::load(), NLAISCRIPT::CLdbHeapMemberiOpCode::load(), NLAISCRIPT::CLdbMemberOpCode::load(), NLAISCRIPT::CLdbOpCode::load(), NLAISCRIPT::CCallMethodi::load(), NLAISCRIPT::CCallStackMethodi::load(), NLAISCRIPT::CCallHeapMethodi::load(), NLAISCRIPT::CCallMethod::load(), NLAISCRIPT::CLibHeapMemberMethod::load(), NLAISCRIPT::CLibStackMemberMethod::load(), NLAISCRIPT::CLibCallMethodi::load(), NLAISCRIPT::CLibCallInheritedMethod::load(), NLAISCRIPT::CLibCallMethod::load(), NLAISCRIPT::CLibMemberMethodi::load(), NLAISCRIPT::CLibMemberInheritedMethod::load(), NLAISCRIPT::CLibMemberMethod::load(), NLAISCRIPT::CMarkMsg::load(), NLAISCRIPT::CAffMemberOpCode::load(), NLAISCRIPT::CAffHeapMemberiOpCode::load(), NLAISCRIPT::CAffOpCode::load(), NLAISCRIPT::CJmpOpCode::load(), NLAISCRIPT::CJFalseOpCode::load(), NLAISCRIPT::CAddParamNameDebug::load(), NLAISCRIPT::CFindRunMsg::load(), NLAISCRIPT::CAffOpCodeDebug::load(), NLAISCRIPT::CLoadHeapObject::load(), NLAIAGENT::CMessageGroup::load(), NLAIAGENT::CVectorMsgContainer::load(), NLAIAGENT::IMessageBase::load(), NLAIAGENT::CLocalMailBox::load(), NLAIAGENT::CSimpleLocalMailBox::load(), NLAIAGENT::IListBasicManager::load(), NLAISCRIPT::CAgentClass::load(), NLAISCRIPT::CComponent::load(), NLAISCRIPT::CMethodeName::load(), NLAISCRIPT::CParam::load(), NLAIAGENT::CIdent::load(), NLAIAGENT::CAgentNumber::load(), NLAIAGENT::CIndexVariant::load(), NLAIAGENT::CVectorGroupType::load(), NLAIAGENT::CGroupType::load(), NLAIFUZZY::CFuzzyVar::load(), NLAIFUZZY::FuzzyType::load(), NLAIFUZZY::CTriangleFuzzySet::load(), NLAIFUZZY::CFuzzyRule::load(), NLAILOGIC::CFactBase::load(), NLSOUND::CEnvEffect::load(), NLAISCRIPT::CCodeBrancheRunDebug::load(), NLAISCRIPT::CCodeBrancheRun::load(), NLAICHARACTER::CCharacterChild::load(), NLAILOGIC::CBoolOperator::load(), NLAILOGIC::CBoolAssert::load(), NLMISC::CBitmap::load(), NLAIAGENT::IAgentComposite::load(), NLAIAGENT::CStringVarName::load(), NLAIAGENT::CAgentScript::load(), NLAIAGENT::CStringType::load(), NLAIAGENT::INombre::load(), NLAIAGENT::IAgentInput::load(), NLAIAGENT::IVector::load(), NLAIAGENT::CActorScript::load(), NLAIAGENT::CIndexedVarName::loadClass(), NL3D::CMeshMRMGeom::loadFirstLod(), NLAISCRIPT::IOpType::loadIOpType(), NL3D::CMeshMRMGeom::loadNextLod(), NLMISC::CBitmap::loadSize(), NLMISC::CBitmap::readDDS(), NLMISC::CBitmap::readTGA(), NLAIAGENT::IRefrence::refLoadStream(), NLAISCRIPT::CVarPStackParam::save(), NLAISCRIPT::CVarPStack::save(), NLAILOGIC::CVarSet::save(), NLAILOGIC::CVar::save(), NLAILOGIC::CValueSet::save(), NLSOUND::CSound::save(), NLAISCRIPT::CScriptDebugSourceMemory::save(), NLAISCRIPT::CScriptDebugSourceFile::save(), NLAIC::CBinaryType::save(), NLAILOGIC::IBaseOperator::save(), NLAISCRIPT::CLdbRefOpCode::save(), NLAISCRIPT::CLdbHeapMemberiOpCode::save(), NLAISCRIPT::CLdbMemberOpCode::save(), NLAISCRIPT::CLdbOpCode::save(), NLAISCRIPT::CCallMethodi::save(), NLAISCRIPT::CCallStackMethodi::save(), NLAISCRIPT::CCallHeapMethodi::save(), NLAISCRIPT::CCallMethod::save(), NLAISCRIPT::CLibHeapMemberMethod::save(), NLAISCRIPT::CLibStackMemberMethod::save(), NLAISCRIPT::CLibCallMethodi::save(), NLAISCRIPT::CLibCallInheritedMethod::save(), NLAISCRIPT::CLibCallMethod::save(), NLAISCRIPT::CLibMemberMethodi::save(), NLAISCRIPT::CLibMemberInheritedMethod::save(), NLAISCRIPT::CLibMemberMethod::save(), NLAISCRIPT::CMarkMsg::save(), NLAISCRIPT::CAffMemberOpCode::save(), NLAISCRIPT::CAffHeapMemberiOpCode::save(), NLAISCRIPT::CAffOpCode::save(), NLAISCRIPT::CJmpOpCode::save(), NLAISCRIPT::CJFalseOpCode::save(), NLAISCRIPT::CLdbNewOpCode::save(), NLAISCRIPT::CAddParamNameDebug::save(), NLAISCRIPT::CFindRunMsg::save(), NLAISCRIPT::CAffOpCodeDebug::save(), NLAISCRIPT::CLoadHeapObject::save(), NLAIAGENT::CMessageGroup::save(), NLAIAGENT::CVectorMsgContainer::save(), NLAIAGENT::IMessageBase::save(), NLAIAGENT::CLocalMailBox::save(), NLAIAGENT::CSimpleLocalMailBox::save(), NLAIAGENT::IListBasicManager::save(), NLAISCRIPT::CAgentClass::save(), NLAISCRIPT::CComponent::save(), NLAISCRIPT::CMethodeName::save(), NLAISCRIPT::CParam::save(), NLAIAGENT::CIdent::save(), NLAIAGENT::CAgentNumber::save(), NLAIAGENT::CIndexVariant::save(), NLAIAGENT::CVectorGroupType::save(), NLAIAGENT::CGroupType::save(), NLAIFUZZY::CFuzzyVar::save(), NLAIFUZZY::FuzzyType::save(), NLAIFUZZY::CTrapezeFuzzySet::save(), NLAIFUZZY::CLeftFuzzySet::save(), NLAIFUZZY::CTriangleFuzzySet::save(), NLAIFUZZY::CRightFuzzySet::save(), NLAIFUZZY::CFuzzyInterval::save(), NLAILOGIC::CFactBase::save(), NLSOUND::CEnvEffect::save(), NLAISCRIPT::CCodeBrancheRunDebug::save(), NLAISCRIPT::CCodeBrancheRun::save(), NLAICHARACTER::CCharacterNoeud::save(), NLAICHARACTER::CCharacterChild::save(), NLAILOGIC::CBoolType::save(), NLAILOGIC::CBoolOperator::save(), NLAILOGIC::CBoolAssert::save(), NLAIAGENT::IAgentComposite::save(), NLAIAGENT::IRefrence::save(), NLAIAGENT::IConnectIA::save(), NLAIAGENT::CStringVarName::save(), NLAIAGENT::CIndexedVarName::save(), NLAIAGENT::CAgentScript::save(), NLAIAGENT::CStringType::save(), NLAIAGENT::INombre::save(), NLAIAGENT::CLocalAgentMail::save(), NLAIAGENT::IAgentInput::save(), NLAIAGENT::IVector::save(), NLAIAGENT::CActorScript::save(), NLAIAGENT::CActor::save(), NLAIAGENT::CIndexedVarName::saveClass(), NL3D::CZone::serial(), NL3D::CPatchInfo::CBindInfo::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CBorderVertex::serial(), NL3D::CPaletteSkin::serial(), NLPACS::CVector2s::serial(), NLMISC::CVector2f::serial(), NLMISC::CVector2d::serial(), NLMISC::CUVW::serial(), NLMISC::CUV::serial(), NLAISCRIPT::COperandSimpleListOr::serial(), NLAISCRIPT::COperandSimple::serial(), NL3D::CTileElement::serial(), NL3D::CTileColor::serial(), NL3D::CTextureFile::serial(), NLPACS::IQuadNode::serial(), NLPACS::CSurfaceQuadTree::serial(), NLPACS::CQuadBranch::serial(), NLSOUND::CSourceUser::serial(), NLSOUND::CSound::serial(), NL3D::CSkeletonWeight::CNode::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::CLink::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrievableSurface::CSurfaceLink::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CVector3s::serial(), NL3D::CPatch::serial(), CMeshDesc::serial(), CObjectViewer::serial(), NL3D::CMRMWedgeGeom::serial(), NLPACS::UTriggerInfo::serial(), NLPACS::UCollisionDesc::serial(), NL3D::CMeshMRMGeom::CLodInfo::serial(), NL3D::CMeshMRMGeom::CLod::serial(), NL3D::CMeshMRMGeom::CVertexBlock::serial(), NL3D::CMeshMRMGeom::CRdrPass::serial(), NL3D::CMeshBase::CMatStage::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMeshGeom::CRdrPass::serial(), NL3D::CMaterial::CTexEnv::serial(), NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NLNET::CLoginCookie::serial(), NLPACS::CLocalRetriever::CInteriorFace::serial(), NLPACS::CLocalRetriever::CTip::serial(), NLPACS::CLocalRetriever::CTip::CChainTip::serial(), NLPACS::CLocalRetriever::serial(), NLNET::CInetAddress::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::CLink::serial(), NLPACS::CExteriorMesh::COrderedEdges::serial(), NLPACS::CExteriorMesh::CEdge::serial(), NLPACS::CExteriorMesh::serial(), CExportNelOptions::serial(), NLSOUND::CEnvSoundUser::serial(), NLSOUND::TEnvEffectRoom::serial(), NLPACS::CEdgeQuad::serial(), NLPACS::CExteriorEdgeEntry::serial(), NLPACS::CCollisionFace::serial(), NLPACS::CSurfaceIdent::serial(), NLPACS::CChainQuad::serial(), NLSOUND::CBoundingSphere::serial(), NLSOUND::CBoundingBox::serial(), NL3D::CBoneBase::serial(), CAutomataDesc::CState::serial(), NL3D::CAnimationPlaylist::serial(), NL3D::CAnimation::serial(), NL3D::CMaterialBase::serial(), NLSOUND::CAmbiantSource::serial(), NLMISC::CAABBox::serial(), NLSOUND::CSound::serialFileHeader(), NLSOUND::CEnvEffect::serialFileHeader(), NL3D::CVertexBuffer::serialHeader(), NL3D::CMeshMRMGeom::serialLodVertexData(), NL3D::CVertexBuffer::serialOldV1Minus(), and NLMISC::CBitmap::writeTGA().

void NLMISC::IStream::serialBit ( bool & bit ) [pure virtual]
 

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

uint16 NLMISC::IStream::serialBitField16 ( uint16 bf ) [inline]
 

Serialisation of bitfield <=16 bits.

Definition at line 352 of file stream_inline.h.

uint32 NLMISC::IStream::serialBitField32 ( uint32 bf ) [inline]
 

Serialisation of bitfield <=32 bits.

Definition at line 358 of file stream_inline.h.

uint8 NLMISC::IStream::serialBitField8 ( uint8 bf ) [inline]
 

Serialisation of bitfield <=8 bits.

Definition at line 346 of file stream_inline.h.

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

void NLMISC::IStream::serialBuffer ( uint8 * buf,
uint len ) [pure virtual]
 

Method to be specified by the Deriver.

Warning:
Do not call these methods from outside, unless you really know what you are doing. Using them instead of serial() can lead to communication problems between different platforms !

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

Referenced by NLMISC::CBitmap::readDDS(), NLMISC::CBitmap::readTGA(), NL3D::CTileNoiseMap::serial(), NLNET::CInetAddress::serial(), and NL3D::CVertexBuffer::serialSubset().

template<classT>
void NLMISC::IStream::serialCheck ( const T & value ) [inline]
 

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 459 of file stream.h.

Referenced by NL3D::CZone::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), CObjectViewer::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimation::serial(), NLSOUND::CSound::serialFileHeader(), NLSOUND::CEnvSoundUser::serialFileHeader(), and NLSOUND::CEnvEffect::serialFileHeader().

void NLMISC::IStream::serialCont ( std::vector< bool >& cont ) [virtual]
 

Specialisation of serialCont() for vector<bool>.

Reimplemented in NLMISC::CStringStream.

Definition at line 251 of file stream.cpp.

void NLMISC::IStream::serialCont ( std::vector< sint8 >& cont ) [virtual]
 

Specialisation of serialCont() for vector<sint8>.

Reimplemented in NLMISC::CStringStream.

Definition at line 234 of file stream.cpp.

void NLMISC::IStream::serialCont ( std::vector< uint8 >& cont ) [virtual]
 

Specialisation of serialCont() for vector<uint8>.

Reimplemented in NLMISC::CStringStream.

Definition at line 217 of file stream.cpp.

template<classK, classT>
void NLMISC::IStream::serialCont ( std::multimap< K,T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 311 of file stream.h.

template<classK, classT>
void NLMISC::IStream::serialCont ( std::map< K,T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 309 of file stream.h.

template<classT>
void NLMISC::IStream::serialCont ( std::multiset< T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 307 of file stream.h.

template<classT>
void NLMISC::IStream::serialCont ( std::set< T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 305 of file stream.h.

template<classT>
void NLMISC::IStream::serialCont ( std::deque< T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 303 of file stream.h.

template<classT>
void NLMISC::IStream::serialCont ( std::list< T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 301 of file stream.h.

template<classT>
void NLMISC::IStream::serialCont ( std::vector< T >& cont ) [inline]
 

Reimplemented in NLMISC::CStringStream.

Definition at line 299 of file stream.h.

Referenced by NLAISCRIPT::CLdbMemberiOpCode::load(), NLAISCRIPT::CLdbHeapMemberiOpCode::load(), NLAISCRIPT::CLdbStackMemberiOpCode::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(), NLAISCRIPT::CLdbMemberiOpCode::save(), NLAISCRIPT::CLdbHeapMemberiOpCode::save(), NLAISCRIPT::CLdbStackMemberiOpCode::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(), NL3D::CZone::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPatch::serial(), CObjectViewer::serial(), NL3D::CMeshMRMGeom::CLod::serial(), NL3D::CMeshBase::CLightInfoMapList::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMaterial::serial(), NLPACS::CLocalRetriever::CTopology::serial(), NLPACS::CLocalRetriever::CTip::serial(), NLPACS::CLocalRetriever::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::serial(), NLSOUND::CEnvSoundUser::serial(), NLSOUND::CEnvEffect::serial(), NLPACS::CEdgeQuad::serial(), NLPACS::CCollisionMeshBuild::serial(), CAutomataDesc::CState::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimation::serial(), and NL3D::CMaterialBase::serial().

template<classT>
void NLMISC::IStream::serialContPolyPtr ( std::multiset< T >& cont ) [inline]
 

Definition at line 354 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPolyPtr ( std::set< T >& cont ) [inline]
 

Definition at line 352 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPolyPtr ( std::deque< T >& cont ) [inline]
 

Definition at line 350 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPolyPtr ( std::list< T >& cont ) [inline]
 

Definition at line 348 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPolyPtr ( std::vector< T >& cont ) [inline]
 

Definition at line 346 of file stream.h.

Referenced by NLSOUND::CEnvSoundUser::serial(), and NL3D::CAnimation::serial().

template<classT>
void NLMISC::IStream::serialContPtr ( std::multiset< T >& cont ) [inline]
 

Definition at line 337 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPtr ( std::set< T >& cont ) [inline]
 

Definition at line 335 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPtr ( std::deque< T >& cont ) [inline]
 

Definition at line 333 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPtr ( std::list< T >& cont ) [inline]
 

Definition at line 331 of file stream.h.

template<classT>
void NLMISC::IStream::serialContPtr ( std::vector< T >& cont ) [inline]
 

Definition at line 329 of file stream.h.

Referenced by NLSOUND::CEnvSoundUser::serial(), NL3D::CAnimationSet::serial(), and NLSOUND::CAmbiantSource::serial().

template<classT>
void NLMISC::IStream::serialEnum ( T & em ) [inline]
 

Template enum serialisation. Serialized as a sint32.

Definition at line 238 of file stream.h.

Referenced by NLPACS::CRetrieverInstance::serial(), NL3D::CMaterial::serial(), NLPACS::CLocalRetriever::serial(), and NL3D::CAnimationPlaylist::serial().

void NLMISC::IStream::serialIStreamable ( IStreamable *& ptr ) [private]
 

Definition at line 89 of file stream.cpp.

template<classT>
void NLMISC::IStream::serialMap ( T & cont ) [inline, private]
 

STL map<> and multimap<> serialisation.

Support up to sint32 length containers.

the object T must provide:

  • typedef iterator; (providing operator++() and operator *())
  • typedef value_type; (must be a std::pair<>)
  • typedef key_type; (must be the type of the key)
  • void clear();
  • size_type size const;
  • iterator begin;
  • iterator end;
  • iterator insert(iterator it, const value_type& x);
Known Supported containers: map<>, multimap<>.
Parameters:
cont   a STL map<> or multimap<> container.

Definition at line 847 of file stream.h.

template<classT>
void NLMISC::IStream::serialPolyPtr ( T *& ptr ) [inline]
 

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 431 of file stream.h.

Referenced by NL3D::CMaterial::CLightMap::serial(), NL3D::CMaterial::serial(), NLSOUND::CEnvSoundUser::serial(), NLSOUND::CEnvEffect::serial(), and NL3D::CMaterialBase::CAnimatedTexture::serial().

template<classT>
void NLMISC::IStream::serialPtr ( T *& ptr ) [inline]
 

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 365 of file stream.h.

Referenced by NLSOUND::CEnvSoundUser::load(), NLSOUND::CEnvSoundUser::save(), NLSOUND::CSourceUser::serial(), and NLSOUND::CEnvSoundUser::serial().

template<classT>
void NLMISC::IStream::serialSTLCont ( T & cont ) [inline, private]
 

standard STL containers serialisation.

Don't work with map<> and multimap<>. Support up to sint32 length containers.

the object T must provide:

  • typedef iterator; (providing operator++() and operator *())
  • typedef value_type; (a base type (uint...), or an object providing "void serial(IStream&)" method.)
  • void clear();
  • size_type size const;
  • iterator begin;
  • iterator end;
  • iterator insert(iterator it, const value_type& x);
Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<>.
Parameters:
cont   a STL container (vector<>, set<> ...).

Definition at line 603 of file stream.h.

template<classT>
void NLMISC::IStream::serialSTLContLen ( T & cont,
sint32 len ) [inline, private]
 

standard STL containers serialisation.

Don't work with map<> and multimap<>. Support up to sint32 length containers. serialize just len element of the container.

Definition at line 561 of file stream.h.

template<classT>
void NLMISC::IStream::serialSTLContLenPolyPtr ( T & cont,
sint32 len ) [inline, private]
 

standard STL containers serialisation.

Don't work with map<> and multimap<>. PolyPtr version Support up to sint32 length containers. serialize just len element of the container.

Definition at line 750 of file stream.h.

template<classT>
void NLMISC::IStream::serialSTLContLenPtr ( T & cont,
sint32 len ) [inline, private]
 

standard STL containers serialisation.

Don't work with map<> and multimap<>. Ptr version. Support up to sint32 length containers. serialize just len element of the container.

Definition at line 668 of file stream.h.

template<classT>
void NLMISC::IStream::serialSTLContPolyPtr ( T & cont ) [inline, private]
 

standard STL containers serialisation.

Don't work with map<> and multimap<>. PolyPtr version Support up to sint32 length containers.

Definition at line 780 of file stream.h.

template<classT>
void NLMISC::IStream::serialSTLContPtr ( T & cont ) [inline, private]
 

standard STL containers serialisation.

Don't work with map<> and multimap<>. Ptr version. Support up to sint32 length containers.

Definition at line 698 of file stream.h.

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

special version for serializing a vector.

Support up to sint32 length containers.

Definition at line 628 of file stream.h.

template<classT>
void NLMISC::IStream::serialVectorPolyPtr ( T & cont ) [inline, private]
 

special version for serializing a vector.

PolyPtr version Support up to sint32 length containers.

Definition at line 803 of file stream.h.

template<classT>
void NLMISC::IStream::serialVectorPtr ( T & cont ) [inline, private]
 

special version for serializing a vector.

Ptr version. Support up to sint32 length containers.

Definition at line 721 of file stream.h.

uint NLMISC::IStream::serialVersion ( uint currentVersion )
 

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 171 of file stream.cpp.

Referenced by NL3D::CZone::serial(), NL3D::CPatchInfo::CBindInfo::serial(), NL3D::CZone::CPatchConnect::serial(), NL3D::CBorderVertex::serial(), NL3D::CVertexBuffer::serial(), NL3D::CTileNoiseMap::serial(), NL3D::CTextureFile::serial(), NLPACS::CSurfaceQuadTree::serial(), NL3D::CSkeletonWeight::CNode::serial(), NL3D::CSkeletonWeight::serial(), NL3D::CInstanceGroup::serial(), NL3D::CInstanceGroup::CInstance::serial(), NLPACS::CRetrieverInstance::serial(), NLPACS::CRetrieverBank::serial(), NL3D::CPrimitiveBlock::serial(), NL3D::CPortal::serial(), NL3D::CPatch::serial(), CMeshDesc::serial(), CObjectViewer::serial(), NL3D::CMeshMRMGeom::CLodInfo::serial(), NL3D::CMeshMRMGeom::CLod::serial(), NL3D::CMeshMRMGeom::CRdrPass::serial(), NL3D::CMeshMRM::serial(), NL3D::CMeshGeom::CMatrixBlock::serial(), NL3D::CMeshGeom::CRdrPass::serial(), NL3D::CMaterial::serial(), NLPACS::CLocalRetriever::serial(), NLPACS::CGlobalRetriever::serial(), NLPACS::CFaceGrid::serial(), NLPACS::CExteriorMesh::serial(), CExportNelOptions::serial(), NLPACS::CEdgeQuad::serial(), NLPACS::CChainQuad::serial(), NL3D::CBoneBase::serial(), NL3D::CAnimationSet::serial(), NL3D::CAnimationPlaylist::serial(), NL3D::CAnimation::serial(), NL3D::CMaterialBase::serial(), NLMISC::CAABBox::serial(), NLSOUND::CSound::serialFileHeader(), NLSOUND::CEnvSoundUser::serialFileHeader(), NLSOUND::CEnvEffect::serialFileHeader(), NL3D::CVertexBuffer::serialHeader(), NL3D::CMeshMRMGeom::serialLodVertexData(), and NL3D::CVertexBuffer::serialSubset().

void NLMISC::IStream::setInOut ( bool inputStream ) [protected]
 

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 302 of file stream.cpp.

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

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 48 of file stream.cpp.


Member Data Documentation

std::map< uint64,void *> NLMISC::IStream::_IdMap [private]
 

Definition at line 546 of file stream.h.

bool NLMISC::IStream::_InputStream [private]
 

Definition at line 540 of file stream.h.

bool NLMISC::IStream::_NeedSwap [private]
 

Definition at line 541 of file stream.h.

bool NLMISC::IStream::_ThrowOnNewer = true [static, private]
 

Definition at line 44 of file stream.cpp.

bool NLMISC::IStream::_ThrowOnOlder = false [static, private]
 

Definition at line 43 of file stream.cpp.


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