RPointerArray< TAny > Class Template Reference

#include <e32cmn.h>

template <>
class RPointerArray< TAny > : private RPointerArrayBase

Inherits from

Public Member Functions
RPointerArray()
RPointerArray(TInt)
RPointerArray(TInt, TInt)
RPointerArray(TAny **, TInt)
TInt Append(const TAny *)
voidAppendL(const TAny *)
TArray< TAny * >Array()
voidClose()
voidCompress()
TInt Count()
TInt Find(const TAny *)
TInt FindInAddressOrder(const TAny *)
TInt FindInAddressOrder(const TAny *, TInt &)
TInt FindInAddressOrderL(const TAny *)
voidFindInAddressOrderL(const TAny *, TInt &)
TInt FindL(const TAny *)
TInt FindReverse(const TAny *)
TInt FindReverseL(const TAny *)
voidGranularCompress()
TInt Insert(const TAny *, TInt)
TInt InsertInAddressOrder(const TAny *)
TInt InsertInAddressOrderAllowRepeats(const TAny *)
voidInsertInAddressOrderAllowRepeatsL(const TAny *)
voidInsertInAddressOrderL(const TAny *)
voidInsertL(const TAny *, TInt)
voidRemove(TInt)
voidReset()
voidSortIntoAddressOrder()
TInt SpecificFindInAddressOrder(const TAny *, TInt)
TInt SpecificFindInAddressOrder(const TAny *, TInt &, TInt)
TInt SpecificFindInAddressOrderL(const TAny *, TInt)
voidSpecificFindInAddressOrderL(const TAny *, TInt &, TInt)
TAny *const &operator[](TInt)
TAny *&operator[](TInt)
Inherited Functions
RPointerArrayBase::At(TInt)const
RPointerArrayBase::BinarySearch(const TAny *,TInt &,TGeneralLinearOrder)const
RPointerArrayBase::BinarySearch(const TAny *,TInt &,TGeneralLinearOrder,TInt)const
RPointerArrayBase::BinarySearchSigned(TInt,TInt &)const
RPointerArrayBase::BinarySearchSigned(TInt,TInt &,TInt)const
RPointerArrayBase::BinarySearchUnsigned(TUint,TInt &)const
RPointerArrayBase::BinarySearchUnsigned(TUint,TInt &,TInt)const
RPointerArrayBase::DoReserve(TInt)
RPointerArrayBase::Entries()
RPointerArrayBase::Find(const TAny *,TGeneralIdentityRelation)const
RPointerArrayBase::FindIsq(const TAny *,TGeneralLinearOrder)const
RPointerArrayBase::FindIsq(const TAny *,TGeneralLinearOrder,TInt)const
RPointerArrayBase::FindIsqSigned(TInt)const
RPointerArrayBase::FindIsqSigned(TInt,TInt)const
RPointerArrayBase::FindIsqUnsigned(TUint)const
RPointerArrayBase::FindIsqUnsigned(TUint,TInt)const
RPointerArrayBase::FindReverse(const TAny *,TGeneralIdentityRelation)const
RPointerArrayBase::GetCount(const CBase *)
RPointerArrayBase::GetElementPtr(const CBase *,TInt)
RPointerArrayBase::HeapSort(TGeneralLinearOrder)
RPointerArrayBase::HeapSortSigned()
RPointerArrayBase::HeapSortUnsigned()
RPointerArrayBase::InsertIsq(const TAny *,TGeneralLinearOrder,TBool)
RPointerArrayBase::InsertIsqSigned(TInt,TBool)
RPointerArrayBase::InsertIsqUnsigned(TUint,TBool)
RPointerArrayBase::RPointerArrayBase()
RPointerArrayBase::RPointerArrayBase(TAny **,TInt)
RPointerArrayBase::RPointerArrayBase(TInt)
RPointerArrayBase::RPointerArrayBase(TInt,TInt)
RPointerArrayBase::ZeroCount()

Detailed Description

Array of raw pointers.

The array is a simple and efficient specialized array of TAny pointers offering standard array behaviour.

The derivation from RPointerArrayBase is private.

Constructor & Destructor Documentation

RPointerArray ( )

