Symbian Developer Library

SYMBIAN OS V6.1 EDITION FOR C++

[Index] [Glossary] [Previous] [Next]



Location: e32base.h
Link against: euser.lib

Class CArrayPtrFlat

CArrayPtrFlat<class T>

Support

Supported from 5.0

Description

Array of pointers to objects implemented using a flat dynamic buffer. The elements of the array are pointers to instances of the template class T and are contained within a CBufFlat.

This type of array has the full behaviour of flat arrays but, in addition, the CArrayPtr<class T>::ResetAndDestroy() function offers a way of destroying all of the objects whose pointers form the elements of the array, before resetting the array.

Notes:

Where possible, use the RPointerArray<class T> class as this is more efficient.

Derivation

CArrayFixA thin templated base class for arrays of fixed length objects
CArrayFixBaseBase class for arrays of fixed length objects
CArrayPtrA thin templated base class for arrays of pointers to objects
CArrayPtrFlatArray of pointers to objects implemented using a flat dynamic buffer
CBaseBase class for all classes to be instantiated on the heap

Defined in CArrayPtrFlat:
CArrayPtrFlat(), SetReserveL()

Inherited from CArrayFix:
AppendL(), AppendL()Append, Array(), At(), Back(), End(), ExpandL(), ExtendL(), Find(), FindIsq(), InsertIsqAllowDuplicatesL(), InsertIsqL(), InsertL(), ResizeL(), operator[]

Inherited from CArrayFixBase:
Compress(), Count(), Delete(), Length(), Reset(), Sort()

Inherited from CArrayPtr:
ResetAndDestroy()

Inherited from CBase:
operator new()


Construction


CArrayPtrFlat()

CArrayPtrFlat(TInt aGranularity);

Description

Constructs a flat array of pointers with specified granularity.

Notes

No memory is allocated to the array buffer by this C++ constructor.

Parameters

TInt aGranularity

The granularity of the array. This value must be positive otherwise the constructor raises an E32USER-CBase 18 panic.

[Top]


Reserve space


SetReserveL()

void SetReserveL(TInt aCount);

Description

Reserves space in the array buffer. If necessary, the array buffer is allocated or re-allocated so that it can accommodate the specified number of elements.

After a successful call to this function, elements can be added to the array and the process is guaranteed not to fail for lack of memory - provided the total number of elements does not exceed the specified number.

This function does not increase the number of elements in the array; i.e. the member function CArrayFixBase::Count() returns the same value both before and after a call to this function.

Parameters

TInt aCount

The total number of elements for which space is to be reserved. This value must not be less than the current number of elements in the array, otherwise the function raises an E32USER-CBase 27 panic.

Leave codes

 

The function leaves if there is insufficient memory available to allocate the reserved space.