»
Symbian OS v9.3 »
Symbian OS reference »
C++ component reference »
Base E32_EKA2 »
RPtrHashSet
This item is not part of the S60 3rd Edition SDK for Symbian OS, Feature Pack 2.
class RPtrHashSet : public RHashTableBase;
Description
A templated class which implements an unordered extensional set of objects of type T using a probe-sequence hash table. The
objects are not copied into the set when they are added; rather the set stores pointers to the contained objects.
Derivation
RHashTableBase
- No description.
RPtrHashSet
- A templated class which implements an unordered extensional set of objects of type T using a probe-sequence hash table
Members
Defined in RPtrHashSet
:
Close()
, Count()
, Find()
, Find()
, FindL()
, FindL()
, Insert()
, InsertL()
, RPtrHashSet()
, RPtrHashSet()
, Remove()
, Reserve()
, ReserveL()
, ResetAndDestroy()
, TIter
Construction and destruction
inline RPtrHashSet(const THashFunction32< T > &aHash, const TIdentityRelation< T > &aIdentity);
Description
Construct a set of objects of type T using a specified hash function and identity relation. The set is initially empty.
Parameters
const THashFunction32 < T > &aHash |
The hash function used to hash the objects of type T.
|
const TIdentityRelation < T > &aIdentity |
The identity relation used to determine if two objects of type T should be considered identical.
|
|
inline RPtrHashSet();
Description
Construct a set of objects of type T using a default hash function and identity relation. The set is initially empty.
inline void Close();
Description
Free all memory used by this set. Returns the set to the same state it had following construction.
inline const T *Find(const T &aKey) const;
Description
Locate a specified element in the set.
Parameters
const T &aKey |
The object of type T to search for.
|
|
Return value
const T * |
A pointer to the specified object, if it is in the set. The object may not be modified via this pointer. NULL if the specified
object is not a member of this set.
|
|
inline const T &FindL(const T &aKey) const;
Description
Locate a specified element in the set.
Parameters
const T &aKey |
The object of type T to search for.
|
|
Return value
const T & |
A reference to the specified object, if it is in the set. The object may not be modified via this reference.
|
|
Leave codes
KErrNotFound |
if the specified object is not a member of this set.
|
|
inline T *Find(const T &aKey);
Description
Locate a specified element in the set.
Parameters
const T &aKey |
The object of type T to search for.
|
|
Return value
T * |
A pointer to the specified object, if it is in the set. The object may be modified via this pointer. Care should be taken
not to modify any parts of the object which are used by either the hash function or the identity relation for this set. If
this is done the set may become inconsistent, resulting in malfunctions and/or panics at a later time. NULL if the specified
object is not a member of this set.
|
|
inline T &FindL(const T &aKey);
Description
Locate a specified element in the set.
Parameters
const T &aKey |
The object of type T to search for.
|
|
Return value
T & |
A reference to the specified object, if it is in the set. The object may be modified via this reference. Care should be taken
not to modify any parts of the object which are used by either the hash function or the identity relation for this set. If
this is done the set may become inconsistent, resulting in malfunctions and/or panics at a later time.
|
|
Leave codes
KErrNotFound |
if the specified object is not a member of this set.
|
|
inline TInt Insert(const T *aKey);
Description
Insert an element into the set.
If the specified object is not currently a member of the set, a pointer to the object is added to the set and KErrNone is
returned. If the specified object is currently a member of the set, the existing pointer to the object is replaced by the
provided pointer and KErrNone is returned. In both cases only a pointer to the object is stored - the object is never copied.
Parameters
const T *aKey |
A pointer to the object of type T to add to the set.
|
|
Return value
TInt
|
KErrNone if the object was added successfully. KErrNoMemory if memory could not be allocated to store the pointer to the new
object.
|
|
inline void InsertL(const T *aKey);
Description
Insert an element into the set.
If the specified object is not currently a member of the set, a pointer to the object is added to the set and KErrNone is
returned. If the specified object is currently a member of the set, the existing pointer to the object is replaced by the
provided pointer and KErrNone is returned. In both cases only a pointer to the object is stored - the object is never copied.
Parameters
const T *aKey |
A pointer to the object of type T to add to the set.
|
|
Leave codes
KErrNoMemory |
if memory could not be allocated to store the pointer to the new object.
|
|
inline TInt Remove(const T *aKey);
Description
Remove an element from the set.
Parameters
const T *aKey |
A pointer to the object to be removed.
|
|
Return value
TInt
|
KErrNone if the object was removed successfully. KErrNotFound if the object was not present in the set.
|
|
inline TInt Count() const;
Description
Query the number of elements in the set.
Return value
TInt
|
The number of elements currently in the set.
|
|
inline TInt Reserve(TInt aCount);
Description
Expand the set to accommodate a specified number of elements. If the set already has enough space for the specified number
of elements, no action is taken. Any elements already in the set are retained.
Parameters
TInt aCount |
The number of elements for which space should be allocated.
|
|
Return value
TInt
|
KErrNone if the operation completed successfully. KErrNoMemory if sufficient memory could not be allocated.
|
|
inline void ReserveL(TInt aCount);
Description
Expand the set to accommodate a specified number of elements. If the set already has enough space for the specified number
of elements, no action is taken. Any elements already in the set are retained.
Parameters
TInt aCount |
The number of elements for which space should be allocated.
|
|
Leave codes
KErrNoMemory |
if sufficient memory could not be allocated.
|
|
void ResetAndDestroy();
Description
Deletes all the objects of type T to which pointers are stored in this set. Then frees all the memory used by the set and
returns the set to the same state as immediately following construction.
typedef TPtrHashSetIter<T> RPtrHashSet< T >::TIter;
Description
A class which allows iteration over the elements of a RPtrHashSet<T> class.
The set being iterated over may not be modified while an iteration is in progress or the iteration operations may malfunction
or panic.