RPointerArray()[inline]

Default C++ constructor.

This constructs an array object for an array of TAny pointers with default granularity, which is 8.

RPointerArray ( TInt )

RPointerArray(TIntaGranularity)[inline, explicit]

C++ constructor with granularity.

This constructs an array object for an array of TAny pointers with the specified granularity.

Parameters
aGranularityThe granularity of the array.
Panic Codes
USER127, if aGranularity is not positive, or greater than or equal to 0x10000000.

RPointerArray ( TInt, TInt )

RPointerArray(TIntaMinGrowBy,
TIntaFactor
)[inline]

C++ constructor with minimum growth step and exponential growth factor.

This constructs an array object for an array of TAny pointers with the specified minimum growth step and exponential growth factor.

Parameters
aMinGrowByThe minimum growth step of the array. Must be between 1 and 65535 inclusive.
aFactorThe factor by which the array grows, multiplied by 256. For example 512 specifies a factor of 2. Must be between 257 and 32767 inclusive.
Panic Codes
USER192, if aMinGrowBy<=0 or aMinGrowBy>65535.
USER193, if aFactor<=257 or aFactor>32767.

RPointerArray ( TAny **, TInt )

RPointerArray(TAny **aEntries,
TIntaCount
)[inline]

C++ constructor with a pointer to the first array entry in a pre-existing array, and the number of entries in that array.

This constructor takes a pointer to a pre-existing set of entries of type TAny*, which is owned by another RPointerArray object. Ownership of the set of entries still resides with the original RPointerArray object.

Parameters
aEntriesA pointer to the first entry of type TAny* in the set of entries belonging to the existing array.
aCountThe number of entries in the existing array. The granularity of this array is set to this value.
Panic Codes
USER156, if aCount is not positive.

Member Function Documentation

Append ( const TAny * )

TInt Append(const TAny *anEntry)[inline]

Reimplemented from RPointerArrayBase::Append(const TAny *)

Appends an pointer onto the array.

Parameters
anEntryThe pointer to be appended.
Return Value
KErrNone, if the insertion is successful, otherwise one of the system wide error codes.

AppendL ( const TAny * )

voidAppendL(const TAny *anEntry)[inline]

Appends an pointer onto the array.

The function leaves with one of the system wide error codes, if the operation fails.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be appended.

Array ( )

TArray< TAny * >Array()const [inline]

Constructs and returns a generic array.

See also: TArray

Return Value
A generic array representing this array.

Close ( )

voidClose()[inline]

Reimplemented from RPointerArrayBase::Close()

Closes the array and frees all memory allocated to it.

The function must be called before this array object goes out of scope.

Note that the function does not delete the objects whose pointers are contained in the array.

Compress ( )

voidCompress()[inline]

Reimplemented from RPointerArrayBase::Compress()

Compresses the array down to a minimum.

After a call to this function, the memory allocated to the array is just sufficient for its contained pointers. Subsequently adding a new pointer to the array always results in a re-allocation of memory.

Count ( )

TInt Count()const [inline]

Reimplemented from RPointerArrayBase::Count()const

Gets the number of pointers in the array.

Return Value
The number of pointers in the array.

Find ( const TAny * )

TInt Find(const TAny *anEntry)const [inline]

Reimplemented from RPointerArrayBase::Find(const TAny *)const

Finds the first pointer in the array which matches the specified pointer, using a sequential search.

Matching is based on the comparison of pointers.

The find operation always starts at the low index end of the array. There is no assumption about the order of objects in the array.

Parameters
anEntryThe pointer to be found.
Return Value
The index of the first matching pointer within the array. KErrNotFound, if no matching pointer can be found.

FindInAddressOrder ( const TAny * )

TInt FindInAddressOrder(const TAny *anEntry)const [inline]

Finds the pointer in the array that matches the specified object pointer, using a binary search technique.

The function assumes that pointers in the array are in address order.

Parameters
anEntryThe pointer to be found.
Return Value
The index of the matching pointer within the array or KErrNotFound if no suitable pointer can be found.

FindInAddressOrder ( const TAny *, TInt & )

TInt FindInAddressOrder(const TAny *anEntry,
TInt &anIndex
)const [inline]

