Main Page | Namespace List | Class Hierarchy | Compound List | File List | Compound Members | File Members | Related Pages

ap_array< T > Class Template Reference

List of all members.

Public Member Functions

void add (T a)
 Function to add an element to an array.

void add (T *a)
void trim ()
 Function to trim an array to exactly the right size.

void grow (int size)
 ap_array (int size_)
 Constructor which specifies the initial array size.

 ap_array ()
 Default constructor.

 ~ap_array ()
 Destructor.


Public Attributes

T * data
 The data for the array.

int size
 The number of locations which exist in the array.

int n
 The number of valid data items currently in the array.

template<class T>
class ap_array< T >


Constructor & Destructor Documentation

template<class T>
ap_array< T >::ap_array int  size_  ) 
 

Constructor which specifies the initial array size.

Parameters:
size_ The initial size.

template<class T>
ap_array< T >::ap_array  ) 
 

Default constructor.

It defaults to array size 10.

template<class T>
ap_array< T >::~ap_array  ) 
 

Destructor.

It deletes the allocated array.


Member Function Documentation

template<class T>
void ap_array< T >::add a  ) 
 

Function to add an element to an array.

The array will grow to twice the needed size when the array is too small to add a new item.

Parameters:
a The item to add.

template<class T>
void ap_array< T >::add T *  a  ) 
 

template<class T>
void ap_array< T >::trim  ) 
 

Function to trim an array to exactly the right size.

After adding items to an array, it may be almost twice as big as it needs to be. Using trim you can shrink it back to its proper size. It actually creates a new array and copies the data.

template<class T>
void ap_array< T >::grow int  size  ) 
 


Member Data Documentation

template<class T>
T* ap_array< T >::data
 

The data for the array.

template<class T>
int ap_array< T >::size
 

The number of locations which exist in the array.

template<class T>
int ap_array< T >::n
 

The number of valid data items currently in the array.


The documentation for this class was generated from the following file:
Generated on Thu Nov 27 08:17:11 2003 for Animp - Animated Particles by doxygen 1.3.2