RArray< TUint > Class Template Reference

template <>
class RArray< TUint > : private RPointerArrayBase

Array of unsigned integers.

The array is a simple and efficient specialized array of unsigned integers offering standard array behaviour.

The derivation from RPointerArrayBase is private.

Inherits from

Public Member Functions
RArray()
RArray(TInt)
RArray(TInt, TInt)
RArray(TUint *, TInt)
TInt Append(TUint)
voidAppendL(TUint)
TArray< TUint >Array()
voidClose()
voidCompress()
TInt Count()
TInt Find(TUint)
TInt FindInOrder(TUint)
TInt FindInOrder(TUint, TInt &)
TInt FindInOrderL(TUint)
voidFindInOrderL(TUint, TInt &)
TInt FindL(TUint)
TInt FindReverse(TUint)
TInt FindReverseL(TUint)
voidGranularCompress()
TInt Insert(TUint, TInt)
TInt InsertInOrder(TUint)
TInt InsertInOrderAllowRepeats(TUint)
voidInsertInOrderAllowRepeatsL(TUint)
voidInsertInOrderL(TUint)
voidInsertL(TUint, TInt)
voidRemove(TInt)
TInt Reserve(TInt)
voidReserveL(TInt)
voidReset()
voidSort()
TInt SpecificFindInOrder(TUint, TInt)
TInt SpecificFindInOrder(TUint, TInt &, TInt)
TInt SpecificFindInOrderL(TUint, TInt)
voidSpecificFindInOrderL(TUint, TInt &, TInt)
const TUint &operator[](TInt)
TUint &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()

Constructor & Destructor Documentation

RArray()

RArray()[inline]

Default C++ constructor.

This constructs an array object for an array of unsigned integers with default granularity.

The default granularity of the array is 8.

RArray(TInt)

RArray(TIntaGranularity)[inline, explicit]

Constructs an array object for an array of unsigned integers with the specified granularity.

panic
USER 127, if aGranularity is not positive or is greater than or equal to 0x10000000.

Parameters

TInt aGranularityThe granularity of the array.

RArray(TInt, TInt)

RArray(TIntaMinGrowBy,
TIntaFactor
)[inline]

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

This constructs an array object for an array of unsigned integers 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.

Parameters

TInt aMinGrowByThe minimum growth step of the array. Must be between 1 and 65535 inclusive.
TInt 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.

RArray(TUint *, TInt)

