fawkes::LockHashSet< KeyType, HashFunction, EqualKey > Class Template Reference
[Fawkes Core Library]

Hash set with a lock. More...

#include <core/utils/lock_hashset.h>

List of all members.

Public Member Functions

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


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 47 of file lock_hashset.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 84 of file lock_hashset.h.

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

Copy constructor.

Parameters:
lh LockHashSet to copy

Definition at line 93 of file lock_hashset.h.

template<class KeyType, class HashFunction, class EqualKey>
fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::~LockHashSet (  )  [virtual]

Destructor.

Definition at line 105 of file lock_hashset.h.


Member Function Documentation

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:
x element to add

Definition at line 143 of file lock_hashset.h.

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

Lock set.

Definition at line 112 of file lock_hashset.h.

Referenced by fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::operator=().

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

Get access to the internal mutex.

Can be used with MutexLocker.

Returns:
internal mutex

Definition at line 157 of file lock_hashset.h.

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:
ll lock hash set to copy
Returns:
reference to this instance

Definition at line 170 of file lock_hashset.h.

References fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::lock(), and fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::unlock().

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

Try to lock set.

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

Definition at line 123 of file lock_hashset.h.

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

Unlock set.

Definition at line 132 of file lock_hashset.h.

Referenced by fawkes::LockHashSet< KeyType, HashFunction, EqualKey >::operator=().


The documentation for this class was generated from the following file:
Generated on Tue Feb 22 13:32:49 2011 for Fawkes API by  doxygen 1.4.7