|
VR-Engage
2.2
|
This class provides methods for writing various data types to a byte stream, maintaining the current write position, and handling platform-specific byte ordering.
#include <byteStream.h>
Public Member Functions | |
| DtStreamWriter (int length=0) | |
| DtStreamWriter (char *buffer, int length) | |
| virtual | ~DtStreamWriter () |
Buffer Access | |
Methods to access the internal buffer | |
| char * | buffer () |
| int | length () |
Value Writers | |
Methods to write values to the byte stream These methods write a value and increment the current position in the byte stream based on the size of the value written. | |
| char * | myBuffer |
| char * | myWriteHead |
| int | myLength |
| bool | myShouldDelete |
| void | writeBool (bool b) |
| void | writeInt8 (char num) |
| void | writeUInt8 (unsigned char num) |
| void | writeInt16 (short num) |
| void | writeUInt16 (unsigned short num) |
| void | writeInt32 (int num) |
| void | writeUInt32 (unsigned int num) |
| void | writeInt64 (Int64 num) |
| void | writeUInt64 (UInt64 num) |
| void | writeSingle (float num) |
| void | writeDouble (double num) |
| void | writeString (const std::string &str) |
| void | writeVector (const DtVector &vec) |
| void | writeTaitBryan (const DtTaitBryan &tb) |
| void | writeQuaternion (const DtQuaternion &q) |
| void | writeEntityId (const DtEntityIdentifier &id) |
| void | writeSimulationAddress (const DtSimulationAddress &addr) |
| void | writeEntityType (const DtEntityType &type) |
| void | writeBytes (char *bytes, int length) |
| void | encodeStringSize (int size) |
| makVre::DtStreamWriter::DtStreamWriter | ( | int | length = 0 | ) |
Constructor that creates an internal buffer.
| length | Size of internal buffer to create (in bytes) |
References length().
| makVre::DtStreamWriter::DtStreamWriter | ( | char * | buffer, |
| int | length ) |
|
virtual |
Virtual destructor.
Cleans up resources, including the buffer if it was created internally
| char * makVre::DtStreamWriter::buffer | ( | ) |
| int makVre::DtStreamWriter::length | ( | ) |
Gets the current length of data in the buffer.
Referenced by DtStreamWriter(), DtStreamWriter(), and writeBytes().
| void makVre::DtStreamWriter::writeBool | ( | bool | b | ) |
Writes a boolean value.
| b | The boolean value to write |
| void makVre::DtStreamWriter::writeInt8 | ( | char | num | ) |
Writes a signed 8-bit integer.
| num | The signed 8-bit integer to write |
| void makVre::DtStreamWriter::writeUInt8 | ( | unsigned char | num | ) |
Writes an unsigned 8-bit integer.
| num | The unsigned 8-bit integer to write |
| void makVre::DtStreamWriter::writeInt16 | ( | short | num | ) |
Writes a signed 16-bit integer.
| num | The signed 16-bit integer to write |
| void makVre::DtStreamWriter::writeUInt16 | ( | unsigned short | num | ) |
Writes an unsigned 16-bit integer.
| num | The unsigned 16-bit integer to write |
| void makVre::DtStreamWriter::writeInt32 | ( | int | num | ) |
Writes a signed 32-bit integer.
| num | The signed 32-bit integer to write |
| void makVre::DtStreamWriter::writeUInt32 | ( | unsigned int | num | ) |
Writes an unsigned 32-bit integer.
| num | The unsigned 32-bit integer to write |
| void makVre::DtStreamWriter::writeInt64 | ( | Int64 | num | ) |
Writes a signed 64-bit integer.
| num | The signed 64-bit integer to write |
| void makVre::DtStreamWriter::writeUInt64 | ( | UInt64 | num | ) |
Writes an unsigned 64-bit integer.
| num | The unsigned 64-bit integer to write |
| void makVre::DtStreamWriter::writeSingle | ( | float | num | ) |
Writes a 32-bit floating point value.
| num | The 32-bit float to write |
| void makVre::DtStreamWriter::writeDouble | ( | double | num | ) |
Writes a 64-bit floating point value.
| num | The 64-bit double to write |
| void makVre::DtStreamWriter::writeString | ( | const std::string & | str | ) |
Writes a string value.
| str | The string to write |
| void makVre::DtStreamWriter::writeVector | ( | const DtVector & | vec | ) |
Writes a 3D vector.
| vec | The vector to write |
| void makVre::DtStreamWriter::writeTaitBryan | ( | const DtTaitBryan & | tb | ) |
Writes a Tait-Bryan angles representation.
| tb | The Tait-Bryan angles to write |
| void makVre::DtStreamWriter::writeQuaternion | ( | const DtQuaternion & | q | ) |
Writes a quaternion.
| q | The quaternion to write |
| void makVre::DtStreamWriter::writeEntityId | ( | const DtEntityIdentifier & | id | ) |
Writes an entity identifier.
| id | The entity identifier to write |
| void makVre::DtStreamWriter::writeSimulationAddress | ( | const DtSimulationAddress & | addr | ) |
Writes a simulation address.
| addr | The simulation address to write |
| void makVre::DtStreamWriter::writeEntityType | ( | const DtEntityType & | type | ) |
Writes an entity type.
| type | The entity type to write |
| void makVre::DtStreamWriter::writeBytes | ( | char * | bytes, |
| int | length ) |
Writes a byte array.
| bytes | Pointer to the bytes to write |
| length | Number of bytes to write |
References length().
|
protected |
Encodes the size of a string as a variable length integer.
| size | The size to encode |
|
protected |
Pointer to the buffer being written to.
|
protected |
Current position in the buffer.
|
protected |
Total length of the buffer.
|
protected |
Flag indicating if the buffer should be deleted on destruction.