Original Symbian headers
Selected EUSER, Window Server, networking, graphics and device declarations
Loading...
Searching...
No Matches
CArrayPtrFlat< T > Class Template Reference

Array of pointers to objects implemented using a flat dynamic buffer. More...

#include <e32base.h>

Inheritance diagram for CArrayPtrFlat< T >:
CArrayPtr< T > CArrayFix< T * > CArrayFixBase CBase

Public Member Functions

 CArrayPtrFlat (TInt aGranularity)
 Constructs a flat array of pointers with specified granularity.
 
void SetReserveL (TInt aCount)
 Reserves space in the array buffer.
 
- Public Member Functions inherited from CArrayPtr< T >
 CArrayPtr (TBufRep aRep, TInt aGranularity)
 
void ResetAndDestroy ()
 Destroys all objects whose pointers form the elements of the array, before resetting the array.
 
- Public Member Functions inherited from CArrayFix< T * >
 CArrayFix (TBufRep aRep, TInt aGranularity)
 
const T * & operator[] (TInt anIndex) const
 Gets a const reference to the element located at the specified position within the array.
 
T * & operator[] (TInt anIndex)
 Gets a non-const reference to the element located at the specified position within the array.
 
const T * & At (TInt anIndex) const
 Gets a const reference to the element located at the specified position within the array.
 
T * & At (TInt anIndex)
 Gets a non-const reference to the element located at the specified position within the array.
 
const T * * End (TInt anIndex) const
 Gets a pointer to the (const) first byte following the end of the contiguous region containing the element at the specified position within the array.
 
T * * End (TInt anIndex)
 Gets a pointer to the first byte following the end of the contiguous region containing the element at the specified position within the array.
 
const T * * Back (TInt anIndex) const
 Gets a pointer to the (const) beginning of a contiguous region.
 
T * * Back (TInt anIndex)
 Gets a pointer to the beginning of a contiguous region.
 
void AppendL (const T * &aRef)
 Appends a single element onto the end of the array.
 
void AppendL (const T * *aPtr, TInt aCount)
 Appends one or more elements onto the end of the array.
 
void AppendL (const T * &aRef, TInt aReplicas)
 Appends replicated copies of an element onto the end of the array.
 
T * & ExpandL (TInt anIndex)
 Expands the array by one element at the specified position.
 
T * & ExtendL ()
 Expands the array by one element at the end of the array.
 
TInt Find (const T * &aRef, TKeyArrayFix &aKey, TInt &anIndex) const
 Finds the position of an element within the array, based on the matching of keys, using a sequential search.
 
TInt FindIsq (const T * &aRef, TKeyArrayFix &aKey, TInt &anIndex) const
 Finds the position of an element within the array, based on the matching of keys, using a binary search technique.
 
void InsertL (TInt anIndex, const T * &aRef)
 Inserts an element into the array at the specified position.
 
void InsertL (TInt anIndex, const T * *aPtr, TInt aCount)
 Inserts one or more elements into the array at the specified position.
 
void InsertL (TInt anIndex, const T * &aRef, TInt aReplicas)
 Inserts replicated copies of an element into the array at the specified position.
 
TInt InsertIsqL (const T * &aRef, TKeyArrayFix &aKey)
 Inserts a single element into the array at a position determined by a key.
 
TInt InsertIsqAllowDuplicatesL (const T * &aRef, TKeyArrayFix &aKey)
 Inserts a single element into the array at a position determined by a key, allowing duplicates.
 
void ResizeL (TInt aCount)
 Changes the size of the array so that it contains the specified number of elements.
 
void ResizeL (TInt aCount, const T * &aRef)
 Changes the size of the array so that it contains the specified number of elements.
 
const TArray< T * > Array () const
 Constructs and returns a TArray<T> object.
 
- Public Member Functions inherited from CArrayFixBase
IMPORT_C ~CArrayFixBase ()
 Destructor.
 
TInt Count () const
 Gets the number of elements held in the array.
 
TInt Length () const
 Gets the length of an element.
 
IMPORT_C void Compress ()
 Compresses the array.
 
IMPORT_C void Reset ()
 Deletes all elements from the array and frees the memory allocated to the array buffer.
 
IMPORT_C TInt Sort (TKeyArrayFix &aKey)
 Sorts the elements of the array into key sequence.
 
IMPORT_C TAny * At (TInt anIndex) const
 Index into the array.
 
IMPORT_C TAny * End (TInt anIndex) const
 Return a pointer past contiguous elements starting at anIndex.
 
