Raul::List< T > Class Template Reference

A realtime safe, (partially) thread safe doubly-linked list. More...

#include <List.hpp>

Inherits Raul::Deletable.

List of all members.

Public Member Functions

void push_back (Node *elem)
 Add an element to the list.
void push_back (T &elem)
 Add an element to the list.
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.
Nodeerase (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

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...


Detailed Description

template<typename T>
class Raul::List< T >

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.


Member Function Documentation

template<typename T>
void Raul::List< T >::push_back ( Node elem  ) 

Add an element to the list.

Thread safe (may be called while another thread is reading the list). Realtime safe.

template<typename T>
void Raul::List< T >::push_back ( T &  elem  ) 

Add an element to the list.

Thread safe (may be called while another thread is reading the list). NOT realtime safe (a Node is allocated).

template<typename T>
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.

template<typename T>
void Raul::List< T >::clear (  ) 

Clear the list, deleting all Nodes contained (but NOT their contents!).

Not realtime safe.

template<typename T>
List< T >::Node * Raul::List< T >::erase ( const iterator  iter  ) 

Remove an element from the list using an iterator.

This function is realtime safe - it is the caller's responsibility to delete the returned Node, or there will be a leak. Thread safe (safe to call while another thread reads the list). iter is invalid immediately following this call.

template<typename T>
List< T >::iterator Raul::List< T >::find ( const T &  val  ) 

Find an element in the list.

This will only return the first element found. If there are duplicated, another call to find() will return the next, etc.


The documentation for this class was generated from the following files:
Generated on Wed Apr 9 08:14:41 2008 for RAUL by  doxygen 1.5.1