class RHashSet : public RHashTableBase |
A templated class which implements an unordered extensional set of objects of type T using a probe-sequence hash table. The objects are copied into the set when they are added. A bitwise binary copy is used here, so the type T must not implement a nontrivial copy constructor.
Public Member Functions | |
---|---|
RHashSet(const THashFunction32< T > &, const TIdentityRelation< T > &) | |
RHashSet() | |
void | Close() |
TInt | Count() |
const T * | Find(const T &) |
T * | Find(const T &) |
const T & | FindL(const T &) |
T & | FindL(const T &) |
TInt | Insert(const T &) |
void | InsertL(const T &) |
TInt | Remove(const T &) |
TInt | Reserve(TInt) |
void | ReserveL(TInt) |
Inherited Enumerations | |
---|---|
RHashTableBase:TDefaultSpecifier | |
RHashTableBase:TElementState |
Public Member Type Definitions | |
---|---|
typedef | THashSetIter< T > TIter |
RHashSet | ( | const THashFunction32< T > & | aHash, |
const TIdentityRelation< T > & | aIdentity | ||
) | [inline] |
Construct a set of objects of type T using a specified hash function and identity relation. The set is initially empty.
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. |
RHashSet | ( | ) | [inline] |
Construct a set of objects of type T using a default hash function and identity relation. The set is initially empty.
void | Close | ( | ) | [inline] |
Free all memory used by this set. Returns the set to the same state it had following construction.
TInt | Count | ( | ) | const [inline] |
Query the number of elements in the set.
The number of elements currently in the set.
const T * | Find | ( | const T & | aKey | ) | const [inline] |
Locate a specified element in the set.
A pointer to the copy of the specified object in the set, if it exists. The object may not be modified via this pointer. NULL if the specified object is not a member of this set.
const T & aKey | The object of type T to search for. |
T * | Find | ( | const T & | aKey | ) | [inline] |
Locate a specified element in the set.
A pointer to the copy of the specified object in the set, if it exists. 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.
const T & aKey | The object of type T to search for. |
const T & | FindL | ( | const T & | aKey | ) | const [inline] |
Locate a specified element in the set.
A reference to the copy of the specified object in the set, if it exists. The object may not be modified via this reference.
leave
KErrNotFound if the specified object is not a member of this set.
const T & aKey | The object of type T to search for. |
T & | FindL | ( | const T & | aKey | ) | [inline] |
Locate a specified element in the set.
A reference to the copy of the specified object in the set, if it exists. 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
KErrNotFound if the specified object is not a member of this set.
const T & aKey | The object of type T to search for. |
TInt | Insert | ( | const T & | aKey | ) | [inline] |
Insert an element into the set.
If the specified object is not currently a member of the set, a copy of the object is added to the set and KErrNone is returned. If the specified object is currently a member of the set, the existing copy of the object is replaced by the provided object and KErrNone is returned. In both cases the object is copied bitwise into the set.
KErrNone if the object was added successfully. KErrNoMemory if memory could not be allocated to store the copy of aKey.
const T & aKey | The object of type T to add to the set. |
void | InsertL | ( | const T & | aKey | ) | [inline] |
Insert an element into the set.
If the specified object is not currently a member of the set, a copy of the object is added to the set and KErrNone is returned. If the specified object is currently a member of the set, the existing copy of the object is replaced by the provided object and KErrNone is returned. In both cases the object is copied bitwise into the set.
leave
KErrNoMemory if memory could not be allocated to store the copy of aKey.
const T & aKey | The object of type T to add to the set. |
TInt | Remove | ( | const T & | aKey | ) | [inline] |
Remove an element from the set.
KErrNone if the object was removed successfully. KErrNotFound if the object was not present in the set.
const T & aKey | The object to be removed. |
TInt | Reserve | ( | TInt | aCount | ) | [inline] |
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.
KErrNone if the operation completed successfully.
KErrNoMemory if sufficient memory could not be allocated.
TInt aCount | The number of elements for which space should be allocated. |
void | ReserveL | ( | TInt | aCount | ) | [inline] |
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.
leave
KErrNoMemory if sufficient memory could not be allocated.
TInt aCount | The number of elements for which space should be allocated. |
typedef THashSetIter< T > | TIter |
A class which allows iteration over the elements of a RHashSet<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.