#include <HashVector.h>
Inheritance diagram for HashVector:
Public Member Functions | |
HashVector (int MvsS=MVS_NORMAL, int HashBits=10) | |
virtual | ~HashVector () |
Free all the data associated with this hash vector. | |
uint | Length () |
Return the number of elements in this vector. | |
uint | Buckets () |
Get number of buckets used. | |
virtual void | FreeItem (Some Item) const |
Virtual function which frees a vector element. | |
void | DeleteAll () |
Delete all elements. | |
virtual HashKey_t | GetKey (Some Item) const |
Extract the sort key from a item. | |
virtual int | Compare (HashKey_t Key1, HashKey_t Key2) const |
Compare two array elements in given Mode. | |
void | Insert (Some Item) |
Insert element 'Item' into the hash vector. | |
void | Delete (Some Item) |
Delete element 'Item' from the hash vector. | |
Some | GetByKey (HashKey_t Key) const |
Find a hash vector element by search key; returns 0 if not found. | |
void | IncRef () |
--- Expose the hidden Base interface ---/// | |
Iterator | Begin () const |
Get an iterator pointing to the start of hash vector. | |
Iterator | End () const |
Get an iterator pointing to the end of hash vector. | |
Iterator | FindKey (HashKey_t Key) const |
Like GetByKey but return an iterator. | |
Public Attributes | |
HashResult_t(* | Hash )(HashKey_t Key) |
This is a pointer to the hash function. | |
Protected Member Functions | |
void | lhbDestroy (LargeHashBucket *lhb) |
Destroy the large hash bucket, and free all elements. | |
void | lhbInsertSorted (LargeHashBucket *lhb, Some Item) |
Insert a element into the large hash bucket so that bucket remains sorted. | |
int | lhbFind (LargeHashBucket *lhb, HashKey_t Key) const |
Find a element in a large hash bucket by key and return its index. | |
Some | lhbGetByKey (LargeHashBucket *lhb, HashKey_t Key) const |
Same but return the element itself. | |
HashVector (HashVector *other) | |
Copy this hash vector (without reallocating pointers!). | |
void | SetBuckets (int iBuckets) |
void | _Insert (Some Item) |
Static Protected Member Functions | |
static HashResult_t | DefaultHash (HashKey_t Key) |
Default hash function. | |
Protected Attributes | |
HashResult_t | HashMask |
The bitmask to AND with the hash result. | |
int | MemVsSpeed |
Memory-vs-speed coefficient. | |
Classes | |
class | Iterator |
struct | LargeHashBucket |
HashVector::HashVector | ( | int | MvsS = MVS_NORMAL , |
|
int | HashBits = 10 | |||
) |
Initialize the hash vector so that it initially contains the requested number of buckets.
void HashVector::_Insert | ( | Some | Item | ) | [protected] |
Slightly faster Insert without sanity checks.
void HashVector::SetBuckets | ( | int | iBuckets | ) | [protected] |
Resize the hash vector so that it uses so much buckets. The hash vector really adjusts its size automatically, so there's no need to call this function.