libcuckoo
0.3.1
|
#include <cuckoohash_map.hh>
Classes | |
class | const_iterator |
class | iterator |
Public Types | |
Type Declarations | |
using | key_type = typename cuckoohash_map::key_type |
using | mapped_type = typename cuckoohash_map::mapped_type |
using | value_type = typename cuckoohash_map::value_type |
using | size_type = typename cuckoohash_map::size_type |
using | difference_type = typename cuckoohash_map::difference_type |
using | hasher = typename cuckoohash_map::hasher |
using | key_equal = typename cuckoohash_map::key_equal |
using | allocator_type = typename cuckoohash_map::allocator_type |
using | reference = typename cuckoohash_map::reference |
using | const_reference = typename cuckoohash_map::const_reference |
using | pointer = typename cuckoohash_map::pointer |
using | const_pointer = typename cuckoohash_map::const_pointer |
Public Member Functions | |
Constructors, Destructors, and Assignment | |
locked_table ()=delete | |
locked_table (const locked_table &)=delete | |
locked_table & | operator= (const locked_table &)=delete |
locked_table (locked_table &<) noexcept | |
locked_table & | operator= (locked_table &<) noexcept |
void | unlock () |
Table Details | |
Methods for getting information about the table. Many are identical to their cuckoohash_map counterparts. Only new functions or those with different behavior are documented. | |
bool | is_active () const |
hasher | hash_function () const |
key_equal | key_eq () const |
allocator_type | get_allocator () const |
size_type | hashpower () const |
size_type | bucket_count () const |
bool | empty () const |
size_type | size () const |
size_type | capacity () const |
double | load_factor () const |
void | minimum_load_factor (const double mlf) |
double | minimum_load_factor () const |
void | maximum_hashpower (size_type mhp) |
size_type | maximum_hashpower () const |
void | max_num_worker_threads (size_type extra_threads) |
size_type | max_num_worker_threads () const |
Iterators | |
iterator | begin () |
const_iterator | begin () const |
const_iterator | cbegin () const |
iterator | end () |
const_iterator | end () const |
const_iterator | cend () const |
Modifiers | |
void | clear () |
template<typename K , typename... Args> | |
std::pair< iterator, bool > | insert (K &&key, Args &&... val) |
iterator | erase (const_iterator pos) |
iterator | erase (iterator pos) |
template<typename K > | |
size_type | erase (const K &key) |
Lookup | |
template<typename K > | |
iterator | find (const K &key) |
template<typename K > | |
const_iterator | find (const K &key) const |
template<typename K > | |
mapped_type & | at (const K &key) |
template<typename K > | |
const mapped_type & | at (const K &key) const |
template<typename K > | |
T & | operator[] (K &&key) |
template<typename K > | |
size_type | count (const K &key) const |
template<typename K > | |
std::pair< iterator, iterator > | equal_range (const K &key) |
template<typename K > | |
std::pair< const_iterator, const_iterator > | equal_range (const K &key) const |
Re-sizing | |
void | rehash (size_type n) |
void | reserve (size_type n) |
Comparison | |
| |
bool | operator== (const locked_table <) const |
bool | operator!= (const locked_table <) const |
Static Public Member Functions | |
Table Parameters | |
static constexpr size_type | slot_per_bucket () |
Friends | |
class | cuckoohash_map |
std::ostream & | operator<< (std::ostream &os, const locked_table <) |
std::istream & | operator>> (std::istream &is, locked_table <) |
An ownership wrapper around a cuckoohash_map table instance. When given a table instance, it takes all the locks on the table, blocking all outside operations on the table. Because the locked_table has unique ownership of the table, it can provide a set of operations on the table that aren't possible in a concurrent context.
The locked_table interface is very similar to the STL unordered_map interface, and for functions whose signatures correspond to unordered_map methods, the behavior should be mostly the same.
|
inline |
Returns an iterator to the beginning of the table. If the table is empty, it will point past the end of the table.
|
inline |
Returns an iterator past the end of the table.
|
inline |
This behaves like the unordered_map::try_emplace
method. It will always invalidate all iterators, due to the possibilities of cuckoo hashing and expansion.
|
inline |
Returns whether the locked table has ownership of the table
|
inline |
This function has the same lifetime properties as cuckoohash_map::insert, except that the value is default-constructed, with no parameters, if it is not already in the table.
|
inline |
This has the same behavior as cuckoohash_map::rehash, except that we don't return anything.
|
inline |
This has the same behavior as cuckoohash_map::reserve, except that we don't return anything.
|
inline |
Unlocks the table, thereby freeing the locks on the table, but also invalidating all iterators and table operations with this object. It is idempotent.