Roc Toolkit internal modules
Roc Toolkit: real-time audio streaming
roc::core::List< T, Ownership > Class Template Reference

Intrusive doubly-linked list. More...

#include <list.h>

Inheritance diagram for roc::core::List< T, Ownership >:
Collaboration diagram for roc::core::List< T, Ownership >:

Public Types

typedef Ownership< T >::Pointer Pointer
 Pointer type. More...
 

Public Member Functions

 List ()
 Initialize empty list. More...
 
 ~List ()
 Release ownership of containing objects. More...
 
size_t size () const
 Get number of elements in list. More...
 
Pointer front () const
 Get first list element. More...
 
Pointer back () const
 Get last list element. More...
 
Pointer nextof (T &element) const
 Get list element next to given one. More...
 
void push_front (T &element)
 Prepend element to list. More...
 
void push_back (T &element)
 Append element to list. More...
 
void insert_before (T &element, T &before)
 Insert element into list. More...
 
void remove (T &element)
 Remove element from list. More...
 

Detailed Description

template<class T, template< class TT > class Ownership = RefCntOwnership>
class roc::core::List< T, Ownership >

Intrusive doubly-linked list.

Template Parameters
Tdefines object type, it should inherit ListNode.
Ownershipdefines ownership policy which is used to acquire an element ownership when it's added to the list and release ownership when it's removed from the list

Definition at line 31 of file list.h.

Member Typedef Documentation

template<class T, template< class TT > class Ownership = RefCntOwnership>
typedef Ownership<T>::Pointer roc::core::List< T, Ownership >::Pointer

Pointer type.

Remarks
either raw or smart pointer depending on the ownership policy.

Definition at line 36 of file list.h.

Constructor & Destructor Documentation

template<class T, template< class TT > class Ownership = RefCntOwnership>
roc::core::List< T, Ownership >::List ( )
inline

Initialize empty list.

Definition at line 39 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
roc::core::List< T, Ownership >::~List ( )
inline

Release ownership of containing objects.

Definition at line 47 of file list.h.

Member Function Documentation

template<class T, template< class TT > class Ownership = RefCntOwnership>
Pointer roc::core::List< T, Ownership >::back ( ) const
inline

Get last list element.

Returns
last element or NULL if list is empty.

Definition at line 82 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
Pointer roc::core::List< T, Ownership >::front ( ) const
inline

Get first list element.

Returns
first element or NULL if list is empty.

Definition at line 72 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
void roc::core::List< T, Ownership >::insert_before ( T &  element,
T &  before 
)
inline

Insert element into list.

Remarks
  • inserts element before before
  • acquires ownership of element
Precondition
element should not be member of any list. before should be member of this list or NULL.

Definition at line 144 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
Pointer roc::core::List< T, Ownership >::nextof ( T &  element) const
inline

Get list element next to given one.

Returns
list element following element if element is not last, or NULL otherwise.
Precondition
element should be member of this list.

Definition at line 97 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
void roc::core::List< T, Ownership >::push_back ( T &  element)
inline

Append element to list.

Remarks
  • appends element to list
  • acquires ownership of element
Precondition
element should not be member of any list.

Definition at line 131 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
void roc::core::List< T, Ownership >::push_front ( T &  element)
inline

Prepend element to list.

Remarks
  • prepends element to list
  • acquires ownership of element
Precondition
element should not be member of any list.

Definition at line 115 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
void roc::core::List< T, Ownership >::remove ( T &  element)
inline

Remove element from list.

Remarks
  • removes element from list
  • releases ownership of element
Precondition
element should be member of this list.

Definition at line 156 of file list.h.

template<class T, template< class TT > class Ownership = RefCntOwnership>
size_t roc::core::List< T, Ownership >::size ( ) const
inline

Get number of elements in list.

Definition at line 65 of file list.h.


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