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

PointerArray Class Reference

The PointerArray class is a dynamically sized array that stores pointer type data. More...

List of all members.

Public Member Functions

 PointerArray ()
 The constructor for PointerArray simply calls the Construct function.
 ~PointerArray ()
 The destructor for LongArray simply calls the Destruct function.
void Construct ()
 The Construct function readies the internal structure of the PointerArray for use.
void Destruct ()
 The Destruct function cleans up the internal structure of the PointerArray.
void AddPointer (char *t)
 The AddPointer function adds a new unsigned long to the PointerArray.
char * ReturnAt (unsigned long i) const
 The ReturnAt function is used to get a pointer stored in a specific position within the array.
void AddAt (unsigned long i, char *t)
 The AddAt function replaces an element of the array with a new pointer.
void RemoveAt (unsigned long i)
 The RemoveAt function removes the pointer at a given position from the array.
unsigned long NumberOfPointers () const
 The NumberOfPointers function returns the number of elements currently in the array.

Public Attributes

char ** ar
 The internal array data.
unsigned long size
 The number of available elements in the internal array.
unsigned long used
 The number of elements in the internal array that are currently used.


Detailed Description

The PointerArray class is a dynamically sized array that stores pointer type data.

The pointer data is returned and pased to functions as char pointers, so you will need to use casts for other kinds of pointers. This class' implementation is nearly identical to Int8Array, CThingArray, and LongArray.

See also:
Int8Array

CThingArray

LongArray


Constructor & Destructor Documentation

PointerArray::PointerArray  ) 
 

The constructor for PointerArray simply calls the Construct function.

See also:
PointerArray::Construct()

PointerArray::~PointerArray  ) 
 

The destructor for LongArray simply calls the Destruct function.

See also:
PointerArray::Destruct()


Member Function Documentation

void PointerArray::AddAt unsigned long  i,
char *  t
 

The AddAt function replaces an element of the array with a new pointer.

If you try to replace an element at a position greater than the number of elements in the array nothing will happen.

Parameters:
i the index of the element to be replaced.
t the new pointer that will replace the old one.

void PointerArray::AddPointer char *  t  ) 
 

The AddPointer function adds a new unsigned long to the PointerArray.

If there is not enough storage in the internal array it will be expanded. The new pointer is always added to the end of the array. The size of the array is expanded by 8 every time it needs to be resized.

Parameters:
t a char pointer that is to be stored in this PointergArray

void PointerArray::Construct  ) 
 

The Construct function readies the internal structure of the PointerArray for use.

To reset an PointerArray you can call Destruct on it followed by a call to Construct.

See also:
PointerArray::Destruct()

void PointerArray::Destruct  ) 
 

The Destruct function cleans up the internal structure of the PointerArray.

The Destruct function does not attempt to free the pointers in any way.

See also:
PointerArray::Construct()

void PointerArray::RemoveAt unsigned long  i  ) 
 

The RemoveAt function removes the pointer at a given position from the array.

The old pointerg is replaced by what was previously the last pointer in the array and then the active part of the array is reduced by one. The RemoveAt function does not preserve the order of elements. Attempting to remove a position greater than the number of elements in the array has no effect.

Parameters:
i the index of the pointer to be removed.

char * PointerArray::ReturnAt unsigned long  i  )  const
 

The ReturnAt function is used to get a pointer stored in a specific position within the array.

If you attempt to return a pointer at a position greater than the number of elements stored in the array NULL will be the result.

Parameters:
i the index of the pointer to be returned.
Returns:
the pointer that was requested as a char pointer.


The documentation for this class was generated from the following files:
Generated on Sat Apr 16 16:31:09 2005 for Centum API by  doxygen 1.4.2