Location:
e32std.h
Link against: euser.lib
RPointerArray<class T>
Supported from 5.0
A simple and efficient array of pointers to objects. The elements
of the array are pointers to instances of the template class
T
.
The class offers standard array behaviour which includes insertion, appending and sorting of pointers.
|
Defined in RPointerArray
:
Append()
, Array()
, Close()
, Compress()
, Count()
, Find()
, FindInAddressOrder()
, FindInOrder()
, GranularCompress()
, Insert()
, InsertInAddressOrder()
, InsertInAddressOrderAllowRepeats()
, InsertInOrder()
, InsertInOrderAllowRepeats()
, RPointerArray()
, Remove()
, Reset()
, ResetAndDestroy()
, Sort()
, SortIntoAddressOrder()
, operator[]()
RPointerArrayBase
is
private
.RPointerArray();
Default C++ constructor.
This constructs an array object for an array of pointers with default granularity, which is 8.
RPointerArray(TInt aGranularity);
C++ constructor with granularity.
This constructs an array object for an array of pointers with the specified granularity.
|
void Close();
Closes the array and frees all memory allocated to it.
The function must be called before this array object goes out of scope.
void Reset();
Empties the array.
It frees all memory allocated to the array and resets the internal state so that it is ready to be reused.
This array object can be allowed to go out of scope after a call to this function.
void ResetAndDestroy();
Empties the array and deletes the referenced objects.
It frees all memory allocated to the array and resets the internal state so that it is ready to be reused. The function also deletes all of the objects whose pointers are contained by the array.
This array object can be allowed to go out of scope after a call to this function.
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 object pointers. Adding a new object pointer to the array always results in a re-allocation of memory.
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 object pointers. Adding new object pointers to the array does not result in a re-allocation of memory until the the total number of pointers reaches a multiple of the granularity.
TInt Count() const;
Gets the number of object pointers in the array.
|
TInt Insert(const T* anEntry,TInt aPos);
Inserts an object pointer into the array at a specified position.
|
|
TInt InsertInAddressOrder(const T* anEntry);
Inserts an object pointer into the array in address order.
No duplicate entries are permitted.
The function assumes that existing object pointers within the array are in address order.
|
|
TInt InsertInAddressOrderAllowRepeats(const T* anEntry);
Inserts an object pointer into the array in address order, allowing duplicates.
If the new object pointer is a duplicate of an existing object pointer in the array, then the new pointer is inserted after the existing one. If more than one duplicate object pointer already exists in the array, then any new duplicate pointer is inserted after the last one.
|
|
TInt InsertInOrder(const T* anEntry, TLinearOrder<T> anOrder);
Inserts an object pointer into the array so that the object itself is in object order.
The algorithm for determining the order of two
classT
objects is provided by a function supplied by the
caller.
No duplicate entries are permitted.
|
|
TInt InsertInOrderAllowRepeats(const T* anEntry, TLinearOrder<T> anOrder);
Inserts an object pointer into the array so that the object itself is in object order, allowing duplicates
The algorithm for determining the order of two
classT
objects is provided by a function supplied by the
caller.
If the specified object is a duplicate of an existing object, then the new pointer is inserted after the pointer to the existing object. If more than one duplicate object already exists, then the new pointer is inserted after the pointer to the last one.
|
|
TInt Append(const T* anEntry);
Appends an object pointer onto the array.
|
|
void Remove(TInt anIndex);
Removes the object pointer at the specified position from the array.
|
TInt Find(const T* anEntry) const;
Finds the first object pointer in the array which matches the specified object pointer, using a sequential search.
Matching is based on the comparison of pointers.
The find operation always starts at the low index end of the array. There is no assumption about the order of objects in the array.
|
|
TInt Find(const T* anEntry, TIdentityRelation<T> anIdentity) const;
Finds the first object pointer in the array whose object matches the specified object, using a sequential search and a matching algorithm.
The algorithm for determining whether two class
T
objects match is provided by a function supplied by the
caller.
The find operation always starts at the low index end of the array. There is no assumption about the order of objects in the array.
|
|
TInt FindInAddressOrder(const T* anEntry) const;
TInt FindInAddressOrder(const T* anEntry, TInt& anIndex) const;
Finds the object pointer in the array which matches the specified object pointer, using a binary search technique.
The functions assume that existing object pointers within the array are in address order.
|
|
TInt FindInOrder(const T* anEntry, TLinearOrder<T> anOrder) const;
TInt FindInOrder(const T* anEntry, TInt& anIndex, TLinearOrder<T> anOrder) const;
Finds the object pointer in the array whose object matches the specified object, using a binary search technique and an ordering algorithm.
The functions assume that existing object pointers in the
array are ordered so that the objects themselves are in object order as
determined by an algorithm supplied by the caller and packaged as
aTLinearOrder<T>
.
|
|
void Sort(TLinearOrder<T> anOrder);
Sorts the object pointers within the array.
The sort order of
the pointers is based on the order of the referenced objects. The referenced
object order is determined by an algorithm supplied by the caller and packaged
as aTLinerOrder<T>
.
|
void SortIntoAddressOrder();
Sorts the object pointers within the array into address order.
const T*& operator[](TInt anIndex) const;
T*& operator[](TInt anIndex);
Indexing operator.
This operator returns reference to the object pointer located at the specified position within the array.
Two versions of the operator are supplied. The compiler chooses the appropriate version based on the use made of the returned reference. If the returned reference is used in an expression where the reference can be modified, then the non-const version is chosen.
|
|
TArray<T> Array() const;
Supported from 6.0
Constructs and returns a generic array.
|