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

A buffer class used to accumulate an opaque array of unsigned bytes. More...

#include <omDataBuffer.h>

Public Member Functions

 DataBuffer ()
 Create a data buffer with the default capacity, resize factor, and endian-ness. More...
 
 DataBuffer (Size newCapacity)
 Create a data buffer the specified capacity, default resize factor and native endian-ness. More...
 
 DataBuffer (Size newCapacity, Float newResizeFactor)
 Create a data buffer the specified capacity and resize factor and native endian-ness. More...
 
 DataBuffer (Size newCapacity, Float newResizeFactor, Endianness newEndianness)
 Create a data buffer the specified capacity, resize factor and endian-ness. More...
 
 DataBuffer (const DataBuffer &other)
 Create a copy of the specified data buffer. More...
 
 ~DataBuffer ()
 Destroy the data buffer and all data contained within. More...
 
DataBufferoperator= (const DataBuffer &other)
 Assign the contents of another DataBuffer to this buffer, replacing the original contents. More...
 
DataBufferappend (UByte byte)
 Append an unsigned byte to this data buffer. More...
 
DataBufferappend (const UByte *bytes, Size number)
 Append the specified number of elements from an array of unsigned bytes. More...
 
DataBufferappend (const util::Array< UByte > &array)
 Append an array of unsigned bytes to this data buffer. More...
 
DataBufferappend (const DataBuffer &dataBuffer)
 Append all data in the specified data buffer to this data buffer. More...
 
DataBufferappend (Int8 value)
 Append a signed 8-bit integer to this data buffer. More...
 
DataBufferappend (Int16 value)
 Append a signed 16-bit integer to this data buffer. More...
 
DataBufferappend (UInt16 value)
 Append an unsigned 16-bit integer to this data buffer. More...
 
DataBufferappend (Int32 value)
 Append a signed 32-bit integer to this data buffer. More...
 
DataBufferappend (UInt32 value)
 Append an unsigned 32-bit integer to this data buffer. More...
 
DataBufferappend (Int64 value)
 Append a signed 64-bit integer to this data buffer. More...
 
DataBufferappend (UInt64 value)
 Append an unsigned 64-bit integer to this data buffer. More...
 
DataBufferappend (Float32 value)
 Append a 32-bit floating point number to this data buffer. More...
 
DataBufferappend (Float64 value)
 Append a 64-bit floating point number to this data buffer. More...
 
template<typename T >
DataBufferappend (const T *source, Size number)
 Append a certain number of elements from an array of a primitive type. More...
 
template<typename T >
DataBufferappend (const util::Array< T > &array)
 Append all elements from an array of a primitive type to this data buffer. More...
 
template<typename T >
DataBufferappend (const util::Array< T > &array, Size number)
 Append a certain number of elements from an array of a primitive type. More...
 
template<typename T >
DataBufferoperator<< (const T &value)
 Append to the data buffer. More...
 
UBytereserve (Size numBytes)
 Reserve the specified number of bytes at the end of the buffer where data should be written. More...
 
void clear ()
 Clear all previously added elements from the data buffer. More...
 
Data toData () const
 Return a Data object containing the contents of this DataBuffer. More...
 
 operator const UByte * () const
 Get a pointer to the beginning of the DataBuffer's internal array. More...
 
const UBytegetPointer () const
 Get a pointer pointing to the buffer's internal array. More...
 
Size getSize () const
 Get the number of bytes of data contained in the buffer. More...
 
Size getCapacity () const
 Return the number of elements the buffer can hold without resizing. More...
 
Bool setCapacity (Size newCapacity)
 Set the number of elements the buffer can hold. More...
 
Float getResizeFactor () const
 Get the resize factor for this string buffer. More...
 
void setResizeFactor (Float newResizeFactor)
 Set the resize factor for this string buffer, clamped to [1.1, 10.0]. More...
 
Endianness getEndianness () const
 Get the current endianness of the data being written to the buffer. More...
 
void setEndianness (Endianness newEndianness)
 Set the buffer to serialize data in big endian format. More...
 

Detailed Description

A buffer class used to accumulate an opaque array of unsigned bytes.

Constructor & Destructor Documentation

om::data::DataBuffer::DataBuffer ( )
inline

Create a data buffer with the default capacity, resize factor, and endian-ness.

om::data::DataBuffer::DataBuffer ( Size  newCapacity)
inline

Create a data buffer the specified capacity, default resize factor and native endian-ness.

