Logo Search packages:      
Sourcecode: tbb version File versions  Download package

tbb::concurrent_hash_map< Key, T, HashCompare > Class Template Reference
[Containers]

#include <concurrent_hash_map.h>

List of all members.


Detailed Description

template<typename Key, typename T, typename HashCompare>
class tbb::concurrent_hash_map< Key, T, HashCompare >

Unorderd map from Key to T.

Definition at line 243 of file concurrent_hash_map.h.


Public Types

typedef ptrdiff_t difference_type
typedef Key key_type
typedef T mapped_type
typedef size_t size_type
typedef std::pair< const Key, T > value_type

Public Member Functions

void clear ()
 Clear table.
 concurrent_hash_map (const concurrent_hash_map &table)
 Copy constructor.
 concurrent_hash_map ()
 Construct empty table.
bool erase (const Key &key)
 Erase item.
bool find (accessor &result, const Key &key)
 Find item and acquire a write lock on the item.
bool find (const_accessor &result, const Key &key) const
 Find item 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 Key &key)
 Insert item (if not already present) and acquire a read lock on the item.
concurrent_hash_mapoperator= (const concurrent_hash_map &table)
 Assignment.
 ~concurrent_hash_map ()
 Clear table and destroy it.

Package Functions

const_iterator begin () const
iterator begin ()
bool empty () const
 True if size()==0.
const_iterator end () const
iterator end ()
size_type max_size () const
 Upper bound on size.
const_range_type range (size_type grainsize) const
range_type range (size_type grainsize)
size_type size () const
 Number of items in table.

Package Attributes

 __pad0__:hash_map_iterator<concurrent_hash_map
 __pad1__:hash_map_iterator<concurrent_hash_map
 __pad2__:hash_map_range<value_type
 __pad3__:hash_map_range<const value_type
const value_type const_iterator
const_iterator const_range_type
value_type iterator
iterator range_type

Private Types

typedef spin_rw_mutex bucket_mutex_t
typedef spin_rw_mutex chain_mutex_t
typedef size_t hashcode_t
 Type of a hash code.
enum  operation { op_insert, op_find, op_remove }
typedef spin_rw_mutex segment_mutex_t

Private Member Functions

segmentget_segment (hashcode_t hashcode)
void grow_segment (segment_mutex_t::scoped_lock &segment_lock, segment &s)
 Grow segment for which caller has acquired a write lock.
void initialize ()
 Perform initialization on behalf of a constructor.
void internal_copy (const concurrent_hash_map &source)
 Copy "source" to *this, where *this must start out empty.
bool lookup (const_accessor *result, const Key &key, bool write, operation op)
 Does heavy lifting for "find" and "insert".
bucketremove_from_list (const Key &key, chain &c)
bucketsearch_list (const Key &key, chain &c)

Private Attributes

HashCompare my_hash_compare
segmentmy_segment
size_t n_segment
 Number of segments.
unsigned char n_segment_bits
 Log2 of n_segment.

Friends

struct bucket
struct chain
class const_accessor
class internal::hash_map_iterator
class internal::hash_map_range
struct segment

Classes

class  accessor
 Allows write access to elements and combines data access, locking, and garbage collection. More...
struct  bucket
 Basic unit of storage used in chain. More...
struct  chain
 A linked-list of buckets. More...
class  const_accessor
 Combines data access, locking, and garbage collection. More...
struct  segment
 Segment of the table. More...

The documentation for this class was generated from the following file:

Generated by  Doxygen 1.6.0   Back to index