THashTable Class Reference

class THashTable

Generic hashtable for storing keys with associated values. K must be a subclass of class MHashKey.

Public Member Functions
THashTable(TUint)
~THashTable()
voidConstructL()
V *Find(MHashKey &)
TUint Length()
voidRemoveAll()
TUint RemoveIf(TBool(*)(const V &, void *), void *)
TUint RemoveL(MHashKey &)
TUint Size()
TUint StoreL(MHashKey &, V &)
Private Attributes
TUint iSize
TChain< K, V > *iTable

Constructor & Destructor Documentation

THashTable(TUint)

THashTable(TUintaSize)

Parameters

TUint aSize

~THashTable()

~THashTable()

Member Functions Documentation

ConstructL()

voidConstructL()

Find(MHashKey &)

V *Find(MHashKey &aKey)

Parameters

MHashKey & aKey

Length()

TUint Length()

RemoveAll()

voidRemoveAll()

Removes all data from the hashtable.

RemoveIf(TBool(*)(const V &, void *), void *)

TUint RemoveIf(TBool(*)(const V &, void *)aRemoveCriteria,
void *aDataObject
)

Iterate through hashtable and exectue aRemoveCriteria function for all entries. Delete entries for which the function returns ETrue.

Parameters

TBool(*)(const V &, void *) aRemoveCriteriaFunction that returns ETrue if the data item given as the parameter for the function should be removed.
void * aDataObjectData pointer that is passed to the remove criteria function. The meaning of data pointer is determined by the criteria function. See CDestinationCache::Cleanup for example on how this function is used.

RemoveL(MHashKey &)

TUint RemoveL(MHashKey &aKey)

Deletes a data item from hash and releases the memory allocated.

Parameters

MHashKey & aKey

Size()

TUint Size()[inline]

How many bytes does the hash table take. This assumes all data objects are equally sized.

StoreL(MHashKey &, V &)

TUint StoreL(MHashKey &aKey,
V &aValue
)

Store key and the associated value to the hashtable. The cache operates in overwrite mode: if key exists, the earlier value is overwritten with new one. A future work item might be to implement the conventional mode, that would raise an exception when the key already exists.

Parameters

MHashKey & aKey
V & aValue

Member Data Documentation

TUint iSize

TUint iSize[private]

TChain< K, V > * iTable

TChain< K, V > *iTable[private]