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

#include <TreeIn.h>

Collaboration diagram for TreeInRoot< R, N, K, n >:
Collaboration graph

Protected Member Functions

 TreeInRoot ()
 
 ~TreeInRoot ()
 
int compare (N const &node1, N const &node2) const
 
int compareKey (N const &node, K key) const
 
virtual void add (N &node)
 
void add (N *node)
 
void remove (N &node)
 
void remove (N *node)
 
N * find (K key) const
 
N * base () const
 
N * first () const
 
N * last () const
 
void check () const
 

Friends

class TreeInNode< R, N, K, n >
 

Detailed Description

template<class R, class N, class K, int n>
class TreeInRoot< R, N, K, n >

Intrusive Binary Tree, Root.

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

Constructor & Destructor Documentation

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

Constructor.

Starts us as an empty list.

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

Destructor.

Removes all nodes attached to us.

Doesn't actually call remove on every node to avoid possible unneeded rebalencing, just manually unlinks all nodes.

Here is the call graph for this function:

Member Function Documentation

template<class R , class N , class K , int n>
void TreeInRoot< R, N, K, n >::add ( N &  node)
inlineprotectedvirtual

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 different list it is removed before being added to the list

Here is the call graph for this function:

template<class R , class N , class K , int n_>
void TreeInRoot< R, N, K, 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 , class K , int n>
N* TreeInRoot< R, N, K, n >::base ( ) const
inlineprotected
template<class R , class N , class K , int n>
void TreeInRoot< R, N, K, n >::check ( ) const
inlineprotected
template<class R , class N , class K , int n>
int TreeInRoot< R, N, K, n >::compare ( N const &  node1,
N const &  node2 
) const
protected
template<class R , class N , class K , int n>
int TreeInRoot< R, N, K, n >::compareKey ( N const &  node,
key 
) const
protected
template<class R , class N , class K , int n>
N * TreeInRoot< R, N, K, n >::find ( key) const
protected

find a node

template<class R , class N , class K , int n>
N * TreeInRoot< R, N, K, n >::first ( ) const
inlineprotected
template<class R , class N , class K , int n>
N * TreeInRoot< R, N, K, n >::last ( ) const
inlineprotected
template<class R , class N , class K , int n>
void TreeInRoot< R, N, K, 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.
template<class R , class N , class K , int n_>
void TreeInRoot< R, N, K, 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.

Friends And Related Function Documentation

template<class R , class N , class K , int n>
friend class TreeInNode< R, N, K, n >
friend

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