Finds the pointer in the array that matches the specified object pointer, using a binary search technique.

The function assumes that pointers in the array are in address order.

Parameters
anEntryThe pointer to be found.
anIndexA TInt supplied by the caller. On return, contains an index value: If the function returns KErrNone, this is the index of the matching pointer within the array. If the function returns KErrNotFound, this is the index of the last pointer within the array which logically precedes anEntry.
Return Value
KErrNone, if a matching pointer is found. KErrNotFound, if no suitable pointer can be found.

FindInAddressOrderL ( const TAny * )

TInt FindInAddressOrderL(const TAny *anEntry)const [inline]

Finds the pointer in the array that matches the specified pointer, using a binary search technique.

The function assumes that pointers in the array are in address order.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be found.
Return Value
The index of the matching pointer within the array
Leave Codes
KErrNotFound,if no suitable pointer can be found.

FindInAddressOrderL ( const TAny *, TInt & )

voidFindInAddressOrderL(const TAny *anEntry,
TInt &anIndex
)const [inline]

Finds the pointer in the array that matches the specified pointer, using a binary search technique.

The function assumes that pointers in the array are in address order.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be found.
anIndexA reference to a TInt into which the function puts an index value: If the function does not leave, this is the index of the matching pointer within the array. If the function leaves with KErrNotFound, this is the index of the last pointer within the array which logically precedes anEntry.
Leave Codes
KErrNotFound,if no suitable pointer can be found.

FindL ( const TAny * )

TInt FindL(const TAny *anEntry)const [inline]

Finds the first pointer in the array which matches the specified pointer, using a sequential search.

Matching is based on the comparison of pointers.

The find operation always starts at the low index end of the array. There is no assumption about the order of objects in the array.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be found.
Return Value
The index of the first matching pointer within the array.
Leave Codes
KErrNotFound,if no matching pointer can be found.

FindReverse ( const TAny * )

TInt FindReverse(const TAny *anEntry)const [inline]

Reimplemented from RPointerArrayBase::FindReverse(const TAny *)const

Finds the last pointer in the array which matches the specified pointer, using a sequential search.

Matching is based on the comparison of pointers.

The find operation always starts at the high index end of the array. There is no assumption about the order of objects in the array.

Parameters
anEntryThe pointer to be found.
Return Value
The index of the last matching pointer within the array. KErrNotFound, if no matching pointer can be found.

FindReverseL ( const TAny * )

TInt FindReverseL(const TAny *anEntry)const [inline]

Finds the last pointer in the array which matches the specified pointer, using a sequential search.

Matching is based on the comparison of pointers.

The find operation always starts at the high index end of the array. There is no assumption about the order of objects in the array.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be found.
Return Value
The index of the last matching pointer within the array.
Leave Codes
KErrNotFound,if no matching pointer can be found.

GranularCompress ( )

voidGranularCompress()[inline]

Reimplemented from RPointerArrayBase::GranularCompress()

Compresses the array down to a granular boundary.

After a call to this function, the memory allocated to the array is sufficient for its contained pointers. Adding new pointers to the array does not result in a re-allocation of memory until the the total number of pointers reaches a multiple of the granularity.

Insert ( const TAny *, TInt )

TInt Insert(const TAny *anEntry,
TIntaPos
)[inline]

Reimplemented from RPointerArrayBase::Insert(const TAny *,TInt)

Inserts an pointer into the array at the specified position.

Parameters
anEntryThe pointer to be inserted.
aPosThe position within the array where the pointer is to be inserted. The position is relative to zero, i.e. zero implies that a pointer is inserted at the beginning of the array.
Return Value
KErrNone, if the insertion is successful, otherwise one of the system wide error codes.
Panic Codes
USER131, if aPos is negative, or is greater than the number of object pointers currently in the array.

InsertInAddressOrder ( const TAny * )

TInt InsertInAddressOrder(const TAny *anEntry)[inline]

Inserts an pointer into the array in address order.

No duplicate entries are permitted. The array remains unchanged following an attempt to insert a duplicate entry.

The function assumes that existing pointers within the array are in address order.

