fawkes::RWLockMap< KeyType, ValueType, LessKey > Class Template Reference
[Fawkes Core Library]

Hash map with a lock. More...

#include <core/utils/rwlock_map.h>

Inheritance diagram for fawkes::RWLockMap< KeyType, ValueType, LessKey >:

[legend]
List of all members.

Public Member Functions

 RWLockMap ()
 Constructor.
 RWLockMap (const RWLockMap< KeyType, ValueType, LessKey > &lm)
 Copy constructor.
virtual ~RWLockMap ()
 Destructor.
void lock_for_read ()
 Lock list for reading.
void lock_for_write ()
 Lock list for writing.
bool try_lock_for_read ()
 Try to lock list for reading.
bool try_lock_for_write ()
 Try to lock list for writing.
void unlock ()
 Unlock list.
RefPtr< ReadWriteLockrwlock () const
 Get access to the internal rwlock.
void erase_locked (const KeyType &key)
 Remove item with lock.

Detailed Description

template<typename KeyType, typename ValueType, typename LessKey = std::less<KeyType>>
class fawkes::RWLockMap< KeyType, ValueType, LessKey >

Hash map with a lock.

This class provides a map that has an intrinsic read/write lock. The lock can be applied with the regular locking methods.

See also:
ReadWriteLock
Author:
Tim Niemueller

Definition at line 37 of file rwlock_map.h.


Constructor & Destructor Documentation

template<typename KeyType, typename ValueType, typename LessKey>
fawkes::RWLockMap< KeyType, ValueType, LessKey >::RWLockMap (  ) 

Constructor.

Definition at line 72 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
fawkes::RWLockMap< KeyType, ValueType, LessKey >::RWLockMap ( const RWLockMap< KeyType, ValueType, LessKey > &  lm  ) 

Copy constructor.

Parameters:
lm RWLockMap to copy

Definition at line 81 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
fawkes::RWLockMap< KeyType, ValueType, LessKey >::~RWLockMap (  )  [virtual]

Destructor.

Definition at line 88 of file rwlock_map.h.


Member Function Documentation

template<typename KeyType, typename ValueType, typename LessKey>
void fawkes::RWLockMap< KeyType, ValueType, LessKey >::erase_locked ( const KeyType &  key  ) 

Remove item with lock.

The map is automatically locked and unlocked during the removal.

Parameters:
key key of the value to erase

Definition at line 147 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
void fawkes::RWLockMap< KeyType, ValueType, LessKey >::lock_for_read (  ) 

Lock list for reading.

Definition at line 95 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
void fawkes::RWLockMap< KeyType, ValueType, LessKey >::lock_for_write (  ) 

Lock list for writing.

Definition at line 104 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
RefPtr< ReadWriteLock > fawkes::RWLockMap< KeyType, ValueType, LessKey >::rwlock (  )  const

Get access to the internal rwlock.

Can be used with RwlockLocker.

Returns:
internal rwlock

Definition at line 161 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
bool fawkes::RWLockMap< KeyType, ValueType, LessKey >::try_lock_for_read (  ) 

Try to lock list for reading.

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

Definition at line 115 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
bool fawkes::RWLockMap< KeyType, ValueType, LessKey >::try_lock_for_write (  ) 

Try to lock list for writing.

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

Definition at line 126 of file rwlock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
void fawkes::RWLockMap< KeyType, ValueType, LessKey >::unlock (  ) 

Unlock list.

Definition at line 135 of file rwlock_map.h.


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