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

Unordered map from Key to T. More...

#include <concurrent_hash_map.h>

List of all members.

Public Types

typedef Key key_type
typedef T mapped_type
typedef std::pair< const Key,
T > 
value_type
typedef size_t 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 A 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_mapoperator= (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
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.

Friends

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

Classes

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


Detailed Description

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

Unordered map from Key to T.

concurrent_hash_map is associative container with concurrent access.

Compatibility
The class meets all Container Requirements from C++ Standard (See ISO/IEC 14882:2003(E), clause 23.1).
Exception Safety
Changes since TBB 2.0


Member Function Documentation

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::erase ( accessor item_accessor  )  [inline]

Erase item by accessor.

Return true if item was erased by particularly this call.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::erase ( const_accessor item_accessor  )  [inline]

Erase item by const_accessor.

Return true if item was erased by particularly this call.

template<typename Key, typename T, typename HashCompare, typename A>
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.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::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.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::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.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::insert ( const value_type &  value  )  [inline]

Insert item by copying if there is no such key present already.

Returns true if item is inserted.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::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.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::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.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::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.

template<typename Key, typename T, typename HashCompare, typename A>
bool tbb::concurrent_hash_map< Key, T, HashCompare, A >::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.

template<typename Key, typename T, typename HashCompare, typename A>
concurrent_hash_map< Key, T, HashCompare, A >::size_type tbb::concurrent_hash_map< Key, T, HashCompare, A >::size (  )  const

Number of items in table.

Be aware that this method is relatively slow compared to the typical size() method for an STL container.


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

Copyright © 2005-2009 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.