RAUL 0.8.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Classes | Public Member Functions
Raul::List< T > Class Template Reference
Realtime Audio Utility Library

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

`#include <List.hpp>`

Inheritance diagram for Raul::List< T >:
Collaboration diagram for Raul::List< T >:

List of all members.

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

## 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 | ) |

Realtime Safe.

Add an element to the list.

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

Referenced by Raul::Maid::manage().

template<typename T>

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

NOT Realtime Safe.

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.

References Raul::List< T >::size().

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.

Referenced by Raul::Maid::cleanup().

template<typename T>

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.

The documentation for this class was generated from the following files:

- List.hpp
- ListImpl.hpp