Collection<type> class public functions

Collection
~Collection
allowGrowth
append
getAllocSize
getSize
grow
setGrowth
setSize
operator[]
zero

Collection(void);
Collection(int arraySize);
Collection(Collection<type>& aCollection);
Collection(int arraySize, type *aCollection);


~Collection();
Removes the array from the heap.

void allowGrowth(int status = 1);
is status is true, then trying to access the next highest element which isn't in the array.

void append(type& element);
Adds the element to the end of the array, grow if allocation size is same size as array.
void append(type element);
Same as append above, but for use with r-values.

long getAllocSize(void) const;
returns the allocation size of the array.

long getSize(void) const;
returns the size of the array (not the allocated size which may be greater).

void grow(long growamt = -1);
Increase the allocation size of the collection. If growamt is -1, then grow by the preset growth amount.

void setGrowth(long growth);
Sets the element increment to grow by when it is necessary to grow.

void setSize(long newSize);
sets the size of the collection (not the allocated size). If the size is greated then the allocated size, then the array will grow so that allocated size equals element size.

type& operator[](int arrayIndex);
Access the indexth element of the collection.

void zero(int minIndex = -1, int maxIndex = -1);
Put a zero value in each index location of the collection.




Send comments/errors on this page to
craig@ccrma.stanford.edu