Parameters
anEntryThe pointer to be inserted.
Return Value
KErrNone, if the insertion is successful; KErrAlreadyExists, if an attempt is being made to insert a duplicate entry; otherwise one of the other system wide error codes.

InsertInAddressOrderAllowRepeats ( const TAny * )

TInt InsertInAddressOrderAllowRepeats(const TAny *anEntry)[inline]

Inserts an pointer into the array in address order, allowing duplicates.

If the new pointer is a duplicate of an existing pointer in the array, then the new pointer is inserted after the existing one. If more than one duplicate pointer already exists in the array, then any new duplicate pointer is inserted after the last one.

The function assumes that existing pointers within the array are in address order.

Parameters
anEntryThe pointer to be inserted.
Return Value
KErrNone, if the insertion is successful, otherwise one of the system wide error codes.

InsertInAddressOrderAllowRepeatsL ( const TAny * )

voidInsertInAddressOrderAllowRepeatsL(const TAny *anEntry)[inline]

Inserts an pointer into the array in address order, allowing duplicates.

If the new pointer is a duplicate of an existing pointer in the array, then the new pointer is inserted after the existing one. If more than one duplicate pointer already exists in the array, then any new duplicate pointer is inserted after the last one.

The function assumes that existing pointers within the array are in address order.

The function leaves with one of the system wide error codes, if the operation fails.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be inserted.

InsertInAddressOrderL ( const TAny * )

voidInsertInAddressOrderL(const TAny *anEntry)[inline]

Inserts an pointer into the array in address order.

No duplicate entries are permitted. The function assumes that existing pointers within the array are in address order.

The function leaves with one of the system wide error codes, if the operation fails.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be inserted.

InsertL ( const TAny *, TInt )

voidInsertL(const TAny *anEntry,
TIntaPos
)[inline]

Inserts an pointer into the array at the specified position.

The function leaves with one of the system wide error codes, if the operation fails.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

Parameters
anEntryThe pointer to be inserted.
aPosThe position within the array where the pointer is to be inserted. The position is relative to zero, i.e. zero implies that a pointer is inserted at the beginning of the array.
Panic Codes
USER131, if aPos is negative, or is greater than the number of object pointers currently in the array.

Remove ( TInt )

voidRemove(TIntanIndex)[inline]

Reimplemented from RPointerArrayBase::Remove(TInt)

Removes the pointer at the specified position from the array.

Note that the function does not delete the object whose pointer is removed.

Parameters
anIndexThe position within the array from where the pointer is to be removed. The position is relative to zero, i.e. zero implies that a pointer at the beginning of the array is to be removed.
Panic Codes
USER130, if anIndex is negative, or is greater than the number of objects currently in the array.

Reset ( )

voidReset()[inline]

Reimplemented from RPointerArrayBase::Reset()

Empties the array.

It frees all memory allocated to the array and resets the internal state so that it is ready to be reused.

This array object can be allowed to go out of scope after a call to this function.

Note that the function does not delete the objects whose pointers are contained in the array.

SortIntoAddressOrder ( )

voidSortIntoAddressOrder()[inline]

Sorts the pointers within the array into address order.

SpecificFindInAddressOrder ( const TAny *, TInt )

TInt SpecificFindInAddressOrder(const TAny *anEntry,
TIntaMode
)const [inline]

Finds the pointer in the array that matches the specified pointer, using a binary search technique.

Where there is more than one matching element, it finds the first, the last or any matching element as specified by the value of aMode.

The function assumes that pointers in the array are in address order.

See also: TArrayFindMode

Parameters
anEntryThe pointer to be found.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.
Return Value
KErrNotFound, if there is no matching element, otherwise the array index of a matching element - what the index refers to depends on the value of aMode: if this is EArrayFindMode_First, then the index refers to the first matching element; if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; if this is EArrayFindMode_Last, then the index refers to first element that follows the last matching element - if the last matching element is also the last element of the array, then the index value is the same as the total number of elements in the array.

SpecificFindInAddressOrder ( const TAny *, TInt &, TInt )

TInt SpecificFindInAddressOrder(const TAny *anEntry,
TInt &anIndex,
TIntaMode
)const [inline]

