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

LongArray Class Reference

The LongArray class is a dynamically sized array that stores unsigned long type data. More...

List of all members.

Public Member Functions

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

Public Attributes

unsigned long * 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 LongArray class is a dynamically sized array that stores unsigned long type data.

This class' implementation is nearly identical to Int8Array, CThingArray, and PointerArray.

See also:
Int8Array

CThingArray

PointerArray


Constructor & Destructor Documentation

LongArray::LongArray  ) 
 

The constructor for LongArray simply calls the Construct function.

See also:
LongArray::Construct()

LongArray::~LongArray  ) 
 

The destructor for LongArray simply calls the Destruct function.

See also:
LongArray::Destruct()


Member Function Documentation

void LongArray::AddAt unsigned long  i,
unsigned long  t
 

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

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 unsigned long that will replace the old one.

void LongArray::AddLong unsigned long  t  ) 
 

The AddLong function adds a new unsigned long to the LongArray.

If there is not enough storage in the internal array it will be expanded. The new unsigned long 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 unsinged long that is to be stored in this LongArray

void LongArray::Construct  ) 
 

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

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

See also:
LongArray::Destruct()

void LongArray::Destruct  ) 
 

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

See also:
LongArray::Construct()

unsigned long LongArray::Find unsigned long  v  )  const
 

The Find function returns the index of the first element of a certain unsigned long value.

The find function searches from the first element to the last element and returns the zero based index when it finds the item. If it cannot be found -1, cast to an unsigned long, is returned.

Parameters:
v the value to find
Returns:
the index of the value, or -1 if not found.

void LongArray::RemoveAt unsigned long  i  ) 
 

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

The old unsigned long is replaced by what was previously the last unsigned long 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 unsigned long to be removed.

unsigned long LongArray::ReturnAt unsigned long  i  )  const
 

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

If you attempt to return an unsigned long at a position greater than the number of elements stored in the array 0 will be the result.

Parameters:
i the index of the unsigned long to be returned.
Returns:
the unsigned long that was requested.


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