Om
1.0.0
A universal framework for multimedia simulation
|
A class that handles decoding of standard types from binary data. More...
#include <omBinaryDecoder.h>
Public Member Functions | |
BinaryDecoder () | |
Create a new binary decoder that uses the native endianness for primitive types. More... | |
const BinaryFormat & | getFormat () const |
Return a reference to the binary format this decoder is using. More... | |
void | setFormat (const BinaryFormat &newFormat) |
Set the binary format this decoder is using. More... | |
Size | getDataSize () const |
Return the total size of the decoder's data source in bytes. More... | |
void | setData (const UByte *newData, Size dataSizeInBytes) |
Set a pointer to an external data source that should be read with this decoder. More... | |
void | pad (const UByte *&data) |
Pad the alignment of the specified pointer to the next aligned object boundary. More... | |
Bool | read (Bool &value) |
Read a boolean from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (Int8 &value) |
Read a signed 8-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (UInt8 &value) |
Read an unsigned 8-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (Int16 &value) |
Read a signed 16-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (UInt16 &value) |
Read an unsigned 16-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (Int32 &value) |
Read a signed 32-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (UInt32 &value) |
Read an unsigned 32-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (Int64 &value) |
Read a signed 64-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (UInt64 &value) |
Read an unsigned 64-bit integer from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (lang::Float16 &value) |
Read a 16-bit float from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (Float32 &value) |
Read a 32-bit float from the data pointer into the output value parameter and advance the pointer. More... | |
Bool | read (Float64 &value) |
Read a 64-bit float from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::Complex< T > &value) |
Read a 2D vector of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::VectorND< T, 2 > &value) |
Read a 2D vector of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::VectorND< T, 3 > &value) |
Read a 3D vector of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::VectorND< T, 4 > &value) |
Read a 4D vector of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::MatrixND< T, 2, 2 > &value) |
Read a 2x2 matrix of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::MatrixND< T, 3, 3 > &value) |
Read a 3x3 matrix of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::MatrixND< T, 4, 4 > &value) |
Read a 4x4 matrix of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::Transform3D< T > &value) |
Read a 3x3 matrix of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::AABB1D< T > &value) |
Read a 1D range of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::AABB2D< T > &value) |
Read a 2D range of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
Bool | read (math::AABB3D< T > &value) |
Read a 3D range of the templated type from the data pointer into the output value parameter and advance the pointer. More... | |
template<typename T > | |
void | readArray (T *array, Size number) |
Read an array of values of the templated type and advance the data pointer. More... | |
data::String | readASCIIString () |
Read an ASCII encoded string starting at the specified data pointer and return it and advance the pointer. More... | |
data::UTF8String | readUTF8String () |
Read a UTF-8 encoded string starting at the specified data pointer and return it and advance the pointer. More... | |
data::UTF16String | readUTF16String () |
Read a UTF-16 encoded string starting at the specified data pointer and return it and advance the pointer. More... | |
data::UTF32String | readUTF32String () |
Read a UTF-32 encoded string starting at the specified data pointer and return it and advance the pointer. More... | |
Bool | read (UByte *newData, Size number) |
Read the specified number of bytes of data into the buffer. More... | |
virtual Size | readData (UByte *buffer, Size number) |
Read the specified number of bytes from the stream and place them in the buffer given by a pointer. More... | |
virtual Bool | canSeek () const |
Return whether or not this type of stream allows seeking. More... | |
virtual Bool | canSeek (Int64 relativeOffset) const |
Return whether or not this stream can seek by the specified amount in bytes. More... | |
virtual Int64 | seek (Int64 relativeOffset) |
Move the current position in the stream by the specified relative signed offset in bytes. More... | |
virtual LargeSize | getBytesRemaining () const |
Return the number of bytes remaining in the stream. More... | |
virtual LargeIndex | getPosition () const |
Return the current byte index within the stream relative to the beginning. More... | |
Public Member Functions inherited from om::io::DataInputStream | |
virtual | ~DataInputStream () |
Destroy an input stream and free all of it's resources (close it). More... | |
Size | readData (data::DataBuffer &buffer, Size numBytes) |
Read the specified number of bytes from the stream and place them in the specified data buffer. More... | |
data::Data | readAllData () |
Read as many bytes from the stream as possible and return them in a Data object. More... | |
Size | readAllData (data::DataBuffer &buffer) |
Read as many bytes from the stream as possible and place them in the specified data buffer. More... | |
Bool | hasBytesRemaining () const |
Return whether or not there are bytes remaining in the stream. More... | |
A class that handles decoding of standard types from binary data.
om::io::BinaryDecoder::BinaryDecoder | ( | ) |
Create a new binary decoder that uses the native endianness for primitive types.
|
inline |
Return a reference to the binary format this decoder is using.
|
inline |
Set the binary format this decoder is using.
|
inline |
Return the total size of the decoder's data source in bytes.
Set a pointer to an external data source that should be read with this decoder.
This function prepares the decoder for reading from an external data source. When the decoder reaches the end of the data, it cannot read any further.
|
inline |
Pad the alignment of the specified pointer to the next aligned object boundary.
Read a boolean from the data pointer into the output value parameter and advance the pointer.
Read a signed 8-bit integer from the data pointer into the output value parameter and advance the pointer.
Read an unsigned 8-bit integer from the data pointer into the output value parameter and advance the pointer.
Read a signed 16-bit integer from the data pointer into the output value parameter and advance the pointer.
Read an unsigned 16-bit integer from the data pointer into the output value parameter and advance the pointer.
Read a signed 32-bit integer from the data pointer into the output value parameter and advance the pointer.
Read an unsigned 32-bit integer from the data pointer into the output value parameter and advance the pointer.
Read a signed 64-bit integer from the data pointer into the output value parameter and advance the pointer.
Read an unsigned 64-bit integer from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 16-bit float from the data pointer into the output value parameter and advance the pointer.
Read a 32-bit float from the data pointer into the output value parameter and advance the pointer.
Read a 64-bit float from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 2D vector of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 2D vector of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 3D vector of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 4D vector of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 2x2 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 3x3 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 4x4 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 3x3 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 1D range of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 2D range of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read a 3D range of the templated type from the data pointer into the output value parameter and advance the pointer.
|
inline |
Read an array of values of the templated type and advance the data pointer.
data::String om::io::BinaryDecoder::readASCIIString | ( | ) |
Read an ASCII encoded string starting at the specified data pointer and return it and advance the pointer.
data::UTF8String om::io::BinaryDecoder::readUTF8String | ( | ) |
Read a UTF-8 encoded string starting at the specified data pointer and return it and advance the pointer.
data::UTF16String om::io::BinaryDecoder::readUTF16String | ( | ) |
Read a UTF-16 encoded string starting at the specified data pointer and return it and advance the pointer.
data::UTF32String om::io::BinaryDecoder::readUTF32String | ( | ) |
Read a UTF-32 encoded string starting at the specified data pointer and return it and advance the pointer.
Read the specified number of bytes of data into the buffer.
Read the specified number of bytes from the stream and place them in the buffer given by a pointer.
Implements om::io::DataInputStream.
|
virtual |
Return whether or not this type of stream allows seeking.
Implements om::io::DataInputStream.
Return whether or not this stream can seek by the specified amount in bytes.
Implements om::io::DataInputStream.
Move the current position in the stream by the specified relative signed offset in bytes.
Implements om::io::DataInputStream.
|
virtual |
Return the number of bytes remaining in the stream.
Implements om::io::DataInputStream.
|
virtual |
Return the current byte index within the stream relative to the beginning.
Implements om::io::DataInputStream.