24 #ifndef _CORE_UTILS_RWLOCK_VECTOR_H_ 25 #define _CORE_UTILS_RWLOCK_VECTOR_H_ 27 #include <core/threading/read_write_lock.h> 28 #include <core/utils/refptr.h> 34 template <
typename Type>
45 virtual void unlock()
const;
50 void erase_locked(
typename std::vector<Type>::iterator pos);
51 void erase_locked(
typename std::vector<Type>::iterator first,
52 typename std::vector<Type>::iterator last);
72 template <
typename Type>
80 template <
typename Type>
87 template <
typename Type>
93 template <
typename Type>
101 template <
typename Type>
111 template <
typename Type>
121 template <
typename Type>
129 template <
typename Type>
139 template <
typename Type>
144 std::vector<Type>::push_back(x);
149 template <
typename Type>
154 std::vector<Type>::pop_back();
161 template <
typename Type>
166 std::vector<Type>::erase(pos);
174 template <
typename Type>
177 typename std::vector<Type>::iterator last)
180 std::vector<Type>::erase(first, last);
187 template <
typename Type>
200 template <
typename Type>
208 for (i = lv.begin(); i != lv.end(); ++i) {
223 template <
typename Type>
229 typename std::vector<Type>::const_iterator i;
230 for (i = v.begin(); i != v.end(); ++i) {
virtual void lock_for_read() const
Lock vector for reading.
Fawkes library namespace.
RefPtr< ReadWriteLock > rwlock() const
Get access to the internal read/write lock.
virtual void unlock() const
Unlock vector.
virtual bool try_lock_for_write() const
Try to lock vector for writing.
virtual ~RWLockVector()
Destructor.
RWLockVector< Type > & operator=(const RWLockVector< Type > &lv)
Copy values from another RWLockVector.
Read/write lock to allow multiple readers but only a single writer on the resource at a time.
virtual void lock_for_write() const
Lock vector for writing.
RefPtr<> is a reference-counting shared smartpointer.
void erase_locked(typename std::vector< Type >::iterator pos)
Erase given element with lock protection.
void pop_back_locked()
Remove last element with lock protection.
virtual bool try_lock_for_read() const
Try to lock vector for reading.
RWLockVector()
Constructor.
void push_back_locked(const Type &x)
Push element to vector at back with lock protection.