|
|
|
|
Documentation |
|
Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages Search
NLMISC::CMemStream Class ReferenceMemStream memory stream (see also NLNET::CMessage).
More...
#include <mem_stream.h>
Inheritance diagram for NLMISC::CMemStream:
List of all members.
Public Methods |
| CMemStream (bool inputStream=false, bool stringmode=false, uint32 defaultcapacity=0) |
| Initialization constructor. More...
|
| CMemStream (const CMemStream &other) |
| Copy constructor. More...
|
CMemStream & | operator= (const CMemStream &other) |
| Assignment operator. More...
|
void | setStringMode (bool stringmode) |
| Set string mode. More...
|
bool | stringMode () const |
| Return string mode. More...
|
virtual void | serialBuffer (uint8 *buf, uint len) |
| Method inherited from IStream. More...
|
virtual void | serialBit (bool &bit) |
| Method inherited from IStream. More...
|
virtual bool | seek (sint32 offset, TSeekOrigin origin) throw (EStream) |
| Moves the stream pointer to a specified location. More...
|
virtual sint32 | getPos () throw (EStream) |
| Get the location of the stream pointer. More...
|
virtual void | clear () |
| Clears the message. More...
|
virtual uint32 | length () const |
| Returns the length (size) of the message, in bytes. More...
|
const uint8 * | buffer () const |
| Returns a pointer to the message buffer (read only) Returns NULL if the buffer is empty. More...
|
void | resetBufPos () |
void | fill (const uint8 *srcbuf, uint32 len) |
| Fills the message buffer, for reading. More...
|
void | resize (uint32 size) |
uint8 * | bufferToFill (uint32 msgsize) |
| EXPERIMENTAL: Returns a pointer to the message buffer for filling by an external function (use at your own risk, you MUST fill the number of bytes you specify in "msgsize"). More...
|
virtual void | invert () |
| Transforms the message from input to output or from output to input. More...
|
void | resetPtrTable () |
| Force to reset the ptr table. More...
|
void | increaseBufferIfNecessary (uint32 len) |
| Increase the buffer size if 'len' can't enter, otherwise, do nothing. More...
|
template<class T> void | fastSerial (T &val) |
template<class T> void | fastWrite (T &value) |
template<class T> void | fastRead (T &value) |
template<class T> void | serial (T &obj) |
| Template serialisation (should take the one from IStream). More...
|
template<class T> void | serialCont (std::vector< T > &cont) |
template<class T> void | serialCont (std::list< T > &cont) |
template<class T> void | serialCont (std::deque< T > &cont) |
template<class T> void | serialCont (std::set< T > &cont) |
template<class T> void | serialCont (std::multiset< T > &cont) |
template<class K, class T> void | serialCont (std::map< K, T > &cont) |
template<class K, class T> void | serialCont (std::multimap< K, T > &cont) |
virtual void | serialCont (std::vector< uint8 > &cont) |
| Specialisation of serialCont() for vector<uint8>. More...
|
virtual void | serialCont (std::vector< sint8 > &cont) |
| Specialisation of serialCont() for vector<sint8>. More...
|
virtual void | serialCont (std::vector< bool > &cont) |
| Specialisation of serialCont() for vector<bool>. More...
|
template<class T0, class T1> void | serial (T0 &a, T1 &b) |
template<class T0, class T1, class T2> void | serial (T0 &a, T1 &b, T2 &c) |
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, 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, class T4, class T5> void | serial (T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f) |
|
Those method are a specialisation of template method "void serial(T&)".
|
virtual void | serial (uint8 &b) |
virtual void | serial (sint8 &b) |
virtual void | serial (uint16 &b) |
virtual void | serial (sint16 &b) |
virtual void | serial (uint32 &b) |
virtual void | serial (sint32 &b) |
virtual void | serial (uint64 &b) |
virtual void | serial (sint64 &b) |
virtual void | serial (float &b) |
virtual void | serial (double &b) |
virtual void | serial (bool &b) |
virtual void | serial (char &b) |
virtual void | serial (std::string &b) |
virtual void | serial (ucstring &b) |
|
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. More...
|
void | serialSeparatedBufferOut (uint8 *buf, uint len) |
| Output: writes len bytes from buf into the stream. More...
|
virtual void | serialHex (uint32 &b) |
| Serialisation in hexadecimal. More...
|
Protected Methods |
uint32 | lengthS () const |
| Returns the serialized length (number of bytes written or read). More...
|
uint32 | lengthR () const |
| Returns the "read" message size (number of bytes to read). More...
|
Protected Attributes |
CObjectVector< uint8, false > | _Buffer |
uint8 * | _BufPos |
bool | _StringMode |
uint32 | _DefaultCapacity |
Detailed Description
MemStream memory stream (see also NLNET::CMessage).
-
Author:
-
Olivier Cado , Nevrax France
-
Date:
-
2000
Definition at line 64 of file mem_stream.h.
Constructor & Destructor Documentation
NLMISC::CMemStream::CMemStream |
( |
bool |
inputStream = false, |
|
|
bool |
stringmode = false, |
|
|
uint32 |
defaultcapacity = 0 |
|
) |
[inline] |
|
NLMISC::CMemStream::CMemStream |
( |
const CMemStream & |
other |
) |
[inline] |
|
Member Function Documentation
const uint8* NLMISC::CMemStream::buffer |
( |
|
) |
const [inline] |
|
uint8* NLMISC::CMemStream::bufferToFill |
( |
uint32 |
msgsize |
) |
[inline] |
|
|
EXPERIMENTAL: Returns a pointer to the message buffer for filling by an external function (use at your own risk, you MUST fill the number of bytes you specify in "msgsize").
This method prevents from doing one useless buffer copy, using fill().
Definition at line 218 of file mem_stream.h.
References _Buffer, and _BufPos. |
virtual void NLMISC::CMemStream::clear |
( |
|
) |
[inline, virtual] |
|
template<class T> |
void NLMISC::CMemStream::fastRead |
( |
T & |
value |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::fastSerial |
( |
T & |
val |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::fastWrite |
( |
T & |
value |
) |
[inline] |
|
void NLMISC::CMemStream::fill |
( |
const uint8 * |
srcbuf, |
|
|
uint32 |
len |
|
) |
[inline] |
|
virtual sint32 NLMISC::CMemStream::getPos |
( |
|
) |
throw (EStream) [inline, virtual] |
|
void NLMISC::CMemStream::increaseBufferIfNecessary |
( |
uint32 |
len |
) |
[inline] |
|
virtual void NLMISC::CMemStream::invert |
( |
|
) |
[inline, virtual] |
|
virtual uint32 NLMISC::CMemStream::length |
( |
|
) |
const [inline, virtual] |
|
|
Returns the length (size) of the message, in bytes.
If isReading(), it is the number of bytes that can be read, otherwise it is the number of bytes that have been written.
Reimplemented in NLMISC::CBitMemStream.
Definition at line 152 of file mem_stream.h.
References NLMISC::IStream::isReading, lengthR, and lengthS.
Referenced by NLMISC::CBufFIFO::push, NLNET::CBufSock::pushBuffer, NLNET::CBufServer::pushBufferToHost, NLNET::CBufClient::receive, resize, NLNET::CBufClient::send, and NLNET::CMessage::setType. |
uint32 NLMISC::CMemStream::lengthR |
( |
|
) |
const [inline, protected] |
|
uint32 NLMISC::CMemStream::lengthS |
( |
|
) |
const [inline, protected] |
|
CMemStream& NLMISC::CMemStream::operator= |
( |
const CMemStream & |
other |
) |
[inline] |
|
void NLMISC::CMemStream::resetBufPos |
( |
|
) |
[inline] |
|
void NLMISC::CMemStream::resetPtrTable |
( |
|
) |
[inline] |
|
void NLMISC::CMemStream::resize |
( |
uint32 |
size |
) |
|
|
void NLMISC::CMemStream::serial |
( |
ucstring & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
std::string & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
char & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
bool & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
double & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
float & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
sint64 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
uint64 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
sint32 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
uint32 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
sint16 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
uint16 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
sint8 & |
b |
) |
[inline, virtual] |
|
void NLMISC::CMemStream::serial |
( |
uint8 & |
b |
) |
[inline, virtual] |
|
template<class T0, class T1, class T2, class T3, class T4, class T5> |
void NLMISC::CMemStream::serial |
( |
T0 & |
a, |
|
|
T1 & |
b, |
|
|
T2 & |
c, |
|
|
T3 & |
d, |
|
|
T4 & |
e, |
|
|
T5 & |
f |
|
) |
[inline] |
|
template<class T0, class T1, class T2, class T3, class T4> |
void NLMISC::CMemStream::serial |
( |
T0 & |
a, |
|
|
T1 & |
b, |
|
|
T2 & |
c, |
|
|
T3 & |
d, |
|
|
T4 & |
e |
|
) |
[inline] |
|
template<class T0, class T1, class T2, class T3> |
void NLMISC::CMemStream::serial |
( |
T0 & |
a, |
|
|
T1 & |
b, |
|
|
T2 & |
c, |
|
|
T3 & |
d |
|
) |
[inline] |
|
template<class T0, class T1, class T2> |
void NLMISC::CMemStream::serial |
( |
T0 & |
a, |
|
|
T1 & |
b, |
|
|
T2 & |
c |
|
) |
[inline] |
|
template<class T0, class T1> |
void NLMISC::CMemStream::serial |
( |
T0 & |
a, |
|
|
T1 & |
b |
|
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::serial |
( |
T & |
obj |
) |
[inline] |
|
void NLMISC::CMemStream::serialBit |
( |
bool & |
bit |
) |
[virtual] |
|
void NLMISC::CMemStream::serialBuffer |
( |
uint8 * |
buf, |
|
|
uint |
len |
|
) |
[virtual] |
|
virtual void NLMISC::CMemStream::serialCont |
( |
std::vector< bool > & |
cont |
) |
[inline, virtual] |
|
virtual void NLMISC::CMemStream::serialCont |
( |
std::vector< sint8 > & |
cont |
) |
[inline, virtual] |
|
virtual void NLMISC::CMemStream::serialCont |
( |
std::vector< uint8 > & |
cont |
) |
[inline, virtual] |
|
template<class K, class T> |
void NLMISC::CMemStream::serialCont |
( |
std::multimap< K, T > & |
cont |
) |
[inline] |
|
template<class K, class T> |
void NLMISC::CMemStream::serialCont |
( |
std::map< K, T > & |
cont |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::serialCont |
( |
std::multiset< T > & |
cont |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::serialCont |
( |
std::set< T > & |
cont |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::serialCont |
( |
std::deque< T > & |
cont |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::serialCont |
( |
std::list< T > & |
cont |
) |
[inline] |
|
template<class T> |
void NLMISC::CMemStream::serialCont |
( |
std::vector< T > & |
cont |
) |
[inline] |
|
void NLMISC::CMemStream::serialHex |
( |
uint32 & |
b |
) |
[inline, virtual] |
|
uint NLMISC::CMemStream::serialSeparatedBufferIn |
( |
uint8 * |
buf, |
|
|
uint |
len |
|
) |
|
|
void NLMISC::CMemStream::serialSeparatedBufferOut |
( |
uint8 * |
buf, |
|
|
uint |
len |
|
) |
|
|
void NLMISC::CMemStream::setStringMode |
( |
bool |
stringmode |
) |
[inline] |
|
bool NLMISC::CMemStream::stringMode |
( |
|
) |
const [inline] |
|
Member Data Documentation
|
Definition at line 411 of file mem_stream.h.
Referenced by buffer, bufferToFill, clear, CMemStream, fill, getPos, NLMISC::CBitMemStream::getPosInBit, increaseBufferIfNecessary, invert, NLMISC::CBitMemStream::length, lengthR, lengthS, operator=, resetBufPos, resize, NLMISC::CBitMemStream::serial, NLMISC::CStringStream::serialSeparatedBufferIn, serialSeparatedBufferIn, NLMISC::CStringStream::serialSeparatedBufferOut, and serialSeparatedBufferOut. |
uint8* NLMISC::CMemStream::_BufPos [protected]
|
|
|
Definition at line 412 of file mem_stream.h.
Referenced by bufferToFill, NLMISC::CBitMemStream::CBitMemStream, clear, NLMISC::CBitMemStream::clear, CMemStream, fastRead, fastSerial, fastWrite, fill, getPos, NLMISC::CBitMemStream::getPosInBit, increaseBufferIfNecessary, invert, NLMISC::CBitMemStream::invert, NLMISC::CBitMemStream::length, lengthS, operator=, resetBufPos, resize, NLMISC::CBitMemStream::serial, serialBuffer, NLMISC::CStringStream::serialSeparatedBufferIn, serialSeparatedBufferIn, NLMISC::CStringStream::serialSeparatedBufferOut, and serialSeparatedBufferOut. |
uint32 NLMISC::CMemStream::_DefaultCapacity [protected]
|
|
bool NLMISC::CMemStream::_StringMode [protected]
|
|
The documentation for this class was generated from the following files:
|
|