GClasses

GClasses::GConstStringToIndexHashTable Class Reference

Hash table based on keys of constant strings (or at least strings that won't change during the lifetime of the hash table). It's a good idea to use a GHeap in connection with this class. More...

#include <GHashTable.h>

Inheritance diagram for GClasses::GConstStringToIndexHashTable:
GClasses::GHashTableBase

List of all members.

Public Member Functions

 GConstStringToIndexHashTable (size_t nInitialBucketCount, bool bCaseSensitive)
virtual ~GConstStringToIndexHashTable ()
virtual size_t hash (const char *pKey, size_t nBucketCount)
 Computes a hash of the key.
virtual bool areKeysEqual (const char *pKey1, const char *pKey2)
 Returns true iff the two keys are equal.
void add (const char *pKey, size_t nValue)
 Adds a key and value pair to the hash table. The key should be a constant string (or at least a string that won't change over the lifetime of the hash table). The GHeap class provides a good place to store such a string.
bool get (const char *pKey, size_t *pValue)
 Gets the value for the specified key.
bool get (const char *pKey, size_t nLen, size_t *pValue)
 Gets the value for the specified key.
void remove (const char *pKey)
 Removes an entry from the hash table.

Protected Attributes

bool m_bCaseSensitive

Detailed Description

Hash table based on keys of constant strings (or at least strings that won't change during the lifetime of the hash table). It's a good idea to use a GHeap in connection with this class.


Constructor & Destructor Documentation

GClasses::GConstStringToIndexHashTable::GConstStringToIndexHashTable ( size_t  nInitialBucketCount,
bool  bCaseSensitive 
) [inline]
virtual GClasses::GConstStringToIndexHashTable::~GConstStringToIndexHashTable ( ) [inline, virtual]

Member Function Documentation

void GClasses::GConstStringToIndexHashTable::add ( const char *  pKey,
size_t  nValue 
) [inline]

Adds a key and value pair to the hash table. The key should be a constant string (or at least a string that won't change over the lifetime of the hash table). The GHeap class provides a good place to store such a string.

virtual bool GClasses::GConstStringToIndexHashTable::areKeysEqual ( const char *  pKey1,
const char *  pKey2 
) [inline, virtual]

Returns true iff the two keys are equal.

Implements GClasses::GHashTableBase.

bool GClasses::GConstStringToIndexHashTable::get ( const char *  pKey,
size_t  nLen,
size_t *  pValue 
)

Gets the value for the specified key.

bool GClasses::GConstStringToIndexHashTable::get ( const char *  pKey,
size_t *  pValue 
) [inline]

Gets the value for the specified key.

virtual size_t GClasses::GConstStringToIndexHashTable::hash ( const char *  pKey,
size_t  nBucketCount 
) [inline, virtual]

Computes a hash of the key.

Implements GClasses::GHashTableBase.

void GClasses::GConstStringToIndexHashTable::remove ( const char *  pKey) [inline]

Removes an entry from the hash table.


Member Data Documentation