om::data::DataBuffer::DataBuffer ( Size  newCapacity,
Float  newResizeFactor 
)
inline

Create a data buffer the specified capacity and resize factor and native endian-ness.

om::data::DataBuffer::DataBuffer ( Size  newCapacity,
Float  newResizeFactor,
Endianness  newEndianness 
)
inline

Create a data buffer the specified capacity, resize factor and endian-ness.

om::data::DataBuffer::DataBuffer ( const DataBuffer other)

Create a copy of the specified data buffer.

om::data::DataBuffer::~DataBuffer ( )

Destroy the data buffer and all data contained within.

Member Function Documentation

DataBuffer& om::data::DataBuffer::operator= ( const DataBuffer other)

Assign the contents of another DataBuffer to this buffer, replacing the original contents.

DataBuffer& om::data::DataBuffer::append ( UByte  byte)

Append an unsigned byte to this data buffer.

DataBuffer& om::data::DataBuffer::append ( const UByte bytes,
Size  number 
)

Append the specified number of elements from an array of unsigned bytes.

DataBuffer& om::data::DataBuffer::append ( const util::Array< UByte > &  array)
inline

Append an array of unsigned bytes to this data buffer.

DataBuffer& om::data::DataBuffer::append ( const DataBuffer dataBuffer)
inline

Append all data in the specified data buffer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( Int8  value)
inline

Append a signed 8-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( Int16  value)
inline

Append a signed 16-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( UInt16  value)
inline

Append an unsigned 16-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( Int32  value)
inline

Append a signed 32-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( UInt32  value)
inline

Append an unsigned 32-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( Int64  value)
inline

Append a signed 64-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( UInt64  value)
inline

Append an unsigned 64-bit integer to this data buffer.

DataBuffer& om::data::DataBuffer::append ( Float32  value)
inline

Append a 32-bit floating point number to this data buffer.

DataBuffer& om::data::DataBuffer::append ( Float64  value)
inline

Append a 64-bit floating point number to this data buffer.

template<typename T >
DataBuffer& om::data::DataBuffer::append ( const T *  source,
Size  number 
)
inline

Append a certain number of elements from an array of a primitive type.

template<typename T >
DataBuffer& om::data::DataBuffer::append ( const util::Array< T > &  array)
inline

Append all elements from an array of a primitive type to this data buffer.

template<typename T >
DataBuffer& om::data::DataBuffer::append ( const util::Array< T > &  array,
Size  number 
)
inline

Append a certain number of elements from an array of a primitive type.

template<typename T >
DataBuffer& om::data::DataBuffer::operator<< ( const T &  value)
inline

Append to the data buffer.

UByte* om::data::DataBuffer::reserve ( Size  numBytes)
inline

Reserve the specified number of bytes at the end of the buffer where data should be written.

The number of valid bytes in the buffer is increased by this number. A pointer to the location where the bytes should be written is returned. If the specified number of bytes is not written to the pointer returned, the result is undefined.

Parameters
numBytes- the number of bytes to reserve at the end of the buffer.
Returns
a pointer to where the bytes should be written.
void om::data::DataBuffer::clear ( )
inline

Clear all previously added elements from the data buffer.

Data om::data::DataBuffer::toData ( ) const
inline

Return a Data object containing the contents of this DataBuffer.

This version of the toData() method leaves the DataBuffer unmodified and copies the data into the Data object.

om::data::DataBuffer::operator const UByte * ( ) const
inline

Get a pointer to the beginning of the DataBuffer's internal array.

const UByte* om::data::DataBuffer::getPointer ( ) const
inline

Get a pointer pointing to the buffer's internal array.

Size om::data::DataBuffer::getSize ( ) const
inline

Get the number of bytes of data contained in the buffer.

Size om::data::DataBuffer::getCapacity ( ) const
inline

Return the number of elements the buffer can hold without resizing.

Bool om::data::DataBuffer::setCapacity ( Size  newCapacity)
inline

Set the number of elements the buffer can hold.

Float om::data::DataBuffer::getResizeFactor ( ) const
inline

Get the resize factor for this string buffer.

void om::data::DataBuffer::setResizeFactor ( Float  newResizeFactor)
inline

Set the resize factor for this string buffer, clamped to [1.1, 10.0].

Endianness om::data::DataBuffer::getEndianness ( ) const
inline

Get the current endianness of the data being written to the buffer.

void om::data::DataBuffer::setEndianness ( Endianness  newEndianness)
inline

Set the buffer to serialize data in big endian format.


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