Fawkes API
Fawkes Development Version
|
Multi-Map with a lock. More...
#include <>>
Public Member Functions | |
LockMultiMap () | |
Constructor. More... | |
LockMultiMap (const LockMultiMap< KeyType, ValueType, LessKey > &lm) | |
Copy constructor. More... | |
virtual | ~LockMultiMap () |
Destructor. More... | |
void | lock () const |
Lock list. More... | |
bool | try_lock () const |
Try to lock list. More... | |
void | unlock () const |
Unlock list. More... | |
RefPtr< Mutex > | mutex () const |
Get access to the internal mutex. More... | |
void | erase_locked (const KeyType &key) |
Remove item with lock. More... | |
LockMultiMap< KeyType, ValueType, LessKey > & | operator= (const LockMultiMap< KeyType, ValueType, LessKey > &ll) |
Copy values from another LockMultiMap. More... | |
LockMultiMap< KeyType, ValueType, LessKey > & | operator= (const std::map< KeyType, ValueType, LessKey > &l) |
Copy values from a standard map. More... | |
Multi-Map with a lock.
This class provides a multimap that has an intrinsic lock. The lock can be applied with the regular locking methods.
Definition at line 37 of file lock_multimap.h.
fawkes::LockMultiMap< KeyType, ValueType, LessKey >::LockMultiMap | ( | ) |
Constructor.
Definition at line 76 of file lock_multimap.h.
fawkes::LockMultiMap< KeyType, ValueType, LessKey >::LockMultiMap | ( | const LockMultiMap< KeyType, ValueType, LessKey > & | lm | ) |
|
virtual |
Destructor.
Definition at line 93 of file lock_multimap.h.
void fawkes::LockMultiMap< KeyType, ValueType, LessKey >::erase_locked | ( | const KeyType & | key | ) |
Remove item with lock.
The map is automatically locked and unlocked during the removal.
key | key of the value to erase |
Definition at line 132 of file lock_multimap.h.
void fawkes::LockMultiMap< KeyType, ValueType, LessKey >::lock | ( | ) | const |
Lock list.
Definition at line 100 of file lock_multimap.h.
Referenced by fawkes::LockMultiMap< fawkes::LedInterface *, std::string >::erase_locked(), fawkes::LockMultiMap< fawkes::LedInterface *, std::string >::lock(), and fawkes::LockMultiMap< fawkes::LedInterface *, std::string >::operator=().
RefPtr< Mutex > fawkes::LockMultiMap< KeyType, ValueType, LessKey >::mutex | ( | ) | const |
Get access to the internal mutex.
Can be used with MutexLocker.
Definition at line 146 of file lock_multimap.h.
LockMultiMap< KeyType, ValueType, LessKey > & fawkes::LockMultiMap< KeyType, ValueType, LessKey >::operator= | ( | const LockMultiMap< KeyType, ValueType, LessKey > & | ll | ) |
Copy values from another LockMultiMap.
Copies the values one by one. Both instances are locked during the copying and this instance is cleared before copying.
ll | map to copy |
Definition at line 161 of file lock_multimap.h.
LockMultiMap< KeyType, ValueType, LessKey > & fawkes::LockMultiMap< KeyType, ValueType, LessKey >::operator= | ( | const std::map< KeyType, ValueType, LessKey > & | l | ) |
Copy values from a standard map.
Copies the values one by one. This instance is locked during the copying and cleared.
l | map to copy |
Definition at line 185 of file lock_multimap.h.
bool fawkes::LockMultiMap< KeyType, ValueType, LessKey >::try_lock | ( | ) | const |
Try to lock list.
Definition at line 111 of file lock_multimap.h.
Referenced by fawkes::LockMultiMap< fawkes::LedInterface *, std::string >::try_lock().
void fawkes::LockMultiMap< KeyType, ValueType, LessKey >::unlock | ( | ) | const |
Unlock list.
Definition at line 120 of file lock_multimap.h.
Referenced by fawkes::LockMultiMap< fawkes::LedInterface *, std::string >::operator=(), and fawkes::LockMultiMap< fawkes::LedInterface *, std::string >::unlock().