RPointerArray Class Reference

#include <e32cmn.h>

Link against: libm.lib

class RPointerArray : private RPointerArrayBase

Inherits from

Public Member Functions
RPointerArray()
RPointerArray(TInt)
RPointerArray(TInt, TInt)
RPointerArray(T **, TInt)
TInt Append(const T *)
voidAppendL(const T *)
TArray< T * >Array()
voidClose()
voidCompress()
TInt Count()
TInt Find(const T *)
TInt Find(const T *, TIdentityRelation< T >)
TInt Find(const K &, TBool(*)(const K *k, const T &t))
TInt FindInAddressOrder(const T *)
TInt FindInAddressOrder(const T *, TInt &)
TInt FindInAddressOrderL(const T *)
voidFindInAddressOrderL(const T *, TInt &)
TInt FindInOrder(const T *, TLinearOrder< T >)
TInt FindInOrder(const T *, TInt &, TLinearOrder< T >)
TInt FindInOrder(const K &, TInt(*)(const K *k, const T &t))
TInt FindInOrderL(const T *, TLinearOrder< T >)
voidFindInOrderL(const T *, TInt &, TLinearOrder< T >)
TInt FindL(const T *)
TInt FindL(const T *, TIdentityRelation< T >)
TInt FindReverse(const T *)
TInt FindReverse(const T *, TIdentityRelation< T >)
TInt FindReverse(const K &, TInt(*)(const K *k, const T &t))
TInt FindReverseL(const T *)
TInt FindReverseL(const T *, TIdentityRelation< T >)
voidGranularCompress()
TInt Insert(const T *, TInt)
TInt InsertInAddressOrder(const T *)
TInt InsertInAddressOrderAllowRepeats(const T *)
voidInsertInAddressOrderAllowRepeatsL(const T *)
voidInsertInAddressOrderL(const T *)
TInt InsertInOrder(const T *, TLinearOrder< T >)
TInt InsertInOrderAllowRepeats(const T *, TLinearOrder< T >)
voidInsertInOrderAllowRepeatsL(const T *, TLinearOrder< T >)
voidInsertInOrderL(const T *, TLinearOrder< T >)
voidInsertL(const T *, TInt)
voidRemove(TInt)
TInt Reserve(TInt)
voidReserveL(TInt)
voidReset()
voidResetAndDestroy()
voidSort(TLinearOrder< T >)
voidSortIntoAddressOrder()
TInt SpecificFindInAddressOrder(const T *, TInt)
TInt SpecificFindInAddressOrder(const T *, TInt &, TInt)
TInt SpecificFindInAddressOrderL(const T *, TInt)
voidSpecificFindInAddressOrderL(const T *, TInt &, TInt)
TInt SpecificFindInOrder(const T *, TLinearOrder< T >, TInt)
TInt SpecificFindInOrder(const T *, TInt &, TLinearOrder< T >, TInt)
TInt SpecificFindInOrderL(const T *, TLinearOrder< T >, TInt)
voidSpecificFindInOrderL(const T *, TInt &, TLinearOrder< T >, TInt)
T *const &operator[](TInt)
T *&operator[](TInt)
Inherited Functions
RPointerArrayBase::Append(const TAny *)
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 *)const
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 *)const
RPointerArrayBase::FindReverse(const TAny *,TGeneralIdentityRelation)const
RPointerArrayBase::GetCount(const CBase *)
RPointerArrayBase::GetElementPtr(const CBase *,TInt)
RPointerArrayBase::HeapSort(TGeneralLinearOrder)
RPointerArrayBase::HeapSortSigned()
RPointerArrayBase::HeapSortUnsigned()
RPointerArrayBase::Insert(const TAny *,TInt)
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

A simple and efficient array of pointers to objects.

The elements of the array are pointers to instances of a class; this class is specified as the template parameter T.

The class offers standard array behaviour which includes insertion, appending and sorting of pointers.

Derivation from RPointerArrayBase is private.

Constructor & Destructor Documentation

