Fawkes API
Fawkes Development Version
|
Vector with a lock. More...
#include <>>
Public Member Functions | |
RWLockVector () | |
Constructor. More... | |
RWLockVector (const RWLockVector< Type > &lv) | |
Copy constructor. More... | |
virtual | ~RWLockVector () |
Destructor. More... | |
virtual void | lock_for_read () const |
Lock vector for reading. More... | |
virtual void | lock_for_write () const |
Lock vector for writing. More... | |
virtual bool | try_lock_for_read () const |
Try to lock vector for reading. More... | |
virtual bool | try_lock_for_write () const |
Try to lock vector for writing. More... | |
virtual void | unlock () const |
Unlock vector. More... | |
RefPtr< ReadWriteLock > | rwlock () const |
Get access to the internal read/write lock. 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... | |
RWLockVector< Type > & | operator= (const RWLockVector< Type > &lv) |
Copy values from another RWLockVector. More... | |
RWLockVector< Type > & | operator= (const std::vector< Type > &v) |
Copy values from a standard vector. More... | |
Vector with a lock.
This class provides a vector that has an intrinsic lock. The lock can be applied with the regular locking methods.
Definition at line 37 of file rwlock_vector.h.
fawkes::RWLockVector< Type >::RWLockVector | ( | ) |
Constructor.
Definition at line 77 of file rwlock_vector.h.
fawkes::RWLockVector< Type >::RWLockVector | ( | const RWLockVector< Type > & | lv | ) |
|
virtual |
Destructor.
Definition at line 93 of file rwlock_vector.h.
void fawkes::RWLockVector< Type >::erase_locked | ( | typename std::vector< Type >::iterator | pos | ) |
Erase given element with lock protection.
pos | iterator for the object position to remove |
Definition at line 175 of file rwlock_vector.h.
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.
first | iterator to first element to erase |
last | iterator to first element not to erase |
Definition at line 188 of file rwlock_vector.h.
|
virtual |
Lock vector for reading.
Definition at line 100 of file rwlock_vector.h.
Referenced by fawkes::RWLockVector< fawkes::RRDDefinition *>::lock_for_read(), and fawkes::RWLockVector< fawkes::RRDDefinition *>::operator=().
|
virtual |
Lock vector for writing.
Definition at line 109 of file rwlock_vector.h.
Referenced by fawkes::RWLockVector< fawkes::RRDDefinition *>::erase_locked(), fawkes::RWLockVector< fawkes::RRDDefinition *>::lock_for_write(), fawkes::RWLockVector< fawkes::RRDDefinition *>::operator=(), fawkes::RWLockVector< fawkes::RRDDefinition *>::pop_back_locked(), and fawkes::RWLockVector< fawkes::RRDDefinition *>::push_back_locked().
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.
lv | vector to copy |
Definition at line 216 of file rwlock_vector.h.
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.
v | vector to copy |
Definition at line 240 of file rwlock_vector.h.
void fawkes::RWLockVector< Type >::pop_back_locked | ( | ) |
Remove last element with lock protection.
Definition at line 162 of file rwlock_vector.h.
void fawkes::RWLockVector< Type >::push_back_locked | ( | const Type & | x | ) |
Push element to vector at back with lock protection.
x | element to add |
Definition at line 151 of file rwlock_vector.h.
RefPtr< ReadWriteLock > fawkes::RWLockVector< Type >::rwlock | ( | ) | const |
Get access to the 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().
|
virtual |
Try to lock vector for reading.
Definition at line 120 of file rwlock_vector.h.
Referenced by fawkes::RWLockVector< fawkes::RRDDefinition *>::try_lock_for_read().
|
virtual |
Try to lock vector for writing.
Definition at line 131 of file rwlock_vector.h.
Referenced by fawkes::RWLockVector< fawkes::RRDDefinition *>::try_lock_for_write().
|
virtual |
Unlock vector.
Definition at line 140 of file rwlock_vector.h.
Referenced by fawkes::RWLockVector< fawkes::RRDDefinition *>::operator=(), and fawkes::RWLockVector< fawkes::RRDDefinition *>::unlock().