Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <e32cmn.h>

Class RArray

class RArray : private RArrayBase;

Description

A simple and efficient array of fixed length objects.

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

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

Note:

1. where possible, this class should be used in preference to CArrayFixFlat<classT>.

2. the derivation from RArrayBase is private.

3. for performance reasons, RArray stores objects in the array as word (4 byte) aligned quantities. This means that some member functions do not work when RArray is instantiated for classes of less than 4 bytes in size, or when the class's alignment requirement is not 4. Be aware that it is possible to get an unhandled exception on hardware that enforces strict alignment.

The affected functions are:

3.1 the constructor: RArray::RArray(TInt,T *,TInt)

3.2 RArray::Append(const T &)

3.3 RArray::Insert(const T &,TInt)

3.4 the [] operator, and then using the pointer to iterate through the array as you would with a C array.

Derivation

Members

Defined in RArray:


Construction and destruction


RArray()

inline RArray();

Description

Default C++ constructor.

This constructs an array object for an array of type class T objects with default granularity and key offset value. The default granularity is 8 and the defaul key offset value is zero.

Panic codes

USER

129, if the size of class T is not positive or is not less than 640.


RArray(TInt)

inline RArray(TInt aGranularity);

Description

C++ constructor with granularity.

This constructs an array object for an array of type class T objects with a specified granularity and default key offset value. The default key offset value is zero.

Parameters

TInt aGranularity

The granularity of the array.

Panic codes

USER

129, if the size of class T is not positive or is not less than 640.

USER

127, if aGranularity is not positive or the product of this value and the size of class T is not less than 0x10000000.


RArray(TInt,TInt)

inline RArray(TInt aGranularity, TInt aKeyOffset);

Description

C++ constructor with granularity and key offset.

This constructs an array object for an array of type class T objects with a specified granularity and a specified key offset value.

Parameters

TInt aGranularity

The granularity of the array.

TInt aKeyOffset

The key offset.

Panic codes

USER

129, if the size of class T is not positive or is not less than 640.

USER

127, if aGranularity is not positive or the product of this value and the size of class T is not less than 0x10000000.

USER

128, if aKeyOffset is not positive, or is not less than the size of class T, or is not a multiple of 4.


RArray(TInt,TInt,TInt)

inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);

Description

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

This constructs an array object for an array of class T objects with the specified minimum growth step and exponential growth factor.

Parameters

TInt aMinGrowBy

The minimum growth step of the array. Must be between 1 and 65535 inclusive.

TInt aKeyOffset

The key offset.

TInt aFactor

The 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

USER

129, if the size of class T is not positive or is not less than 640.

USER

128, if aKeyOffset is negative, or is not less than the size of class T, or is not a multiple of 4.

USER

192, if aMinGrowBy<=0 or aMinGrowBy>65535.

USER

193, if aFactor<=257 or aFactor>32767.


RArray(TInt,T *,TInt)

inline RArray(TInt aEntrySize, T *aEntries, TInt aCount);

Description

C++ constructor with size of entry, 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 class T objects owned by another RArray object. Ownership of the set of entries still resides with the original RArray object.

This array is assigned a default granularity and key offset value. The default granularity is 8 and the default key offset value is zero.

The purpose of constructing an array in this way is to allow sorting and finding operations to be done without further allocation of memory.

Parameters

TInt aEntrySize

The size of an entry in the existing array.

T *aEntries

A pointer to the first entry of type class T in the set of entries belonging to the existing array.

TInt aCount

The number of entries in the existing array.

Panic codes

USER

129, if aEntrySize is not positive or is not less than 640.

USER

156, if aCount is not positive.

[Top]


Member functions


Close()

inline void Close();

Description

Closes the array and frees all memory allocated to the array.

The function must be called before this array object is destroyed.


Count()const

inline TInt Count() const;

Description

Gets the number of objects in the array.

Return value

TInt

The number of objects in the array.


operator[](TInt)const

inline const T& operator[](TInt anIndex) const;