Finds the pointer in the array that matches the specified pointer, using a binary search technique.

Where there is more than one matching element, it finds the first, the last or any matching element as specified by the value of aMode.

The function assumes that pointers in the array are in address order.

See also: TArrayFindMode

Parameters
anEntryThe pointer to be found.
anIndexA TInt type supplied by the caller. On return, it contains an index value depending on whether a match is found and on the value of aMode. If there is no matching element in the array, then this is the index of the first element in the array that is bigger than the element being searched for - if no elements in the array are bigger, then the index value is the same as the total number of elements in the array. If there is a matching element, then what the index refers to depends on the value of aMode: if this is EArrayFindMode_First, then the index refers to the first matching element; if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; if this is EArrayFindMode_Last, then the index refers to first element that follows the last matching element - if the last matching element is also the last element of the array, then the index value is the same as the total number of elements in the array.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.
Return Value
KErrNone, if a matching pointer is found. KErrNotFound, if no suitable pointer can be found.

SpecificFindInAddressOrderL ( const TAny *, TInt )

TInt SpecificFindInAddressOrderL(const TAny *anEntry,
TIntaMode
)const [inline]

Finds the pointer in the array that matches the specified pointer, using a binary search technique.

Where there is more than one matching element, it finds the first, the last or any matching element as specified by the value of aMode.

The function assumes that pointers in the array are in address order.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

See also: TArrayFindMode

Parameters
anEntryThe pointer to be found.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.
Return Value
If there is a matching element, the array index of a matching element - what the index refers to depends on the value of aMode: if this is EArrayFindMode_First, then the index refers to the first matching element; if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; if this is EArrayFindMode_Last, then the index refers to first element that follows the last matching element - if the last matching element is also the last element of the array, then the index value is the same as the total number of elements in the array.
Leave Codes
KErrNotFoundif no matching entry exists.

SpecificFindInAddressOrderL ( const TAny *, TInt &, TInt )

voidSpecificFindInAddressOrderL(const TAny *anEntry,
TInt &anIndex,
TIntaMode
)const [inline]

Finds the pointer in the array that matches the specified pointer, using a binary search technique.

Where there is more than one matching element, it finds the first, the last or any matching element as specified by the value of aMode.

The function assumes that pointers in the array are in address order.

NOTE: This function is NOT AVAILABLE to code running on the kernel side.

See also: TArrayFindMode

Parameters
anEntryThe pointer to be found.
anIndexA TInt type supplied by the caller. On return, it contains an index value depending on whether a match is found and on the value of aMode. If there is no matching element in the array, then this is the index of the first element in the array that is bigger than the element being searched for - if no elements in the array are bigger, then the index value is the same as the total number of elements in the array. If there is a matching element, then what the index refers to depends on the value of aMode: if this is EArrayFindMode_First, then the index refers to the first matching element; if this is EArrayFindMode_Any, then the index can refer to any of the matching elements; if this is EArrayFindMode_Last, then the index refers to first element that follows the last matching element - if the last matching element is also the last element of the array, then the index value is the same as the total number of elements in the array.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.
Leave Codes
KErrNotFound,if no suitable pointer can be found.

operator[] ( TInt )

TAny *const &operator[](TIntanIndex)const [inline]

Gets a reference to the pointer located at the specified position within the array.

The compiler chooses this option if the returned reference is used in an expression where the reference cannot be modified.

Parameters
anIndexThe position of the pointer within the array. The position is relative to zero, i.e. zero implies the object pointer at the beginning of the array.
Return Value
A const reference to the pointer at position anIndex within the array.
Panic Codes
USER130, if anIndex is negative, or is greater than the number of objects currently in the array.

operator[] ( TInt )

TAny *&operator[](TIntanIndex)[inline]

Gets a reference to the pointer located at the specified position within the array.

The compiler chooses this option if the returned reference is used in an expression where the reference can be modified.

Parameters
anIndexThe position of the pointer within the array. The position is relative to zero, i.e. zero implies the object pointer at the beginning of the array.
Return Value
A non-const reference to the pointer at position anIndex within the array.
Panic Codes
USER130, if anIndex is negative, or is greater than the number of objects currently in the array.