Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::data::Buffer< T > Class Template Reference

An array-based buffer class. More...

#include <omBuffer.h>

Public Member Functions

 Buffer ()
 Create an empty buffer with the default initial capacity. More...
 
 Buffer (Size initialCapacity)
 Create an empty buffer with the specified initial capacity. More...
 
 Buffer (Size initialCapacity, Float newResizeFactor)
 Create an empty buffer with the specified initial capacity and resize factor. More...
 
 Buffer (const Buffer &other)
 Create an identical copy of the specified buffer. More...
 
 ~Buffer ()
 Destroy a buffer, deallocating all resources used. More...
 
Bufferoperator= (const Buffer &other)
 Assign the contents of one array list to another, performing a deep copy. More...
 
Bufferappend (const T &element)
 Append an element to the end of this buffer. More...
 
Bufferappend (const T *source, Size numElements)
 Append the specified number of elements from the given array. More...
 
Bufferappend (const util::Array< T > &array)
 Append all elements from the specified array to the end of the buffer. More...
 
Bufferappend (const util::Array< T > &array, Size number)
 Append a certain number of elements from the specified array to the end of the buffer. More...
 
Bufferappend (const Buffer &aBuffer)
 Append all data from the specified buffer. More...
 
Bufferoperator<< (const T &element)
 Append an element to the end of this buffer. More...
 
Bufferoperator<< (const util::Array< T > &array)
 Append all elements from the specified array to the end of the buffer. More...
 
Bufferoperator<< (const Buffer &aBuffer)
 Append all data from the specified buffer. More...
 
void clear ()
 Clear the contents of the buffer, keeping its capacity intact. More...
 
util::Array< T > toArray () const
 Convert the contents of this buffer to an array object. More...
 
 operator util::Array< T > ()
 Convert the contents of this buffer to an array object. More...
 
const T * getPointer () const
 Get a pointer pointing to the buffer's internal array. More...
 
Size getSize () const
 Get the number of elements in the buffer. More...
 
Size getCapacity () const
 Get 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 buffer. More...
 
void setResizeFactor (Float newResizeFactor)
 Set the resize factor for this buffer, clamped to [1.1, 10.0]. More...
 

Detailed Description

template<typename T>
class om::data::Buffer< T >

An array-based buffer class.

This class allows the user to accumulate elements in a resizing buffer, then use the buffer's array as a contiguous block of memory at some later point.

Constructor & Destructor Documentation

template<typename T >
om::data::Buffer< T >::Buffer ( )
inline

Create an empty buffer with the default initial capacity.

template<typename T >
om::data::Buffer< T >::Buffer ( Size  initialCapacity)
inline

Create an empty buffer with the specified initial capacity.

template<typename T >
om::data::Buffer< T >::Buffer ( Size  initialCapacity,
Float  newResizeFactor 
)
inline

Create an empty buffer with the specified initial capacity and resize factor.

template<typename T >
om::data::Buffer< T >::Buffer ( const Buffer< T > &  other)
inline

Create an identical copy of the specified buffer.

template<typename T >
om::data::Buffer< T >::~Buffer ( )
inline

Destroy a buffer, deallocating all resources used.

Member Function Documentation

template<typename T >
Buffer& om::data::Buffer< T >::operator= ( const Buffer< T > &  other)
inline

Assign the contents of one array list to another, performing a deep copy.

template<typename T >
Buffer& om::data::Buffer< T >::append ( const T &  element)
inline

Append an element to the end of this buffer.

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

Append the specified number of elements from the given array.

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

Append all elements from the specified array to the end of the buffer.

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

Append a certain number of elements from the specified array to the end of the buffer.

template<typename T >
Buffer& om::data::Buffer< T >::append ( const Buffer< T > &  aBuffer)
inline

Append all data from the specified buffer.

template<typename T >
Buffer& om::data::Buffer< T >::operator<< ( const T &  element)
inline

Append an element to the end of this buffer.

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

Append all elements from the specified array to the end of the buffer.

template<typename T >
Buffer& om::data::Buffer< T >::operator<< ( const Buffer< T > &  aBuffer)
inline

Append all data from the specified buffer.

template<typename T >
void om::data::Buffer< T >::clear ( )
inline

Clear the contents of the buffer, keeping its capacity intact.

template<typename T >
util::Array<T> om::data::Buffer< T >::toArray ( ) const
inline

Convert the contents of this buffer to an array object.

template<typename T >
om::data::Buffer< T >::operator util::Array< T > ( )
inline

Convert the contents of this buffer to an array object.

template<typename T >
const T* om::data::Buffer< T >::getPointer ( ) const
inline

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

template<typename T >
Size om::data::Buffer< T >::getSize ( ) const
inline

Get the number of elements in the buffer.

template<typename T >
Size om::data::Buffer< T >::getCapacity ( ) const
inline

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

template<typename T >
Bool om::data::Buffer< T >::setCapacity ( Size  newCapacity)
inline

Set the number of elements the buffer can hold.

template<typename T >
Float om::data::Buffer< T >::getResizeFactor ( ) const
inline

Get the resize factor for this buffer.

template<typename T >
void om::data::Buffer< T >::setResizeFactor ( Float  newResizeFactor)
inline

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


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