Description

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

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

Parameters

TInt anIndex

The position of the object within the array. The position is relative to zero, i.e. zero implies the object at the beginning of the array.

Return value

const T &

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

Panic codes

USER

130, if anIndex is negative or is greater than the number of objects currently in the array


operator[](TInt)

inline T& operator[](TInt anIndex);

Description

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

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

Parameters

TInt anIndex

The position of the object within the array. The position is relative to zero, i.e. zero implies the object at the beginning of the array.

Return value

T &

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

Panic codes

USER

130, if anIndex is negative or is greater than the number of objects currently in the array


Append(const T &)

inline TInt Append(const T &anEntry);

Description

Apends an object onto the array.

Parameters

const T &anEntry

A reference to the object of type class T to be appended.

Return value

TInt

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


Insert(const T &,TInt)

inline TInt Insert(const T &anEntry, TInt aPos);

Description

Inserts an object into the array at a specified position.

Parameters

const T &anEntry

The class T object to be inserted.

TInt aPos

The position within the array where the object is to be inserted. The position is relative to zero, i.e. zero implies that an object is inserted at the beginning of the array.

Return value

TInt

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

Panic codes

USER

131, if aPos is negative or is greater than the number of objects currently in the array.


Remove(TInt)

inline void Remove(TInt anIndex);

Description

Removes the object at a specified position from the array.

Parameters

TInt anIndex

The position within the array from where the object is to be removed. The position is relative to zero, i.e. zero implies that an object at the beginning of the array is to be removed.

Panic codes

USER

130, if anIndex is negative or is greater than the number of objects currently in the array.


Compress()

inline void Compress();

Description

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 objects. Subsequently adding a new object to the array always results in a re-allocation of memory.


Reset()

inline void Reset();

Description

Empties the array, so that it is ready to be reused.

The function 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.


Find(const T &)const

inline TInt Find(const T &anEntry) const;

Description

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

Matching is based on the comparison of a TInt value at the key offset position within the objects.

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

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

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


Find(const T &,TIdentityRelation< T >)const

inline TInt Find(const T &anEntry, TIdentityRelation< T > anIdentity) const;

Description

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

The algorithm for determining whether two class T type 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TIdentityRelation< T > anIdentity

A package encapsulating the function which determines whether two class T type objects match.

Return value

TInt

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


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

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

Description

Finds the first object 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.

Parameters

const K &aKey

The key of type K to be compared with the elements of the array using apfnCompare.

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

A function defining the identity relation between the object in the array, and their keys of type K. The function returns true if k and t match based on this relationship.

Return value

TInt

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


FindReverse(const T &)const

inline TInt FindReverse(const T &anEntry) const;

Description

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

Matching is based on the comparison of a TInt value at the key offset position within the objects.

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

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

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


FindReverse(const T &,TIdentityRelation< T >)const

inline TInt FindReverse(const T &anEntry, TIdentityRelation< T > anIdentity) const;

Description

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

The algorithm for determining whether two class T type 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TIdentityRelation< T > anIdentity

A package encapsulating the function which determines whether two class T type objects match.

Return value

TInt

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


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

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

Description

Finds the first object 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.

Parameters

const K &aKey

The key of type K to be compared with the elements of the array using apfnMatch.

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

A function defining the identity relation between the object in the array, and their keys of type K. The function returns true if k and t match based on this relationship.

Return value

TInt

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


FindInSignedKeyOrder(const T &)const

inline TInt FindInSignedKeyOrder(const T &anEntry) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in signed key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

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


FindInUnsignedKeyOrder(const T &)const

inline TInt FindInUnsignedKeyOrder(const T &anEntry) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in unsigned key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

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


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

inline TInt FindInOrder(const T &anEntry, TLinearOrder< T > anOrder) const;

Description

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

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TLinearOrder< T > anOrder

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

Return value

TInt

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


FindInSignedKeyOrder(const T &,TInt &)const

