Fawkes API  Fawkes Development Version
fawkes::RWLockVector Class Reference

Vector with a lock. More...

#include <>>

Inheritance diagram for fawkes::RWLockVector:

List of all members.

Public Member Functions

 RWLockVector ()
 Constructor.
 RWLockVector (const RWLockVector< Type > &lv)
 Copy constructor.
virtual ~RWLockVector ()
 Destructor.
virtual void lock_for_read () const
 Lock vector for reading.
virtual void lock_for_write () const
 Lock vector for writing.
virtual bool try_lock_for_read () const
 Try to lock vector for reading.
virtual bool try_lock_for_write () const
 Try to lock vector for writing.
virtual void unlock () const
 Unlock vector.
RefPtr< ReadWriteLockrwlock () const
 Get access to the internal read/write lock.
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.
RWLockVector< Type > & operator= (const RWLockVector< Type > &lv)
 Copy values from another RWLockVector.
RWLockVector< 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:
ReadWriteLock
Author:
Tim Niemueller

Constructor & Destructor Documentation

fawkes::RWLockVector::RWLockVector ( )

Constructor.

Definition at line 77 of file rwlock_vector.h.

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

Copy constructor.

Parameters:
lvRWLockVector to copy

Definition at line 86 of file rwlock_vector.h.

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

Destructor.

Definition at line 93 of file rwlock_vector.h.


Member Function Documentation

void fawkes::RWLockVector::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 175 of file rwlock_vector.h.

void fawkes::RWLockVector::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 188 of file rwlock_vector.h.

void fawkes::RWLockVector::lock_for_read ( ) const [virtual]

Lock vector for reading.

Definition at line 100 of file rwlock_vector.h.

void fawkes::RWLockVector::lock_for_write ( ) const [virtual]

Lock vector for writing.

Definition at line 109 of file rwlock_vector.h.

RWLockVector< Type > & fawkes::RWLockVector::operator= ( const RWLockVector< Type > &  lv)

Copy values from another RWLockVector.

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 216 of file rwlock_vector.h.

RWLockVector< Type > & fawkes::RWLockVector::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 240 of file rwlock_vector.h.

void fawkes::RWLockVector::pop_back_locked ( )

Remove last element with lock protection.

Definition at line 162 of file rwlock_vector.h.

void fawkes::RWLockVector::push_back_locked ( const Type &  x)

Push element to vector at back with lock protection.

Parameters:
xelement to add

Definition at line 151 of file rwlock_vector.h.

RefPtr< ReadWriteLock > fawkes::RWLockVector::rwlock ( ) const

Get access to the internal read/write lock.

Returns:
internal read/write lock

Definition at line 202 of file rwlock_vector.h.

Referenced by RRDThread::generate_graphs(), RRDThread::add_rrd(), RRDThread::remove_rrd(), RRDThread::add_graph(), and RRDThread::add_data().

bool fawkes::RWLockVector::try_lock_for_read ( ) const [virtual]

Try to lock vector for reading.

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

Definition at line 120 of file rwlock_vector.h.

bool fawkes::RWLockVector::try_lock_for_write ( ) const [virtual]

Try to lock vector for writing.

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

Definition at line 131 of file rwlock_vector.h.

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

Unlock vector.

Definition at line 140 of file rwlock_vector.h.


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