Inheritance diagram for w_hash_t< T, LOCK, K >:
The hash function used here is :
Thus, to make this work, you need to define a (static, global, or inlined) function
w_base_t::uint4_t w_hash(const K &key)
Note that since the hash function uses the _mask to collect the lower bits of the result of w_hash, the w_hash(key) function should be sensitive to the way hash-table uses of the w_hash function, and the hash tables should be aware of the likely bit distribution of the result of w_hash(key).
Definition at line 122 of file w_hash.h.
Public Member Functions | |
NORET | w_hash_t (uint4_t sz, uint4_t key_offset, uint4_t link_offset, const LOCK *lock) |
Construct hash table. | |
w_hash_t & | push (T *t) |
Insert an element in the table at the front of its bucket. | |
w_hash_t & | append (T *t) |
Insert an element in the table at the tail of its bucket. | |
T * | lookup (const K &k) const |
Find an element in the table. | |
bool | member (T const *t) const |
True if element is in the table. | |
T * | remove (const K &k) |
Remove the (single) element with the given key. | |
void | remove (T *t) |
Remove the given element that is in the table. | |
uint4_t | num_members () const |
Total number of elements in the table. | |
Friends | |
ostream &const w_hash_t< T, LOCK, K > & | obj |
ostream & | operator<< BIND_FRIEND_OPERATOR_PART_2B (T, LOCK, K)(ostream &o |
Standard ostream operator, despite the macro here (in w_workaround.h). |
NORET w_hash_t< T, LOCK, K >::w_hash_t | ( | uint4_t | sz, | |
uint4_t | key_offset, | |||
uint4_t | link_offset, | |||
const LOCK * | lock | |||
) |
Construct hash table.
[in] | sz | Number of bits in result values. |
[in] | key_offset | Offset in object of type T where key K is found |
[in] | link_offset | Offset in object of type T where w_link_t is found This w_link_t is used to hold the object in a hash table bucket |
[in] | lock | Pointer to a lock used to protect the table. |
The lock passed in is not used. There is no enforcement of locking these structures. The template contains the lock type so that it is relatively easy to tell what structures are unprotected by perusing the code.