inline TInt FindInSignedKeyOrder(const T &anEntry, TInt &anIndex) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in signed key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

On return contains an index value. If the function returns KErrNone, this is the index of the matching object within the array. If the function returns KErrNotFound, this is the index of the first element in the array whose key is bigger than the key of the element being sought. If there are no elements in the array with a bigger key, then the index value is the same as the total number of elements in the array.

Return value

TInt

KErrNone if a matching object is found, or KErrNotFound if no matching object can be found.


FindInUnsignedKeyOrder(const T &,TInt &)const

inline TInt FindInUnsignedKeyOrder(const T &anEntry, TInt &anIndex) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in unsigned key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

On return contains an index value. If the function returns KErrNone, this is the index of the matching object within the array. If the function returns KErrNotFound, this is the index of the first element in the array whose key is bigger than the key of the element being sought. If there are no elements in the array with a bigger key, then the index value is the same as the total number of elements in the array.

Return value

TInt

KErrNone if a matching object is found, or KErrNotFound if no matching object can be found.


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

inline TInt FindInOrder(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder) const;

Description

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

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

On return contains an index value. If the function returns KErrNone, this is the index of the matching object within the array. If the function returns KErrNotFound, 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.

TLinearOrder< T > anOrder

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

Return value

TInt

KErrNone if a matching object is found. KErrNotFound if no matching object can be found.


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

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

Description

Finds the object 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 objects 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>.

Parameters

const K &aKey

The key of type K to be compared with the elements of the array using apfnCompare.

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

A 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.

Return value

TInt

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


SpecificFindInSignedKeyOrder(const T &,TInt)const

