Fawkes API
Fawkes Development Version
|
Vector with a lock. More...
#include <>>
Public Member Functions | |
LockVector () | |
Constructor. More... | |
LockVector (const LockVector< Type > &lv) | |
Copy constructor. More... | |
virtual | ~LockVector () |
Destructor. More... | |
virtual void | lock () const |
Lock vector. More... | |
virtual bool | try_lock () const |
Try to lock vector. More... | |
virtual void | unlock () const |
Unlock vector. More... | |
RefPtr< Mutex > | mutex () const |
Get access to the internal mutex. More... | |
void | push_back_locked (const Type &x) |
Push element to vector at back with lock protection. More... | |
void | pop_back_locked () |
Remove last element with lock protection. More... | |
void | erase_locked (typename std::vector< Type >::iterator pos) |
Erase given element with lock protection. More... | |
void | erase_locked (typename std::vector< Type >::iterator first, typename std::vector< Type >::iterator last) |
Erase given element range with lock protection. More... | |
LockVector< Type > & | operator= (const LockVector< Type > &lv) |
Copy values from another LockVector. More... | |
LockVector< Type > & | operator= (const std::vector< Type > &v) |
Copy values from a standard vector. More... | |
Vector with a lock.
This class provides a vector that has an intrinsic lock. The lock can be applied with the regular locking methods.
Definition at line 37 of file lock_vector.h.
fawkes::LockVector< Type >::LockVector | ( | ) |
Constructor.
Definition at line 75 of file lock_vector.h.
fawkes::LockVector< Type >::LockVector | ( | const LockVector< Type > & | lv | ) |
|
virtual |
Destructor.
Definition at line 91 of file lock_vector.h.
void fawkes::LockVector< Type >::erase_locked | ( | typename std::vector< Type >::iterator | pos | ) |
Erase given element with lock protection.
pos | iterator for the object position to remove |
Definition at line 153 of file lock_vector.h.
Referenced by fawkes::NavGraphStaticListEdgeCostConstraint::remove_edge().
void fawkes::LockVector< Type >::erase_locked | ( | typename std::vector< Type >::iterator | first, |
typename std::vector< Type >::iterator | last | ||
) |
Erase given element range with lock protection.
first | iterator to first element to erase |
last | iterator to first element not to erase |
Definition at line 166 of file lock_vector.h.
|
virtual |
Lock vector.
Definition at line 98 of file lock_vector.h.
Referenced by fawkes::NavGraphStaticListEdgeCostConstraint::compute(), fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::erase_locked(), NaoQiDCMThread::finalize(), fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::lock(), fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::operator=(), fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::pop_back_locked(), and fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::push_back_locked().
RefPtr< Mutex > fawkes::LockVector< Type >::mutex | ( | ) | const |
Get access to the internal mutex.
Can be used with MutexLocker.
Definition at line 181 of file lock_vector.h.
LockVector< Type > & fawkes::LockVector< Type >::operator= | ( | const LockVector< Type > & | lv | ) |
Copy values from another LockVector.
Copies the values one by one. Both instances are locked during the copying and this instance is cleared before copying.
lv | vector to copy |
Definition at line 195 of file lock_vector.h.
LockVector< Type > & fawkes::LockVector< Type >::operator= | ( | const std::vector< Type > & | v | ) |
Copy values from a standard vector.
Copies the values one by one. This instance is locked during the copying and cleared.
v | vector to copy |
Definition at line 219 of file lock_vector.h.
void fawkes::LockVector< Type >::pop_back_locked | ( | ) |
Remove last element with lock protection.
Definition at line 140 of file lock_vector.h.
void fawkes::LockVector< Type >::push_back_locked | ( | const Type & | x | ) |
Push element to vector at back with lock protection.
x | element to add |
Definition at line 129 of file lock_vector.h.
Referenced by fawkes::NavGraphStaticListEdgeCostConstraint::add_edge().
|
virtual |
Try to lock vector.
Definition at line 109 of file lock_vector.h.
Referenced by fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::try_lock().
|
virtual |
Unlock vector.
Definition at line 118 of file lock_vector.h.
Referenced by fawkes::NavGraphStaticListEdgeCostConstraint::compute(), NaoQiDCMThread::finalize(), fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::operator=(), and fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::unlock().