Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::io::BinaryDecoder Class Reference

A class that handles decoding of standard types from binary data. More...

#include <omBinaryDecoder.h>

Inheritance diagram for om::io::BinaryDecoder:
om::io::DataInputStream

Public Member Functions

 BinaryDecoder ()
 Create a new binary decoder that uses the native endianness for primitive types. More...
 
const BinaryFormatgetFormat () 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...
 

Detailed Description

A class that handles decoding of standard types from binary data.

Constructor & Destructor Documentation

om::io::BinaryDecoder::BinaryDecoder ( )

Create a new binary decoder that uses the native endianness for primitive types.

Member Function Documentation

const BinaryFormat& om::io::BinaryDecoder::getFormat ( ) const
inline

Return a reference to the binary format this decoder is using.

void om::io::BinaryDecoder::setFormat ( const BinaryFormat newFormat)
inline

Set the binary format this decoder is using.

Size om::io::BinaryDecoder::getDataSize ( ) const
inline

Return the total size of the decoder's data source in bytes.

void om::io::BinaryDecoder::setData ( const UByte newData,
Size  dataSizeInBytes 
)
inline

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.

void om::io::BinaryDecoder::pad ( const UByte *&  data)
inline

Pad the alignment of the specified pointer to the next aligned object boundary.

Bool om::io::BinaryDecoder::read ( Bool value)
inline

Read a boolean from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( Int8 value)
inline

Read a signed 8-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( UInt8 value)
inline

Read an unsigned 8-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( Int16 value)
inline

Read a signed 16-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( UInt16 value)
inline

Read an unsigned 16-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( Int32 value)
inline

Read a signed 32-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( UInt32 value)
inline

Read an unsigned 32-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( Int64 value)
inline

Read a signed 64-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( UInt64 value)
inline

Read an unsigned 64-bit integer from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( lang::Float16 value)
inline

Read a 16-bit float from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( Float32 value)
inline

Read a 32-bit float from the data pointer into the output value parameter and advance the pointer.

Bool om::io::BinaryDecoder::read ( Float64 value)
inline

Read a 64-bit float from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::Complex< T > &  value)
inline

Read a 2D vector of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::VectorND< T, 2 > &  value)
inline

Read a 2D vector of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::VectorND< T, 3 > &  value)
inline

Read a 3D vector of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::VectorND< T, 4 > &  value)
inline

Read a 4D vector of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::MatrixND< T, 2, 2 > &  value)
inline

Read a 2x2 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::MatrixND< T, 3, 3 > &  value)
inline

Read a 3x3 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::MatrixND< T, 4, 4 > &  value)
inline

Read a 4x4 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::Transform3D< T > &  value)
inline

Read a 3x3 matrix of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::AABB1D< T > &  value)
inline

Read a 1D range of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::AABB2D< T > &  value)
inline

Read a 2D range of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
Bool om::io::BinaryDecoder::read ( math::AABB3D< T > &  value)
inline

Read a 3D range of the templated type from the data pointer into the output value parameter and advance the pointer.

template<typename T >
void om::io::BinaryDecoder::readArray ( T *  array,
Size  number 
)
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.

Bool om::io::BinaryDecoder::read ( UByte newData,
Size  number 
)

Read the specified number of bytes of data into the buffer.

virtual Size om::io::BinaryDecoder::readData ( UByte buffer,
Size  number 
)
virtual

Read the specified number of bytes from the stream and place them in the buffer given by a pointer.

Implements om::io::DataInputStream.

virtual Bool om::io::BinaryDecoder::canSeek ( ) const
virtual

Return whether or not this type of stream allows seeking.

Implements om::io::DataInputStream.

virtual Bool om::io::BinaryDecoder::canSeek ( Int64  relativeOffset) const
virtual

Return whether or not this stream can seek by the specified amount in bytes.

Implements om::io::DataInputStream.

virtual Int64 om::io::BinaryDecoder::seek ( Int64  relativeOffset)
virtual

Move the current position in the stream by the specified relative signed offset in bytes.

Implements om::io::DataInputStream.

virtual LargeSize om::io::BinaryDecoder::getBytesRemaining ( ) const
virtual

Return the number of bytes remaining in the stream.

Implements om::io::DataInputStream.

virtual LargeIndex om::io::BinaryDecoder::getPosition ( ) const
virtual

Return the current byte index within the stream relative to the beginning.

Implements om::io::DataInputStream.


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