ATLAS Offline Software
Loading...
Searching...
No Matches
CxxUtils::ConcurrentStrMap< VALUE, UPDATER > Class Template Reference

Hash map from strings allowing concurrent, lockless reads. More...

#include <ConcurrentStrMap.h>

Collaboration diagram for CxxUtils::ConcurrentStrMap< VALUE, UPDATER >:

Classes

class  const_iterator
 Iterator class. More...
struct  Hasher
 Hash functional for keys. More...
struct  Matcher
 Matching functional for keys. More...

Public Types

using key_type = std::string
 Standard STL types.
using mapped_type = VALUE
using size_type = size_t
using Updater_t = typename Impl_t::Updater_t
 Updater object.
using Context_t = typename Updater_t::Context_t
 Context type.
using Lock_t = typename Impl_t::Lock_t
 Type for external locking.
using const_iterator_value = std::pair<const key_type&, mapped_type>
 Value structure for iterators.
using const_iterator_range = CxxUtils::iterator_range<const_iterator>
 A range defined by two iterators.

Public Member Functions

 ConcurrentStrMap (Updater_t &&updater, size_type capacity=64, const Context_t &ctx=Updater_t::defaultContext())
 Ensure that the underlying map can store our mapped_type.
 ConcurrentStrMap (const ConcurrentStrMap &other, Updater_t &&updater, size_t capacity=64, const Context_t &ctx=Updater_t::defaultContext())
 Constructor from another map.
template<class InputIterator>
 ConcurrentStrMap (InputIterator f, InputIterator l, Updater_t &&updater, size_type capacity=64, const Context_t &ctx=Updater_t::defaultContext())
 Constructor from a range.
 ConcurrentStrMap (const ConcurrentStrMap &other)=delete
 Copy / move / assign not supported.
 ConcurrentStrMap (ConcurrentStrMap &&other)=delete
ConcurrentStrMapoperator= (const ConcurrentStrMap &other)=delete
ConcurrentStrMapoperator= (ConcurrentStrMap &&other)=delete
 ~ConcurrentStrMap ()
 Destructor.
size_type size () const
 Return the number of items currently in the map.
bool empty () const
 Test if the map is currently empty.
size_t capacity () const
 Return the current size (capacity) of the hash table.
const_iterator_range range () const
 Return an iterator range covering the entire map.
const_iterator begin () const
 Iterator at the start of the map.
const_iterator end () const
 Iterator at the end of the map.
const_iterator cbegin () const
 Iterator at the start of the map.
const_iterator cend () const
 Iterator at the end of the map.
bool contains (const key_type &key) const
 Test if a key is in the container.
size_type count (const key_type &key) const
 Return the number of times a given key is in the container.
const_iterator find (const key_type &key) const
 Look up an element in the map.
mapped_type at (const std::string &key) const
 Look up an element in the map.
std::pair< const_iterator, const_iteratorequal_range (const key_type &key) const
 Return a range of iterators with entries matching key.
Lock_t lock ()
 Take a lock on the container.
