Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

RmArray< Type > Class Template Reference

Templated dynamically resizable array. More...

#include <RmArray.h>

List of all members.

Public Member Functions

 RmArray ()
 Constructor.

 RmArray (const RmArray< Type > &src)
 Constructor.

 ~RmArray ()
 Desstructor.

int size () const
 Size of array.

bool empty () const
int capacity () const
bool reserve (int reserveSize)
 Reserve memory.

bool resize (int newSize)
 Resize size of array.

bool clear ()
 Destroy allocated memory.

bool push_back (Type data)
 Add new item to end of array.

bool push_front (Type data)
 Add new item to front.

bool remove (Type data)
 Remove data.

iterator erase (iterator &itr)
 Remove item by iterator.

iterator begin ()
 Begin iterator.

const_iterator begin () const
 Begin iterator.

iterator end ()
 End iterator.

const_iterator end () const
 End iterator.

 operator Type * ()
 Access array as C style array.

 operator const Type * () const
 Access array as C style array.

Type & operator[] (int nIndex)
 Access item by index.

const Type & operator[] (int nIndex) const
 Access item by index.

void operator= (const RmArray< Type > &src)
 Copy array.

void SetIncrementSize (int size)
 Set increment size.

int GetIncrementSize () const
 Get increment size.


Detailed Description

template<class Type>
class RmArray< Type >

Templated dynamically resizable array.

To define the class:

RmArray< TYPE > myArray

To define an iterator to use with the class:

RmArray< TYPE >::iterator myArrayIterator;


Constructor & Destructor Documentation

template<class Type>
RmArray< Type >::RmArray  )  [inline]
 

Constructor.

Constructor

template<class Type>
RmArray< Type >::RmArray const RmArray< Type > &  src  )  [inline]
 

Constructor.

Copy Constructor

Parameters:
src Source array to copy from

template<class Type>
RmArray< Type >::~RmArray  )  [inline]
 

Desstructor.

Destructor


Member Function Documentation

template<class Type>
const_iterator RmArray< Type >::begin  )  const [inline]
 

Begin iterator.

Returns an iterator initializes to the beginning of the array

Returns:
First item iterator

template<class Type>
iterator RmArray< Type >::begin  )  [inline]
 

Begin iterator.

Returns an iterator initializes to the beginning of the array

Returns:
First item iterator

template<class Type>
int RmArray< Type >::capacity  )  const [inline]
 

\ breif Get capacity

Returns array's maximum reserved data

Returns:
Size of reserved ( allocated data );

template<class Type>
bool RmArray< Type >::clear  )  [inline]
 

Destroy allocated memory.

Clears the entire array, and frees any allocated memory

Returns:
None

template<class Type>
bool RmArray< Type >::empty  )  const [inline]
 

\ breif Empty check

Returns true of the array has 0 elements, false otherwise

Returns:
True if array has no items, False otherwise

template<class Type>
const_iterator RmArray< Type >::end  )  const [inline]
 

End iterator.

Returns a const iterator initializes to the end of the array

Returns:
Last item iterator

template<class Type>
iterator RmArray< Type >::end  )  [inline]
 

End iterator.

Returns an iterator initializes to the beginning of the array

Returns:
Last item iterator

template<class Type>
iterator RmArray< Type >::erase iterator itr  )  [inline]
 

Remove item by iterator.

Removes the item pointed to by the iterator itr from the array

Parameters:
itr Iterator to specify location of item to remove
Returns:
Next iterator, End iterator if last item is removed

template<class Type>
int RmArray< Type >::GetIncrementSize  )  const [inline]
 

Get increment size.

Return increment size

Returns:
Increment size

template<class Type>
RmArray< Type >::operator const Type *  )  const [inline]
 

Access array as C style array.

Returns a pointer to the type array data

Returns:
Pointer to allocated table of items

template<class Type>
RmArray< Type >::operator Type *  )  [inline]
 

Access array as C style array.

Returns a pointer to the type array data

Returns:
Pointer to allocated table of items

template<class Type>
void RmArray< Type >::operator= const RmArray< Type > &  src  )  [inline]
 

Copy array.

Copy Operator

Parameters:
src Source array to copy from
Returns:
None

template<class Type>
const Type& RmArray< Type >::operator[] int  nIndex  )  const [inline]
 

Access item by index.

Returns the array item at index

Parameters:
nIndex Index to retriev item for
Returns:
Item at index

template<class Type>
Type& RmArray< Type >::operator[] int  nIndex  )  [inline]
 

Access item by index.

Returns the array item at index

Parameters:
nIndex Index to retriev item for
Returns:
Item at index

template<class Type>
bool RmArray< Type >::push_back Type  data  )  [inline]
 

Add new item to end of array.

Add an item to the back of the array

Parameters:
data Data to add
Returns:
True on success

template<class Type>
bool RmArray< Type >::push_front Type  data  )  [inline]
 

Add new item to front.

Add an item to the front of the array

Parameters:
data Data to add
Returns:
True on success

template<class Type>
bool RmArray< Type >::remove Type  data  )  [inline]
 

Remove data.

Removes a specific item from the array

Parameters:
data Data to remove
Returns:
True on success

template<class Type>
bool RmArray< Type >::reserve int  reserveSize  )  [inline]
 

Reserve memory.

Reserve memory enough to store reserveSize items so that each push_back will not have to reallocate memory until reserveSize items is reached.

Parameters:
\reserveSize Number of items to reserve memory for
Returns:
None

template<class Type>
bool RmArray< Type >::resize int  newSize  )  [inline]
 

Resize size of array.

Adjusts the size of the array

Parameters:
newSize Number of items
Returns:
None

template<class Type>
void RmArray< Type >::SetIncrementSize int  size  )  [inline]
 

Set increment size.

How much more to re-allocate when we have to resize array

Parameters:
size Number of items for additional allocation at each re-size
Returns:
None

template<class Type>
int RmArray< Type >::size  )  const [inline]
 

Size of array.

Returns the number of elements in the array

None


The documentation for this class was generated from the following file:
Generated on Fri Feb 25 16:08:53 2005 for RenderMonkey SDK by doxygen 1.3.6