![]() Home Page Toolkit Overview Using GML User Input Services Finger Tracker Calibrator Frame Grabber Service protocol Obtaining GML Installing GML Licence Developer Documentation Tcl/Tk API The GML Canvas Image processing Tcl Scripts Library List of Classes List of Files C/C++ API List of Classes List of Files |
gml_TDynamicArray Class Template Reference#include <gml_DynamicArray.h>
Collaboration diagram for gml_TDynamicArray: ![]() Detailed Descriptiontemplate<class T>
An array of fixed sized elements that can grow over time. Growth is by block of elements (not one element every time). Finding a free slot in the array is somewhat optimized using a bitmap of used slots.
|
Public Member Functions | |
gml_TError | Init (gml_TBlockSize nbElem=sDefaultNbElem, gml_TBlockSize nbIncrease=sDefaultNbIncrease) |
Initializes the array with nbElem elements of size elemSize. When a new element is required and the array is full, the array is re-allocated with nbIncrease more elements. | |
void | Dispose () |
Release the array resources. | |
T * | Base () |
Returns the base address of the array. | |
T * | GetElem (gml_TBlockSize *index=(gml_TBlockSize *) NULL) |
Get a pointer to a new element from the array. If index is not NULL, <*index> recieves the index of the element in the array. | |
void | ReleaseElem (T *elem) |
Flag elem as not being used anymore. | |
Static Public Attributes | |
static const gml_TBlockSize | sDefaultNbElem = 20 |
default starting number of elements in an array | |
static const gml_TBlockSize | sDefaultNbIncrease = 20 |
default additional slots allocated on array growth | |
Protected Member Functions | |
gml_TError | Allocate (gml_TBlockSize nbElem) |
Protected Attributes | |
gml_TBlockSize | fNbIncrease |
size of the increased allocation when a new element is < needed and the array is full | |
T * | fMem |
memory allocated for the array | |
gml_TBlockSize | fNbElem |
number of elements that the current memory can store | |
gml_TBlockSize | fInUse |
number of current allocated elements | |
UInt32 * | fBitmap |
bitmap of elements in use | |
gml_TBlockSize | fBMSize |
size (number of 32 bit words) of used bitmap |
T* Base | ( | ) | [inline] |
T * GetElem | ( | gml_TBlockSize * | index = (gml_TBlockSize *) NULL |
) | [inline] |
Get a pointer to a new element from the array. If index is not NULL, <*index> recieves the index of the element in the array.