Fawkes API  Fawkes Development Version
fawkes::LockVector< Type > Class Template Reference

Vector with a lock. More...

#include <>>

Inheritance diagram for fawkes::LockVector< Type >:

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< Mutexmutex () 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...
 

Detailed Description

template<typename Type>
class fawkes::LockVector< Type >

Vector with a lock.

This class provides a vector that has an intrinsic lock. The lock can be applied with the regular locking methods.

See also
Mutex
Author
Tim Niemueller

Definition at line 35 of file lock_vector.h.

Constructor & Destructor Documentation

◆ LockVector() [1/2]

template<typename Type >
fawkes::LockVector< Type >::LockVector

Constructor.

Definition at line 71 of file lock_vector.h.

◆ LockVector() [2/2]

template<typename Type >
fawkes::LockVector< Type >::LockVector ( const LockVector< Type > &  lv)

Copy constructor.

Parameters
lvLockVector to copy

Definition at line 79 of file lock_vector.h.

◆ ~LockVector()

template<typename Type >
fawkes::LockVector< Type >::~LockVector
virtual

Destructor.

Definition at line 86 of file lock_vector.h.

Member Function Documentation

◆ erase_locked() [1/2]

template<typename Type >
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.

Parameters
firstiterator to first element to erase
lastiterator to first element not to erase

Definition at line 156 of file lock_vector.h.

◆ erase_locked() [2/2]

template<typename Type >
void fawkes::LockVector< Type >::erase_locked ( typename std::vector< Type >::iterator  pos)

Erase given element with lock protection.

Parameters
positerator for the object position to remove

Definition at line 143 of file lock_vector.h.

Referenced by fawkes::NavGraphStaticListEdgeCostConstraint::remove_edge().

◆ lock()

template<typename Type >
void fawkes::LockVector< Type >::lock
virtual

Lock vector.

Definition at line 93 of file lock_vector.h.

Referenced by fawkes::LockVector< Type >::operator=().

◆ mutex()

template<typename Type >
RefPtr< Mutex > fawkes::LockVector< Type >::mutex

Get access to the internal mutex.

Can be used with MutexLocker.

Returns
internal mutex

Definition at line 170 of file lock_vector.h.

◆ operator=() [1/2]

template<typename Type >
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.

Parameters
lvvector to copy
Returns
reference to this instance

Definition at line 183 of file lock_vector.h.

References fawkes::LockVector< Type >::lock(), and fawkes::LockVector< Type >::unlock().

◆ operator=() [2/2]

template<typename Type >
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.

Parameters
vvector to copy
Returns
reference to this instance

Definition at line 206 of file lock_vector.h.

◆ pop_back_locked()

template<typename Type >
void fawkes::LockVector< Type >::pop_back_locked

Remove last element with lock protection.

Definition at line 131 of file lock_vector.h.

◆ push_back_locked()

template<typename Type >
void fawkes::LockVector< Type >::push_back_locked ( const Type &  x)

Push element to vector at back with lock protection.

Parameters
xelement to add

Definition at line 121 of file lock_vector.h.

Referenced by fawkes::NavGraphStaticListEdgeCostConstraint::add_edge().

◆ try_lock()

template<typename Type >
bool fawkes::LockVector< Type >::try_lock
virtual

Try to lock vector.

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

Definition at line 103 of file lock_vector.h.

◆ unlock()

template<typename Type >
void fawkes::LockVector< Type >::unlock
virtual

Unlock vector.

Definition at line 111 of file lock_vector.h.

Referenced by fawkes::LockVector< Type >::operator=().


The documentation for this class was generated from the following file: