class RHashMap : public RHashTableBase |
A templated class which implements an associative array with key type K and value type V, using a probe-sequence hash table. Both the key and value objects are copied into the table when they are added. A bitwise binary copy is used here, so neither of the types K and V may implement a nontrivial copy constructor.
Public Member Functions | |
---|---|
RHashMap(const THashFunction32< K > &, const TIdentityRelation< K > &) | |
RHashMap() | |
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) |
Inherited Enumerations | |
---|---|
RHashTableBase:TDefaultSpecifier | |
RHashTableBase:TElementState |
Public Member Type Definitions | |
---|---|
typedef | THashMapIter< K, V > TIter |
RHashMap | ( | 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.
const THashFunction32< K > & aHash | The hash function used to hash the key objects of type K. |
const TIdentityRelation< K > & aIdentity | The identity relation used to determine if two key objects of type K should be considered identical. |
RHashMap | ( | ) | [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] |
Free all memory used by this array. Returns the array to the same state it had following construction.
TInt | Count | ( | ) | const [inline] |
Query the number of key-value pairs in the array.
The number of key-value pairs currently 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.
A pointer to the copy of the corresponding value object in the array, if the specified key object was found. The value object may not be modified via this pointer. NULL if the specified key object was not found.
const K & 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.
A pointer to the copy of the corresponding value object in the array, if the specified key object was found. The value object may be modified via this pointer. NULL if the specified key object was not found.
const K & 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.
A reference to the copy of the corresponding value object in the array, if the specified key object was found. The value object may not be modified via this reference.
leave
KErrNotFound if the specified key object was not found.
const K & aKey | The key object of type K to look up. |
V & | FindL | ( | const K & | aKey | ) | [inline] |
Look up a specified key in the associative array and return a pointer to the corresponding value.
A reference to the copy of the corresponding value object in the array, if the specified key object was found. The value object may be modified via this reference.
leave
KErrNotFound if the specified key object was not found.
const K & aKey | The key object of type K to look up. |
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 copy of the key object along with a copy of the value object are added to the array and KErrNone is returned. If the specified key object is found in the array, the existing copies of both the key and value objects are replaced by the provided objects and KErrNone is returned. In both cases the objects are copied bitwise into the array.
KErrNone if the key-value pair was added successfully. KErrNoMemory if memory could not be allocated to store the copies of aKey and aValue.
const K & aKey | The key object of type K to add to the array. |
const V & aValue | 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 copy of the key object along with a copy of the value object are added to the array and KErrNone is returned. If the specified key object is found in the array, the existing copies of both the key and value objects are replaced by the provided objects and KErrNone is returned. In both cases the objects are copied bitwise into the array.
leave
KErrNoMemory if memory could not be allocated to store the copies of aKey and aValue.
const K & aKey | The key object of type K to add to the array. |
const V & aValue | The value object of type V to associate with aKey. |
TInt | Remove | ( | const K & | aKey | ) | [inline] |
Remove a key-value pair from the array.
KErrNone if the key object and corresponding value object were removed successfully. KErrNotFound if the key object was not present in the array.
const K & aKey | The key to be removed. |
TInt | Reserve | ( | TInt | aCount | ) | [inline] |
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.
KErrNone if the operation completed successfully.
KErrNoMemory if sufficient memory could not be allocated.
TInt aCount | The number of key-value pairs for which space should be allocated. |
void | ReserveL | ( | TInt | aCount | ) | [inline] |
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.
leave
KErrNoMemory if sufficient memory could not be allocated.
TInt aCount | The number of key-value pairs for which space should be allocated. |
typedef THashMapIter< K, V > | TIter |
A class which allows iteration over the elements of a RHashMap<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.