IMPORT_C TAny * Back (TInt anIndex) const
 Return a pointer to contiguous elements before anIndex.
 
IMPORT_C void Delete (TInt anIndex)
 Deletes a single element from the array at a specified position.
 
IMPORT_C void Delete (TInt anIndex, TInt aCount)
 Deletes one or more contiguous elements from the array, starting at a specific position.
 
IMPORT_C TAny * ExpandL (TInt anIndex)
 Expand the array to make room for a new record at anIndex.
 
IMPORT_C TInt Find (const TAny *aPtr, TKeyArrayFix &aKey, TInt &anIndex) const
 Find in the array using a sequential search.
 
IMPORT_C TInt FindIsq (const TAny *aPtr, TKeyArrayFix &aKey, TInt &anIndex) const
 Find in the array using a binary search.
 
IMPORT_C void InsertL (TInt anIndex, const TAny *aPtr)
 Insert a record into the array.
 
IMPORT_C void InsertL (TInt anIndex, const TAny *aPtr, TInt aCount)
 Insert aCount records into the array.
 
IMPORT_C TInt InsertIsqL (const TAny *aPtr, TKeyArrayFix &aKey)
 Insert in sequence, no duplicates allowed.
 
IMPORT_C TInt InsertIsqAllowDuplicatesL (const TAny *aPtr, TKeyArrayFix &aKey)
 Insert in sequence, allow duplicates.
 
IMPORT_C void ResizeL (TInt aCount, const TAny *aPtr)
 Resize the array to contain aCount records, copying a record into any new slots.
 
- Public Member Functions inherited from CBase
 CBase ()
 Default constructor.
 
virtual IMPORT_C ~CBase ()
 Virtual destructor.
 
TAny * operator new (TUint aSize, TAny *aBase) __NO_THROW
 Initialises the object to binary zeroes.
 
TAny * operator new (TUint aSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TUint aExtraSize) __NO_THROW
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 
TAny * operator new (TUint aSize, TLeave, TUint aExtraSize)
 Allocates the object from the heap and then initialises its contents to binary zeroes.
 

Additional Inherited Members

- Static Public Member Functions inherited from CBase
static IMPORT_C void Delete (CBase *aPtr)
 Deletes the specified object.
 
- Protected Member Functions inherited from CArrayFixBase
IMPORT_C CArrayFixBase (TBufRep aRep, TInt aRecordLength, TInt aGranularity)
 Constructor.
 
IMPORT_C void InsertRepL (TInt anIndex, const TAny *aPtr, TInt aReplicas)
 Insert aReplicas copies of a record into the array.
 
IMPORT_C void SetKey (TKeyArrayFix &aKey) const
 Set the key data.
 
IMPORT_C void SetReserveFlatL (TInt aCount)
 Reserve space to contain aCount items.
 
- Protected Member Functions inherited from CBase
virtual IMPORT_C TInt Extension_ (TUint aExtensionId, TAny *&a0, TAny *a1)
 Extension function.
 
- Static Protected Member Functions inherited from CArrayFixBase
static IMPORT_C TInt CountR (const CBase *aPtr)
 Return the number of items in the array.
 
static IMPORT_C const TAny * AtR (const CBase *aPtr, TInt anIndex)
 Return the address of an item in the array.
 

Detailed Description

template<class T>
class CArrayPtrFlat< T >

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.

Note that where possible, use the RPointerArray<class T> class as this is more efficient.

See also
CBufFlat
CArrayPtr::ResetAndDestroy
RPointerArray
API status
Published to all clients. Released API.

Definition at line 650 of file e32base.h.

Constructor & Destructor Documentation

◆ CArrayPtrFlat()

template<class T >
CArrayPtrFlat< T >::CArrayPtrFlat ( TInt  aGranularity)
inlineexplicit

Constructs a flat array of pointers with specified granularity.

Note that no memory is allocated to the array buffer by this constructor.

Parameters
aGranularityThe granularity of the array.

Panic condition: E32USER-CBase 18, if aGranularity is not positive.

(generated from Symbian Developer Library)

Member Function Documentation

◆ SetReserveL()

template<class T >
void CArrayPtrFlat< T >::SetReserveL ( TInt  aCount)
inline

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
aCountThe total number of elements for which space is to be reserved.

Panic condition: E32USER-CBase 27, if aCount is less than the current number of elements in the array.

(generated from Symbian Developer Library)


The documentation for this class was generated from the following files: