#include <tables.h>
Public Member Functions | |
| void | disableRehash () |
| Control rehashing: by default hash tables rehash themselves automatically. | |
| void | enableRehash () |
| uint32_t | getHashMask () const |
| Return the hash mask to get access to the table: index = hashValue & mask. | |
| size_t | getNbBuckets () const |
| size_t | getTableSize () const |
| void | reset () |
| Reset the table without deleting the buckets. | |
| void | resetDelete () |
| Reset the table and delete the buckets. | |
| base::Enumerator< BucketType > | getEnumerator () const |
| Enumerator. | |
| void | incBuckets () |
| Increase the counter of the buckets. | |
| void | decBuckets () |
| Decrease the counter of the buckets. | |
| BucketType ** | getAtBucket (uint32_t hashValue) const |
| Access to a particular table entry with a hash value. | |
| BucketType * | getBucket (uint32_t hashValue) const |
| Access to the first bucket in the table with a given hash value. | |
Protected Types | |
| enum | { MAX_TABLE_SIZE = (1 << 26) } |
| We give a limit to the size of the tables to stop rehashing after a certain point. More... | |
Protected Member Functions | |
| BucketType ** | getBuckets () const |
| Access to the bucket table. | |
| AbstractTable (uint32_t sizePower2, bool aggressive) | |
| Protected constructor: this is an abstract class only. | |
| ~AbstractTable () | |
| Destructor: not virtual. | |
Protected Attributes | |
| size_t | nbBuckets |
| number of buckets | |
Private Member Functions | |
| bool | needsRehash () const |
Private Attributes | |
| uint32_t | mask |
| mask to apply to hash value to get indices = size - 1 since the size of the table is a power of 2 | |
| uint32_t | shiftThreshold |
| mask >> shiftThreshold is the threshold | |
| bool | mayRehash |
| used to disable rehashing | |
| BucketType ** | buckets |
| the table of buckets | |
Classes | |
| struct | Bucket_t |
| Simple adapter to tie together the hash table and bucket types. More... | |
DO NOT USE DIRECTLY.
| BucketType,: | customized buckets (with customized data) to use. | |
| BucketParentType,: | SingleBucket_t or DoubleBucket_t | |
| BucketParentTemplate,: | SingleBucket or DoubleBucket |
|
|||||
|
We give a limit to the size of the tables to stop rehashing after a certain point.
|
|
||||||||||||||||
|
Protected constructor: this is an abstract class only.
|
|
|||||||||
|
Destructor: not virtual. There is no polymorphism involved here. |
|
|||||||||
|
Decrease the counter of the buckets. Call this whenever you remove a bucket from the hash table. |
|
|||||||||
|
Control rehashing: by default hash tables rehash themselves automatically. You can disable this feature. |
|
|||||||||
|
|
|
||||||||||
|
Access to a particular table entry with a hash value.
|
|
||||||||||
|
Access to the first bucket in the table with a given hash value.
|
|
|||||||||
|
Access to the bucket table.
|
|
|||||||||
|
|
|
|||||||||
|
Return the hash mask to get access to the table: index = hashValue & mask.
|
|
|||||||||
|
|
|
|||||||||
|
|
|
|||||||||
|
Increase the counter of the buckets. This automatically calls rehash if needed. Call this whenever you add a new bucket in the hash table, BUT ALWAYS AFTER adding a bucket (bucket->link(somewhere) because of the rehashing. |
|
|||||||||
|
|
|
|||||||||
|
Reset the table without deleting the buckets.
|
|
|||||||||
|
Reset the table and delete the buckets. Note: as the bucket type is custom, the delete call may call destructors of the sub-types. |
|
|||||
|
the table of buckets
|
|
|||||
|
mask to apply to hash value to get indices = size - 1 since the size of the table is a power of 2
|
|
|||||
|
used to disable rehashing
|
|
|||||
|
number of buckets
|
|
|||||
|
mask >> shiftThreshold is the threshold
|
1.4.2