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

A specialization of the PODArray class with 2 dimensions. More...

#include <omPODArray.h>

Public Member Functions

 PODArray ()
 Create a new empty POD array without any memory allocated. More...
 
 PODArray (SizeType newSize0, SizeType newSize1)
 Create a new POD array of the given sizes 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 (SizeType dimension) const
 Return the current size of the array along the given dimension index. More...
 
SizeType getSizeInBytes () const
 Return the current number of bytes that are internally allocated, the memory usage. More...
 
void setSize (SizeType newSize0, SizeType newSize1)
 Set the current valid size of the array. More...
 
void setSizeCopy (SizeType newSize0, SizeType newSize1)
 Set the current valid size of the array. More...
 
void setSizeCopyUnwrap (SizeType newSize0, SizeType newSize1, SizeType split0=0, SizeType split1=0)
 Set the current valid size of the array, copying and unwrwapping the previous contents around a split point. More...
 
Bool isAllocated () const
 Return whether or not this PODArray's internal memory buffer is currently allocated. More...
 
void allocate (SizeType newSize0, SizeType newSize1)
 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 row at the specified index. More...
 
const T * operator[] (SizeType i) const
 Return a const reference to the row at the specified index. More...
 
T * operator() (SizeType i)
 Return a reference to the row at the specified index. More...
 
const T * operator() (SizeType i) const
 Return a const reference to the row at the specified index. More...
 
T & operator() (SizeType i, SizeType j)
 Return a reference to the array element at the specified 2D index. More...
 
const T & operator() (SizeType i, SizeType j) const
 Return a const reference to the array element at the specified 2D index. More...
 
void zero ()
 Zero the entire contents of the array if it is allocated. More...
 
void zero (SizeType start0, SizeType number0, SizeType start1, SizeType number1)
 Zero a range of the array for each dimension if it is allocated. More...
 

Detailed Description

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

A specialization of the PODArray class with 2 dimensions.

Constructor & Destructor Documentation

template<typename T , typename SizeType , typename AllocatorType >
om::util::PODArray< T, 2, 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, 2, SizeType, AllocatorType >::PODArray ( SizeType  newSize0,
SizeType  newSize1 
)
inline

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

template<typename T , typename SizeType , typename AllocatorType >
om::util::PODArray< T, 2, SizeType, AllocatorType >::PODArray ( const PODArray< T, 2, 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, 2, 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, 2, SizeType, AllocatorType >::operator= ( const PODArray< T, 2, 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, 2, 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, 2, SizeType, AllocatorType >::getSize ( SizeType  dimension) const
inline

Return the current size of the array along the given dimension index.

template<typename T , typename SizeType , typename AllocatorType >
SizeType om::util::PODArray< T, 2, 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, 2, SizeType, AllocatorType >::setSize ( SizeType  newSize0,
SizeType  newSize1 
)
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, 2, SizeType, AllocatorType >::setSizeCopy ( SizeType  newSize0,
SizeType  newSize1 
)
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 >
void om::util::PODArray< T, 2, SizeType, AllocatorType >::setSizeCopyUnwrap ( SizeType  newSize0,
SizeType  newSize1,
SizeType  split0 = 0,
SizeType  split1 = 0 
)
inline

Set the current valid size of the array, copying and unwrwapping the previous contents around a split point.

This method is intended for efficient resizing of circular buffers. The old contents are copied after being unwrapped around the splitting point for each dimension. The split points indicate the new starting indices of the array. The array regions before the split points are copied after the end of the previous array data in the new array. 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, 2, 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, 2, SizeType, AllocatorType >::allocate ( SizeType  newSize0,
SizeType  newSize1 
)
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, 2, 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, 2, 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, 2, 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, 2, SizeType, AllocatorType >::operator[] ( SizeType  i)
inline

Return a reference to the row at the specified index.

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

Return a const reference to the row at the specified index.

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

Return a reference to the row at the specified index.

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

Return a const reference to the row at the specified index.

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

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

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

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

template<typename T , typename SizeType , typename AllocatorType >
void om::util::PODArray< T, 2, 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, 2, SizeType, AllocatorType >::zero ( SizeType  start0,
SizeType  number0,
SizeType  start1,
SizeType  number1 
)
inline

Zero a range of the array for each dimension if it is allocated.


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