Intrusive Containers
Public Member Functions | Friends | List of all members
DListInRoot< R, N, n > Class Template Reference

#include <DListIn.h>

Collaboration diagram for DListInRoot< R, N, n >:
Collaboration graph

Public Member Functions

 DListInRoot ()
 
 ~DListInRoot ()
 
void add (N &node)
 
void add (N *node)
 
void addFirst (N &node)
 
void addFirst (N *node)
 
void addLast (N &node)
 
void addLast (N *node)
 
void remove (N &node)
 
void remove (N *node)
 
N * first () const
 
N * last () const
 

Friends

class DListInNode< R, N, n >
 

Detailed Description

template<class R, class N, int n>
class DListInRoot< R, N, n >

Intrusive Doubly Linked List, List.

Template Parameters
LThe class that will be the owner of the List. Must derive from DListInRoot<R, N, n>
NThe class that will be the nodes of the List. Must derive from DListInNode<R, N, n>
nA numerical parameter to allow a give List/Node combination to have multiple list-node relationships. Defaults to 0 if not provided.
See also
DListInNode

Constructor & Destructor Documentation

template<class R , class N , int n>
DListInRoot< R, N, n >::DListInRoot ( )

Constructor.

Starts us as an empty list.

template<class R , class N , int n>
DListInRoot< R, N, n >::~DListInRoot ( )

Destructor.

Removes all nodes attached to us.

Member Function Documentation

template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::add ( N &  node)
inline

Add node to our list, at "natural" point. Note that this is the front for singly linked lists and the end for doubly linked list.

Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::add ( N *  node)
inline

Add node to our list, at "natural" point. Note that this is the front for singly linked lists and the end for doubly linked lists.

Parameters
nodeThe node to add to the list If node is nulR, Nothing is done. If node is currently on a list (even us) it is removed before being added to the list
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::addFirst ( N &  node)
inline

Add node to front of our list.

Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::addFirst ( N *  node)
inline

Add node to front of our list.

Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::addLast ( N &  node)
inline

Add node to end of our list. Note that this operation is O(n) on list current size. See DListInRoot to make this O(1).

Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::addLast ( N *  node)
inline

Add node to end of our list. Note that this operation is O(n) on list current size. See DListInRoot to make this O(1).

Parameters
nodeThe node to add to the list If node is currently on a list (even us) it is removed before being added to the list
template<class R , class N , int n>
N* DListInRoot< R, N, n >::first ( ) const
inline
template<class R , class N , int n>
N* DListInRoot< R, N, n >::last ( ) const
inline
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::remove ( N &  node)
inline

Remove Node from List

Parameters
nodenode to be removed. If node is not on this list, nothing will be done.
template<class R , class N , int n_>
void DListInRoot< R, N, n_ >::remove ( N *  node)
inline

Remove Node from List

Parameters
nodePointer to node to be removed. If node is null, operation will be ignored. If node is not on this list, nothing will be done.

Friends And Related Function Documentation

template<class R , class N , int n>
friend class DListInNode< R, N, n >
friend

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