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

Hash map with a lock. More...

#include <core/utils/lock_hashmap.h>

Inheritance diagram for fawkes::LockHashMap< KeyType, ValueType, HashFunction, EqualKey >:

[legend]
List of all members.

Public Member Functions

 LockHashMap ()
 Constructor.
 LockHashMap (const LockHashMap< KeyType, ValueType, HashFunction, EqualKey > &lh)
 Copy constructor.
virtual ~LockHashMap ()
 Destructor.
void lock () const
 Lock map.
bool try_lock () const
 Try to lock map.
void unlock () const
 Unlock map.
RefPtr< Mutexmutex () const
 Get access to the internal mutex.
LockHashMap< KeyType, ValueType,
HashFunction, EqualKey > & 
operator= (const LockHashMap< KeyType, ValueType, HashFunction, EqualKey > &ll)
 Copy values from another LockHashMap.

Detailed Description

template<class KeyType, class ValueType, class HashFunction = __gnu_cxx::hash<KeyType>, class EqualKey = std::equal_to<KeyType>>
class fawkes::LockHashMap< KeyType, ValueType, HashFunction, EqualKey >

Hash map with a lock.

This class provides a hash map 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_hashmap.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 82 of file lock_hashmap.h.

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

Copy constructor.

Parameters:
lh LockHashMap to copy

Definition at line 92 of file lock_hashmap.h.

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

Destructor.

Definition at line 105 of file lock_hashmap.h.


Member Function Documentation

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

Lock map.

Definition at line 113 of file lock_hashmap.h.

Referenced by fawkes::NetworkNameResolver::flush_cache(), fawkes::LockHashMap< KeyType, ValueType, HashFunction, EqualKey >::operator=(), and fawkes::NetworkNameResolver::resolve_address().

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

Get access to the internal mutex.

Can be used with MutexLocker.

Returns:
internal mutex

Definition at line 145 of file lock_hashmap.h.

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

Copy values from another LockHashMap.

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

Parameters:
ll hash map to copy
Returns:
reference to this instance

Definition at line 159 of file lock_hashmap.h.

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

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

Try to lock map.

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

Definition at line 124 of file lock_hashmap.h.

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

Unlock map.

Definition at line 133 of file lock_hashmap.h.

Referenced by fawkes::NetworkNameResolver::flush_cache(), fawkes::LockHashMap< KeyType, ValueType, HashFunction, EqualKey >::operator=(), and fawkes::NetworkNameResolver::resolve_address().


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