RPointerArray ( )

RPointerArray()[inline]

Default C++ constructor.

This constructs an array object for an array of 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 pointers with the specified granularity.

panic
USER 127, if aGranularity is not positive, or greater than or equal to 0x10000000.
ParameterDescription
aGranularityThe granularity of the array.

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 pointers with the specified minimum growth step and exponential growth factor.

panic
USER 192, if aMinGrowBy<=0 or aMinGrowBy>65535.
panic
USER 193, if aFactor<=257 or aFactor>32767.
ParameterDescription
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.

RPointerArray ( T **, TInt )

RPointerArray(T **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 pointer to class T, which is owned by another RPointerArray object. Ownership of the set of entries still resides with the original RPointerArray object.

panic
USER 156, if aCount is not positive.
ParameterDescription
aEntriesA pointer to the first entry of type pointer to class T 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.

Member Function Documentation

Append ( const T * )

TInt Append(const T *anEntry)[inline]

Appends an object pointer onto the array.

ParameterDescription
anEntryThe object pointer to be appended.

Returns: KErrNone, if the insertion is successful, otherwise one of the system wide error codes.

AppendL ( const T * )

voidAppendL(const T *anEntry)[inline]

Appends an object 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.

ParameterDescription
anEntryThe object pointer to be appended.

Array ( )

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

Constructs and returns a generic array.

See also: TArray

Returns: 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 object pointers. Subsequently adding a new object 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 object pointers in the array.

Returns: The number of object pointers in the array.

Find ( const T * )

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

Finds the first object pointer in the array which matches the specified object 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.

ParameterDescription
anEntryThe object pointer to be found.

Returns: The index of the first matching object pointer within the array. KErrNotFound, if no matching object pointer can be found.

Find ( const T *, TIdentityRelation< T > )

TInt Find(const T *anEntry,
TIdentityRelation< T >anIdentity
)const [inline]

Finds the first object pointer in the array whose object matches the specified object, using a sequential search and a matching algorithm.

The algorithm for determining whether two class T objects match is provided by a function supplied by the caller.

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.

ParameterDescription
anEntryThe object pointer to be found.
anIdentityA package encapsulating the function which determines whether two class T objects match.

Returns: The index of the first matching object pointer within the array. KErrNotFound, if no suitable object pointer can be found.

Find ( const K &, TBool(*)(const K *k, const T &t) )

TInt Find(const K &aKey,
TBool(*)(const K *k, const T &t)apfnCompare
)const [inline]

Finds the first object pointer in the array which matches aKey using the comparison algorithm provided by apfnCompare.

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.

ParameterDescription
aKeyThe key of type K to be compared with the elements of the array using apfnCompare.
apfnCompareA function defining the identity relation between the object pointers in the array, and their keys of type K. The function returns true if k and t match based on this relationship.

Returns: The index of the first matching object pointer within the array. KErrNotFound, if no suitable object pointer can be found.

FindInAddressOrder ( const T * )

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

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

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

ParameterDescription
anEntryThe object pointer to be found.

Returns: The index of the matching object pointer within the array or KErrNotFound if no suitable object pointer can be found.

FindInAddressOrder ( const T *, TInt & )

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

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

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

ParameterDescription
anEntryThe object 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 object pointer within the array. If the function returns KErrNotFound, this is the index of the first object pointer within the array which logically follows after anEntry.

Returns: KErrNone, if a matching object pointer is found. KErrNotFound, if no suitable object pointer can be found.

FindInAddressOrderL ( const T * )

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

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

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

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

leave
KErrNotFound, if no suitable object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.

Returns: The index of the matching object pointer within the array

FindInAddressOrderL ( const T *, TInt & )

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

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

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

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

leave
KErrNotFound, if no suitable object pointer can be found.
ParameterDescription
anEntryThe object 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 object pointer within the array. If the function leaves with KErrNotFound, this is the index of the first object pointer within the array which logically follows after anEntry.

FindInOrder ( const T *, TLinearOrder< T > )

TInt FindInOrder(const T *anEntry,
TLinearOrder< T >anOrder
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

The function assumes that existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T>.

ParameterDescription
anEntryThe object pointer to be found.
anOrderA package encapsulating the function which determines the order of two class T objects.

Returns: The index of the matching object pointer within the array or KErrNotFound, if no suitable object pointer can be found.

FindInOrder ( const T *, TInt &, TLinearOrder< T > )

TInt FindInOrder(const T *anEntry,
TInt &anIndex,
TLinearOrder< T >anOrder
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

The function assumes that existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T>.

ParameterDescription
anEntryThe object 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 object pointer within the array. If the function returns KErrNotFound, this is the index of the first object pointer in the array whose object is larger than the entry being searched for - if no objects pointed to in the array are larger, then the index value is the same as the total number of object pointers in the array.
anOrderA package encapsulating the function which determines the order of two class T objects.

Returns: KErrNone, if a matching object pointer is found. KErrNotFound, if no suitable object pointer can be found.

FindInOrder ( const K &, TInt(*)(const K *k, const T &t) )

TInt FindInOrder(const K &aKey,
TInt(*)(const K *k, const T &t)apfnCompare
)const [inline]

Finds the object pointer in the array whose object matches the specified key, (Using the relationship defined within apfnCompare) using a binary search technique and an ordering algorithm.

The function assumes that existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T>.

ParameterDescription
aKeyThe key of type K to be compared with the elements of the array using apfnCompare.
apfnCompareA function which defines the order that the array was sorted, where in it aKey (via the defined relationship) should fit, and if the key is present.

Returns: The index of the matching object pointer within the array. KErrNotFound, if no suitable object pointer can be found.

FindInOrderL ( const T *, TLinearOrder< T > )

TInt FindInOrderL(const T *anEntry,
TLinearOrder< T >anOrder
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

The function assumes that existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T>.

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

leave
KErrNotFound, if no suitable object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.
anOrderA package encapsulating the function which determines the order of two class T objects.

Returns: The index of the matching object pointer within the array.

FindInOrderL ( const T *, TInt &, TLinearOrder< T > )

voidFindInOrderL(const T *anEntry,
TInt &anIndex,
TLinearOrder< T >anOrder
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

The function assumes that existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T>.

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

leave
KErrNotFound, if no suitable object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.
anIndexA TInt supplied by the caller. On return, contains an index value: If the function does not leave, this is the index of the matching object pointer within the array. If the function leaves with KErrNotFound, this is the index of the first object pointer in the array whose object is bigger than the entry being searched for - if no objects pointed to in the array are bigger, then the index value is the same as the total number of object pointers in the array.
anOrderA package encapsulating the function which determines the order of two class T objects.

FindL ( const T * )

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

Finds the first object pointer in the array which matches the specified object 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.

leave
KErrNotFound, if no matching object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.

Returns: The index of the first matching object pointer within the array.

FindL ( const T *, TIdentityRelation< T > )

TInt FindL(const T *anEntry,
TIdentityRelation< T >anIdentity
)const [inline]

Finds the first object pointer in the array whose object matches the specified object, using a sequential search and a matching algorithm.

The algorithm for determining whether two class T objects match is provided by a function supplied by the caller.

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.

leave
KErrNotFound, if no suitable object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.
anIdentityA package encapsulating the function which determines whether two class T objects match.

Returns: The index of the first matching object pointer within the array.

FindReverse ( const T * )

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

Finds the last object pointer in the array which matches the specified object 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.

ParameterDescription
anEntryThe object pointer to be found.

Returns: The index of the last matching object pointer within the array. KErrNotFound, if no matching object pointer can be found.

FindReverse ( const T *, TIdentityRelation< T > )

TInt FindReverse(const T *anEntry,
TIdentityRelation< T >anIdentity
)const [inline]

Finds the last object pointer in the array whose object matches the specified object, using a sequential search and a matching algorithm.

The algorithm for determining whether two class T objects match is provided by a function supplied by the caller.

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.

ParameterDescription
anEntryThe object pointer to be found.
anIdentityA package encapsulating the function which determines whether two class T objects match.

Returns: The index of the last matching object pointer within the array. KErrNotFound, if no suitable object pointer can be found.

FindReverse ( const K &, TInt(*)(const K *k, const T &t) )

TInt FindReverse(const K &aKey,
TInt(*)(const K *k, const T &t)apfnMatch
)const [inline]

Finds the first object pointer in the array which matches aKey using the comparison algorithm provided by apfnCompare.

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.

ParameterDescription
aKeyThe key of type K to be compared with the elements of the array using apfnMatch.
apfnMatchA function defining the identity relation between the object pointers in the array, and their keys of type K. The function returns true if k and t match based on this relationship.

Returns: The index of the first matching object pointer within the array. KErrNotFound, if no suitable object pointer can be found.

FindReverseL ( const T * )

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

Finds the last object pointer in the array which matches the specified object 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.

leave
KErrNotFound, if no matching object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.

Returns: The index of the last matching object pointer within the array.

FindReverseL ( const T *, TIdentityRelation< T > )

TInt FindReverseL(const T *anEntry,
TIdentityRelation< T >anIdentity
)const [inline]

Finds the last object pointer in the array whose object matches the specified object, using a sequential search and a matching algorithm.

The algorithm for determining whether two class T objects match is provided by a function supplied by the caller.

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.

leave
KErrNotFound, if no suitable object pointer can be found.
ParameterDescription
anEntryThe object pointer to be found.
anIdentityA package encapsulating the function which determines whether two class T objects match.

Returns: The index of the last matching object pointer within the array.

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 object pointers. Adding new object 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 T *, TInt )

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

Inserts an object pointer into the array at the specified position.

panic
USER 131, if aPos is negative, or is greater than the number of object pointers currently in the array.
ParameterDescription
anEntryThe object pointer to be inserted.
aPosThe position within the array where the object 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.

Returns: KErrNone, if the insertion is successful, otherwise one of the system wide error codes.

InsertInAddressOrder ( const T * )

TInt InsertInAddressOrder(const T *anEntry)[inline]

Inserts an object 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 object pointers within the array are in address order.

ParameterDescription
anEntryThe object pointer to be inserted.

Returns: 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 T * )

TInt InsertInAddressOrderAllowRepeats(const T *anEntry)[inline]

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

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

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

ParameterDescription
anEntryThe object pointer to be inserted.

Returns: KErrNone, if the insertion is successful, otherwise one of the system wide error codes.

InsertInAddressOrderAllowRepeatsL ( const T * )

voidInsertInAddressOrderAllowRepeatsL(const T *anEntry)[inline]

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

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

The function assumes that existing object 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.

ParameterDescription
anEntryThe object pointer to be inserted.

InsertInAddressOrderL ( const T * )

voidInsertInAddressOrderL(const T *anEntry)[inline]

Inserts an object pointer into the array in address order.

No duplicate entries are permitted. The function assumes that existing object 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.

ParameterDescription
anEntryThe object pointer to be inserted.

InsertInOrder ( const T *, TLinearOrder< T > )

TInt InsertInOrder(const T *anEntry,
TLinearOrder< T >anOrder
)[inline]

Inserts an object pointer into the array so that the object itself is in object order.

The algorithm for determining the order of two class T objects is provided by a function supplied by the caller.

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

The function assumes that the array is ordered so that the referenced objects are in object order.

ParameterDescription
anEntryThe object pointer to be inserted.
anOrderA package encapsulating the function which determines the order of two class T objects.

Returns: 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.

InsertInOrderAllowRepeats ( const T *, TLinearOrder< T > )

TInt InsertInOrderAllowRepeats(const T *anEntry,
TLinearOrder< T >anOrder
)[inline]

Inserts an object pointer into the array so that the object itself is in object order, allowing duplicates

The algorithm for determining the order of two class T objects is provided by a function supplied by the caller.

If the specified object is a duplicate of an existing object, then the new pointer is inserted after the pointer to the existing object. If more than one duplicate object already exists, then the new pointer is inserted after the pointer to the last one.

ParameterDescription
anEntryThe object pointer to be inserted.
anOrderA package encapsulating the function which determines the order of two class T objects.

Returns: KErrNone, if the insertion is successful, otherwise one of the system wide error codes.

InsertInOrderAllowRepeatsL ( const T *, TLinearOrder< T > )

voidInsertInOrderAllowRepeatsL(const T *anEntry,
TLinearOrder< T >anOrder
)[inline]

Inserts an object pointer into the array so that the object itself is in object order, allowing duplicates

The algorithm for determining the order of two class T objects is provided by a function supplied by the caller.

If the specified object is a duplicate of an existing object, then the new pointer is inserted after the pointer to the existing object. If more than one duplicate object already exists, then the new pointer is inserted after the pointer to the last one.

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.

ParameterDescription
anEntryThe object pointer to be inserted.
anOrderA package encapsulating the function which determines the order of two class T objects.

InsertInOrderL ( const T *, TLinearOrder< T > )

voidInsertInOrderL(const T *anEntry,
TLinearOrder< T >anOrder
)[inline]

Inserts an object pointer into the array so that the object itself is in object order.

The algorithm for determining the order of two class T objects is provided by a function supplied by the caller.

No duplicate entries are permitted.

The function assumes that the array is ordered so that the referenced objects are in object order.

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

Note that the array remains unchanged following an attempt to insert a duplicate entry.

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

ParameterDescription
anEntryThe object pointer to be inserted.
anOrderA package encapsulating the function which determines the order of two class T objects.

InsertL ( const T *, TInt )

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

Inserts an object 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.

panic
USER 131, if aPos is negative, or is greater than the number of object pointers currently in the array.
ParameterDescription
anEntryThe object pointer to be inserted.
aPosThe position within the array where the object 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.

Remove ( TInt )

voidRemove(TIntanIndex)[inline]

Reimplemented from RPointerArrayBase::Remove(TInt)

Removes the object pointer at the specified position from the array.

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

panic
USER 130, if anIndex is negative, or is greater than the number of objects currently in the array.
ParameterDescription
anIndexThe position within the array from where the object 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.

Reserve ( TInt )

TInt Reserve(TIntaCount)[inline]

Reserves space for the specified number of elements.

After a call to this function, the memory allocated to the array is sufficient to hold the number of object pointers specified. Adding new object pointers to the array does not result in a re-allocation of memory until the the total number of pointers exceeds the specified count.

ParameterDescription
aCountThe number of object pointers for which space should be reserved

Returns: KErrNone If the operation completed successfully KErrNoMemory If the requested amount of memory could not be allocated

ReserveL ( TInt )

voidReserveL(TIntaCount)[inline]

Reserves space for the specified number of elements.

After a call to this function, the memory allocated to the array is sufficient to hold the number of object pointers specified. Adding new object pointers to the array does not result in a re-allocation of memory until the the total number of pointers exceeds the specified count.

leave
KErrNoMemory If the requested amount of memory could not be allocated
ParameterDescription
aCountThe number of object pointers for which space should be reserved

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.

ResetAndDestroy ( )

voidResetAndDestroy()

Empties the array and deletes the referenced objects.

It frees all memory allocated to the array and resets the internal state so that it is ready to be reused. The function also deletes all of the objects whose pointers are contained by the array.

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

Sort ( TLinearOrder< T > )

voidSort(TLinearOrder< T >anOrder)[inline]

Sorts the object pointers within the array.

The sort order of the pointers is based on the order of the referenced objects. The referenced object order is determined by an algorithm supplied by the caller and packaged as a TLinerOrder<T>.

ParameterDescription
anOrderA package encapsulating the function which determines the order of two class T objects.

SortIntoAddressOrder ( )

voidSortIntoAddressOrder()[inline]

Sorts the object pointers within the array into address order.

SpecificFindInAddressOrder ( const T *, TInt )

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

Finds the object pointer in the array that matches the specified object 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 object pointers in the array are in address order.

See also: TArrayFindMode

ParameterDescription
anEntryThe object 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.

Returns: 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 T *, TInt &, TInt )

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

Finds the object pointer in the array that matches the specified object 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 object pointers in the array are in address order.

See also: TArrayFindMode

ParameterDescription
anEntryThe object 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.

Returns: KErrNone, if a matching object pointer is found. KErrNotFound, if no suitable object pointer can be found.

SpecificFindInAddressOrderL ( const T *, TInt )

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

Finds the object pointer in the array that matches the specified object 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 object pointers in the array are in address order.

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

leave
KErrNotFound if no matching entry exists.

See also: TArrayFindMode

ParameterDescription
anEntryThe object 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.

Returns: 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.

SpecificFindInAddressOrderL ( const T *, TInt &, TInt )

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

Finds the object pointer in the array that matches the specified object 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 object pointers in the array are in address order.

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

leave
KErrNotFound, if no suitable object pointer can be found.

See also: TArrayFindMode

ParameterDescription
anEntryThe object 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.

SpecificFindInOrder ( const T *, TLinearOrder< T >, TInt )

TInt SpecificFindInOrder(const T *anEntry,
TLinearOrder< T >anOrder,
TIntaMode
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

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 existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T> type.

See also: TArrayFindMode

ParameterDescription
anEntryThe object pointer to be found.
anOrderA package encapsulating the function which determines the order of two class T objects.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Returns: 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.

SpecificFindInOrder ( const T *, TInt &, TLinearOrder< T >, TInt )

TInt SpecificFindInOrder(const T *anEntry,
TInt &anIndex,
TLinearOrder< T >anOrder,
TIntaMode
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

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 existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T> type.

See also: TArrayFindMode

ParameterDescription
anEntryThe object 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.
anOrderA package encapsulating the function which determines the order of two class T objects.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Returns: KErrNone, if a matching object pointer is found. KErrNotFound, if no suitable object pointer can be found.

SpecificFindInOrderL ( const T *, TLinearOrder< T >, TInt )

TInt SpecificFindInOrderL(const T *anEntry,
TLinearOrder< T >anOrder,
TIntaMode
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

In the case that there is more than one matching element finds the first, last or any match as specified by the value of aMode.

The function assumes that existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T> type.

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

leave
KErrNotFound if no matching entry exists.

See also: TArrayFindMode

ParameterDescription
anEntryThe object pointer to be found.
anOrderA package encapsulating the function which determines the order of two class T objects.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Returns: 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.

SpecificFindInOrderL ( const T *, TInt &, TLinearOrder< T >, TInt )

voidSpecificFindInOrderL(const T *anEntry,
TInt &anIndex,
TLinearOrder< T >anOrder,
TIntaMode
)const [inline]

Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.

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 existing object pointers in the array are ordered so that the objects themselves are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T>.

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

leave
KErrNotFound, if no suitable object pointer can be found.

See also: TArrayFindMode

ParameterDescription
anEntryThe object 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.
anOrderA package encapsulating the function which determines the order of two class T objects.
aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindModeenum values.

operator[] ( TInt )

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

Gets a reference to the object 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.

panic
USER 130, if anIndex is negative, or is greater than the number of objects currently in the array.
ParameterDescription
anIndexThe position of the object pointer within the array. The position is relative to zero, i.e. zero implies the object pointer at the beginning of the array.

Returns: A const reference to the object pointer at position anIndex within the array.

operator[] ( TInt )

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

Gets a reference to the object 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.

panic
USER 130, if anIndex is negative, or is greater than the number of objects currently in the array.
ParameterDescription
anIndexThe position of the object pointer within the array. The position is relative to zero, i.e. zero implies the object pointer at the beginning of the array.

Returns: A non-const reference to the object pointer at position anIndex within the array.