HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator Class Reference

#include <unordered_map_concurrent.h>

Public Member Functions

 iterator (unordered_map_concurrent *umc=NULL)
 
 iterator (const iterator &src)
 
 ~iterator ()
 
void clear ()
 
const BinMap_t::value_type & operator* () const
 
const BinMap_t::value_type * operator-> () const
 
 operator bool ()
 
iteratoroperator= (const iterator &src)
 
bool operator== (const iterator &other) const
 
bool operator!= (const iterator &other)
 
void operator++ ()
 
void operator++ (int)
 
void lock ()
 Lock the bin we point to, if not already locked. More...
 
void unlock ()
 Unlock the bin we point to, if locked. More...
 
bool incr_no_lock ()
 

Friends

class unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >
 

Detailed Description

template<class KEY, class VALUE, class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
class unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator

An unordered_map_concurrent::iterator points to a specific entry in the umc, and holds a lock to the bin the entry is in.

Definition at line 115 of file unordered_map_concurrent.h.

Constructor & Destructor Documentation

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::iterator ( unordered_map_concurrent umc = NULL)
inline

Construct an unordered_map_concurrent iterator that points to nothing.

Definition at line 123 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::iterator ( const iterator src)
inline

Copy constructor of an unordered_map_concurrent iterator transfers the lock (if held) to this. Caveat: the copied iterator no longer holds the lock!

Definition at line 133 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::~iterator ( )
inline

Destroying an unordered_map_concurrent iterator releases any bin locks it held.

Definition at line 145 of file unordered_map_concurrent.h.

Member Function Documentation

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
void unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::clear ( )
inline

Totally invalidate this iterator – point it to nothing (releasing any locks it may have had).

Definition at line 149 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
bool unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::incr_no_lock ( )
inline

Without changing the lock status (i.e., the caller already holds the lock on the iterator's bin), increment to the next element within the bin. Return true if it's pointing to a valid element afterwards, false if it ran off the end of the bin contents.

Definition at line 246 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
void unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::lock ( )
inline

Lock the bin we point to, if not already locked.

Definition at line 225 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator bool ( )
inline

Treating an iterator as a bool yields true if it points to a valid element of one of the bins of the map, false if it's equivalent to the end() iterator.

Definition at line 174 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
bool unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator!= ( const iterator other)
inline

Definition at line 202 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
const BinMap_t::value_type& unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator* ( ) const
inline

Definition at line 159 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
void unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator++ ( )
inline

Increment to the next entry in the map. If we finish the bin we're in, move on to the next bin (releasing our lock on the old bin and acquiring a lock on the new bin). If we finish the last bin of the map, return the end() iterator.

Definition at line 208 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
void unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator++ ( int  )
inline

Definition at line 222 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
const BinMap_t::value_type* unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator-> ( ) const
inline

Dereferencing returns a reference to the hash table entry the iterator refers to.

Definition at line 166 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
iterator& unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator= ( const iterator src)
inline

Iterator assignment transfers ownership of any bin locks held by the operand.

Definition at line 182 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
bool unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::operator== ( const iterator other) const
inline

Definition at line 194 of file unordered_map_concurrent.h.

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
void unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS, BINMAP >::iterator::unlock ( )
inline

Unlock the bin we point to, if locked.

Definition at line 233 of file unordered_map_concurrent.h.

Friends And Related Function Documentation

template<class KEY , class VALUE , class HASH = std::hash<KEY>, class PRED = std::equal_to<KEY>, size_t BINS = 16, class BINMAP = std::unordered_map<KEY, VALUE, HASH, PRED>>
friend class unordered_map_concurrent< KEY, VALUE, HASH, PRED, BINS,BINMAP >
friend

Definition at line 118 of file unordered_map_concurrent.h.


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