GlsMap Toolkit  1.3.1
disti::VPFUtil::PointerArray< T > Class Template Reference

#include <vpf_util.h>

Public Types

enum  { DEFAULT_INITIAL_SIZE = 16u }
 

Public Member Functions

 PointerArray (const unsigned int initialSize=DEFAULT_INITIAL_SIZE)
 
 ~PointerArray ()
 
bool InsertPointer (T *const p)
 
bool MovePointer (const unsigned int curIndex, const unsigned int newIndex)
 
unsigned int GetCount (void) const
 
T * GetPointer (const unsigned int index)
 
const T * GetPointer (const unsigned int index) const
 
bool IsValid (void) const
 

Protected Attributes

WarningBool _isValid
 
unsigned int _arraySize
 
unsigned int _arrayCount
 
T ** _pointers
 

Detailed Description

template<class T>
class disti::VPFUtil::PointerArray< T >

encapsulates a growable array of pointers

Member Enumeration Documentation

template<class T>
anonymous enum

default initial size of array

Constructor & Destructor Documentation

template<class T>
disti::VPFUtil::PointerArray< T >::PointerArray ( const unsigned int  initialSize = DEFAULT_INITIAL_SIZE)
inline

Ctor

Parameters
initialSize[optional, defaults to DEFAULT_INITIAL_SIZE] initial size of array (>0)
template<class T>
disti::VPFUtil::PointerArray< T >::~PointerArray ( )
inline

Dtor

Member Function Documentation

template<class T>
unsigned int disti::VPFUtil::PointerArray< T >::GetCount ( void  ) const
inline

Get number of pointers in the array

Returns
number of pointers in the array
template<class T>
T* disti::VPFUtil::PointerArray< T >::GetPointer ( const unsigned int  index)
inline

Get a pointer in the array

Parameters
indexzero based index into array
Returns
pointer at index else NULL
template<class T>
const T* disti::VPFUtil::PointerArray< T >::GetPointer ( const unsigned int  index) const
inline

Get a const pointer in the array

Parameters
indexzero based index into array
Returns
pointer at index else NULL
template<class T>
bool disti::VPFUtil::PointerArray< T >::InsertPointer ( T *const  p)
inline

Insert a pointer into the array at the end of the array

Parameters
ppointer to add (non NULL)
Returns
true on success else false
template<class T>
bool disti::VPFUtil::PointerArray< T >::IsValid ( void  ) const
inline

Determine if the array is in a valid state

Returns
true if valid else false
template<class T>
bool disti::VPFUtil::PointerArray< T >::MovePointer ( const unsigned int  curIndex,
const unsigned int  newIndex 
)
inline

Move a pointer from one index in the array to another index in the array. array elements are shifted down accordingly.

Parameters
curIndexcurrent index of pointer
newIndexnew desired index of pointer
Returns
true if success else false

Member Data Documentation

template<class T>
unsigned int disti::VPFUtil::PointerArray< T >::_arrayCount
protected

number of elements in _pointers pointer array

template<class T>
unsigned int disti::VPFUtil::PointerArray< T >::_arraySize
protected

length of _pointers pointer array

template<class T>
WarningBool disti::VPFUtil::PointerArray< T >::_isValid
protected

true if array is valid else false

template<class T>
T** disti::VPFUtil::PointerArray< T >::_pointers
protected

array of T pointers


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