VR-Engage  2.2
Loading...
Searching...
No Matches
makRadarFx::DtStreamReader Class Reference

Detailed Description

This class reads and decodes various data types from a byte array, assuming the data in the byte stream is in little endian format. It provides methods for reading primitive types as well as common complex data structures.

#include <byteStream.h>

Inheritance diagram for makRadarFx::DtStreamReader:
[legend]

Public Member Functions

 DtStreamReader (unsigned char *buffer, int length, bool makeCopy=false)
 
virtual ~DtStreamReader ()
 

Value Reading Methods

Each method reads a value and advances the read position

unsigned char * myBuffer
 
unsigned char * myReadHead
 
int myLength
 
bool myShouldDelete
 
virtual bool readBool ()
 
virtual char readInt8 ()
 
virtual unsigned char readUInt8 ()
 
virtual short readInt16 ()
 
virtual unsigned short readUInt16 ()
 
virtual int readInt32 ()
 
virtual unsigned readUInt32 ()
 
virtual long long readInt64 ()
 
virtual unsigned long long readUInt64 ()
 
virtual float readSingle ()
 
virtual double readDouble ()
 
virtual std::string readString ()
 
virtual DtVector readVector ()
 
virtual DtTaitBryan readTaitBryan ()
 
DtQuaternion readQuaternion ()
 
DtEntityIdentifier readEntityId ()
 
DtEntityType readEntityType ()
 
unsigned char * readBytes (int length)
 
virtual void readBytes (unsigned char *buffer, int length)
 
int decodeStringSize ()
 

Constructor & Destructor Documentation

◆ DtStreamReader()

makRadarFx::DtStreamReader::DtStreamReader ( unsigned char * buffer,
int length,
bool makeCopy = false )

Constructor for stream reader.

Parameters
bufferPointer to the input byte array
lengthLength of the input buffer in bytes
makeCopyWhether to make a copy of the buffer (true) or use the original (false)

Creates a new stream reader to work with the provided buffer

◆ ~DtStreamReader()

virtual makRadarFx::DtStreamReader::~DtStreamReader ( )
virtual

Virtual destructor.

Cleans up resources, including the buffer if it was copied

Member Function Documentation

◆ readBool()

virtual bool makRadarFx::DtStreamReader::readBool ( )
virtual

Reads a boolean value.

Returns
The boolean value read from the stream

◆ readInt8()

virtual char makRadarFx::DtStreamReader::readInt8 ( )
virtual

Reads an 8-bit signed integer.

Returns
The 8-bit signed integer value read from the stream

◆ readUInt8()

virtual unsigned char makRadarFx::DtStreamReader::readUInt8 ( )
virtual

Reads an 8-bit unsigned integer.

Returns
The 8-bit unsigned integer value read from the stream

◆ readInt16()

virtual short makRadarFx::DtStreamReader::readInt16 ( )
virtual

Reads a 16-bit signed integer.

Returns
The 16-bit signed integer value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readUInt16()

virtual unsigned short makRadarFx::DtStreamReader::readUInt16 ( )
virtual

Reads a 16-bit unsigned integer.

Returns
The 16-bit unsigned integer value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readInt32()

virtual int makRadarFx::DtStreamReader::readInt32 ( )
virtual

Reads a 32-bit signed integer.

Returns
The 32-bit signed integer value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readUInt32()

virtual unsigned makRadarFx::DtStreamReader::readUInt32 ( )
virtual

Reads a 32-bit unsigned integer.

Returns
The 32-bit unsigned integer value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readInt64()

virtual long long makRadarFx::DtStreamReader::readInt64 ( )
virtual

Reads a 64-bit signed integer.

Returns
The 64-bit signed integer value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readUInt64()

virtual unsigned long long makRadarFx::DtStreamReader::readUInt64 ( )
virtual

Reads a 64-bit unsigned integer.

Returns
The 64-bit unsigned integer value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readSingle()

virtual float makRadarFx::DtStreamReader::readSingle ( )
virtual

Reads a 32-bit floating point value.

Returns
The 32-bit float value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readDouble()

virtual double makRadarFx::DtStreamReader::readDouble ( )
virtual

Reads a 64-bit floating point value.

Returns
The 64-bit double value read from the stream

Reimplemented in makRadarFx::DtBigEndianStreamReader.

◆ readString()

virtual std::string makRadarFx::DtStreamReader::readString ( )
virtual

Reads a string.

Returns
The string value read from the stream

◆ readVector()

virtual DtVector makRadarFx::DtStreamReader::readVector ( )
virtual

Reads a 3D vector.

Returns
The vector value read from the stream

◆ readTaitBryan()

virtual DtTaitBryan makRadarFx::DtStreamReader::readTaitBryan ( )
virtual

Reads a Tait-Bryan angle set.

Returns
The Tait-Bryan angles read from the stream

◆ readQuaternion()

DtQuaternion makRadarFx::DtStreamReader::readQuaternion ( )

Reads a quaternion.

Returns
The quaternion value read from the stream

◆ readEntityId()

DtEntityIdentifier makRadarFx::DtStreamReader::readEntityId ( )

Reads an entity identifier.

Returns
The entity identifier read from the stream

◆ readEntityType()

DtEntityType makRadarFx::DtStreamReader::readEntityType ( )

Reads an entity type.

Returns
The entity type read from the stream

◆ readBytes() [1/2]

unsigned char * makRadarFx::DtStreamReader::readBytes ( int length)

Allocates and reads bytes into a new buffer.

Parameters
lengthNumber of bytes to read
Returns
Pointer to a newly allocated buffer containing the read bytes

This method allocates a new byte array and copies data into it

◆ readBytes() [2/2]

virtual void makRadarFx::DtStreamReader::readBytes ( unsigned char * buffer,
int length )
virtual

Reads bytes into a supplied buffer.

Parameters
bufferPointer to the destination buffer
lengthNumber of bytes to read

This reads from the byte stream into a supplied buffer

◆ decodeStringSize()

int makRadarFx::DtStreamReader::decodeStringSize ( )
protected

Determines the size of a string from a variable length encoded integer.

Returns
The decoded size of the following string

Member Data Documentation

◆ myBuffer

unsigned char* makRadarFx::DtStreamReader::myBuffer
protected

Pointer to the beginning of the buffer.

◆ myReadHead

unsigned char* makRadarFx::DtStreamReader::myReadHead
protected

Current read position within the buffer.

◆ myLength

int makRadarFx::DtStreamReader::myLength
protected

Total length of the buffer in bytes.

◆ myShouldDelete

bool makRadarFx::DtStreamReader::myShouldDelete
protected

Flag indicating if the buffer should be deleted on destruction.


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