24 #include <boost/utility.hpp> 26 #include "raul/AtomicInt.hpp" 27 #include "raul/AtomicPtr.hpp" 28 #include "raul/Deletable.hpp" 53 explicit Node(T elem) : _elem(elem) {}
58 : _elem(copy._elem), _prev(copy._prev), _next(copy._next)
61 Node* prev()
const {
return _prev.get(); }
62 void prev(
Node* ln) { _prev = ln; }
63 Node* next()
const {
return _next.get(); }
64 void next(
Node* ln) { _next = ln; }
65 T& elem() {
return _elem;}
66 const T& elem()
const {
return _elem; }
78 , _const_end_iter(
this)
82 _end_iter._listnode = NULL;
83 _const_end_iter._listnode = NULL;
96 unsigned size()
const {
return static_cast<unsigned>(_size.get()); }
99 bool empty() {
return (_head.get() == NULL); }
108 : _list(i._list), _listnode(i._listnode) {}
110 inline const T& operator*();
111 inline const T* operator->();
114 inline bool operator!=(
const iterator& iter)
const;
116 inline bool operator==(
const iterator& iter)
const;
119 inline const typename List<T>::Node* node()
const {
return _listnode; }
121 friend class List<T>;
134 inline T& operator*();
135 inline T* operator->();
137 inline bool operator!=(
const iterator& iter)
const;
139 inline bool operator==(
const iterator& iter)
const;
142 friend class List<T>;
146 const
List<T>* _list;
150 void chop_front(List<T>& front, size_t front_size, Node* front_tail);
160 T& front() {
return *begin(); }
161 const T& front()
const {
return *begin(); }
163 Node* head() {
return _head.get(); }
164 const Node* head()
const {
return _head.get(); }
177 #endif // RAUL_LIST_HPP 179 #include "ListImpl.hpp" Something with a virtual destructor.
Definition: Deletable.hpp:28
void clear()
Clear the list, deleting all Nodes contained (but NOT their contents!)
Definition: ListImpl.hpp:37
Realtime safe iterator for a List.
Definition: List.hpp:130
A node in a List.
Definition: List.hpp:51
Atomic pointer.
Definition: AtomicPtr.hpp:30
A realtime safe, (partially) thread safe doubly-linked list.
Definition: List.hpp:41
void append(List< T > &list)
Append a list to this list.
Definition: ListImpl.hpp:119
Atomic integer.
Definition: AtomicInt.hpp:29
Node * erase(const iterator iter)
Remove an element from the list using an iterator.
Definition: ListImpl.hpp:177
Realtime safe const iterator for a List.
Definition: List.hpp:104
void push_back(Node *elem)
Realtime Safe.
Definition: ListImpl.hpp:61
bool empty()
Valid for any thread.
Definition: List.hpp:99
iterator find(const T &val)
Find an element in the list.
Definition: ListImpl.hpp:158
unsigned size() const
Valid only in the write thread.
Definition: List.hpp:96