|
| | HashContainerMP () |
| | Construct an empty HashContainer.
|
| |
| | HashContainerMP (size_type n) |
| | Construct an empty HashContainer with at least n buckets.
|
| |
| | ~HashContainerMP () |
| | Destroy the HashContainer.
|
| |
| size_type | size () |
| | Return the number of elements stored.
|
| |
| size_type | buckets () |
| | Return the number of buckets.
|
| |
| bool | empty () |
| | Return true iff size() == 0.
|
| |
| bool | unbalanced () |
| | Return true if this HashContainer should be rebalanced.
|
| |
|
iterator | begin () |
| |
|
write_iterator | write_begin () |
| |
| bool | contains (const K &key) |
| | Test if an element with key key exists in the table.
|
| |
| ptr | find (const K &key) |
| | Return a read pointer for the element with key, if any.
|
| |
| write_ptr | find_write (const K &key) |
| | Return a write pointer for the element with key, if any.
|
| |
| bool | find_clean (const K &key, std::function< void(V &storage)> store, std::function< bool(V &storage)> shouldremove) |
| | Find a key K and call store if found. Calls clean on colliding entries upon the way.
|
| |
| bool | find_erase (const K &key, V &storage) |
| | Copy the value of V for K in storage if K is found, delete it from the table and return true. If nonfound, nothing is deleted and returns false.
|
| |
| bool | find_erase_clean (const K &key, std::function< void(V &storage)> store, std::function< bool(V &storage)> shouldremove) |
| | Find a key, and call store if found before removing it. Calls clean on colliding entries upon the way.
|
| |
|
ptr | find_insert (const K &key, const V &value) |
| |
|
write_ptr | find_insert_write (const K &key, const V &value) |
| |
|
ptr | find_create (const K &key, std::function< V(void)> on_create) |
| |
| void | insert (const K &key, const V &value, std::function< void(V &value)> on_replace=[](V &){}) |
| | Insert a key. Replace an item if it already exists, insert it if not. Gives the ability to do something (eg free resources) with the previous element. Does not look at use count for you and done under read lock ! The difference with find_insert, is that find_insert will not change the value if the value already existsn while here on_replace() will be called, and then the value will be replaced. on_replace() is NOT called if the value does not exists. This function was called set() before.
|
| |
|
void | insert_clean (const K &key, const V &value, std::function< bool(V &storage)> shouldremove) |
| |
|
void | erase (const K &key) |
| |
|
void | clear () |
| |
|
void | rehash (size_type n) |
| |
|
bool | alone (bool atomic=false) |
| |
|
uint32_t | refcnt () |
| |
|
void | disable_mt () |
| |
|
bool | mt () |
| |
|
void | resize_clear (uint32_t n) |
| |
|
|
void | initialize (size_type n) |
| |
|
void | deinitialize () |
| |
|
| HashContainerMP (const HashContainerMP< K, V, Item, MT > &) |
| |
|
HashContainerMP< K, V, Item, MT > & | operator= (const HashContainerMP< K, V, Item, MT > &) |
| |
|
size_type | bucket (const K &key) |
| |
|
void | erase_item (ListItem *item) |
| |
|
ListItem * | allocate (const ListItem &li) |
| |
|
void | release_pending (bool force=false) |
| |
|
template<bool do_remove> |
| bool | _find_clean (const K &key, std::function< void(V &storage)> store, std::function< bool(V &storage)> shouldremove, std::function< void(ListItem *&head)> on_missing=[](ListItem *&head){}) |
| |
template<typename K, typename V, typename Item, typename MT = MT_T>
class HashContainerMP< K, V, Item, MT >
Intrusive hash table template, MT safe version.
K is the type of the key V is the type of the value Item is the value type enclosed by a reference counting mechanism based on shared pointers like shared<V> or rw_shared<V>, depending on the level of protection you want.
For convenience HashTableMP is an alias for HashContainerMP<K,V,shared<V>>
template<typename K , typename V , typename Item , typename MT = MT_T>
| bool HashContainerMP< K, V, Item, MT >::find_erase |
( |
const K & |
key, |
|
|
V & |
storage |
|
) |
| |
|
inline |
Copy the value of V for K in storage if K is found, delete it from the table and return true. If nonfound, nothing is deleted and returns false.
template<typename K , typename V , typename Item , typename MT = MT_T>
| void HashContainerMP< K, V, Item, MT >::insert |
( |
const K & |
key, |
|
|
const V & |
value, |
|
|
std::function< void(V &value)> |
on_replace = [](V &){} |
|
) |
| |
|
inline |
Insert a key. Replace an item if it already exists, insert it if not. Gives the ability to do something (eg free resources) with the previous element. Does not look at use count for you and done under read lock ! The difference with find_insert, is that find_insert will not change the value if the value already existsn while here on_replace() will be called, and then the value will be replaced. on_replace() is NOT called if the value does not exists. This function was called set() before.