18 #ifndef RAUL_LIST_IMPL_HPP
19 #define RAUL_LIST_IMPL_HPP
39 Node* node = _head.get();
72 ln->prev(_tail.get());
73 _tail.get()->next(ln);
100 ln->prev(_tail.get());
101 _tail.get()->next(ln);
118 template <
typename T>
122 Node*
const my_head = _head.get();
123 Node*
const my_tail = _tail.get();
124 Node*
const other_head = list._head.get();
125 Node*
const other_tail = list._tail.get();
128 if (my_head == NULL && my_tail == NULL) {
132 }
else if (other_head != NULL && other_tail != NULL) {
134 other_head->prev(my_tail);
139 my_tail->next(other_head);
141 _size += list.
size();
155 template <
typename T>
159 for (
iterator i = begin(); i != end(); ++i)
174 template <
typename T>
178 Node*
const n = iter._listnode;
182 Node*
const prev = n->prev();
183 Node*
const next = n->next();
186 if (n == _head.get())
190 if (n == _tail.get())
191 _tail = _tail.get()->prev();
194 n->prev()->next(next);
197 n->next()->prev(prev);
208 template <
typename T>
216 template <
typename T>
218 List<T>::iterator::operator*()
221 return _listnode->elem();
225 template <
typename T>
227 List<T>::iterator::operator->()
230 return &_listnode->elem();
234 template <
typename T>
235 inline typename List<T>::iterator&
236 List<T>::iterator::operator++()
239 _listnode = _listnode->next();
245 template <
typename T>
247 List<T>::iterator::operator!=(
const iterator& iter)
const
249 return (_listnode != iter._listnode);
253 template <
typename T>
255 List<T>::iterator::operator!=(
const const_iterator& iter)
const
257 return (_listnode != iter._listnode);
261 template <
typename T>
263 List<T>::iterator::operator==(
const iterator& iter)
const
265 return (_listnode == iter._listnode);
269 template <
typename T>
271 List<T>::iterator::operator==(
const const_iterator& iter)
const
273 return (_listnode == iter._listnode);
277 template <
typename T>
278 inline typename List<T>::iterator
281 typename List<T>::iterator iter(
this);
283 iter._listnode = _head.get();
289 template <
typename T>
290 inline const typename List<T>::iterator
301 template <
typename T>
309 template <
typename T>
314 return _listnode->elem();
318 template <
typename T>
323 return &_listnode->elem();
327 template <
typename T>
328 inline typename List<T>::const_iterator&
329 List<T>::const_iterator::operator++()
332 _listnode = _listnode->next();
338 template <
typename T>
340 List<T>::const_iterator::operator!=(
const const_iterator& iter)
const
342 return (_listnode != iter._listnode);
346 template <
typename T>
348 List<T>::const_iterator::operator!=(
const iterator& iter)
const
350 return (_listnode != iter._listnode);
354 template <
typename T>
356 List<T>::const_iterator::operator==(
const const_iterator& iter)
const
358 return (_listnode == iter._listnode);
362 template <
typename T>
364 List<T>::const_iterator::operator==(
const iterator& iter)
const
366 return (_listnode == iter._listnode);
369 template <
typename T>
370 inline typename List<T>::const_iterator
371 List<T>::begin()
const
373 typename List<T>::const_iterator iter(
this);
374 iter._listnode = _head.get();
382 #endif // RAUL_LIST_IMPL_HPP
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:118
unsigned size() const
Valid only in the write thread.
Definition: List.hpp:87
A node in a List.
Definition: List.hpp:48
A realtime safe, (partially) thread safe doubly-linked list.
Definition: List.hpp:38
void append(List< T > &list)
Append a list to this list.
Definition: ListImpl.hpp:120
Node * erase(const iterator iter)
Remove an element from the list using an iterator.
Definition: ListImpl.hpp:176
void push_back(Node *elem)
Realtime Safe.
Definition: ListImpl.hpp:61
iterator find(const T &val)
Find an element in the list.
Definition: ListImpl.hpp:157
const_iterator(const List< T > *const list)
const_iterator stuff ///
Definition: ListImpl.hpp:302