Fawkes API  Fawkes Development Version
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fawkes::RWLockVector< Type > Class Template Reference

Vector with a lock. More...

#include <>>

Inheritance diagram for fawkes::RWLockVector< Type >:

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.

Additional Inherited Members

- Public Attributes inherited from std::vector< T >
elements
 STL member.

Detailed Description

template<typename Type>
class fawkes::RWLockVector< 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:
ReadWriteLock
Author:
Tim Niemueller

Definition at line 37 of file rwlock_vector.h.


Constructor & Destructor Documentation

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

Constructor.

Definition at line 77 of file rwlock_vector.h.

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

Copy constructor.

Parameters:
lvRWLockVector to copy

Definition at line 86 of file rwlock_vector.h.

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

Destructor.

Definition at line 93 of file rwlock_vector.h.


Member Function Documentation

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

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

template<typename Type >
void fawkes::RWLockVector< Type >::lock_for_read ( ) const
virtual

Lock vector for reading.

Definition at line 100 of file rwlock_vector.h.

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

template<typename Type >
void fawkes::RWLockVector< Type >::lock_for_write ( ) const
virtual

Lock vector for writing.

Definition at line 109 of file rwlock_vector.h.

template<typename Type>
RWLockVector< Type > & fawkes::RWLockVector< Type >::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.

References fawkes::RWLockVector< Type >::lock_for_read(), and fawkes::RWLockVector< Type >::unlock().

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

template<typename Type >
void fawkes::RWLockVector< Type >::pop_back_locked ( )

Remove last element with lock protection.

Definition at line 162 of file rwlock_vector.h.

template<typename Type>
void fawkes::RWLockVector< Type >::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.

template<typename Type >
RefPtr< ReadWriteLock > fawkes::RWLockVector< Type >::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::add_data(), RRDThread::add_graph(), RRDThread::add_rrd(), RRDThread::generate_graphs(), and RRDThread::remove_rrd().

template<typename Type >
bool fawkes::RWLockVector< Type >::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.

template<typename Type >
bool fawkes::RWLockVector< Type >::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.

template<typename Type >
void fawkes::RWLockVector< Type >::unlock ( ) const
virtual

Unlock vector.

Definition at line 140 of file rwlock_vector.h.

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


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