|
| HashMap (uint64_t capacity, uint64_t expansion_rate=3) |
|
| ~HashMap () |
| Not Thread Safe! May create a very large stack! Note: should implement a better way... More...
|
|
bool | at (Key key, ValueAccessor &va) |
| This function returns true and initializes the passed ValueAccessor if the key exists in the hash map. More...
|
|
bool | insert (Key key, Value value) |
| This function returns true if the key value pair was successfully inserted. More...
|
|
bool | remove (Key key) |
| Attempts to remove a key/value pair from the hash map Returns false in the event the key is not in the hash map or if the access_counter is non-zero. More...
|
|
size_t | size () |
|
uint64_t | get_position (Key &key, size_t depth) |
|
uint64_t | max_depth () |
|
void | print_key (Key &key) |
| Outputs the positions a key belongs in at each depth. More...
|
|
template<class Key, class Value, class Functor = default_functor<Key, Value>>
class tervel::containers::wf::HashMap< Key, Value, Functor >
A wait-free hash map implementation.
TODO(steven): Provide general overview
Functor should have the following functions: -Key hash(Key k) (where hash(a) == (hash(b) implies a == b -bool key_equals (Key a, Key b) Important Note: the hashed value of keys will be passed in.
template<class Key , class Value , class Functor = default_functor<Key, Value>>
Not Thread Safe! May create a very large stack! Note: should implement a better way...
If it is a node type then the node will be freed If it is an array node then the destructor of the array node will free any nodes that are referenced it. This may cause more array node's to be freed. Stack can reach max_depth() in size.
template<class Key , class Value , class Functor >
This function returns true and initializes the passed ValueAccessor if the key exists in the hash map.
Initializing the ValueAccessor consists of assigning storing a reference to the associated value and a reference to the access counter. The access counter will have been increased by one. Upon the destruction or re-initialization of the ValueAccessor, the access counter will be decremented.
The sequential complexity of this operation is O(max_depth()).
- Parameters
-
key | the key to look up |
va | the location to store the address of the value/access_counter |
- Returns
- whether or not the key is present
template<class Key , class Value , class Functor >
This function returns true if the key value pair was successfully inserted.
Otherwise it returns false.
A key can fail to insert in the event the key is already present.
The sequential complexity of this operation is O(max_depth()).
- Parameters
-
key | The key to insert |
value | The key's associated value |
- Returns
- whether or not the the key/value was inserted