RArray(TUint *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 TUint objects. Ownership of the set of entries does not transfer to this RArray object.

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

TUint * aEntriesA pointer to the first entry of type class TUint in the set of entries belonging to the existing array.
TInt aCountThe number of entries in the existing array.

Member Functions Documentation

Append(TUint)

TInt Append(TUintanEntry)[inline]

Appends an unsigned integer onto the array.

Parameters

TUint anEntryThe unsigned integer to be appended.

AppendL(TUint)

voidAppendL(TUintanEntry)[inline]

Appends an unsigned integer 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

TUint anEntryThe unsigned integer to be appended.

Array()

TArray< TUint >Array()const [inline]

Constructs and returns a generic array.

TArray

Close()

voidClose()[inline]

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

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

Compress()

voidCompress()[inline]

Compresses the array down to a minimum.

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

Count()

TInt Count()const [inline]

Gets the number of unsigned integers in the array.

Find(TUint)

TInt Find(TUintanEntry)const [inline]

Finds the first unsigned integer in the array which matches the specified value, using a sequential search.

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

Parameters

TUint anEntryThe unsigned integer to be found.

FindInOrder(TUint)

TInt FindInOrder(TUintanEntry)const [inline]

Finds the unsigned integer in the array which matches the specified value, using a binary search technique.

The functions assume that existing entries within the array are in unsigned integer order.

Parameters

TUint anEntryThe unsigned integer to be found.

FindInOrder(TUint, TInt &)

TInt FindInOrder(TUintanEntry,
TInt &anIndex
)const [inline]

Finds the unsigned integer in the array which matches the specified value, using a binary search technique.

If the index cannot be found, the function returns the index of the last unsigned integer within the array which logically precedes anEntry.

The functions assume that existing entries within the array are in unsigned integer order.

Parameters

TUint anEntryThe unsigned integer to be found.
TInt & anIndexA TInt supplied by the caller. On return, contains an index value. If the function returns KErrNone, this is the index of the matching unsigned integer within the array. If the function returns KErrNotFound, this is the index of the first unsigned integer within the array that is bigger than the unsigned integer being searched for - if no unsigned integers within the array are bigger, then the index value is the same as the total number of unsigned integers within the array.

FindInOrderL(TUint)

TInt FindInOrderL(TUintanEntry)const [inline]

Finds the unsigned integer in the array which matches the specified value, using a binary search technique.

The functions assume that existing entries within the array are in unsigned integer order.

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

leave
KErrNotFound, if no matching entry can be found.

Parameters

TUint anEntryThe unsigned integer to be found.

FindInOrderL(TUint, TInt &)

voidFindInOrderL(TUintanEntry,
TInt &anIndex
)const [inline]

Finds the unsigned integer in the array which matches the specified value, using a binary search technique.

If the index cannot be found, the function returns the index of the last unsigned integer within the array which logically precedes anEntry. The functions assume that existing entries within the array are in unsigned integer order.

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

leave
KErrNotFound, if no matching entry can be found.

Parameters

TUint anEntryThe unsigned integer to be found.
TInt & anIndexA TInt supplied by the caller. On return, contains an index value of the matching unsigned integer within the array. If the function leaves with KErrNotFound, this is the index of the first unsigned integer within the array that is bigger than the unsigned integer being searched for - if no unsigned integers within the array are bigger, then the index value is the same as the total number of unsigned integers within the array.

FindL(TUint)

TInt FindL(TUintanEntry)const [inline]

Finds the first unsigned integer in the array which matches the specified value, using a sequential search.

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

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

leave
KErrNotFound, if no matching entry can be found.

Parameters

TUint anEntryThe unsigned integer to be found.

FindReverse(TUint)

TInt FindReverse(TUintanEntry)const [inline]

Finds the last unsigned integer in the array which matches the specified value, using a sequential search.

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

Parameters

TUint anEntryThe unsigned integer to be found.

FindReverseL(TUint)

TInt FindReverseL(TUintanEntry)const [inline]

Finds the last unsigned integer in the array which matches the specified value, using a sequential search.

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

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

leave
KErrNotFound, if no matching entry can be found.

Parameters

TUint anEntryThe unsigned integer to be found.

GranularCompress()

voidGranularCompress()[inline]

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

Insert(TUint, TInt)

TInt Insert(TUintanEntry,
TIntaPos
)[inline]

Inserts an unsigned integer into the array at the specified position.

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

Parameters

TUint anEntryThe unsigned integer to be inserted.
TInt aPosThe position within the array where the unsigned integer is to be inserted. The position is relative to zero, i.e. zero implies that an entry is inserted at the beginning of the array.

InsertInOrder(TUint)

TInt InsertInOrder(TUintanEntry)[inline]

Inserts an unsigned integer into the array in unsigned integer order.

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

The function assumes that existing entries within the array are in unsigned integer order.

Parameters

TUint anEntryThe unsigned integer to be inserted.

InsertInOrderAllowRepeats(TUint)

TInt InsertInOrderAllowRepeats(TUintanEntry)[inline]

Inserts an unsigned integer into the array in unsigned integer order, allowing duplicates.

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

The function assumes that existing entries within the array are in unsigned integer order.

Parameters

TUint anEntryThe unsigned integer to be inserted.

InsertInOrderAllowRepeatsL(TUint)

voidInsertInOrderAllowRepeatsL(TUintanEntry)[inline]

Inserts an unsigned integer into the array in unsigned integer order, allowing duplicates.

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

The function assumes that existing entries within the array are in unsigned integer 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

TUint anEntryThe unsigned integer to be inserted.

InsertInOrderL(TUint)

voidInsertInOrderL(TUintanEntry)[inline]

Inserts an unsigned integer into the array in unsigned integer order.

No duplicate entries are permitted.

The function assumes that existing entries within the array are in unsigned integer 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

TUint anEntryThe unsigned integer to be inserted.

InsertL(TUint, TInt)

voidInsertL(TUintanEntry,
TIntaPos
)[inline]

Inserts an unsigned integer 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 entries currently in the array.

Parameters

TUint anEntryThe unsigned integer to be inserted.
TInt aPosThe position within the array where the unsigned integer is to be inserted. The position is relative to zero, i.e. zero implies that an entry is inserted at the beginning of the array.

Remove(TInt)

voidRemove(TIntanIndex)[inline]

Removes the unsigned integer at the specified position from the array.

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

Parameters

TInt anIndexThe position within the array from where the unsigned integer is to be removed. The position is relative to zero, i.e. zero implies that an entry 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 integers specified. Adding new integers to the array does not result in a re-allocation of memory until the the total number of integers exceeds the specified count.

Parameters

TInt aCountThe number of integers for which space should be reserved

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

leave
KErrNoMemory If the requested amount of memory could not be allocated

Parameters

TInt aCountThe number of integers for which space should be reserved

Reset()

voidReset()[inline]

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.

Sort()

voidSort()[inline]

Sorts the array entries into unsigned integer order.

SpecificFindInOrder(TUint, TInt)

TInt SpecificFindInOrder(TUintanEntry,
TIntaMode
)const [inline]

Finds the unsigned integer in the array that matches the specified unsigned integer using a binary search technique.

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 the array is in unsigned integer order.

TArrayFindMode

Parameters

TUint anEntryThe unsigned integer to be found..
TInt aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

SpecificFindInOrder(TUint, TInt &, TInt)

TInt SpecificFindInOrder(TUintanEntry,
TInt &anIndex,
TIntaMode
)const [inline]

Finds the unsigned integer in the array that matches the specified unsigned integer using a binary search technique.

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

The function assumes that the array is in unsigned integer order.

TArrayFindMode

Parameters

TUint anEntryThe unsigned integer to be found.
TInt & 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.
TInt aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

SpecificFindInOrderL(TUint, TInt)

TInt SpecificFindInOrderL(TUintanEntry,
TIntaMode
)const [inline]

Finds the unsigned integer in the array that matches the specified unsigned integer using a binary search technique.

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

The function assumes that the array is in unsigned integer order.

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

leave
KErrNotFound if no matching entry exists.
TArrayFindMode

Parameters

TUint anEntryThe unsigned integer to be found.
TInt aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

SpecificFindInOrderL(TUint, TInt &, TInt)

voidSpecificFindInOrderL(TUintanEntry,
TInt &anIndex,
TIntaMode
)const [inline]

Finds the unsigned integer in the array that matches the specified unsigned integer using a binary search technique.

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 the array is in unsigned integer order.

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

leave
KErrNotFound if no matching entry exists.
TArrayFindMode

Parameters

TUint anEntryThe unsigned integer to be found.
TInt & 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.
TInt aModeSpecifies whether to find the first match, the last match or any match, as defined by one of the TArrayFindMode enum values.

operator[](TInt)

const TUint &operator[](TIntanIndex)const [inline]

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

The compiler uses this variant 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 entries currently in the array.

Parameters

TInt anIndexThe position of the unsigned integer within the array, relative to zero, i.e. zero implies the entry at the beginning of the array.

operator[](TInt)

TUint &operator[](TIntanIndex)[inline]

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

The compiler uses this variant 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 entries currently in the array.

Parameters

TInt anIndexThe position of the unsigned integer within the array, relative to zero, i.e. zero implies the entry at the beginning of the array.