Fawkes API  Fawkes Development Version
fawkes::LockVector Class Reference

Vector with a lock. More...

#include <>>

Inheritance diagram for fawkes::LockVector:

List of all members.

Public Member Functions

 LockVector ()
 Constructor.
 LockVector (const LockVector< Type > &lv)
 Copy constructor.
virtual ~LockVector ()
 Destructor.
virtual void lock () const
 Lock vector.
virtual bool try_lock () const
 Try to lock vector.
virtual void unlock () const
 Unlock vector.
RefPtr< Mutexmutex () const
 Get access to the internal mutex.
void push_back_locked (const Type &x)
 Push element to vector at back with lock protection.
void pop_back_locked ()
 Remove last element with lock protection.
void erase_locked (typename std::vector< Type >::iterator pos)
 Erase given element with lock protection.
void erase_locked (typename std::vector< Type >::iterator first, typename std::vector< Type >::iterator last)
 Erase given element range with lock protection.
LockVector< Type > & operator= (const LockVector< Type > &lv)
 Copy values from another LockVector.
LockVector< Type > & operator= (const std::vector< Type > &v)
 Copy values from a standard vector.

Detailed Description

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

Constructor & Destructor Documentation

fawkes::LockVector::LockVector ( )

Constructor.

Definition at line 75 of file lock_vector.h.

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

Copy constructor.

Parameters:
lvLockVector to copy

Definition at line 84 of file lock_vector.h.

fawkes::LockVector::~LockVector ( ) [virtual]

Destructor.

Definition at line 91 of file lock_vector.h.


Member Function Documentation

void fawkes::LockVector::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.

void fawkes::LockVector::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.

void fawkes::LockVector::lock ( ) const [virtual]

Lock vector.

Definition at line 98 of file lock_vector.h.

RefPtr< Mutex > fawkes::LockVector::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.

LockVector< Type > & fawkes::LockVector::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.

LockVector< Type > & fawkes::LockVector::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.

void fawkes::LockVector::pop_back_locked ( )

Remove last element with lock protection.

Definition at line 140 of file lock_vector.h.

void fawkes::LockVector::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.

bool fawkes::LockVector::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.

void fawkes::LockVector::unlock ( ) const [virtual]

Unlock vector.

Definition at line 118 of file lock_vector.h.


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