24 #ifndef _CORE_UTILS_LOCK_VECTOR_H_
25 #define _CORE_UTILS_LOCK_VECTOR_H_
27 #include <core/threading/mutex.h>
28 #include <core/utils/refptr.h>
34 template <
typename Type>
35 class LockVector :
public std::vector<Type>
41 virtual void lock()
const;
43 virtual void unlock()
const;
48 void erase_locked(
typename std::vector<Type>::iterator pos);
49 void erase_locked(
typename std::vector<Type>::iterator first,
50 typename std::vector<Type>::iterator last);
70 template <
typename Type>
78 template <
typename Type>
80 : std::vector<Type>::vector(lv), mutex_(new
Mutex())
85 template <
typename Type>
91 template <
typename Type>
101 template <
typename Type>
109 template <
typename Type>
119 template <
typename Type>
124 std::vector<Type>::push_back(x);
129 template <
typename Type>
134 std::vector<Type>::pop_back();
141 template <
typename Type>
146 std::vector<Type>::erase(pos);
154 template <
typename Type>
157 typename std::vector<Type>::iterator last)
160 std::vector<Type>::erase(first, last);
168 template <
typename Type>
181 template <
typename Type>
189 for (i = lv.begin(); i != lv.end(); ++i) {
204 template <
typename Type>
206 LockVector<Type>::operator=(
const std::vector<Type> &v)
210 typename std::vector<Type>::const_iterator i;
211 for (i = v.begin(); i != v.end(); ++i) {