Fawkes API
Fawkes Development Version
|
Hash set with a lock. More...
#include <core/utils/lock_hashset.h>
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< Mutex > | mutex () 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... | |
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.
Definition at line 54 of file lock_hashset.h.
fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::LockHashSet | ( | ) |
Constructor.
Definition at line 91 of file lock_hashset.h.
fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::LockHashSet | ( | const LockHashSet< KeyType, HashFunction, EqualKey > & | lh | ) |
|
virtual |
Destructor.
Definition at line 114 of file lock_hashset.h.
void fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::insert_locked | ( | const KeyType & | x | ) |
Insert element to hash set with lock protection.
x | element to add |
Definition at line 152 of file lock_hashset.h.
void fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::lock | ( | ) | const |
Lock set.
Definition at line 121 of file lock_hashset.h.
Referenced by fawkes::LockHashSet< std::string >::insert_locked(), fawkes::LockHashSet< std::string >::lock(), and fawkes::LockHashSet< std::string >::operator=().
RefPtr< Mutex > fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::mutex | ( | ) | const |
Get access to the internal mutex.
Can be used with MutexLocker.
Definition at line 166 of file lock_hashset.h.
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.
ll | lock hash set to copy |
Definition at line 179 of file lock_hashset.h.
bool fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::try_lock | ( | ) | const |
Try to lock set.
Definition at line 132 of file lock_hashset.h.
Referenced by fawkes::LockHashSet< std::string >::try_lock().
void fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::unlock | ( | ) | const |
Unlock set.
Definition at line 141 of file lock_hashset.h.
Referenced by fawkes::LockHashSet< std::string >::operator=(), and fawkes::LockHashSet< std::string >::unlock().