Intrusive Containers
Protected Member Functions | List of all members
ListInRoot< R, N, n > Class Template Reference

#include <ListIn.h>

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

Protected Member Functions

 ListInRoot ()
 
 ~ListInRoot ()
 
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
 Return pointer to first Node on list. More...
 

Detailed Description

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

Intrusive Singly Linked List, List.

Template Parameters
LThe class that will be the owner of the List. Must derive from ListInRoot<R, N, n>
NThe class that will be the nodes of the List. Must derive from ListInNode<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
ListInNode

Constructor & Destructor Documentation

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

Constructor.

Starts us as an empty list.

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

Destructor.

Removes all nodes attached to us.

Member Function Documentation

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

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 ListInRoot< R, N, n_ >::add ( N *  node)
inlineprotected

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 ListInRoot< R, N, n_ >::addFirst ( N &  node)
inlineprotected

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

Here is the call graph for this function:

template<class R , class N , int n_>
void ListInRoot< R, N, n_ >::addFirst ( N *  node)
inlineprotected

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 ListInRoot< R, N, n_ >::addLast ( N &  node)
inlineprotected

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

Here is the call graph for this function:

template<class R , class N , int n_>
void ListInRoot< R, N, n_ >::addLast ( N *  node)
inlineprotected

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* ListInRoot< R, N, n >::first ( ) const
inlineprotected

Return pointer to first Node on list.

template<class R , class N , int n_>
void ListInRoot< R, N, n_ >::remove ( N &  node)
inlineprotected

Remove Node from List

Parameters
nodenode to be removed. If node is not on this list, nothing will be done.

Here is the call graph for this function:

template<class R , class N , int n_>
void ListInRoot< R, N, n_ >::remove ( N *  node)
inlineprotected

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.

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