#include <e32hashtab.h>
class RPtrHashMap : public RHashTableBase |
Public Member Type Definitions | |
---|---|
typedef | TPtrHashMapIter< K, V > TIter |
Public Member Functions | |
---|---|
RPtrHashMap(const THashFunction32< K > &, const TIdentityRelation< K > &) | |
RPtrHashMap() | |
void | Close() |
TInt | Count() |
const V * | Find(const K &) |
V * | Find(const K &) |
const V & | FindL(const K &) |
V & | FindL(const K &) |
TInt | Insert(const K *, const V *) |
void | InsertL(const K *, const V *) |
TInt | Remove(const K *) |
TInt | Reserve(TInt) |
void | ReserveL(TInt) |
void | ResetAndDestroy() |
Inherited Enumerations | |
---|---|
RHashTableBase:TDefaultSpecifier | |
RHashTableBase:TElementState |
A templated class which implements an associative array with key type K and value type V, using a probe-sequence hash table. Neither the key nor value objects are copied into the table when they are added - only pointers are stored.
typedef TPtrHashMapIter< K, V > | TIter |
A class which allows iteration over the elements of a RPtrHashMap<K,V> class.
The array being iterated over may not be modified while an iteration is in progress or the iteration operations may malfunction or panic.
See also: TPtrHashMapIter<K,V>
RPtrHashMap | ( | const THashFunction32< K > & | aHash, |
const TIdentityRelation< K > & | aIdentity | ||
) | [inline] |
Construct an associative array of key-value pairs of type (K,V) using a specified hash function and identity relation. The array initially contains no key-value pairs.
Parameters | |
---|---|
aHash | The hash function used to hash the key objects of type K. |
aIdentity | The identity relation used to determine if two key objects of type K should be considered identical. |
RPtrHashMap | ( | ) | [inline] |
Construct an associative array of key-value pairs of type (K,V) using a default hash function and identity relation. The array initially contains no key-value pairs.
void | Close | ( | ) | [inline] |
Reimplemented from RHashTableBase::Close()
Free all memory used by this array. Returns the array to the same state it had following construction.
TInt | Count | ( | ) | const [inline] |
Reimplemented from RHashTableBase::Count()const
Query the number of key-value pairs in the array.
const V * | Find | ( | const K & | aKey | ) | const [inline] |
Look up a specified key in the associative array and return a pointer to the corresponding value.
Parameters | |
---|---|
aKey | The key object of type K to look up. |
V * | Find | ( | const K & | aKey | ) | [inline] |
Look up a specified key in the associative array and return a pointer to the corresponding value.
Parameters | |
---|---|
aKey | The key object of type K to look up. |
const V & | FindL | ( | const K & | aKey | ) | const [inline] |
Look up a specified key in the associative array and return a pointer to the corresponding value.
Parameters | |
---|---|
aKey | The key object of type K to look up. |
Leave Codes | |
---|---|
KErrNotFound | if the specified key object was not found. |
V & | FindL | ( | const K & | aKey | ) | [inline] |
Look up a specified key in the associative array and return a pointer to the corresponding value.
Parameters | |
---|---|
aKey | The key object of type K to look up. |
Leave Codes | |
---|---|
KErrNotFound | if the specified key object was not found. |
TInt | Insert | ( | const K * | aKey, |
const V * | aValue | |||
) | [inline] |
Insert a key-value pair into the array.
If the specified key object is not found in the array, a pointer to the key object along with a pointer to the value object are added to the array and KErrNone is returned. If the specified key object is found in the array, the existing pointers to both the key and value objects are replaced by the provided pointers and KErrNone is returned. In both cases only pointers are stored in the array - the objects themselves are not copied.
Parameters | |
---|---|
aKey | A pointer to the key object of type K to add to the array. |
aValue | A pointer to the value object of type V to associate with aKey. |
void | InsertL | ( | const K * | aKey, |
const V * | aValue | |||
) | [inline] |
Insert a key-value pair into the array.
If the specified key object is not found in the array, a pointer to the key object along with a pointer to the value object are added to the array and KErrNone is returned. If the specified key object is found in the array, the existing pointers to both the key and value objects are replaced by the provided pointers and KErrNone is returned. In both cases only pointers are stored in the array - the objects themselves are not copied.
Parameters | |
---|---|
aKey | A pointer to the key object of type K to add to the array. |
aValue | A pointer to the value object of type V to associate with aKey. |
Leave Codes | |
---|---|
KErrNoMemory | if memory could not be allocated to store the pointers aKey and aValue. |
TInt | Remove | ( | const K * | aKey | ) | [inline] |
Remove a key-value pair from the array.
Parameters | |
---|---|
aKey | A pointer to the key to be removed. |
Reimplemented from RHashTableBase::Reserve(TInt)
Expand the array to accommodate a specified number of key-value pairs. 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 | |
---|---|
aCount | The number of key-value pairs for which space should be allocated. |
void | ReserveL | ( | TInt | aCount | ) | [inline] |
Reimplemented from RHashTableBase::ReserveL(TInt)
Expand the array to accommodate a specified number of key-value pairs. 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 | |
---|---|
aCount | The number of key-value pairs for which space should be allocated. |
Leave Codes | |
---|---|
KErrNoMemory | if sufficient memory could not be allocated. |