23 #ifndef BAGEL_BOFLIB_VHASH_TABLE_H 24 #define BAGEL_BOFLIB_VHASH_TABLE_H 26 #include "bagel/boflib/list.h" 30 template<
class T,
int S>
35 bool contains(
const T &val);
36 void insert(
const T &val);
52 unsigned(*_pHashFunction)(
const T &);
65 template<
class T,
int S>
67 _pHashFunction(hashFun), _bisEmpty(
true) {
71 template<
class T,
int S>
73 for (
int x = 0; x < _nHashTableSize; x++) {
77 for (
int i = 0; i < nListEntries; i++) {
80 pHashBucket->setNodeItem(i, (T *)
nullptr);
86 template<
class T,
int S>
88 T *pNodeValue =
new T(val);
90 assert(pNode !=
nullptr);
92 int nHashBucketIndex = ((*_pHashFunction)(val)) % _nHashTableSize;
93 assert(nHashBucketIndex < _nHashTableSize);
96 assert(pHashBucket !=
nullptr);
101 template<
class T,
int S>
103 bool returnValue =
false;
104 int nHashBucketIndex = ((*_pHashFunction)(val)) % _nHashTableSize;
105 assert(nHashBucketIndex < _nHashTableSize);
108 CBofList<T *> *pHashBucket = &(fakeThis->_xHashTable[nHashBucketIndex]);
109 assert(pHashBucket !=
nullptr);
110 int nItemsInBucket = pHashBucket->getCount();
111 for (
int i = 0; i < nItemsInBucket; i++) {
113 if (TableEntry->compareNoCase((
const char *)val) == 0) {
Definition: vhash_table.h:31
int getActualCount() const
Definition: list.h:193
void addToTail(CBofListNode< T > *pNewNode)
Definition: list.h:459
T getNodeItem(int nNodeIndex)
Definition: list.h:220