Having been unable to find a hashtable implementation for Symbian environments, I ended up reinventing the wheel a bit and wrote my own. The API somewhat resembles that of java.util.Hashtable, and only implements the "mandatory" functions (put, get, remove, rehash). It is implemented as a set of templated classes. All of the code is attached, please find a summary of the API (with comments stripped) below:
public: // Constructors and destructor static CHashTable* NewL( TInt aInitialTableSize = KDefaultTableSize, TReal aRehashRatio = KDefaultRehashRatio ); static CHashTable* NewLC( TInt aInitialTableSize = KDefaultTableSize, TReal aRehashRatio = KDefaultRehashRatio ); virtual ~CHashTable();
public: // New methods void PutL( const TDesC& aKey, T* aObj ); const T* GetL( const TDesC& aKey ) const; TBool Remove( const TDesC& aKey ); void ResetTable(); void RehashL(); CEntryIterator<T>* EntriesLC() const; TReal LoadFactor(); TInt NumEntries() const;
|