inline TInt SpecificFindInSignedKeyOrder(const T &anEntry, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by a signed 32-bit word (the key) embedded in each array element. 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 objects within the array are in signed key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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.


SpecificFindInUnsignedKeyOrder(const T &,TInt)const

inline TInt SpecificFindInUnsignedKeyOrder(const T &anEntry, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by an unsigned 32-bit word (the key) embedded in each array element. Where there is more than one matching element, it finds the first, last or any matching element as specified by the value of aMode.

The function assumes that existing objects within the array are in unsigned key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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 &,TLinearOrder< T >,TInt)const

inline TInt SpecificFindInOrder(const T &anEntry, TLinearOrder< T > anOrder, TInt aMode) const;

Description

Finds the object in the array which 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 objects within the array are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T> type.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TLinearOrder< T > anOrder

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

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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.


SpecificFindInSignedKeyOrder(const T &,TInt &,TInt)const

inline TInt SpecificFindInSignedKeyOrder(const T &anEntry, TInt &anIndex, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by a signed 32-bit word (the key) embedded in each array element. Where there is more than one matching element, finds the first, last or any matching element as specified specified by the value of aMode.

The function assumes that existing objects within the array are in signed key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

A 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.

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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


SpecificFindInUnsignedKeyOrder(const T &,TInt &,TInt)const

inline TInt SpecificFindInUnsignedKeyOrder(const T &anEntry, TInt &anIndex, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by an unsigned 32-bit word (the key) embedded in each array element. Where there is more than one matching element, it finds the first, last or any matching element as specified by the value of aMode.

The function assumes that existing objects within the array are in unsigned key order.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

A 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.

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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


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

inline TInt SpecificFindInOrder(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique and a specified 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 objects within the array are in object order as determined by an algorithm supplied by the caller and packaged as a TLinearOrder<T> type.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

A 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.

TLinearOrder< T > anOrder

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

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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


InsertInSignedKeyOrder(const T &)

inline TInt InsertInSignedKeyOrder(const T &anEntry);

Description

Inserts an object into the array in ascending signed key order.

The order of two class T type objects is based on comparing a TInt value located at the key offset position within the class T object.

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

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

Return value

TInt

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.


InsertInUnsignedKeyOrder(const T &)

inline TInt InsertInUnsignedKeyOrder(const T &anEntry);

Description

Inserts an object into the array in ascending unsigned key order.

The order of two class T type objects is based on comparing a TUint value located at the key offset position within the class T object.

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

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

Return value

TInt

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.


InsertInOrder(const T &,TLinearOrder< T >)

inline TInt InsertInOrder(const T &anEntry, TLinearOrder< T > anOrder);

Description

Inserts an object of into the array in object order.

The algorithm for determining the order of two class T type 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 existing objects within the array are in object order.

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

TLinearOrder< T > anOrder

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

Return value

TInt

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.


InsertInSignedKeyOrderAllowRepeats(const T &)

inline TInt InsertInSignedKeyOrderAllowRepeats(const T &anEntry);

Description

Inserts an object into the array in ascending signed key order, allowing duplicates.

The order of two class T type objects is based on comparing a TInt value located at the key offset position within the class T object.

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

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

Return value

TInt

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


InsertInUnsignedKeyOrderAllowRepeats(const T &)

inline TInt InsertInUnsignedKeyOrderAllowRepeats(const T &anEntry);

Description

Inserts an object into the array in ascending unsigned key order, allowing duplicates.

The order of two class T type objects is based on comparing a TUint value located at the key offset position within the class T object.

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

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

Return value

TInt

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


InsertInOrderAllowRepeats(const T &,TLinearOrder< T >)

inline TInt InsertInOrderAllowRepeats(const T &anEntry, TLinearOrder< T > anOrder);

Description

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

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

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

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

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

TLinearOrder< T > anOrder

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

Return value

TInt

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


AppendL(const T &)

inline void AppendL(const T &anEntry);

Description

Apends an object 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

const T &anEntry

A reference to the object of type class T to be appended.


InsertL(const T &,TInt)

inline void InsertL(const T &anEntry, TInt aPos);

Description

Inserts an object into the array at a 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

const T &anEntry

The class T object to be inserted.

TInt aPos

The position within the array where the object is to be inserted. The position is relative to zero, i.e. zero implies that an object is inserted at the beginning of the array.

Panic codes

USER

131, if aPos is negative or is greater than the number of objects currently in the array.


FindL(const T &)const

inline TInt FindL(const T &anEntry) const;

Description

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

Matching is based on the comparison of a TInt value at the key offset position within the objects.

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

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

The index of the first matching object within the array.

Leave codes

KErrNotFound,

if no matching object can be found.


FindL(const T &,TIdentityRelation< T >)const

inline TInt FindL(const T &anEntry, TIdentityRelation< T > anIdentity) const;

Description

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

The algorithm for determining whether two class T type 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TIdentityRelation< T > anIdentity

A package encapsulating the function which determines whether two class T type objects match.

Return value

TInt

The index of the first matching object within the array.

Leave codes

KErrNotFound,

if no matching object can be found.


FindReverseL(const T &)const

inline TInt FindReverseL(const T &anEntry) const;

Description

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

Matching is based on the comparison of a TInt value at the key offset position within the objects.

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

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

The index of the last matching object within the array.

Leave codes

KErrNotFound,

if no matching object can be found.


FindReverseL(const T &,TIdentityRelation< T >)const

inline TInt FindReverseL(const T &anEntry, TIdentityRelation< T > anIdentity) const;

Description

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

The algorithm for determining whether two class T type 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TIdentityRelation< T > anIdentity

A package encapsulating the function which determines whether two class T type objects match.

Return value

TInt

The index of the last matching object within the array.

Leave codes

KErrNotFound,

if no matching object can be found.


FindInSignedKeyOrderL(const T &)const

inline TInt FindInSignedKeyOrderL(const T &anEntry) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in signed key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

The index of the matching object within the array.

Leave codes

KErrNotFound,

if no matching object can be found.


FindInUnsignedKeyOrderL(const T &)const

inline TInt FindInUnsignedKeyOrderL(const T &anEntry) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in unsigned key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

Return value

TInt

The index of the matching object within the array.

Leave codes

KErrNotFound,

if no matching object can be found.


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

inline TInt FindInOrderL(const T &anEntry, TLinearOrder< T > anOrder) const;

Description

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

The function assumes that existing objects within the array 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TLinearOrder< T > anOrder

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

Return value

TInt

The index of the matching object within the array.

Leave codes

KErrNotFound

if no matching object can be found.


FindInSignedKeyOrderL(const T &,TInt &)const

inline void FindInSignedKeyOrderL(const T &anEntry, TInt &anIndex) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in signed key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

On return contains an index value of the matching object within the array. If the function leaves with KErrNotFound,this is the index of the first element in the array whose key is bigger than the key of the element being sought. If there are no elements in the array with a bigger key, then the index value is the same as the total number of elements in the array.

Leave codes

KErrNotFound,

if no matching object can be found.


FindInUnsignedKeyOrderL(const T &,TInt &)const

inline void FindInUnsignedKeyOrderL(const T &anEntry, TInt &anIndex) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The function assumes that existing objects within the array are in unsigned key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

On return contains an index value of the matching object within the array. If the function leaves with KErrNotFound, this is the index of the first element in the array whose key is bigger than the key of the element being sought. If there are no elements in the array with a bigger key, then the index value is the same as the total number of elements in the array.

Leave codes

KErrNotFound,

if no matching object can be found.


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

inline void FindInOrderL(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder) const;

Description

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

The function assumes that existing objects within the array 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

On return contains the index value of the matching object within the array If the function leaves with KErrNotFound, 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.

TLinearOrder< T > anOrder

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

Leave codes

KErrNotFound

if no matching object can be found.


SpecificFindInSignedKeyOrderL(const T &,TInt)const

inline TInt SpecificFindInSignedKeyOrderL(const T &anEntry, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by a signed 32-bit word (the key) embedded in each array element. In the case that there is more than one matching element, finds the first, last or any match as specified.

The function assumes that existing objects within the array are in signed key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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

KErrNotFound

if no matching entry exists.


SpecificFindInUnsignedKeyOrderL(const T &,TInt)const

inline TInt SpecificFindInUnsignedKeyOrderL(const T &anEntry, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by an unsigned 32-bit word (the key) embedded in each array element. In the case that there is more than one matching element, finds the first, last or any match as specified.

The function assumes that existing objects within the array are in unsigned key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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

KErrNotFound

if no matching entry exists.


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

inline TInt SpecificFindInOrderL(const T &anEntry, TLinearOrder< T > anOrder, TInt aMode) const;

Description

Finds the object in the array which 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 objects within the array 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TLinearOrder< T > anOrder

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

TInt aMode

Specifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

Return value

TInt

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

KErrNotFound

if no matching entry exists.


SpecificFindInSignedKeyOrderL(const T &,TInt &,TInt)const

inline void SpecificFindInSignedKeyOrderL(const T &anEntry, TInt &anIndex, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by a signed 32-bit word (the key) embedded in each array element. In the case that there is more than one matching element, finds the first, last or any match as specified.

The function assumes that existing objects within the array are in signed key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

A 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.

TInt aMode

Specifies 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 matching entry exists.


SpecificFindInUnsignedKeyOrderL(const T &,TInt &,TInt)const

inline void SpecificFindInUnsignedKeyOrderL(const T &anEntry, TInt &anIndex, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique.

The element ordering is determined by an unsigned 32-bit word (the key) embedded in each array element. In the case that there is more than one matching element, finds the first, last or any match as specified.

The function assumes that existing objects within the array are in unsigned key order.

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

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

A 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.

TInt aMode

Specifies 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 matching entry exists.


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

inline void SpecificFindInOrderL(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder, TInt aMode) const;

Description

Finds the object in the array which matches the specified object using a binary search technique and a specified 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 objects within the array 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.

Parameters

const T &anEntry

A reference to an object of type class T to be used for matching.

TInt &anIndex

A 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.

TLinearOrder< T > anOrder

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

TInt aMode

Specifies 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 matching entry exists.


InsertInSignedKeyOrderL(const T &)

inline void InsertInSignedKeyOrderL(const T &anEntry);

Description

Inserts an object into the array in ascending signed key order.

The order of two class T type objects is based on comparing a TInt value located at the key offset position within the class T object.

No duplicate entries are permitted.

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.

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.


InsertInUnsignedKeyOrderL(const T &)

inline void InsertInUnsignedKeyOrderL(const T &anEntry);

Description

Inserts an object into the array in ascending unsigned key order, not allowing duplicate entries.

The order of two class T type objects is based on comparing a TUint value located at the key offset position within the class T object.

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.

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.


InsertInOrderL(const T &,TLinearOrder< T >)

inline void InsertInOrderL(const T &anEntry, TLinearOrder< T > anOrder);

Description

Inserts an object of into the array in object order.

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

No duplicate entries are permitted.

The function assumes that existing objects within the array 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.

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.

TLinearOrder< T > anOrder

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


InsertInSignedKeyOrderAllowRepeatsL(const T &)

inline void InsertInSignedKeyOrderAllowRepeatsL(const T &anEntry);

Description

Inserts an object into the array in ascending signed key order, allowing duplicates.

The order of two class T type objects is based on comparing a TInt value located at the key offset position within the class T object.

If anEntry is a duplicate of an existing object in the array, then the new object is inserted after the existing object. If more than one duplicate object already exists in the array, then any new duplicate object is inserted after 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.

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.


InsertInUnsignedKeyOrderAllowRepeatsL(const T &)

inline void InsertInUnsignedKeyOrderAllowRepeatsL(const T &anEntry);

Description

Inserts an object into the array in ascending unsigned key order, allowing duplicates.

The order of two class T type objects is based on comparing a TUint value located at the key offset position within the class T object.

If anEntry is a duplicate of an existing object in the array, then the new object is inserted after the existing object. If more than one duplicate object already exists in the array, then any new duplicate object is inserted after 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.

Parameters

const T &anEntry

A reference to the object of type class T to be inserted.


InsertInOrderAllowRepeatsL(const T &,TLinearOrder< T >)

inline void InsertInOrderAllowRepeatsL(const T &anEntry, TLinearOrder< T > anOrder);

Description

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

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

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

The function assumes that existing objects within the array are in object 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

const T &anEntry

A reference to the object of type class T to be inserted.

TLinearOrder< T > anOrder

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


GranularCompress()

inline void GranularCompress();

Description

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 objects. Adding new objects to the array does not result in a re-allocation of memory until the the total number of objects reaches a multiple of the granularity.


Reserve(TInt)

inline TInt Reserve(TInt aCount);

Description

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 objects specified. Adding new objects to the array does not result in a re-allocation of memory until the the total number of objects exceeds the specified count.

Parameters

TInt aCount

The number of objects for which space should be reserved

Return value

TInt

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


ReserveL(TInt)

inline void ReserveL(TInt aCount);

Description

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 objects specified. Adding new objects to the array does not result in a re-allocation of memory until the the total number of objects exceeds the specified count.

Parameters

TInt aCount

The number of objects for which space should be reserved

Leave codes

KErrNoMemory

If the requested amount of memory could not be allocated


SortSigned()

inline void SortSigned();

Description

Sorts the objects within the array; the sort order is assumed to be in signed integer order.


SortUnsigned()

inline void SortUnsigned();

Description

Sorts the objects within the array; the sort order is assumed to be in unsigned integer order.


Sort(TLinearOrder< T >)

inline void Sort(TLinearOrder< T > anOrder);

Description

Sorts the objects within the array using the specified TLinearOrder.

The sort order is determined by an algorithm supplied by the caller and packaged as a TLinerOrder<T>.

Parameters

TLinearOrder< T > anOrder

A package encapsulating the function which determines the order of two class T type objects.


Array()const

inline TArray< T > Array() const;

Description

Constructs and returns a generic array.

Return value

TArray< T >

A generic array representing this array.