Om  1.0.0
A universal framework for multimedia simulation
Public Member Functions | List of all members
om::util::PODArray< T, 1, SizeType, AllocatorType > Class Template Reference

A specialization of the PODArray class with 1 dimension. More...

#include <omPODArray.h>

Public Member Functions

 PODArray ()
 Create a new empty POD array without any memory allocated. More...
 
 PODArray (SizeType newSize)
 Create a new POD array of the given size without any memory allocated. More...
 
 PODArray (const PODArray &other)
 Create a new empty POD array that copies the state of another array. More...
 
 ~PODArray ()
 Destroy a POD array, releasing any allocated memory. More...
 
PODArrayoperator= (const PODArray &other)
 Assign the state of another PODArray to this one, copying its elements. More...
 
SizeType getCapacity () const
 Return the current capacity of the array's allocated storage. More...
 
SizeType getSize () const
 Return the current valid size of the array. More...
 
SizeType getSizeInBytes () const
 Return the current number of bytes that are internally allocated, the memory usage. More...
 
void setSize (SizeType newSize)
 Set the current valid size of the array. More...
 
void setSizeCopy (SizeType newSize)
 Set the current valid size of the array. More...
 
Bool isAllocated () const
 Return whether or not this PODArray's internal memory buffer is currently allocated. More...
 
void allocate (SizeType newSize)
 Make sure that the internal memory is allocated and has at least the given size. More...
 
void allocate ()
 Make sure that the internal memory is allocated. More...
 
void deallocate ()
 Free the memory used by the array but keep its current size. More...
 
T * getPointer () const
 Return a pointer to the first element in this array. More...
 
T & operator[] (SizeType i)
 Return a reference to the array element at the specified index. More...
 
const T & operator[] (SizeType i) const
 Return a const reference to the array element at the specified index. More...
 
T & operator() (SizeType i)
 Return a reference to the array element at the specified index. More...
 
const T & operator() (SizeType i) const
 Return a const reference to the array element at the specified index. More...
 
void zero ()
 Zero the entire contents of the array if it is allocated. More...
 
void zero (SizeType startIndex, SizeType number)
 Zero a range of the array if it is allocated. More...
 

Detailed Description

template<typename T, typename SizeType, typename AllocatorType>
class om::util::PODArray< T, 1, SizeType, AllocatorType >

A specialization of the PODArray class with 1 dimension.

Constructor & Destructor Documentation

template<typename T , typename SizeType , typename AllocatorType >
om::util::PODArray< T, 1, SizeType, AllocatorType >::PODArray ( )
inline

Create a new empty POD array without any memory allocated.

template<typename T , typename SizeType , typename AllocatorType >
om::util::PODArray< T, 1, SizeType, AllocatorType >::PODArray ( SizeType  newSize)
inline

Create a new POD array of the given size without any memory allocated.

template<typename T , typename SizeType , typename AllocatorType >
om::util::PODArray< T, 1, SizeType, AllocatorType >::PODArray ( const PODArray< T, 1, SizeType, AllocatorType > &  other)
inline

Create a new empty POD array that copies the state of another array.

template<typename T , typename SizeType , typename AllocatorType >
om::util::PODArray< T, 1, SizeType, AllocatorType >::~PODArray ( )
inline

Destroy a POD array, releasing any allocated memory.

Member Function Documentation

template<typename T , typename SizeType , typename AllocatorType >
PODArray& om::util::PODArray< T, 1, SizeType, AllocatorType >::operator= ( const PODArray< T, 1, SizeType, AllocatorType > &  other)
inline

Assign the state of another PODArray to this one, copying its elements.

template<typename T , typename SizeType , typename AllocatorType >
SizeType om::util::PODArray< T, 1, SizeType, AllocatorType >::getCapacity ( ) const
inline

Return the current capacity of the array's allocated storage.

template<typename T , typename SizeType , typename AllocatorType >
SizeType om::util::PODArray< T, 1, SizeType, AllocatorType >::getSize ( ) const
inline

Return the current valid size of the array.

template<typename T , typename SizeType , typename AllocatorType >
SizeType om::util::PODArray< T, 1, SizeType, AllocatorType >::getSizeInBytes ( ) const
inline

Return the current number of bytes that are internally allocated, the memory usage.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::setSize ( SizeType  newSize)
inline

Set the current valid size of the array.

The contents of the resulting buffer are undefined. If the array was not previously allocated the method does not allocate any memory.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::setSizeCopy ( SizeType  newSize)
inline

Set the current valid size of the array.

The old contents are copied and the rest of the memory is uninitialized. If the array was not previously allocated the method does not allocate any memory.

template<typename T , typename SizeType , typename AllocatorType >
Bool om::util::PODArray< T, 1, SizeType, AllocatorType >::isAllocated ( ) const
inline

Return whether or not this PODArray's internal memory buffer is currently allocated.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::allocate ( SizeType  newSize)
inline

Make sure that the internal memory is allocated and has at least the given size.

If the memory is already allocated with at least the given size, the method has no effect. If new memory is allocated, its contents are undefined.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::allocate ( )
inline

Make sure that the internal memory is allocated.

If the memory is already allocated, the method has no effect. If new memory is allocated, its contents are undefined.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::deallocate ( )
inline

Free the memory used by the array but keep its current size.

If the memory is already allocated, the method has no effect. If new memory is allocated, its contents are undefined.

template<typename T , typename SizeType , typename AllocatorType >
T* om::util::PODArray< T, 1, SizeType, AllocatorType >::getPointer ( ) const
inline

Return a pointer to the first element in this array.

template<typename T , typename SizeType , typename AllocatorType >
T& om::util::PODArray< T, 1, SizeType, AllocatorType >::operator[] ( SizeType  i)
inline

Return a reference to the array element at the specified index.

template<typename T , typename SizeType , typename AllocatorType >
const T& om::util::PODArray< T, 1, SizeType, AllocatorType >::operator[] ( SizeType  i) const
inline

Return a const reference to the array element at the specified index.

template<typename T , typename SizeType , typename AllocatorType >
T& om::util::PODArray< T, 1, SizeType, AllocatorType >::operator() ( SizeType  i)
inline

Return a reference to the array element at the specified index.

template<typename T , typename SizeType , typename AllocatorType >
const T& om::util::PODArray< T, 1, SizeType, AllocatorType >::operator() ( SizeType  i) const
inline

Return a const reference to the array element at the specified index.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::zero ( )
inline

Zero the entire contents of the array if it is allocated.

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 1, SizeType, AllocatorType >::zero ( SizeType  startIndex,
SizeType  number 
)
inline

Zero a range of the array if it is allocated.


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