Fawkes API  Fawkes Development Version
fawkes::LockHashSet< KeyType, HashFunction, EqualKey > Class Template Reference

#include <core/utils/lock_hashset.h>

Inheritance diagram for fawkes::LockHashSet< KeyType, HashFunction, EqualKey >:

Public Member Functions

 LockHashSet ()
 Constructor. More...
 
 LockHashSet (const LockHashSet< KeyType, HashFunction, EqualKey > &lh)
 Copy constructor. More...
 
virtual ~LockHashSet ()
 Destructor. More...
 
void lock () const
 Lock set. More...
 
bool try_lock () const
 Try to lock set. More...
 
void unlock () const
 Unlock set. More...
 
RefPtr< Mutexmutex () const
 Get access to the internal mutex. More...
 
void insert_locked (const KeyType &x)
 Insert element to hash set with lock protection. More...
 
LockHashSet< KeyType, HashFunction, EqualKey > & operator= (const LockHashSet< KeyType, HashFunction, EqualKey > &ll)
 Copy values from another LockHashSet. More...
 

Detailed Description

template<class KeyType, class HashFunction = gnu_cxx_::hash<KeyType>, class EqualKey = std::equal_to<KeyType>>
class fawkes::LockHashSet< KeyType, HashFunction, EqualKey >

Hash set with a lock. This class provides a hash set that has an intrinsic lock. The lock can be applied with the regular locking methods.

See also
Mutex
Author
Tim Niemueller

Definition at line 60 of file lock_hashset.h.

Constructor & Destructor Documentation

◆ LockHashSet() [1/2]

template<class KeyType , class HashFunction , class EqualKey >
fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::LockHashSet

Constructor.

Definition at line 94 of file lock_hashset.h.

◆ LockHashSet() [2/2]

template<class KeyType , class HashFunction , class EqualKey >
fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::LockHashSet ( const LockHashSet< KeyType, HashFunction, EqualKey > &  lh)

Copy constructor.

Parameters
lhLockHashSet to copy

Definition at line 102 of file lock_hashset.h.

◆ ~LockHashSet()

template<class KeyType , class HashFunction , class EqualKey >
fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::~LockHashSet
virtual

Destructor.

Definition at line 117 of file lock_hashset.h.

Member Function Documentation

◆ insert_locked()

template<class KeyType , class HashFunction , class EqualKey >
void fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::insert_locked ( const KeyType &  x)

Insert element to hash set with lock protection.

Parameters
xelement to add

Definition at line 152 of file lock_hashset.h.

◆ lock()

template<class KeyType , class HashFunction , class EqualKey >
void fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::lock

Lock set.

Definition at line 124 of file lock_hashset.h.

◆ mutex()

template<typename KeyType , class HashFunction , class EqualKey >
RefPtr< Mutex > fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::mutex

Get access to the internal mutex.

Can be used with MutexLocker.

Returns
internal mutex

Definition at line 165 of file lock_hashset.h.

◆ operator=()

template<typename KeyType , class HashFunction , class EqualKey >
LockHashSet< KeyType, HashFunction, EqualKey > & fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::operator= ( const LockHashSet< KeyType, HashFunction, EqualKey > &  ll)

Copy values from another LockHashSet.

Copies the values one by one. Both instances are locked during the copying and this instance is cleared before copying.

Parameters
lllock hash set to copy
Returns
reference to this instance

Definition at line 179 of file lock_hashset.h.

◆ try_lock()

template<class KeyType , class HashFunction , class EqualKey >
bool fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::try_lock

Try to lock set.

Returns
true, if the lock has been aquired, false otherwise.

Definition at line 134 of file lock_hashset.h.

◆ unlock()

template<class KeyType , class HashFunction , class EqualKey >
void fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::unlock

Unlock set.

Definition at line 142 of file lock_hashset.h.


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