Main Page | Modules | Namespace List | Data Structures | File List | Data Fields | Globals

ResizableArray Class Reference
[Global Functions]

A data structure that provides a resizable array This is used within Spam to avoid reading input data files multiple times, without having to use any STL library classes. More...

#include <ResizableArray.h>


Public Member Functions

 ResizableArray (int initialSize)
 Allocate the memory for the initial size of the array.

 ResizableArray ()
 Allocate the memory for the default initial size of the array.

 ~ResizableArray ()
 Destructor.

void Add (int item)
 Push an item onto the end of the array, resizing the local copy in memory if necessary.

void ToArray (int *&arr, int &len)
 Return a copy of the data in the ResizableArray.


Private Attributes

int * _memory
int memSize
int length

Static Private Attributes

const int DEFAULT_INITIAL_SIZE = 16


Detailed Description

A data structure that provides a resizable array This is used within Spam to avoid reading input data files multiple times, without having to use any STL library classes.

Definition at line 50 of file ResizableArray.h.


Constructor & Destructor Documentation

ResizableArray::ResizableArray int  initialSize  )  [inline]
 

Allocate the memory for the initial size of the array.

Parameters:
initialSize 

Definition at line 58 of file ResizableArray.h.

ResizableArray::ResizableArray  )  [inline]
 

Allocate the memory for the default initial size of the array.

Definition at line 69 of file ResizableArray.h.

ResizableArray::~ResizableArray  )  [inline]
 

Destructor.

Definition at line 77 of file ResizableArray.h.


Member Function Documentation

void ResizableArray::Add int  item  )  [inline]
 

Push an item onto the end of the array, resizing the local copy in memory if necessary.

Parameters:
item The item to add

Definition at line 88 of file ResizableArray.h.

Referenced by CollectASCIIInfo(), and CollectBinaryInfo().

void ResizableArray::ToArray int *&  arr,
int &  len
[inline]
 

Return a copy of the data in the ResizableArray.

Parameters:
arr The memory location to copy the array
len The number of elements in the array

Definition at line 117 of file ResizableArray.h.

Referenced by CollectASCIIInfo(), and CollectBinaryInfo().


Field Documentation

int* ResizableArray::_memory [private]
 

Definition at line 128 of file ResizableArray.h.

Referenced by Add(), ResizableArray(), ToArray(), and ~ResizableArray().

const int ResizableArray::DEFAULT_INITIAL_SIZE = 16 [static, private]
 

Definition at line 125 of file ResizableArray.h.

Referenced by ResizableArray().

int ResizableArray::length [private]
 

Definition at line 130 of file ResizableArray.h.

Referenced by Add(), ResizableArray(), and ToArray().

int ResizableArray::memSize [private]
 

Definition at line 129 of file ResizableArray.h.

Referenced by Add(), and ResizableArray().


The documentation for this class was generated from the following file:
Generated on Thu Mar 11 12:01:54 2004 for SPAM by doxygen 1.3.4