#include <string_stream.h>
Inheritance diagram for NLMISC::CStringStream:
Nevrax France
Definition at line 43 of file string_stream.h.
Seek fonctionnality | |
enum | TSeekOrigin { begin, current, end } |
virtual std::string | getStreamName () const |
Public Types | |
Public Member Functions | |
const uint8 * | buffer () const |
uint8 * | bufferToFill (uint32 msgsize) |
virtual void | clear () |
Clears the message. | |
CStringStream (const CStringStream &other) | |
Copy constructor. | |
CStringStream (bool inputStream=false, uint32 defaultcapacity=0) | |
Initialization constructor. | |
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) |
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) |
void | increaseBufferIfNecessary (uint32 len) |
Increase the buffer size if 'len' can't enter, otherwise, do nothing. | |
virtual void | invert () |
bool | isReading () const |
Is this stream a Read/Input stream? | |
bool | isXML () const |
virtual uint32 | length () const |
CStringStream & | operator= (const CStringStream &other) |
Assignment operator. | |
template<class T> void | poke (T value, sint32 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 | serialHex (uint32 &b) |
Serialisation in hexadecimal. | |
virtual void | serialMemStream (CMemStream &b) |
Serial memstream, bitmemstream... | |
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. | |
void | setStringMode (bool stringmode) |
Set string 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. | |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. | |
Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<>, map<>, multimap<> Support up to sint32 length containers.
| |
template<class T, class Allocator> void | serialCont (std::vector< T, Allocator > &cont) |
Specialisation of serialCont() for vector<bool>. | |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. | |
Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<>, map<>, multimap<> Support up to sint32 length containers.
| |
template<class T, class Allocator> void | serialCont (std::vector< T, Allocator > &cont) |
Specialisation of serialCont() for vector<bool>. | |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. | |
Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<>, map<>, multimap<> Support up to sint32 length containers.
| |
template<class T, class Allocator> void | serialCont (std::vector< T, Allocator > &cont) |
Specialisation of serialCont() for vector<bool>. | |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
Base type serialisation. | |
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) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. | |
Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<>, map<>, multimap<> Support up to sint32 length containers.
| |
template<class T, class Allocator> void | serialCont (std::vector< T, Allocator > &cont) |
Specialisation of serialCont() for vector<bool>. | |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
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. | |
uint16 | serialBitField16 (uint16 bf) |
Serialisation of bitfield <=16 bits. | |
uint32 | serialBitField32 (uint32 bf) |
Serialisation of bitfield <=32 bits. | |
uint8 | serialBitField8 (uint8 bf) |
Serialisation of bitfield <=8 bits. | |
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.
| |
template<class T> void | serialCheck (const T &value) |
template<class T> void | serialContPolyPtr (std::multiset< T > &cont) |
template<class T> void | serialContPolyPtr (std::set< T > &cont) |
template<class T> void | serialContPolyPtr (std::deque< T > &cont) |
template<class T> void | serialContPolyPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPolyPtr (std::vector< T, Allocator > &cont) |
template<class T> void | serialPolyPtr (T *&ptr) |
template<class T> void | serialPtr (T *&ptr) |
uint | serialVersion (uint currentVersion) |
standard STL containers serialisation. Elements must be pointers on a base type (uint...) or on a | |
object providing "void serial(IStream&)" method. Known Supported containers: vector<>, list<>, deque<>, set<>, multiset<> Support up to sint32 length containers.
| |
template<class T> void | serialContPtr (std::multiset< T > &cont) |
template<class T> void | serialContPtr (std::set< T > &cont) |
template<class T> void | serialContPtr (std::deque< T > &cont) |
template<class T> void | serialContPtr (std::list< T > &cont) |
template<class T, class Allocator> void | serialContPtr (std::vector< T, Allocator > &cont) |
is the name of the node to open | |
xmlPushBegin() open recurcively a new node and open its header. You must call xmlPushEnd() to close the header and xmlPop() to close this node.
| |
bool | xmlBreakLine () |
bool | xmlComment (const char *comment) |
bool | xmlPop () |
bool | xmlPushBegin (const char *name) |
bool | xmlPushEnd () |
bool | xmlSetAttrib (const char *name) |
is the name of the node to open | |
xmlPush() open recurcively a new node. You must call xmlPop to close this node.
| |
bool | xmlPush (const char *name) |
XML user interface | |
Those functions are used to add information in your stream to structure it like a XML document. Exemple of a serial sequence :
The result will be an xml document structured like this:
Node header serials are the serialisations done between xmlPushBegin() and xmlPushEnd() call. There is some restrictions on them: Node header serials are only available for basic types (numbers and strings). xmlSetAttrib() must be called before node header serial. Note that XML documents only have ONE root node, so all serialisation must be done between a xmlPush() and a xmlPop() call.
When a xml input stream will try to open a node, it will scan all currrent child nodes to find the good one. So input xml stream can skip unknown node. | |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, T &value3, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, T &value2, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, T &value1, const char *nodeName) |
template<class T> void | xmlSerial (T &value0, const char *nodeName) |
Static Public Member Functions | |
void | getVersionException (bool &throwOnOlder, bool &throwOnNewer) |
void | setVersionException (bool throwOnOlder, bool throwOnNewer) |
Protected Member Functions | |
uint32 | lengthR () const |
uint32 | lengthS () const |
Returns the serialized length (number of bytes written or read). | |
template<class T> void | serialVector (T &cont) |
XML implementation interface | |
void | setInOut (bool inputStream) |
void | setXMLMode (bool on) |
virtual bool | xmlBreakLineInternal () |
xmlBreakLine implementation | |
virtual bool | xmlCommentInternal (const char *comment) |
xmlComment implementation | |
virtual bool | xmlPopInternal () |
xmlPop implementation | |
virtual bool | xmlPushBeginInternal (const char *name) |
xmlPushBegin implementation | |
virtual bool | xmlPushEndInternal () |
xmlPushEnd implementation | |
virtual bool | xmlSetAttribInternal (const char *name) |
xmlBreakLine implementation | |
XML implementation interface | |
void | setInOut (bool inputStream) |
void | setXMLMode (bool on) |
virtual bool | xmlBreakLineInternal () |
xmlBreakLine implementation | |
virtual bool | xmlCommentInternal (const char *comment) |
xmlComment implementation | |
virtual bool | xmlPopInternal () |
xmlPop implementation | |
virtual bool | xmlPushBeginInternal (const char *name) |
xmlPushBegin implementation | |
virtual bool | xmlPushEndInternal () |
xmlPushEnd implementation | |
virtual bool | xmlSetAttribInternal (const char *name) |
xmlBreakLine implementation | |
XML implementation interface | |
void | setInOut (bool inputStream) |
void | setXMLMode (bool on) |
virtual bool | xmlBreakLineInternal () |
xmlBreakLine implementation | |
virtual bool | xmlCommentInternal (const char *comment) |
xmlComment implementation | |
virtual bool | xmlPopInternal () |
xmlPop implementation | |
virtual bool | xmlPushBeginInternal (const char *name) |
xmlPushBegin implementation | |
virtual bool | xmlPushEndInternal () |
xmlPushEnd implementation | |
virtual bool | xmlSetAttribInternal (const char *name) |
xmlBreakLine implementation | |
XML implementation interface | |
void | setInOut (bool inputStream) |
void | setXMLMode (bool on) |
virtual bool | xmlBreakLineInternal () |
xmlBreakLine implementation | |
virtual bool | xmlCommentInternal (const char *comment) |
xmlComment implementation | |
virtual bool | xmlPopInternal () |
xmlPop implementation | |
virtual bool | xmlPushBeginInternal (const char *name) |
xmlPushBegin implementation | |
virtual bool | xmlPushEndInternal () |
xmlPushEnd implementation | |
virtual bool | xmlSetAttribInternal (const char *name) |
xmlBreakLine implementation | |
Protected Attributes | |
CObjectVector< uint8, false > | _Buffer |
uint8 * | _BufPos |
uint32 | _DefaultCapacity |
bool | _StringMode |
|
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. Definition at line 549 of file stream.h.
|
|
Initialization constructor.
Definition at line 48 of file string_stream.h. References uint32.
00048 : CMemStream( inputStream, defaultcapacity ) {} |
|
Copy constructor.
Definition at line 51 of file string_stream.h.
00051 : CMemStream( other ) {} |
|
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 NLNET::CMessage::assignFromSubMessage(), NLMISC::displayBitStream(), NLNET::CMessage::extractStreamFromPos(), NLNET::TMessageRecord::serial(), NLMISC::IStream::serialMemStream(), NLMISC::CBitMemStream::serialMemStream(), and NLNET::CMessage::serialMessage().
00239 { 00240 return _Buffer.getPtr(); 00241 /* if ( _Buffer.empty() ) 00242 { 00243 return NULL; 00244 } 00245 else 00246 { 00247 return &(*_Buffer.begin()); 00248 }*/ 00249 } |
|
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 NLNET::CMessage::extractStreamFromPos(), NLPACS::CGlobalRetriever::CLrLoader::run(), NLNET::TMessageRecord::serial(), NLMISC::IStream::serialMemStream(), and NLNET::CMessage::serialMessage().
|
|
Clears the message.
Reimplemented in NLMISC::CBitMemStream, and NLNET::CMessage. Definition at line 201 of file mem_stream.h. References NLMISC::CMemStream::_BufPos, NLMISC::CMemStream::_DefaultCapacity, NLMISC::CObjectVector< uint8, false >::clear(), NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), NLMISC::CMemStream::resetPtrTable(), and NLMISC::CObjectVector< uint8, false >::resize(). Referenced by NLPACS::CGlobalRetriever::CLrLoader::run().
|
|
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 } |
|
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 } |
|
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 } |
|
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 NLNET::CMessage::assignFromSubMessage(), and NL3D::CTextureMem::doGenerate().
|
|
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.
|
|
Get the location of the stream pointer. NB: If the stream doesn't support the seek fonctionnality, it throws ESeekNotSupported. Default implementation: { throw ESeekNotSupported; }
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 NLNET::CMessage::changeType(), NLNET::CMessage::CMessage(), NLNET::CMessage::getName(), NLNET::CMessage::lockSubMessage(), NLNET::CMessage::readType(), NLNET::CMessage::readTypeAtCurrentPos(), NLMISC::CBitMemStream::serial(), NLMISC::CBitMemStream::serialCont(), NLMISC::CBitMemStream::serialMemStream(), NLNET::CMessage::setType(), and NLNET::CMessage::unlockSubMessage().
|
|
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 } |
|
Get the behavior of IStream regarding input stream that are older/newer than the class.
Definition at line 78 of file stream.cpp. References NLMISC::IStream::_ThrowOnNewer, and NLMISC::IStream::_ThrowOnOlder.
00079 { 00080 throwOnOlder=_ThrowOnOlder; 00081 throwOnNewer=_ThrowOnNewer; 00082 } |
|
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 } |
|
Transforms the message from input to output or from output to input Precondition:
- Write->Read, the position is set at the beginning of the stream Reimplemented in NLMISC::CBitMemStream, and NLNET::CMessage. Definition at line 331 of file mem_stream.h. References NLMISC::CMemStream::_BufPos, NLMISC::CObjectVector< uint8, false >::getPtr(), NLMISC::IStream::isReading(), NLMISC::CMemStream::lengthR(), NLMISC::CMemStream::resetPtrTable(), NLMISC::CObjectVector< uint8, false >::resize(), NLMISC::IStream::setInOut(), and uint32. Referenced by NL3D::CParticleSystemShape::buildFromPS(), NL3D::CAnimationOptimizer::cloneTrack(), NL3D::CParticleSystemShape::flushTextures(), NL3D::CParticleSystemShape::instanciatePS(), and NLPACS::CGlobalRetriever::CLrLoader::run().
00332 { 00333 if ( isReading() ) 00334 { 00335 // In->Out: We want to write (serialize out) what we have read (serialized in) 00336 uint32 sizeOfReadStream = lengthR(); 00337 resetPtrTable(); 00338 setInOut( false ); 00339 _BufPos = _Buffer.getPtr() + sizeOfReadStream; 00340 } 00341 else 00342 { 00343 // Out->In: We want to read (serialize in) what we have written (serialized out) 00344 resetPtrTable(); 00345 setInOut( true ); 00346 _Buffer.resize (_BufPos - _Buffer.getPtr()); 00347 _BufPos = _Buffer.getPtr(); 00348 } 00349 } |
|
|
Definition at line 221 of file stream.h. References NLMISC::IStream::_XML. Referenced by NLMISC::CMemStream::serial().
00221 { return _XML; }
|
|
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. Reimplemented in NLMISC::CBitMemStream, and NLNET::CMessage. Definition at line 217 of file mem_stream.h. References NLMISC::IStream::isReading(), NLMISC::CMemStream::lengthR(), NLMISC::CMemStream::lengthS(), and uint32. Referenced by NLMISC::CMemStream::fastRead(), NLMISC::CMemStream::fastSerial(), NLMISC::CMemStream::resize(), NLMISC::CMemStream::serialBuffer(), NLMISC::IStream::serialMemStream(), serialSeparatedBufferIn(), and NLMISC::CMemStream::serialSeparatedBufferIn().
|
|
Returns the "read" message size (number of bytes to read) Do not use directly, use length() instead in reading mode (which is virtual) Reimplemented in NLNET::CMessage. Definition at line 511 of file mem_stream.h. References NLMISC::CMemStream::size(), and uint32. Referenced by NLMISC::CBitMemStream::getSerialItem(), NLMISC::CBitMemStream::internalSerial(), NLMISC::CMemStream::invert(), NLMISC::CMemStream::length(), and NLMISC::CBitMemStream::length().
00512 { 00513 return size(); 00514 } |
|
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(), NLNET::CMessage::length(), NLMISC::CMemStream::length(), NLMISC::CBitMemStream::length(), NLMISC::CMemStream::operator=(), NLMISC::CMemStream::serialBuffer(), serialSeparatedBufferIn(), and NLMISC::CMemStream::serialSeparatedBufferIn().
|
|
Assignment operator.
Definition at line 54 of file string_stream.h.
00054 { CMemStream::operator=( other ); return *this; } |
|
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.
|
|
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.
|
|
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().
|
|
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() ; } |
|
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.
|
|
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; }
Reimplemented from NLMISC::IStream. Definition at line 177 of file mem_stream.cpp. References offset, sint, and sint32. Referenced by NLNET::CMessage::changeType(), NLNET::CMessage::CMessage(), NL3D::CParticleSystemShape::flushTextures(), NLNET::CMessage::getName(), NLNET::getNameOfMessageOrTransportClass(), NL3D::CParticleSystemShape::instanciatePS(), NLNET::CMessage::readType(), NLNET::CMessage::readTypeAtCurrentPos(), NLNET::CMessage::serialMessage(), and NLNET::CMessage::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 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 316 of file string_stream.cpp. References NLMISC::IStream::isReading(), len, NLMISC::SEPARATOR, serial(), NLMISC::CMemStream::serialBuffer(), sint, sint32, and uint8.
00317 { 00318 sint32 len=0; 00319 // Read/Write the length. 00320 if(isReading()) 00321 { 00322 serial(len); 00323 b.resize(len); 00324 } 00325 else 00326 { 00327 len= b.size(); 00328 serial(len); 00329 } 00330 // Read/Write the string. 00331 for(sint i=0;i<len;i++) 00332 serialBuffer( (uint8*)&b[i], sizeof( sizeof(b[i]) ) ); 00333 00334 char sep = SEPARATOR; 00335 serialBuffer( (uint8*)&sep, 1 ); 00336 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 290 of file string_stream.cpp. References NLMISC::IStream::isReading(), len, nlassert, NLMISC::SEPARATOR, serial(), NLMISC::CMemStream::serialBuffer(), sint, sint32, and uint8.
00291 { 00292 sint32 len=0; 00293 // Read/Write the length. 00294 if(isReading()) 00295 { 00296 serial(len); 00297 nlassert( len<1000000 ); // limiting string size 00298 b.resize(len); 00299 } 00300 else 00301 { 00302 len= b.size(); 00303 serial(len); 00304 } 00305 00306 // Read/Write the string. 00307 for(sint i=0;i<len;i++) 00308 serialBuffer( (uint8*)&(b[i]), sizeof(b[i]) ); 00309 00310 char sep = SEPARATOR; 00311 serialBuffer( (uint8*)&sep, 1 ); 00312 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 271 of file string_stream.cpp. References NLMISC::IStream::isReading(), NLMISC::SEPARATOR, NLMISC::CMemStream::serialBuffer(), and uint8.
00272 { 00273 char buff [2]; 00274 if ( isReading() ) 00275 { 00276 serialBuffer( (uint8*)buff, 2 ); 00277 b = buff[0]; 00278 } 00279 else 00280 { 00281 buff[0] = b; 00282 buff[1] = SEPARATOR; 00283 serialBuffer( (uint8*)buff, 2 ); 00284 } 00285 00286 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 246 of file string_stream.cpp. References serialBit().
00247 { 00248 serialBit(b); 00249 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 233 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, and writenumber.
00234 { 00235 if ( isReading() ) 00236 { 00237 readnumber( b, double, 128, atof ); // 00238 } 00239 else 00240 { 00241 writenumber( b, "%f", 128 ); 00242 } 00243 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 220 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, and writenumber.
00221 { 00222 if ( isReading() ) 00223 { 00224 readnumber( b, float, 128, atof ); // ? 00225 } 00226 else 00227 { 00228 writenumber( (double)b, "%f", 128 ); 00229 } 00230 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 207 of file string_stream.cpp. References NLMISC::IStream::isReading(), NL_I64, readnumber, sint64, and writenumber.
00208 { 00209 if ( isReading() ) 00210 { 00211 readnumber( b, sint64, 20, atoiInt64 ); // -9223372036854775808 00212 } 00213 else 00214 { 00215 writenumber( b, "%"NL_I64"d", 20 ); 00216 } 00217 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 194 of file string_stream.cpp. References NLMISC::IStream::isReading(), NL_I64, readnumber, uint64, and writenumber.
00195 { 00196 if ( isReading() ) 00197 { 00198 readnumber( b, uint64, 20, atoiInt64 ); // 18446744073709551615 00199 } 00200 else 00201 { 00202 writenumber( b, "%"NL_I64"u", 20 ); 00203 } 00204 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 181 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, sint32, and writenumber.
00182 { 00183 if ( isReading() ) 00184 { 00185 readnumber( b, sint32, 11, atoi ); // -2147483648 00186 } 00187 else 00188 { 00189 writenumber( b, "%d", 11 ); 00190 } 00191 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 168 of file string_stream.cpp. References NLMISC::atoui(), NLMISC::IStream::isReading(), readnumber, uint32, and writenumber.
00169 { 00170 if ( isReading() ) 00171 { 00172 readnumber( b, uint32, 10, atoui ); // 4294967295 00173 } 00174 else 00175 { 00176 writenumber( b, "%u", 10 ); 00177 } 00178 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 155 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, sint16, and writenumber.
00156 { 00157 if ( isReading() ) 00158 { 00159 readnumber( b, sint16, 6, atoi ); // -32768 00160 } 00161 else 00162 { 00163 writenumber( b, "%hd", 6 ); 00164 } 00165 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 141 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, uint16, and writenumber.
00142 { 00143 // No byte swapping in text mode 00144 if ( isReading() ) 00145 { 00146 readnumber( b, uint16, 5, atoi ); // 65535 00147 } 00148 else 00149 { 00150 writenumber( b, "%hu", 5 ); 00151 } 00152 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 128 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, sint16, sint8, and writenumber.
00129 { 00130 if ( isReading() ) 00131 { 00132 readnumber( b, sint8, 4, atoi ); // -128 00133 } 00134 else 00135 { 00136 writenumber( (sint16)b, "%hd", 4 ); 00137 } 00138 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 115 of file string_stream.cpp. References NLMISC::IStream::isReading(), readnumber, uint16, uint8, and writenumber.
00116 { 00117 if ( isReading() ) 00118 { 00119 readnumber( b, uint8, 3, atoi ); // 255 00120 } 00121 else 00122 { 00123 writenumber( (uint16)b,"%hu", 3 ); 00124 } 00125 } |
|
Reimplemented from NLMISC::CMemStream. Definition at line 97 of file string_stream.h. References serial().
|
|
Reimplemented from NLMISC::CMemStream. Definition at line 94 of file string_stream.h. References serial().
|
|
Reimplemented from NLMISC::CMemStream. Definition at line 91 of file string_stream.h. References serial().
|
|
Reimplemented from NLMISC::CMemStream. Definition at line 88 of file string_stream.h. References serial().
|
|
Reimplemented from NLMISC::CMemStream. Definition at line 85 of file string_stream.h. References serial().
|
|
Template serialisation (should take the one from IStream).
Reimplemented from NLMISC::CMemStream. Definition at line 67 of file string_stream.h. Referenced by serial(), serialBit(), and serialCont().
00067 { obj.serial(*this); }
|
|
Method inherited from IStream.
Reimplemented from NLMISC::CMemStream. Definition at line 253 of file string_stream.cpp. References NLMISC::IStream::isReading(), serial(), and uint8. Referenced by serial().
|
|
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 } |
|
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 } |
|
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 } |
|
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 serial(), NLNET::TMessageRecord::serial(), NLMISC::CMemStream::serial(), and NLNET::CMessage::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 } |
|
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 } |
|
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.
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 } |
|
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 340 of file string_stream.cpp. References NLMISC::contReset(), NLMISC::IStream::isReading(), len, serial(), sint, sint32, and v.
00341 { 00342 sint32 len=0; 00343 if(isReading()) 00344 { 00345 serial(len); 00346 // special version for vector: adjut good size. 00347 contReset(cont); 00348 cont.reserve(len); 00349 00350 for(sint i=0;i<len;i++) 00351 { 00352 bool v; 00353 serial(v); 00354 cont.insert(cont.end(), v); 00355 } 00356 } 00357 else 00358 { 00359 len= cont.size(); 00360 serial(len); 00361 00362 std::vector<bool>::iterator it= cont.begin(); 00363 for(sint i=0;i<len;i++, it++) 00364 { 00365 bool b = *it; 00366 serial( b ); 00367 } 00368 } 00369 } |
|
Specialisation of serialCont() for vector<sint8>.
Reimplemented from NLMISC::CMemStream. Definition at line 126 of file string_stream.h. References NLMISC::IStream::serialVector().
00126 { serialVector(cont); } |
|
Specialisation of serialCont() for vector<uint8>.
Reimplemented from NLMISC::CMemStream. Definition at line 124 of file string_stream.h. References NLMISC::IStream::serialVector().
00124 { serialVector(cont); } |
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 82 of file string_stream.h.
00082 {CMemStream::serialCont(cont);} |
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 80 of file string_stream.h.
00080 {CMemStream::serialCont(cont);} |
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 78 of file string_stream.h.
00078 {CMemStream::serialCont(cont);} |
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 76 of file string_stream.h.
00076 {CMemStream::serialCont(cont);} |
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 74 of file string_stream.h.
00074 {CMemStream::serialCont(cont);} |
|
Specialisation of serialCont() for vector<bool>.
Reimplemented from NLMISC::CMemStream. Definition at line 72 of file string_stream.h.
00072 {CMemStream::serialCont(cont);} |
|
Reimplemented from NLMISC::CMemStream. Definition at line 70 of file string_stream.h.
00070 {CMemStream::serialCont(cont);} |
|
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.
Definition at line 379 of file stream.h. References NLMISC::IStream::serialSTLContPolyPtr().
00379 {serialSTLContPolyPtr(cont);} |
|
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.
Definition at line 377 of file stream.h. References NLMISC::IStream::serialSTLContPolyPtr().
00377 {serialSTLContPolyPtr(cont);} |
|
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.
Definition at line 375 of file stream.h. References NLMISC::IStream::serialSTLContPolyPtr().
00375 {serialSTLContPolyPtr(cont);} |
|
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.
Definition at line 373 of file stream.h. References NLMISC::IStream::serialSTLContPolyPtr().
00373 {serialSTLContPolyPtr(cont);} |
|
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.
Definition at line 371 of file stream.h. References NLMISC::IStream::serialVectorPolyPtr(). Referenced by NL3D::CAnimation::serial().
00371 {serialVectorPolyPtr(cont);} |
|
Definition at line 362 of file stream.h. References NLMISC::IStream::serialSTLContPtr().
00362 {serialSTLContPtr(cont);} |
|
Definition at line 360 of file stream.h. References NLMISC::IStream::serialSTLContPtr().
00360 {serialSTLContPtr(cont);} |
|
Definition at line 358 of file stream.h. References NLMISC::IStream::serialSTLContPtr().
00358 {serialSTLContPtr(cont);} |
|
Definition at line 356 of file stream.h. References NLMISC::IStream::serialSTLContPtr().
00356 {serialSTLContPtr(cont);} |
|
Definition at line 354 of file stream.h. References NLMISC::IStream::serialVectorPtr(). Referenced by NL3D::CAnimationSet::serial().
00354 {serialVectorPtr(cont);} |
|
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().
|
|
Serialisation in hexadecimal.
Reimplemented from NLMISC::CMemStream. Definition at line 375 of file string_stream.cpp. References NLMISC::atoihex(), NLMISC::IStream::isReading(), readnumber, uint32, and writenumber.
00376 { 00377 if ( isReading() ) 00378 { 00379 readnumber( b, uint32, 10, atoihex ); // 4294967295 00380 } 00381 else 00382 { 00383 writenumber( b, "%x", 10 ); 00384 } 00385 } |
|
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 } |
|
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).
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);} |
|
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).
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 } |
|
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 from NLMISC::CMemStream. Definition at line 41 of file string_stream.cpp. References 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.
00042 { 00043 nlassert( isReading() ); 00044 00045 // Check that we don't read more than there is to read 00046 if ( ( _BufPos == _Buffer.end() ) || // we are at the end 00047 ( lengthS()+len+SEP_SIZE > length() ) && (_Buffer[_Buffer.size()-1] != SEPARATOR ) ) // we are before the end // calls virtual length (cf. sub messages) 00048 { 00049 throw EStreamOverflow(); 00050 } 00051 // Serialize in 00052 uint32 i = 0; 00053 while ( (i<len) && (*_BufPos) != SEPARATOR ) 00054 { 00055 *(buf+i) = *_BufPos; 00056 i++; 00057 _BufPos++; 00058 } 00059 // Exceeds len 00060 if ( (*_BufPos) != SEPARATOR ) 00061 { 00062 throw EStreamOverflow(); 00063 } 00064 _BufPos += SEP_SIZE; 00065 return i; 00066 } |
|
Output: writes len bytes from buf into the stream.
Reimplemented from NLMISC::CMemStream. Definition at line 71 of file string_stream.cpp. References NLMISC::IStream::isReading(), len, nlassert, NLMISC::CObjectVector< uint8, false >::resize(), NLMISC::SEP_SIZE, NLMISC::SEPARATOR, NLMISC::CObjectVector< uint8, false >::size(), uint, and uint8.
|
|
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 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 } |
|
|
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 } |
|
Set string mode.
Definition at line 113 of file mem_stream.h. References NLMISC::CMemStream::_StringMode. Referenced by NLNET::CMessage::init().
00113 { _StringMode = stringmode; } |
|
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.
Definition at line 71 of file stream.cpp. References NLMISC::IStream::_ThrowOnNewer, and NLMISC::IStream::_ThrowOnOlder.
00072 { 00073 _ThrowOnOlder=throwOnOlder; 00074 _ThrowOnNewer=throwOnNewer; 00075 } |
|
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 } |
|
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 } |
|
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; } |
|
xmlBreakLine() insert a break line in the XML stream.
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 } |
|
xmlBreakLine implementation
Reimplemented in NLMISC::COXml. Definition at line 845 of file stream.h. Referenced by NLMISC::IStream::xmlBreakLine().
00845 { return true; }; |
|
xmlComment() insert a comment line in the XML stream.
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 } |
|
xmlComment implementation
Reimplemented in NLMISC::COXml. Definition at line 848 of file stream.h. Referenced by NLMISC::IStream::xmlComment().
00848 { return true; }; |
|
xmlPop() close the node.
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 } |
|
xmlPop implementation
Reimplemented in NLMISC::COXml. Definition at line 839 of file stream.h. Referenced by NLMISC::IStream::xmlPop().
00839 { return true; }; |
|
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 } |
|
xmlBreakLine() insert a break line in the XML stream.
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 } |
|
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; }; |
|
xmlPushEnd() close the node header.
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 } |
|
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; }; |
|
Definition at line 683 of file stream.h. References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().
|
|
Definition at line 671 of file stream.h. References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().
|
|
Definition at line 659 of file stream.h. References NLMISC::IStream::serial(), NLMISC::IStream::xmlPop(), and NLMISC::IStream::xmlPush().
|
|
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().
|
|
xmlSetAttrib() set the name of the next node header attribute serialised. is the name of the node header attribute serialised.
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 } |
|
xmlBreakLine implementation
Reimplemented in NLMISC::COXml. Definition at line 842 of file stream.h. Referenced by NLMISC::IStream::xmlSetAttrib().
00842 { return true; }; |
|
Definition at line 516 of file mem_stream.h. Referenced by NLMISC::CMemStream::operator=(). |
|
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(). |
|
Definition at line 521 of file mem_stream.h. Referenced by NLMISC::CMemStream::clear(), NLMISC::CMemStream::CMemStream(), and NLMISC::CMemStream::operator=(). |
|
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(). |