A realtime safe, (partially) thread safe doubly-linked list. More...
#include <List.hpp>
Inherits Raul::Deletable.
Classes | |
class | const_iterator |
Realtime safe const iterator for a List. More... | |
class | iterator |
Realtime safe iterator for a List. More... | |
class | Node |
A node in a List. More... | |
Public Member Functions | |
List (size_t size=0, Node *head=NULL, Node *tail=NULL) | |
void | push_back (Node *elem) |
Realtime Safe. | |
void | push_back (T &elem) |
NOT Realtime Safe. | |
void | append (List< T > &list) |
Append a list to this list. | |
void | clear () |
Clear the list, deleting all Nodes contained (but NOT their contents!). | |
unsigned | size () const |
Valid only in the write thread. | |
bool | empty () |
Valid for any thread. | |
void | chop_front (List< T > &front, size_t front_size, Node *front_tail) |
Node * | erase (const iterator iter) |
Remove an element from the list using an iterator. | |
iterator | find (const T &val) |
Find an element in the list. | |
iterator | begin () |
const_iterator | begin () const |
const iterator | end () const |
T & | front () |
const T & | front () const |
Node * | head () |
const Node * | head () const |
A realtime safe, (partially) thread safe doubly-linked list.
Elements can be added safely while another thread is reading the list. Like a typical ringbuffer, this is single-reader single-writer threadsafe only. See documentation for specific functions for specifics.
void Raul::List< T >::push_back | ( | Node * | elem | ) |
Realtime Safe.
Add an element to the list.
Thread safe (may be called while another thread is reading the list). Realtime safe.
void Raul::List< T >::push_back | ( | T & | elem | ) |
void Raul::List< T >::append | ( | List< T > & | list | ) |
Append a list to this list.
This operation is fast ( O(1) ). The appended list is not safe to use concurrently with this call. The appended list will be empty after this call.
Thread safe (may be called while another thread is reading the list). Realtime safe.
References Raul::List< T >::size().
void Raul::List< T >::clear | ( | ) |
Clear the list, deleting all Nodes contained (but NOT their contents!).
Not realtime safe.
List< T >::Node * Raul::List< T >::erase | ( | const iterator | iter | ) |
List< T >::iterator Raul::List< T >::find | ( | const T & | val | ) |
Find an element in the list.
This will return the first element equal to val found in the list.