|
VR-Engage
2.2
|
This class writes and encodes various data types into a byte array in little endian format. It provides methods for writing primitive types as well as common complex data structures.
#include <byteStream.h>
Public Member Functions | |
| DtStreamWriter (int length) | |
| DtStreamWriter (unsigned char *buffer, int length) | |
| virtual | ~DtStreamWriter () |
Buffer Access Methods | |
| virtual unsigned char * | buffer () |
| virtual int | length () |
Value Writing Methods | |
Each method writes a value and advances the write position | |
| unsigned char * | myBuffer |
| unsigned char * | myWriteHead |
| int | myLength |
| bool | myShouldDelete |
| virtual void | writeBool (bool b) |
| virtual void | writeInt8 (char num) |
| virtual void | writeUInt8 (unsigned char num) |
| virtual void | writeInt16 (short num) |
| virtual void | writeUInt16 (unsigned short num) |
| virtual void | writeInt32 (int num) |
| virtual void | writeUInt32 (unsigned int num) |
| virtual void | writeInt64 (long long num) |
| virtual void | writeUInt64 (unsigned long long num) |
| virtual void | writeSingle (float num) |
| virtual void | writeDouble (double num) |
| virtual void | writeString (std::string &str) |
| virtual void | writeVector (DtVector &vec) |
| virtual void | writeTaitBryan (DtTaitBryan &tb) |
| virtual void | writeQuaternion (const DtQuaternion &q) |
| virtual void | writeEntityId (const DtEntityIdentifier &id) |
| virtual void | writeEntityType (const DtEntityType &type) |
| virtual void | writeBytes (unsigned char *buffer, int length) |
| void | encodeStringSize (int size) |
| makRadarFx::DtStreamWriter::DtStreamWriter | ( | int | length | ) |
Constructor that creates an internal buffer.
| length | Size of the internal buffer to create |
Creates a new stream writer with an internal buffer of the specified size. Care must be taken to allocate enough space for all the intended writes.
References length().
| makRadarFx::DtStreamWriter::DtStreamWriter | ( | unsigned char * | buffer, |
| int | length ) |
|
virtual |
Virtual destructor.
Cleans up resources, including the buffer if it was allocated internally
|
virtual |
Gets a pointer to the internal buffer.
Referenced by makRadarFx::DtBigEndianStreamWriter::DtBigEndianStreamWriter(), DtStreamWriter(), and writeBytes().
|
virtual |
Gets the current write position as a length.
Referenced by makRadarFx::DtBigEndianStreamWriter::DtBigEndianStreamWriter(), makRadarFx::DtBigEndianStreamWriter::DtBigEndianStreamWriter(), DtStreamWriter(), DtStreamWriter(), and writeBytes().
|
virtual |
Writes a boolean value.
| b | Boolean value to write |
|
virtual |
Writes an 8-bit signed integer.
| num | Value to write |
|
virtual |
Writes an 8-bit unsigned integer.
| num | Value to write |
|
virtual |
Writes a 16-bit signed integer.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 16-bit unsigned integer.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 32-bit signed integer.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 32-bit unsigned integer.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 64-bit signed integer.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 64-bit unsigned integer.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 32-bit floating point value.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a 64-bit floating point value.
| num | Value to write |
Reimplemented in makRadarFx::DtBigEndianStreamWriter.
|
virtual |
Writes a string.
| str | String value to write |
|
virtual |
Writes a 3D vector.
| vec | Vector to write |
|
virtual |
Writes a Tait-Bryan angle set.
| tb | Tait-Bryan angles to write |
|
virtual |
Writes a quaternion.
| q | Quaternion to write |
|
virtual |
Writes an entity identifier.
| id | Entity identifier to write |
|
virtual |
Writes an entity type.
| type | Entity type to write |
|
virtual |
|
protected |
Encodes the size of the string as a variable length integer.
| size | Size to encode |
|
protected |
Pointer to the beginning of the buffer.
|
protected |
Current write position within the buffer.
|
protected |
Total length of the buffer in bytes.
|
protected |
Flag indicating if the buffer should be deleted on destruction.