TFixedArray Class Reference

class TFixedArray

A thin wrapper class for C++ arrays allowing automatic checking of index values to ensure that all accesses are legal.

The class also supports the deletion of objects.

The class is templated, based on a class type and an integer value. The class type defines the type of object contained in the array; the integer value defines the size (dimension) of the array.

A wrapper object can be:

1. embedded in objects allocated on the heap.

2. used on the program stack.

Public Member Functions
TFixedArray ()
TFixedArray (const T *, TInt )
TArray < T > Array ()
T & At ( TInt )
const T & At ( TInt )
T * Begin ()
const T * Begin ()
void Copy (const T *, TInt )
TInt Count ()
void DeleteAll ()
T * End ()
const T * End ()
TInt Length ()
void Reset ()
T & operator[] ( TInt )
const T & operator[] ( TInt )
Protected Member Functions
const TAny * AtFunctionR (const CBase *, TInt )
TInt CountFunctionR (const CBase *)
TBool InRange ( TInt )
Private Member Type Definitions
typedef TFixedArray < T, S > ThisClass
Protected Attributes
T iRep

Constructor & Destructor Documentation

TFixedArray()

TFixedArray ( ) [inline]

Default constructor.

Constructs an uninitialised C++ array.

TFixedArray(const T *, TInt)

TFixedArray ( const T * aList,
TInt aLength
) [inline]

Constructs a C++ array initialised with the specified objects.

panic
USER 133, in a debug build only, if aLength is negative or is greater than the size of the array as defined by the integer template parameter.

Parameters

const T * aList A pointer to a set of contiguous objects.
TInt aLength The number of contiguous objects to be copied. This value must not be negative and must not be greater than the size of the array as defined by the integer template parameter.

Member Functions Documentation

Array()

TArray < T > Array ( ) const [inline]

Creates and returns a generic array for this C++ array.

At(TInt)

T & At ( TInt aIndex ) [inline]

Gets a reference to the specified element within the C++ array.

panic
USER 133, if aIndex is negative or greater than or equal to the size of the array as defined by the integer template parameter.

Parameters

TInt aIndex The position of the element within the array. This is an offset value; a zero value refers to the first element in the array. This value must be greater than or equal to zero and less than the size of the array.

At(TInt)

const T & At ( TInt aIndex ) const [inline]

Gets a const reference to the specified element within the C++ array.

panic
USER 133, in a debug build only, if aIndex is negative or greater than or equal to the size of the array as defined by the integer template parameter.

Parameters

TInt aIndex The position of the element within the array. This is an offset value; a zero value refers to the first element in the array. This value must be greater than or equal to zero and less than the size of the array.

AtFunctionR(const CBase *, TInt)

const TAny * AtFunctionR ( const CBase * aThis,
TInt aIndex
) [protected, static, inline]

Parameters

const CBase * aThis
TInt aIndex

Begin()

T * Begin ( ) [inline]

Gets a pointer to the first element of the array.

Begin()

const T * Begin ( ) const [inline]

Gets a pointer to the first element of the array.

Copy(const T *, TInt)

void Copy ( const T * aList,
TInt aLength
) [inline]

Copies the specified set of contiguous objects into the C++ array.

The copy operation starts at the beginning of the array, replacing any existing data.

panic
USER 133, in a debug build only, if aLength is negative or is greater than the size of the array as defined by the integer template parameter.

Parameters

const T * aList A pointer to a set of contiguous objects.
TInt aLength The number of contiguous objects to be copied. This value must not be negative and must not be greater than the size of the array as defined by the integer template parameter.

Count()

TInt Count ( ) const [inline]

Gets the size of the array.

For any instance of this class, the array size is fixed and has the same value as the integer template parameter.

CountFunctionR(const CBase *)

TInt CountFunctionR ( const CBase * aThis ) [protected, static, inline]

Parameters

const CBase * aThis

DeleteAll()

void DeleteAll ( ) [inline]

Invokes the delete operator on every member of the array.

The function can only be used for arrays of pointers to CBase derived objects.

If the array is to be used after a call to this function, it is good practice to call TFixedArray<class T,TInt S>::Reset() to set all array elements to NULL.

End()

T * End ( ) [inline]

Gets a pointer to the first byte following the end of the array.

End()

const T * End ( ) const [inline]

Gets a pointer to the first byte following the end of the array.

InRange(TInt)

TBool InRange ( TInt aIndex ) [protected, static, inline]

Parameters

TInt aIndex

Length()

TInt Length ( ) const [inline]

Gets the size of an array element, in bytes.

Reset()

void Reset ( ) [inline]

Fills every element of the array with binary zeroes.

operator[](TInt)

T & operator[] ( TInt aIndex ) [inline]

Gets a reference to the specified element within the C++ array.

panic
USER 133, in a debug build only, if aIndex is negative or greater than or equal to the size of the array as defined by the integer template parameter.

Parameters

TInt aIndex The position of the element within the array. This is an offset value; a zero value refers to the first element in the array. This value must be greater than or equal to zero and less than the size of the array.

operator[](TInt)

const T & operator[] ( TInt aIndex ) const [inline]

Gets a const reference to the specified element within the C++ array.

panic
USER 133, in a debug build only, if aIndex is negative or greater than or equal to the size of the array as defined by the integer template parameter.

Parameters

TInt aIndex The position of the element within the array. This is an offset value; a zero value refers to the first element in the array. This value must be greater than or equal to zero and less than the size of the array.

Member Type Definitions Documentation

Typedef ThisClass

typedef TFixedArray < T, S > ThisClass [private]

Member Data Documentation

T iRep

T iRep [protected]