#include <concurrent_hash_map.h>
Public Types | |
typedef Key | key_type |
typedef T | mapped_type |
typedef std::pair< const Key, T > | value_type |
typedef internal::hash_map_base::size_type | size_type |
typedef ptrdiff_t | difference_type |
typedef value_type * | pointer |
typedef const value_type * | const_pointer |
typedef value_type & | reference |
typedef const value_type & | const_reference |
typedef internal::hash_map_iterator< concurrent_hash_map, value_type > | iterator |
typedef internal::hash_map_iterator< concurrent_hash_map, const value_type > | const_iterator |
typedef internal::hash_map_range< iterator > | range_type |
typedef internal::hash_map_range< const_iterator > | const_range_type |
typedef Allocator | allocator_type |
Public Member Functions | |
concurrent_hash_map (const allocator_type &a=allocator_type()) | |
Construct empty table. | |
concurrent_hash_map (const concurrent_hash_map &table, const allocator_type &a=allocator_type()) | |
Copy constructor. | |
template<typename I> | |
concurrent_hash_map (I first, I last, const allocator_type &a=allocator_type()) | |
Construction with copying iteration range and given allocator instance. | |
concurrent_hash_map & | operator= (const concurrent_hash_map &table) |
Assignment. | |
void | clear () |
Clear table. | |
~concurrent_hash_map () | |
Clear table and destroy it. | |
range_type | range (size_type grainsize=1) |
const_range_type | range (size_type grainsize=1) const |
iterator | begin () |
iterator | end () |
const_iterator | begin () const |
const_iterator | end () const |
std::pair< iterator, iterator > | equal_range (const Key &key) |
std::pair< const_iterator, const_iterator > | equal_range (const Key &key) const |
size_type | size () const |
Number of items in table. | |
bool | empty () const |
True if size()==0. | |
size_type | max_size () const |
Upper bound on size. | |
allocator_type | get_allocator () const |
return allocator object | |
void | swap (concurrent_hash_map &table) |
swap two instances. Iterators are invalidated | |
size_type | count (const Key &key) const |
Return count of items (0 or 1). | |
bool | find (const_accessor &result, const Key &key) const |
Find item and acquire a read lock on the item. | |
bool | find (accessor &result, const Key &key) |
Find item and acquire a write lock on the item. | |
bool | insert (const_accessor &result, const Key &key) |
Insert item (if not already present) and acquire a read lock on the item. | |
bool | insert (accessor &result, const Key &key) |
Insert item (if not already present) and acquire a write lock on the item. | |
bool | insert (const_accessor &result, const value_type &value) |
Insert item by copying if there is no such key present already and acquire a read lock on the item. | |
bool | insert (accessor &result, const value_type &value) |
Insert item by copying if there is no such key present already and acquire a write lock on the item. | |
bool | insert (const value_type &value) |
Insert item by copying if there is no such key present already. | |
template<typename I> | |
void | insert (I first, I last) |
Insert range [first, last). | |
bool | erase (const Key &key) |
Erase item. | |
bool | erase (const_accessor &item_accessor) |
Erase item by const_accessor. | |
bool | erase (accessor &item_accessor) |
Erase item by accessor. | |
Protected Types | |
typedef Allocator::template rebind< node >::other | node_allocator_type |
Protected Member Functions | |
void | delete_node (node_base *n) |
node * | search_bucket (const key_type &key, bucket *b) const |
void | rehash_bucket (bucket *b_new, const hashcode_t h) |
bool | lookup (bool op_insert, const Key &key, const T *t, const_accessor *result, bool write) |
Insert or find item and optionally acquire a lock on the item. | |
bool | exclude (const_accessor &item_accessor, bool readonly) |
delete item by accessor | |
template<typename I> | |
std::pair< I, I > | internal_equal_range (const Key &key, I end) const |
Returns an iterator for an item defined by the key, or for the next item after it (if upper==true). | |
void | internal_copy (const concurrent_hash_map &source) |
Copy "source" to *this, where *this must start out empty. | |
template<typename I> | |
void | internal_copy (I first, I last) |
const_pointer | find (const Key &key) const |
fast find when no concurrent erasure is used | |
Protected Attributes | |
node_allocator_type | my_allocator |
HashCompare | my_hash_compare |
Friends | |
class | internal::hash_map_iterator |
class | internal::hash_map_range |
class | const_accessor |
Classes | |
class | accessor |
Allows write access to elements and combines data access, locking, and garbage collection. More... | |
class | bucket_accessor |
bucket accessor is to find, rehash, acquire a lock, and access a bucket More... | |
class | const_accessor |
Combines data access, locking, and garbage collection. More... | |
struct | node |
concurrent_hash_map is associative container with concurrent access.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::erase | ( | accessor & | item_accessor | ) | [inline] |
Erase item by accessor.
Return true if item was erased by particularly this call.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::erase | ( | const_accessor & | item_accessor | ) | [inline] |
Erase item by const_accessor.
Return true if item was erased by particularly this call.
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::erase | ( | const Key & | key | ) |
Erase item.
Return true if item was erased by particularly this call.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::find | ( | accessor & | result, | |
const Key & | key | |||
) | [inline] |
Find item and acquire a write lock on the item.
Return true if item is found, false otherwise.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::find | ( | const_accessor & | result, | |
const Key & | key | |||
) | const [inline] |
Find item and acquire a read lock on the item.
Return true if item is found, false otherwise.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::insert | ( | const value_type & | value | ) | [inline] |
Insert item by copying if there is no such key present already.
Returns true if item is inserted.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::insert | ( | accessor & | result, | |
const value_type & | value | |||
) | [inline] |
Insert item by copying if there is no such key present already and acquire a write lock on the item.
Returns true if item is new.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::insert | ( | const_accessor & | result, | |
const value_type & | value | |||
) | [inline] |
Insert item by copying if there is no such key present already and acquire a read lock on the item.
Returns true if item is new.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::insert | ( | accessor & | result, | |
const Key & | key | |||
) | [inline] |
Insert item (if not already present) and acquire a write lock on the item.
Returns true if item is new.
bool tbb::concurrent_hash_map< Key, T, HashCompare, Allocator >::insert | ( | const_accessor & | result, | |
const Key & | key | |||
) | [inline] |
Insert item (if not already present) and acquire a read lock on the item.
Returns true if item is new.