GClasses
|
The base class of hash tables. More...
#include <GHashTable.h>
Public Member Functions | |
virtual | ~GHashTableBase () |
size_t | size () |
Returns the number of items in this hash table. | |
size_t | revisionNumber () |
Returns a number that changes when the contents of this table are modified (This is useful for detecting invalidated iterators) | |
Protected Member Functions | |
GHashTableBase (size_t nInitialBucketCount) | |
virtual size_t | hash (const char *pKey, size_t nBucketCount)=0 |
Returns a hash of the key. | |
virtual bool | areKeysEqual (const char *pKey1, const char *pKey2)=0 |
Returns true iff the keys compare equal. | |
void | _Resize (size_t nNewSize) |
void | _Add (const char *pKey, const void *pValue) |
Adds a key/value pair to the hash table. | |
template<class T > | |
bool | _Get (const char *pKey, T **pOutValue) |
Returns true and the first occurrence of a value with the specified key if one exists. | |
void | _Remove (const char *pKey) |
Removes the first found occurrence of the specified key. | |
size_t | _Count (const char *pKey) |
Returns the number of values with the specified key. | |
Protected Attributes | |
struct HashBucket * | m_pBuckets |
struct HashBucket * | m_pFirstEmpty |
size_t | m_nBucketCount |
size_t | m_nCount |
size_t | m_nModCount |
Friends | |
class | GHashTableEnumerator |
The base class of hash tables.
GClasses::GHashTableBase::GHashTableBase | ( | size_t | nInitialBucketCount | ) | [protected] |
virtual GClasses::GHashTableBase::~GHashTableBase | ( | ) | [virtual] |
void GClasses::GHashTableBase::_Add | ( | const char * | pKey, |
const void * | pValue | ||
) | [protected] |
Adds a key/value pair to the hash table.
size_t GClasses::GHashTableBase::_Count | ( | const char * | pKey | ) | [protected] |
Returns the number of values with the specified key.
bool GClasses::GHashTableBase::_Get | ( | const char * | pKey, |
T ** | pOutValue | ||
) | [protected] |
Returns true and the first occurrence of a value with the specified key if one exists.
void GClasses::GHashTableBase::_Remove | ( | const char * | pKey | ) | [protected] |
Removes the first found occurrence of the specified key.
void GClasses::GHashTableBase::_Resize | ( | size_t | nNewSize | ) | [protected] |
virtual bool GClasses::GHashTableBase::areKeysEqual | ( | const char * | pKey1, |
const char * | pKey2 | ||
) | [protected, pure virtual] |
Returns true iff the keys compare equal.
Implemented in GClasses::GHashTable, GClasses::GConstStringHashTable, GClasses::GConstStringToIndexHashTable, and GClasses::GNodeHashTable.
virtual size_t GClasses::GHashTableBase::hash | ( | const char * | pKey, |
size_t | nBucketCount | ||
) | [protected, pure virtual] |
Returns a hash of the key.
Implemented in GClasses::GHashTable, GClasses::GConstStringHashTable, GClasses::GConstStringToIndexHashTable, and GClasses::GNodeHashTable.
size_t GClasses::GHashTableBase::revisionNumber | ( | ) | [inline] |
Returns a number that changes when the contents of this table are modified (This is useful for detecting invalidated iterators)
size_t GClasses::GHashTableBase::size | ( | ) | [inline] |
Returns the number of items in this hash table.
friend class GHashTableEnumerator [friend] |
size_t GClasses::GHashTableBase::m_nBucketCount [protected] |
size_t GClasses::GHashTableBase::m_nCount [protected] |
size_t GClasses::GHashTableBase::m_nModCount [protected] |
struct HashBucket* GClasses::GHashTableBase::m_pBuckets [protected] |
struct HashBucket* GClasses::GHashTableBase::m_pFirstEmpty [protected] |