gml_TArray Class Template Reference

#include <gml_Array.h>

Inherited by gml_TStack.

Collaboration diagram for gml_TArray:

Collaboration graph
[legend]
List of all members.

Detailed Description

template<typename T>
class gml_TArray< T >

Simple fixed-size typed arrays with transparent bounds checking.

If an out-of-bounds index in used, the program terminates immediately.

Checks are disabled if the NDEBUG macro is defined (like assertions).


Public Member Functions

 gml_TArray ()
 Zero size and payload address.
gml_TError Init (unsigned size)
 Allocate memory for the array.
void Dispose ()
 Release resources claimed by Init().
T & operator[] (unsigned const index)
 LValue indexing.
operator[] (unsigned const index) const
 RValue indexing.
unsigned Size () const
 Return the number of elements in the array.
gml_TError Wrap (unsigned size, T const *const data)
 Wrap an existing C array data of size items into a gml_TArray. A deep copy of the existing array is performed.
void Unwrap (unsigned size, T *const data)
 Copy this gml_TArray into an existing C array of size size. The number of objects copied is the smaller of size and the size of this array.
gml_TError Clone (gml_TArray< T > const source)
 Make this array a replicate of the argument array. Init () must have been called first. A deep copy of the existing array data is performed.
void Sort (int(*comparator)(T *, T *))
 Sort the underlying C array, using the argument comparison function.

Protected Attributes

unsigned fSize
 number of elements in array
T * fData
 array data

Member Function Documentation

gml_TError Wrap ( unsigned  size,
T const *const   data 
) [inline]

Wrap an existing C array data of size items into a gml_TArray. A deep copy of the existing array is performed.

Warning:
Make sure that the source array actually contains at least size items.

void Unwrap ( unsigned  size,
T *const  data 
) [inline]

Copy this gml_TArray into an existing C array of size size. The number of objects copied is the smaller of size and the size of this array.

Warning:
Make sure that the destination array actually can store at least size items.


The documentation for this class was generated from the following file:
Generated on Tue Jun 12 14:03:28 2007 for gml by Doxygen 1.5.2.