open-dis-cpp
Public Member Functions | List of all members
DIS::DataStream Class Reference

a class to support managing a network buffer. More...

#include <DataStream.h>

Public Member Functions

 DataStream (Endian stream)
 Setup the internal buffer's Endian type. More...
 
 DataStream (const char *buffer, size_t length, Endian stream)
 Setup the internal buffer. More...
 
const char & operator[] (unsigned int offset) const
 a method for reading the stored buffer data. More...
 
void SetStream (const char *buffer, size_t length, Endian order)
 take ownership of the data buffer.
 
DataStreamoperator<< (bool c)
 
DataStreamoperator<< (char c)
 
DataStreamoperator<< (unsigned char c)
 
DataStreamoperator<< (float c)
 
DataStreamoperator<< (double c)
 
DataStreamoperator<< (int c)
 
DataStreamoperator<< (unsigned int c)
 
DataStreamoperator<< (long long c)
 
DataStreamoperator<< (unsigned long long c)
 
DataStreamoperator<< (unsigned short c)
 
DataStreamoperator<< (short c)
 
DataStreamoperator>> (bool &c)
 
DataStreamoperator>> (char &c)
 
DataStreamoperator>> (unsigned char &c)
 
DataStreamoperator>> (float &c)
 
DataStreamoperator>> (double &c)
 
DataStreamoperator>> (int &c)
 
DataStreamoperator>> (unsigned int &c)
 
DataStreamoperator>> (long long &c)
 
DataStreamoperator>> (unsigned long long &c)
 
DataStreamoperator>> (unsigned short &c)
 
DataStreamoperator>> (short &c)
 
Endian GetStreamEndian () const
 
Endian GetMachineEndian () const
 
size_t GetWritePos () const
 
size_t GetReadPos () const
 
size_t size () const
 
void clear ()
 
bool empty () const
 
 DataStream (Endian stream)
 Setup the internal buffer's Endian type. More...
 
 DataStream (const char *buffer, size_t length, Endian stream)
 Setup the internal buffer. More...
 
const char & operator[] (unsigned int offset) const
 a method for reading the stored buffer data. More...
 
void SetStream (const char *buffer, size_t length, Endian order)
 take ownership of the data buffer.
 
DataStreamoperator<< (bool c)
 
DataStreamoperator<< (char c)
 
DataStreamoperator<< (unsigned char c)
 
DataStreamoperator<< (float c)
 
DataStreamoperator<< (double c)
 
DataStreamoperator<< (int c)
 
DataStreamoperator<< (unsigned int c)
 
DataStreamoperator<< (long long c)
 
DataStreamoperator<< (unsigned long long c)
 
DataStreamoperator<< (unsigned short c)
 
DataStreamoperator<< (short c)
 
DataStreamoperator>> (bool &c)
 
DataStreamoperator>> (char &c)
 
DataStreamoperator>> (unsigned char &c)
 
DataStreamoperator>> (float &c)
 
DataStreamoperator>> (double &c)
 
DataStreamoperator>> (int &c)
 
DataStreamoperator>> (unsigned int &c)
 
DataStreamoperator>> (long long &c)
 
DataStreamoperator>> (unsigned long long &c)
 
DataStreamoperator>> (unsigned short &c)
 
DataStreamoperator>> (short &c)
 
Endian GetStreamEndian () const
 
Endian GetMachineEndian () const
 
size_t GetWritePos () const
 
size_t GetReadPos () const
 
size_t size () const
 
void clear ()
 
bool empty () const
 

Detailed Description

a class to support managing a network buffer.

the clients are responsible for managing the char buffer memory. this class explicitly defines operators for expected types.

Constructor & Destructor Documentation

◆ DataStream() [1/4]

DataStream::DataStream ( Endian  stream)

Setup the internal buffer's Endian type.

Parameters
streamthe Endian type to use for the internal buffer, which will be used for network socket writes.

◆ DataStream() [2/4]

DataStream::DataStream ( const char *  buffer,
size_t  length,
Endian  stream 
)

Setup the internal buffer.

Parameters
bufferthe data to copy and manage.
lengththe number of bytes in the buffer.
streamthe Endian type to use for the internal buffer,

◆ DataStream() [3/4]

DIS::DataStream::DataStream ( Endian  stream)

Setup the internal buffer's Endian type.

Parameters
streamthe Endian type to use for the internal buffer, which will be used for network socket writes.

◆ DataStream() [4/4]

DIS::DataStream::DataStream ( const char *  buffer,
size_t  length,
Endian  stream 
)

Setup the internal buffer.

Parameters
bufferthe data to copy and manage.
lengththe number of bytes in the buffer.
streamthe Endian type to use for the internal buffer,

Member Function Documentation

◆ operator[]() [1/2]

const char& DIS::DataStream::operator[] ( unsigned int  offset) const

a method for reading the stored buffer data.

Parameters
offsetthe index distance with respect to the current read point.

◆ operator[]() [2/2]

const char & DataStream::operator[] ( unsigned int  offset) const

a method for reading the stored buffer data.

Parameters
offsetthe index distance with respect to the current read point.

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