std::pair< const_iterator, bool > emplace (const key_type &key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map.
std::pair< const_iterator, bool > emplace (const Lock_t &lock, const key_type &key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map, with external locking.
std::pair< const_iterator, bool > emplace (key_type &&key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map.
std::pair< const_iterator, bool > emplace (const Lock_t &lock, key_type &&key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map, with external locking.
std::pair< const_iterator, bool > insert_or_assign (const key_type &key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map, or overwrite an existing one.
std::pair< const_iterator, bool > insert_or_assign (const Lock_t &lock, const key_type &key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map, or overwrite an existing one, with external locking.
std::pair< const_iterator, bool > insert_or_assign (key_type &&key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map, or overwrite an existing one.
std::pair< const_iterator, bool > insert_or_assign (const Lock_t &lock, key_type &&key, mapped_type val, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map, or overwrite an existing one, with external locking.
template<class PAIR>
std::pair< const_iterator, bool > insert (const PAIR &p, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map.
template<class PAIR>
std::pair< const_iterator, bool > insert (PAIR &&p, const Context_t &ctx=Updater_t::defaultContext())
 Add an element to the map.
template<class InputIterator>
void insert (InputIterator first, InputIterator last, const Context_t &ctx=Updater_t::defaultContext())
 Insert a range of elements to the map.
void reserve (size_type capacity, const Context_t &ctx=Updater_t::defaultContext())
 Increase the table capacity.
void rehash (size_type capacity)
 Increase the table capacity.
void quiescent (const Context_t &ctx)
 Called when this thread is no longer referencing anything from this container.
void swap (ConcurrentStrMap &other)
 Swap this container with another.
Updater_tupdater ()
 Access the Updater instance.

Private Types

using Impl_t = typename detail::ConcurrentHashmapImpl<UPDATER, Hasher, Matcher>
using val_t = CxxUtils::detail::ConcurrentHashmapVal_t
 Representation type in the underlying map.

Private Member Functions

Impl_t::const_iterator get (const key_type &key) const
 Do a lookup in the table.
std::pair< const_iterator, bool > put (std::unique_ptr< key_type > key, mapped_type val, bool overwrite=true, const Context_t &ctx=Updater_t::defaultContext())
 Insert / overwrite an entry in the table.
std::pair< const_iterator, bool > put (const Lock_t &lock, std::unique_ptr< key_type > key, mapped_type val, bool overwrite=true, const Context_t &ctx=Updater_t::defaultContext())
 Insert / overwrite an entry in the table, with external locking.

Static Private Member Functions

static const std::string * keyAsString (val_t val)
 Convert an underlying key value to a string pointer.
static val_t keyAsVal (const std::string *s)
 Convert a string pointer to an underlying key value.
static mapped_type mappedAsMapped (val_t val)
 Convert an underlying mapped value to this type's mapped value.
static val_t mappedAsVal (mapped_type val)
 Convert this type's mapped value to an underlying mapped value.

Private Attributes

Impl_t m_impl
 The underlying hash table.

Detailed Description

template<class VALUE, template< class > class UPDATER>
requires (detail::IsConcurrentHashmapPayload<VALUE> && detail::IsUpdater<UPDATER>)
class CxxUtils::ConcurrentStrMap< VALUE, UPDATER >

Hash map from strings allowing concurrent, lockless reads.

This class implements a hash map from strings. The mapped type may be a pointer or any numeric type that can fit in a uintptr_t. It allows for concurrent access from many threads. Reads can proceed without taking out a lock, while writes are serialized with each other. Thus, this is appropriate for maps which are read-mostly.

This is based on ConcurrentHashmapImpl.

Besides the mapped value type, this class is templated on an UPDATER class, which is used to manage the underlying memory. See IsUpdater.h for details. (AthenaKernel/RCUUpdater is a concrete version that should work in the context of Athena.)

This mostly supports the interface of std::unordered_map, with a few differences / omissions:

  • Dereferencing the iterator returns a structure by value, not a reference.
  • No try_emplace.
  • No insert methods with hints.
  • No clear(). Could be implemented if really needed; we would need to be able to attach the key strings to be deleted to the old table instance.
  • No erase() methods. In addition to what's needed for clear(), the underlying hash table would need to support tombstones.
  • No operator==.
  • Nothing dealing with the bucket/node interface or merge().

Possible improvements:

  • We could speed up lookups further by storing the hash along with the string. That way, we should almost always not have to do the full string comparison more than once.
  • We could use a more efficient allocator for the string keys that we need to save. That could in particular help for updates, where currently we always need to allocate a string, and then need to delete it if it turns out we're doing an update rather than in insertion.

Definition at line 76 of file ConcurrentStrMap.h.

Member Typedef Documentation

◆ const_iterator_range

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::const_iterator_range = CxxUtils::iterator_range<const_iterator>

A range defined by two iterators.

Definition at line 263 of file ConcurrentStrMap.h.

◆ const_iterator_value

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::const_iterator_value = std::pair<const key_type&, mapped_type>

Value structure for iterators.

For a map from K to V, a STL-style iterator should dereference to a std::pair<const K, V>. However, we don't actually store an object like that anywhere. In order to be able to have STL-like iterators, we instead use a pair where the first element is a const reference to the std::string key. We will return this by value when we deference an iterator. (The compiler should be able to optimize out the redundant packing and unpacking of fields.)

Definition at line 194 of file ConcurrentStrMap.h.

◆ Context_t

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::Context_t = typename Updater_t::Context_t

Context type.

Definition at line 95 of file ConcurrentStrMap.h.

◆ Impl_t

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::Impl_t = typename detail::ConcurrentHashmapImpl<UPDATER, Hasher, Matcher>
private

Definition at line 82 of file ConcurrentStrMap.h.

◆ key_type

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::key_type = std::string

Standard STL types.

Definition at line 89 of file ConcurrentStrMap.h.

◆ Lock_t

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::Lock_t = typename Impl_t::Lock_t

Type for external locking.

Definition at line 97 of file ConcurrentStrMap.h.

◆ mapped_type

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::mapped_type = VALUE

Definition at line 90 of file ConcurrentStrMap.h.

◆ size_type

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::size_type = size_t

Definition at line 91 of file ConcurrentStrMap.h.

◆ Updater_t

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::Updater_t = typename Impl_t::Updater_t

Updater object.

Definition at line 93 of file ConcurrentStrMap.h.

◆ val_t

template<class VALUE, template< class > class UPDATER>
using CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::val_t = CxxUtils::detail::ConcurrentHashmapVal_t
private

Representation type in the underlying map.

Definition at line 84 of file ConcurrentStrMap.h.

Constructor & Destructor Documentation

◆ ConcurrentStrMap() [1/5]

template<class VALUE, template< class > class UPDATER>
CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::ConcurrentStrMap ( Updater_t && updater,
size_type capacity = 64,
const Context_t & ctx = Updater_t::defaultContext() )

Ensure that the underlying map can store our mapped_type.

Constructor.

Parameters
updaterObject used to manage memory (see comments at the start of the class).
capacityThe initial table capacity. (Will be rounded up to a power of two.)
ctxExecution context.

◆ ConcurrentStrMap() [2/5]

template<class VALUE, template< class > class UPDATER>
CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::ConcurrentStrMap ( const ConcurrentStrMap< VALUE, UPDATER > & other,
Updater_t && updater,
size_t capacity = 64,
const Context_t & ctx = Updater_t::defaultContext() )

Constructor from another map.

Parameters
updaterObject used to manage memory (see comments at the start of the class).
capacityThe initial table capacity of the new table. (Will be rounded up to a power of two.)
ctxExecution context.

(Not really a copy constructor since we need to pass updater.)

◆ ConcurrentStrMap() [3/5]

template<class VALUE, template< class > class UPDATER>
template<class InputIterator>
CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::ConcurrentStrMap ( InputIterator f,
InputIterator l,
Updater_t && updater,
size_type capacity = 64,
const Context_t & ctx = Updater_t::defaultContext() )

Constructor from a range.

Parameters
fStart iterator for the range.
lEnd iterator for the range.
updaterObject used to manage memory (see comments at the start of the class).
capacityThe initial table capacity of the new table. (Will be rounded up to a power of two.)
ctxExecution context.

Constructor from a range of pairs.

◆ ConcurrentStrMap() [4/5]

template<class VALUE, template< class > class UPDATER>
CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::ConcurrentStrMap ( const ConcurrentStrMap< VALUE, UPDATER > & other)
delete

Copy / move / assign not supported.

◆ ConcurrentStrMap() [5/5]

template<class VALUE, template< class > class UPDATER>
CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::ConcurrentStrMap ( ConcurrentStrMap< VALUE, UPDATER > && other)
delete

◆ ~ConcurrentStrMap()

template<class VALUE, template< class > class UPDATER>
CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::~ConcurrentStrMap ( )

Destructor.

Member Function Documentation

◆ at()

template<class VALUE, template< class > class UPDATER>
mapped_type CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::at ( const std::string & key) const

Look up an element in the map.

Parameters
keyThe element to find.

Returns the value associated with the key. Throws std::out_of_range if the key does not exist in the map.

◆ begin()

template<class VALUE, template< class > class UPDATER>
const_iterator CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::begin ( ) const

Iterator at the start of the map.

◆ capacity()

template<class VALUE, template< class > class UPDATER>
size_t CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::capacity ( ) const

Return the current size (capacity) of the hash table.

◆ cbegin()

template<class VALUE, template< class > class UPDATER>
const_iterator CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::cbegin ( ) const

Iterator at the start of the map.

◆ cend()

template<class VALUE, template< class > class UPDATER>
const_iterator CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::cend ( ) const

Iterator at the end of the map.

◆ contains()

template<class VALUE, template< class > class UPDATER>
bool CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::contains ( const key_type & key) const

Test if a key is in the container.

Parameters
keyThe key to test.

◆ count()

template<class VALUE, template< class > class UPDATER>
size_type CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::count ( const key_type & key) const

Return the number of times a given key is in the container.

Parameters
keyThe key to test.

Returns either 0 or 1, depending on whether or not the key is in the map.

◆ emplace() [1/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::emplace ( const key_type & key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map.

Parameters
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ emplace() [2/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::emplace ( const Lock_t & lock,
const key_type & key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map, with external locking.

Parameters
lockThe lock object returned from lock().
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ emplace() [3/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::emplace ( const Lock_t & lock,
key_type && key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map, with external locking.

Parameters
lockThe lock object returned from lock().
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ emplace() [4/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::emplace ( key_type && key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map.

Parameters
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ empty()

template<class VALUE, template< class > class UPDATER>
bool CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::empty ( ) const

Test if the map is currently empty.

◆ end()

template<class VALUE, template< class > class UPDATER>
const_iterator CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::end ( ) const

Iterator at the end of the map.

◆ equal_range()

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, const_iterator > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::equal_range ( const key_type & key) const

Return a range of iterators with entries matching key.

Parameters
keyThe element to find.

As keys are unique in this container, this is either a single-element range, or both iterators are equal to end().

◆ find()

template<class VALUE, template< class > class UPDATER>
const_iterator CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::find ( const key_type & key) const

Look up an element in the map.

Parameters
keyThe element to find.

Returns either an iterator referencing the found element or end().

◆ get()

template<class VALUE, template< class > class UPDATER>
Impl_t::const_iterator CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::get ( const key_type & key) const
private

Do a lookup in the table.

Parameters
keyThe key to look up.

Returns an iterator of the underlying map pointing at the found entry or end();

◆ insert() [1/3]

template<class VALUE, template< class > class UPDATER>
template<class PAIR>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert ( const PAIR & p,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map.

Parameters
pThe item to add. Should be a pair where first is the string key and second is the integer value.
ctxExecution context.

This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

For external locking, use emplace().

◆ insert() [2/3]

template<class VALUE, template< class > class UPDATER>
template<class InputIterator>
void CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert ( InputIterator first,
InputIterator last,
const Context_t & ctx = Updater_t::defaultContext() )

Insert a range of elements to the map.

Parameters
firstStart of the range.
lastEnd of the range.
ctxExecution context.

The range should be a sequence of pairs where first is the string key and second is the integer value.

◆ insert() [3/3]

template<class VALUE, template< class > class UPDATER>
template<class PAIR>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert ( PAIR && p,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map.

Parameters
pThe item to add. Should be a pair where first is the string key and second is the integer value.
ctxExecution context.

This will not overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ insert_or_assign() [1/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert_or_assign ( const key_type & key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map, or overwrite an existing one.

Parameters
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ insert_or_assign() [2/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert_or_assign ( const Lock_t & lock,
const key_type & key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map, or overwrite an existing one, with external locking.

Parameters
lockThe lock object returned from lock().
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ insert_or_assign() [3/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert_or_assign ( const Lock_t & lock,
key_type && key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map, or overwrite an existing one, with external locking.

Parameters
lockThe lock object returned from lock().
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ insert_or_assign() [4/4]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::insert_or_assign ( key_type && key,
mapped_type val,
const Context_t & ctx = Updater_t::defaultContext() )

Add an element to the map, or overwrite an existing one.

Parameters
keyThe key of the new item to add.
valThe value of the new item to add.
ctxExecution context.

This will overwrite an existing entry. The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ keyAsString()

template<class VALUE, template< class > class UPDATER>
const std::string * CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::keyAsString ( val_t val)
staticprivate

Convert an underlying key value to a string pointer.

Parameters
valThe underlying key value.

◆ keyAsVal()

template<class VALUE, template< class > class UPDATER>
val_t CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::keyAsVal ( const std::string * s)
staticprivate

Convert a string pointer to an underlying key value.

Parameters
sThe string pointer.

◆ lock()

template<class VALUE, template< class > class UPDATER>
Lock_t CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::lock ( )

Take a lock on the container.

Take a lock on the container. The lock can then be passed to insertion methods, allowing to factor out the locking inside loops. The lock will be released when the lock object is destroyed.

◆ mappedAsMapped()

template<class VALUE, template< class > class UPDATER>
mapped_type CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::mappedAsMapped ( val_t val)
staticprivate

Convert an underlying mapped value to this type's mapped value.

Parameters
valThe underlying mapped value.

◆ mappedAsVal()

template<class VALUE, template< class > class UPDATER>
val_t CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::mappedAsVal ( mapped_type val)
staticprivate

Convert this type's mapped value to an underlying mapped value.

Parameters
valThe mapped value.

◆ operator=() [1/2]

template<class VALUE, template< class > class UPDATER>
ConcurrentStrMap & CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::operator= ( ConcurrentStrMap< VALUE, UPDATER > && other)
delete

◆ operator=() [2/2]

template<class VALUE, template< class > class UPDATER>
ConcurrentStrMap & CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::operator= ( const ConcurrentStrMap< VALUE, UPDATER > & other)
delete

◆ put() [1/2]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::put ( const Lock_t & lock,
std::unique_ptr< key_type > key,
mapped_type val,
bool overwrite = true,
const Context_t & ctx = Updater_t::defaultContext() )
private

Insert / overwrite an entry in the table, with external locking.

Parameters
lockThe lock object returned from lock().
valThe value of the new item to add.
overwriteIf true, allow overwriting an existing entry.
ctxExecution context.

The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ put() [2/2]

template<class VALUE, template< class > class UPDATER>
std::pair< const_iterator, bool > CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::put ( std::unique_ptr< key_type > key,
mapped_type val,
bool overwrite = true,
const Context_t & ctx = Updater_t::defaultContext() )
private

Insert / overwrite an entry in the table.

Parameters
keyThe key of the new item to add.
valThe value of the new item to add.
overwriteIf true, allow overwriting an existing entry.
ctxExecution context.

The first element in the returned pair is an iterator referencing the added item. The second is a flag that is true if a new element was added.

◆ quiescent()

template<class VALUE, template< class > class UPDATER>
void CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::quiescent ( const Context_t & ctx)

Called when this thread is no longer referencing anything from this container.

Parameters
ctxExecution context.

◆ range()

template<class VALUE, template< class > class UPDATER>
const_iterator_range CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::range ( ) const

Return an iterator range covering the entire map.

◆ rehash()

template<class VALUE, template< class > class UPDATER>
void CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::rehash ( size_type capacity)

Increase the table capacity.

Parameters
capacityThe new table capacity.

No action will be taken if capacity is smaller than the current capacity.

◆ reserve()

template<class VALUE, template< class > class UPDATER>
void CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::reserve ( size_type capacity,
const Context_t & ctx = Updater_t::defaultContext() )

Increase the table capacity.

Parameters
capacityThe new table capacity.
ctxExecution context.

No action will be taken if capacity is smaller than the current capacity.

◆ size()

template<class VALUE, template< class > class UPDATER>
size_type CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::size ( ) const

Return the number of items currently in the map.

◆ swap()

template<class VALUE, template< class > class UPDATER>
void CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::swap ( ConcurrentStrMap< VALUE, UPDATER > & other)

Swap this container with another.

Parameters
otherThe container with which to swap.

This will also call swap on the Updater object; hence, the Updater object must also support swap.

This operation is NOT thread-safe. No other threads may be accessing either container during this operation.

◆ updater()

template<class VALUE, template< class > class UPDATER>
Updater_t & CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::updater ( )

Access the Updater instance.

Member Data Documentation

◆ m_impl

template<class VALUE, template< class > class UPDATER>
Impl_t CxxUtils::ConcurrentStrMap< VALUE, UPDATER >::m_impl
private

The underlying hash table.

Definition at line 694 of file ConcurrentStrMap.h.


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