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

A class that represents an immutable array of unsigned byte data. More...

#include <omData.h>

Public Member Functions

 Data ()
 Create an empty Data object that doesn't hold any data. More...
 
 Data (const UByte *newData, Size number)
 Create a Data object by copying the specified number of bytes from the given data pointer. More...
 
 Data (const util::Array< UByte > &array)
 Create a Data object by copying the specified data array. More...
 
 Data (const util::Array< UByte > &array, Size number)
 Create a Data object by copying the specified number of bytes from the given data array. More...
 
 Data (const Data &other)
 
 ~Data ()
 Destroy a Data object, deallocating the internal data array if the reference count reaches zero. More...
 
Dataoperator= (const Data &other)
 Assign the contents of another Data object to this object. More...
 
Size getSize () const
 Return the number of bytes of data that this Data object holds. More...
 
Size getSizeInBytes () const
 Return the number of bytes of data that this Data object holds. More...
 
const UBytegetPointer () const
 Get a pointer to the internal array of bytes that this Data object holds. More...
 
 operator const UByte * () const
 Get a pointer to the internal array of bytes that this Data object holds. More...
 
const UByteoperator() (Index index) const
 Access the byte at the specified index in the Data object's internal array. More...
 
Bool equals (const Data &other) const
 Return whether or not the data contained in this Data object is identical to another's. More...
 
Bool operator== (const Data &other) const
 Return whether or not the data contained in this Data object is identical to another's. More...
 
Bool operator!= (const Data &other) const
 Return whether or not the data contained in this Data object is not identical to another's. More...
 
Data concatenate (const Data &other) const
 Return a Data object containing the concatenation of this data and the specified data. More...
 
Data operator+ (const Data &other) const
 Return a Data object containing the concatenation of this data and the specified data. More...
 
Hash getHashCode () const
 Get a hash code for this Data object. More...
 

Static Public Member Functions

static Data shallow (UByte *array, Size size)
 Create a data object from the specified byte array with the specified size. More...
 

Detailed Description

A class that represents an immutable array of unsigned byte data.

The Data class is the data-oriented analogue to the GenericString class. It is designed to hold an opaque block of data resident in memory. A Data object could be used to hold anything: images, audio, even text. The internal array of data is reference-counted in order to reduce unintended copying.

Constructor & Destructor Documentation

om::data::Data::Data ( )
inline

Create an empty Data object that doesn't hold any data.

om::data::Data::Data ( const UByte newData,
Size  number 
)

Create a Data object by copying the specified number of bytes from the given data pointer.

om::data::Data::Data ( const util::Array< UByte > &  array)

Create a Data object by copying the specified data array.

om::data::Data::Data ( const util::Array< UByte > &  array,
Size  number 
)

Create a Data object by copying the specified number of bytes from the given data array.

om::data::Data::Data ( const Data other)
inline
om::data::Data::~Data ( )

Destroy a Data object, deallocating the internal data array if the reference count reaches zero.

Member Function Documentation

static Data om::data::Data::shallow ( UByte array,
Size  size 
)
inlinestatic

Create a data object from the specified byte array with the specified size.

Once this method completes, it is expected that the Data object now owns the data array pointer and will free it upon destruction.

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

Assign the contents of another Data object to this object.

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

Return the number of bytes of data that this Data object holds.

Size om::data::Data::getSizeInBytes ( ) const
inline

Return the number of bytes of data that this Data object holds.

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

Get a pointer to the internal array of bytes that this Data object holds.

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

Get a pointer to the internal array of bytes that this Data object holds.

const UByte& om::data::Data::operator() ( Index  index) const
inline

Access the byte at the specified index in the Data object's internal array.

Bool om::data::Data::equals ( const Data other) const

Return whether or not the data contained in this Data object is identical to another's.

Bool om::data::Data::operator== ( const Data other) const
inline

Return whether or not the data contained in this Data object is identical to another's.

Bool om::data::Data::operator!= ( const Data other) const
inline

Return whether or not the data contained in this Data object is not identical to another's.

Data om::data::Data::concatenate ( const Data other) const

Return a Data object containing the concatenation of this data and the specified data.

Data om::data::Data::operator+ ( const Data other) const
inline

Return a Data object containing the concatenation of this data and the specified data.

Hash om::data::Data::getHashCode ( ) const
inline

Get a hash code for this Data object.


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