Audio Processing Framework (APF) version 0.5.0
Classes | Public Types | Public Member Functions | List of all members
apf::RtList< T * > Class Template Reference

A list for realtime access and non-realtime modification. More...

#include <apf/rtlist.h>

Inheritance diagram for apf::RtList< T * >:
Inheritance graph
[legend]

Classes

class  AddCommand
 Command to add an element to a list. More...
 
class  ClearCommand
 Command to remove all elements from a list. More...
 
class  RemCommand
 Command to remove an element from a list. More...
 

Public Types

using list_t = typename std::list< T * >
 
using value_type = typename list_t::value_type
 
using size_type = typename list_t::size_type
 
using iterator = typename list_t::iterator
 
using const_iterator = typename list_t::const_iterator
 

Public Member Functions

 RtList (CommandQueue &fifo)
 Constructor. More...
 
 ~RtList ()
 Destructor. More...
 
template<typename X >
X * add (X *item)
 Add an element to the list. More...
 
template<typename ForwardIterator >
void add (ForwardIterator first, ForwardIterator last)
 Add a range of elements to the list. More...
 
void rem (T *to_rem)
 Remove an element from the list. More...
 
template<typename ForwardIterator >
void rem (ForwardIterator first, ForwardIterator last)
 Remove a range of elements from the list. More...
 
void clear ()
 Remove all elements from the list. More...
 
void splice (iterator position, RtList &x)
 Splice another RtList into the RtList. More...
 
void splice (iterator position, RtList &x, iterator first, iterator last)
 Splice a part of another RtList into the RtList. More...
 
Functions to be called from the realtime thread
iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
bool empty () const
 
size_type size () const
 

Detailed Description

template<typename T>
class apf::RtList< T * >

A list for realtime access and non-realtime modification.

It is normally used by a realtime thread and a non-realtime thread at the same time.

The list is created and modified (using add(), rem(), ...) by the non-realtime thread. These functions are not safe for multiple non-realtime threads; access has to be locked in this case.

Before the realtime thread can access the list elements, it has to call CommandQueue::process_commands() to synchronize.

TODO: more information about which functions are allowed in which thread.

Definition at line 57 of file rtlist.h.

Member Typedef Documentation

◆ list_t

template<typename T >
using apf::RtList< T * >::list_t = typename std::list<T*>

Definition at line 60 of file rtlist.h.

◆ value_type

template<typename T >
using apf::RtList< T * >::value_type = typename list_t::value_type

Definition at line 61 of file rtlist.h.

◆ size_type

template<typename T >
using apf::RtList< T * >::size_type = typename list_t::size_type

Definition at line 62 of file rtlist.h.

◆ iterator

template<typename T >
using apf::RtList< T * >::iterator = typename list_t::iterator

Definition at line 63 of file rtlist.h.

◆ const_iterator

template<typename T >
using apf::RtList< T * >::const_iterator = typename list_t::const_iterator

Definition at line 64 of file rtlist.h.

Constructor & Destructor Documentation

◆ RtList()

template<typename T >
apf::RtList< T * >::RtList ( CommandQueue fifo)
inlineexplicit

Constructor.

Parameters
fifothe CommandQueue

Definition at line 74 of file rtlist.h.

◆ ~RtList()

template<typename T >
apf::RtList< T * >::~RtList ( )
inline

Destructor.

Elements can be removed - via rem() or clear() - before the destructor is called. But if not, they are deleted here.

Definition at line 81 of file rtlist.h.

Member Function Documentation

◆ add() [1/2]

template<typename T >
template<typename X >
X * apf::RtList< T * >::add ( X *  item)
inline

Add an element to the list.

Parameters
itemPointer to the list item
Returns
the same pointer
Note
Ownership is passed to the list!

Definition at line 92 of file rtlist.h.

◆ add() [2/2]

template<typename T >
template<typename ForwardIterator >
void apf::RtList< T * >::add ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Add a range of elements to the list.

Parameters
firstBegin of range to be added
lastEnd of range to be added
Note
Ownership is passed to the list!

Definition at line 103 of file rtlist.h.

◆ rem() [1/2]

template<typename T >
void apf::RtList< T * >::rem ( T *  to_rem)
inline

Remove an element from the list.

Definition at line 109 of file rtlist.h.

◆ rem() [2/2]

template<typename T >
template<typename ForwardIterator >
void apf::RtList< T * >::rem ( ForwardIterator  first,
ForwardIterator  last 
)
inline

Remove a range of elements from the list.

Parameters
firstIterator to the first item
lastPast-the-end iterator

Definition at line 118 of file rtlist.h.

◆ clear()

template<typename T >
void apf::RtList< T * >::clear ( )
inline

Remove all elements from the list.

Definition at line 124 of file rtlist.h.

◆ splice() [1/2]

template<typename T >
void apf::RtList< T * >::splice ( iterator  position,
RtList< T * > &  x 
)
inline

Splice another RtList into the RtList.

See also
std::list::splice()

Definition at line 130 of file rtlist.h.

◆ splice() [2/2]

template<typename T >
void apf::RtList< T * >::splice ( iterator  position,
RtList< T * > &  x,
iterator  first,
iterator  last 
)
inline

Splice a part of another RtList into the RtList.

Definition at line 137 of file rtlist.h.

◆ begin() [1/2]

template<typename T >
iterator apf::RtList< T * >::begin ( )
inline

Definition at line 144 of file rtlist.h.

◆ begin() [2/2]

template<typename T >
const_iterator apf::RtList< T * >::begin ( ) const
inline

Definition at line 145 of file rtlist.h.

◆ end() [1/2]

template<typename T >
iterator apf::RtList< T * >::end ( )
inline

Definition at line 146 of file rtlist.h.

◆ end() [2/2]

template<typename T >
const_iterator apf::RtList< T * >::end ( ) const
inline

Definition at line 147 of file rtlist.h.

◆ empty()

template<typename T >
bool apf::RtList< T * >::empty ( ) const
inline

Definition at line 148 of file rtlist.h.

◆ size()

template<typename T >
size_type apf::RtList< T * >::size ( ) const
inline

Definition at line 149 of file rtlist.h.


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