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 37 of file lock_vector.h.

Constructor & Destructor Documentation

◆ LockVector() [1/2]

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

Constructor.

Definition at line 75 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 84 of file lock_vector.h.

◆ ~LockVector()

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

Destructor.

Definition at line 91 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  pos)

Erase given element with lock protection.

Parameters
positerator for the object position to remove

Definition at line 153 of file lock_vector.h.

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

◆ erase_locked() [2/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 166 of file lock_vector.h.

◆ lock()

◆ mutex()

template<typename Type >
RefPtr< Mutex > fawkes::LockVector< Type >::mutex ( ) const

Get access to the internal mutex.

Can be used with MutexLocker.

Returns
internal mutex

Definition at line 181 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 195 of file lock_vector.h.

◆ 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 219 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 140 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 129 of file lock_vector.h.

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

◆ try_lock()

template<typename Type >
bool fawkes::LockVector< Type >::try_lock ( ) const
virtual

Try to lock vector.

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

Definition at line 109 of file lock_vector.h.

Referenced by fawkes::LockVector< std::pair< fawkes::NavGraphEdge, float > >::try_lock().

◆ unlock()


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