![Symbian OS Library](../../../../a_stock/mainheading.gif)
![]() |
![]() |
|
Location:
e32cmn.h
class RArray : private RArrayBase;
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(TInt, T*, TInt)
3.2 Append(const T&)
3.3 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.
RArrayBase
- No description.
RArray
- A simple and efficient array of fixed length objects
Defined in RArray
:
Append()
, AppendL()
, Array()
, Close()
, Compress()
, Count()
, Find()
, Find()
, Find()
, FindInOrder()
, FindInOrder()
, FindInOrder()
, FindInOrderL()
, FindInOrderL()
, FindInSignedKeyOrder()
, FindInSignedKeyOrder()
, FindInSignedKeyOrderL()
, FindInSignedKeyOrderL()
, FindInUnsignedKeyOrder()
, FindInUnsignedKeyOrder()
, FindInUnsignedKeyOrderL()
, FindInUnsignedKeyOrderL()
, FindL()
, FindL()
, FindReverse()
, FindReverse()
, FindReverse()
, FindReverseL()
, FindReverseL()
, GranularCompress()
, Insert()
, InsertInOrder()
, InsertInOrderAllowRepeats()
, InsertInOrderAllowRepeatsL()
, InsertInOrderL()
, InsertInSignedKeyOrder()
, InsertInSignedKeyOrderAllowRepeats()
, InsertInSignedKeyOrderAllowRepeatsL()
, InsertInSignedKeyOrderL()
, InsertInUnsignedKeyOrder()
, InsertInUnsignedKeyOrderAllowRepeats()
, InsertInUnsignedKeyOrderAllowRepeatsL()
, InsertInUnsignedKeyOrderL()
, InsertL()
, RArray()
, RArray()
, RArray()
, RArray()
, RArray()
, Remove()
, Reserve()
, ReserveL()
, Reset()
, Sort()
, SortSigned()
, SortUnsigned()
, SpecificFindInOrder()
, SpecificFindInOrder()
, SpecificFindInOrderL()
, SpecificFindInOrderL()
, SpecificFindInSignedKeyOrder()
, SpecificFindInSignedKeyOrder()
, SpecificFindInSignedKeyOrderL()
, SpecificFindInSignedKeyOrderL()
, SpecificFindInUnsignedKeyOrder()
, SpecificFindInUnsignedKeyOrder()
, SpecificFindInUnsignedKeyOrderL()
, SpecificFindInUnsignedKeyOrderL()
, operator[]()
, operator[]()
inline RArray();
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.
|
inline RArray(TInt aGranularity);
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.
|
|
inline RArray(TInt aGranularity, TInt aKeyOffset);
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.
|
|
inline RArray(TInt aMinGrowBy, TInt aKeyOffset, TInt aFactor);
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.
|
|
inline RArray(TInt aEntrySize, T *aEntries, TInt aCount);
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.
|
|
inline void Close();
Closes the array and frees all memory allocated to the array.
The function must be called before this array object is destroyed.
inline TInt Count() const;
Gets the number of objects in the array.
|
inline const T &operator[](TInt anIndex) const;
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.
|
|
|
inline T &operator[](TInt anIndex);
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.
|
|
|
inline TInt Append(const T &anEntry);
Apends an object onto the array.
|
|
inline TInt Insert(const T &anEntry, TInt aPos);
Inserts an object into the array at a specified position.
|
|
|
inline void Remove(TInt anIndex);
Removes the object at a specified position from the array.
|
|
inline void 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 objects. Subsequently adding a new object to the array always results in a re-allocation of memory.
inline void Reset();
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.
inline TInt Find(const T &anEntry) const;
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.
|
|
inline TInt Find(const T &anEntry, TIdentityRelation< T > anIdentity) const;
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.
|
|
inline TInt Find(const K &aKey, TBool(*apfnCompare)(const K *k, const T &t)) const;
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.
|
|
inline TInt FindReverse(const T &anEntry) const;
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.
|
|
inline TInt FindReverse(const T &anEntry, TIdentityRelation< T > anIdentity) const;
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.
|
|
inline TInt FindReverse(const K &aKey, TInt(*apfnMatch)(const K *k, const T &t)) const;
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.
|
|
inline TInt FindInSignedKeyOrder(const T &anEntry) const;
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.
|
|
inline TInt FindInUnsignedKeyOrder(const T &anEntry) const;
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.
|
|
inline TInt FindInOrder(const T &anEntry, TLinearOrder< T > anOrder) const;
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>.
|
|
inline TInt FindInSignedKeyOrder(const T &anEntry, TInt &anIndex) const;
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.
|
|
inline TInt FindInUnsignedKeyOrder(const T &anEntry, TInt &anIndex) const;
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.
|
|
inline TInt FindInOrder(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder) const;
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>.
|
|
inline TInt FindInOrder(const K &aKey, TInt(*apfnCompare)(const K *k, const T &t)) const;
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>.
|
|
inline TInt SpecificFindInSignedKeyOrder(const T &anEntry, TInt aMode) const;
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.
|
|
inline TInt SpecificFindInUnsignedKeyOrder(const T &anEntry, TInt aMode) const;
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.
|
|
inline TInt SpecificFindInOrder(const T &anEntry, TLinearOrder< T > anOrder, TInt aMode) const;
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.
|
|
inline TInt SpecificFindInSignedKeyOrder(const T &anEntry, TInt &anIndex, TInt aMode) const;
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.
|
|
inline TInt SpecificFindInUnsignedKeyOrder(const T &anEntry, TInt &anIndex, TInt aMode) const;
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.
|
|
inline TInt SpecificFindInOrder(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder, TInt aMode) const;
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.
|
|
inline TInt InsertInSignedKeyOrder(const T &anEntry);
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.
|
|
inline TInt InsertInUnsignedKeyOrder(const T &anEntry);
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.
|
|
inline TInt InsertInOrder(const T &anEntry, TLinearOrder< T > anOrder);
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.
|
|
inline TInt InsertInSignedKeyOrderAllowRepeats(const T &anEntry);
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.
|
|
inline TInt InsertInUnsignedKeyOrderAllowRepeats(const T &anEntry);
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.
|
|
inline TInt InsertInOrderAllowRepeats(const T &anEntry, TLinearOrder< T > anOrder);
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.
|
|
inline void AppendL(const T &anEntry);
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.
|
inline void InsertL(const T &anEntry, TInt aPos);
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.
|
|
inline TInt FindL(const T &anEntry) const;
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.
|
|
|
inline TInt FindL(const T &anEntry, TIdentityRelation< T > anIdentity) const;
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.
|
|
|
inline TInt FindReverseL(const T &anEntry) const;
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.
|
|
|
inline TInt FindReverseL(const T &anEntry, TIdentityRelation< T > anIdentity) const;
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.
|
|
|
inline TInt FindInSignedKeyOrderL(const T &anEntry) const;
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.
|
|
|
inline TInt FindInUnsignedKeyOrderL(const T &anEntry) const;
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.
|
|
|
inline TInt FindInOrderL(const T &anEntry, TLinearOrder< T > anOrder) const;
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.
|
|
|
inline void FindInSignedKeyOrderL(const T &anEntry, TInt &anIndex) const;
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.
|
|
inline void FindInUnsignedKeyOrderL(const T &anEntry, TInt &anIndex) const;
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.
|
|
inline void FindInOrderL(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder) const;
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.
|
|
inline TInt SpecificFindInSignedKeyOrderL(const T &anEntry, TInt aMode) const;
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.
|
|
|
inline TInt SpecificFindInUnsignedKeyOrderL(const T &anEntry, TInt aMode) const;
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.
|
|
|
inline TInt SpecificFindInOrderL(const T &anEntry, TLinearOrder< T > anOrder, TInt aMode) const;
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.
|
|
|
inline void SpecificFindInSignedKeyOrderL(const T &anEntry, TInt &anIndex, TInt aMode) const;
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.
|
|
inline void SpecificFindInUnsignedKeyOrderL(const T &anEntry, TInt &anIndex, TInt aMode) const;
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.
|
|
inline void SpecificFindInOrderL(const T &anEntry, TInt &anIndex, TLinearOrder< T > anOrder, TInt aMode) const;
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.
|
|
inline void InsertInSignedKeyOrderL(const T &anEntry);
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.
|
inline void InsertInUnsignedKeyOrderL(const T &anEntry);
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.
|
inline void InsertInOrderL(const T &anEntry, TLinearOrder< T > anOrder);
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.
|
inline void InsertInSignedKeyOrderAllowRepeatsL(const T &anEntry);
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.
|
inline void InsertInUnsignedKeyOrderAllowRepeatsL(const T &anEntry);
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.
|
inline void InsertInOrderAllowRepeatsL(const T &anEntry, TLinearOrder< T > anOrder);
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.
|
inline void 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 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.
inline TInt Reserve(TInt aCount);
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.
|
|
inline void ReserveL(TInt aCount);
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.
|
|
inline void SortSigned();
Sorts the objects within the array; the sort order is assumed to be in signed integer order.
inline void SortUnsigned();
Sorts the objects within the array; the sort order is assumed to be in unsigned integer order.
inline void Sort(TLinearOrder< T > anOrder);
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>.
|
inline TArray< T > Array() const;
Constructs and returns a generic array.
|