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

Map with a lock. More...

#include <core/utils/lock_map.h>

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

[legend]
List of all members.

Public Member Functions

 LockMap ()
 Constructor.
 LockMap (const LockMap< KeyType, ValueType, LessKey > &lm)
 Copy constructor.
virtual ~LockMap ()
 Destructor.
void lock () const
 Lock list.
bool try_lock () const
 Try to lock list.
void unlock () const
 Unlock list.
RefPtr< Mutexmutex () const
 Get access to the internal mutex.
void erase_locked (const KeyType &key)
 Remove item with lock.
LockMap< KeyType, ValueType,
LessKey > & 
operator= (const LockMap< KeyType, ValueType, LessKey > &ll)
 Copy values from another LockMap.
LockMap< KeyType, ValueType,
LessKey > & 
operator= (const std::map< KeyType, ValueType, LessKey > &l)
 Copy values from a standard map.

Detailed Description

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

Map with a lock.

This class provides a 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 37 of file lock_map.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 76 of file lock_map.h.

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

Copy constructor.

Parameters:
lm LockMap to copy

Definition at line 85 of file lock_map.h.

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

Destructor.

Definition at line 93 of file lock_map.h.


Member Function Documentation

template<typename KeyType, typename ValueType, typename LessKey>
void fawkes::LockMap< 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 132 of file lock_map.h.

Referenced by fawkes::PluginManager::load(), and fawkes::PluginManager::unload().

template<typename KeyType, typename ValueType, typename LessKey>
void fawkes::LockMap< KeyType, ValueType, LessKey >::lock (  )  const

Lock list.

Definition at line 100 of file lock_map.h.

Referenced by WorldModelNetworkThread::ball_pos_rcvd(), fawkes::WorldInfoDataContainer::check_timeout(), fawkes::FawkesNetworkClient::deregister_handler(), FvBaseThread::finalize(), fawkes::WorldInfoDataContainer::get_ball_pos_global(), fawkes::WorldInfoDataContainer::get_ball_pos_relative(), fawkes::WorldInfoDataContainer::get_hosts(), fawkes::PluginManager::get_loaded_plugins(), fawkes::WorldInfoDataContainer::get_opponent_pos(), fawkes::WorldInfoDataContainer::get_robot_pose(), WorldModelNetworkThread::global_ball_pos_rcvd(), fawkes::PluginManager::load(), WorldModelNetworkThread::loop(), FvBaseThread::loop(), fawkes::LockMap< KeyType, ValueType, LessKey >::operator=(), fawkes::WorldInfoDataContainer::opponent_disappeared(), WorldModelNetworkThread::pose_rcvd(), FvBaseThread::register_for_camera(), FvBaseThread::register_for_raw_camera(), fawkes::FawkesNetworkClient::register_handler(), fawkes::WorldInfoDataContainer::set_ball_pos(), fawkes::WorldInfoDataContainer::set_ball_pos_global(), fawkes::WorldInfoDataContainer::set_ball_velocity(), fawkes::WorldInfoDataContainer::set_opponent_pos(), fawkes::WorldInfoDataContainer::set_robot_pose(), fawkes::WorldInfoDataContainer::set_robot_velocity(), FawkesThreadManager::try_recover(), fawkes::PluginManager::unload(), FvBaseThread::unregister_thread(), and WorldModelMultiCopyFuser::~WorldModelMultiCopyFuser().

template<typename KeyType, typename ValueType, typename LessKey>
RefPtr< Mutex > fawkes::LockMap< KeyType, ValueType, LessKey >::mutex (  )  const

Get access to the internal mutex.

Can be used with MutexLocker.

Returns:
internal mutex

Definition at line 146 of file lock_map.h.

Referenced by FvBaseThread::acquire_camctrl(), fawkes::BlackBoardInterfaceListener::bbil_add_data_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_message_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_reader_interface(), fawkes::BlackBoardInterfaceListener::bbil_add_writer_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_data_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_message_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_reader_interface(), fawkes::BlackBoardInterfaceListener::bbil_remove_writer_interface(), FawkesThreadManager::force_remove(), WorldModelMultiCopyFuser::fuse(), fawkes::PluginManager::load(), fawkes::BlackBoardNotifier::register_listener(), FawkesThreadManager::wakeup(), and FawkesThreadManager::wakeup_and_wait().

template<typename KeyType, typename ValueType, typename LessKey>
LockMap< KeyType, ValueType, LessKey > & fawkes::LockMap< 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.

Parameters:
l map to copy
Returns:
reference to this instance

Definition at line 185 of file lock_map.h.

template<typename KeyType, typename ValueType, typename LessKey>
LockMap< KeyType, ValueType, LessKey > & fawkes::LockMap< KeyType, ValueType, LessKey >::operator= ( const LockMap< KeyType, ValueType, LessKey > &  ll  ) 

Copy values from another LockMap.

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

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

Definition at line 161 of file lock_map.h.

References fawkes::LockMap< KeyType, ValueType, LessKey >::lock(), and fawkes::LockMap< KeyType, ValueType, LessKey >::unlock().

template<typename KeyType, typename ValueType, typename LessKey>
bool fawkes::LockMap< KeyType, ValueType, LessKey >::try_lock (  )  const

Try to lock list.

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

Definition at line 111 of file lock_map.h.

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

Unlock list.

Definition at line 120 of file lock_map.h.

Referenced by WorldModelNetworkThread::ball_pos_rcvd(), fawkes::WorldInfoDataContainer::check_timeout(), fawkes::FawkesNetworkClient::deregister_handler(), FvBaseThread::finalize(), fawkes::WorldInfoDataContainer::get_ball_pos_global(), fawkes::WorldInfoDataContainer::get_ball_pos_relative(), fawkes::WorldInfoDataContainer::get_hosts(), fawkes::PluginManager::get_loaded_plugins(), fawkes::WorldInfoDataContainer::get_opponent_pos(), fawkes::WorldInfoDataContainer::get_robot_pose(), WorldModelNetworkThread::global_ball_pos_rcvd(), fawkes::PluginManager::load(), WorldModelNetworkThread::loop(), FvBaseThread::loop(), fawkes::LockMap< KeyType, ValueType, LessKey >::operator=(), fawkes::WorldInfoDataContainer::opponent_disappeared(), WorldModelNetworkThread::pose_rcvd(), FvBaseThread::register_for_camera(), FvBaseThread::register_for_raw_camera(), fawkes::FawkesNetworkClient::register_handler(), fawkes::WorldInfoDataContainer::set_ball_pos(), fawkes::WorldInfoDataContainer::set_ball_pos_global(), fawkes::WorldInfoDataContainer::set_ball_velocity(), fawkes::WorldInfoDataContainer::set_opponent_pos(), fawkes::WorldInfoDataContainer::set_robot_pose(), fawkes::WorldInfoDataContainer::set_robot_velocity(), FawkesThreadManager::try_recover(), fawkes::PluginManager::unload(), FvBaseThread::unregister_thread(), and WorldModelMultiCopyFuser::~WorldModelMultiCopyFuser().


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