LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::tree< T >::nodeManager Class Reference

The nodeManager takes care of the memory administration. More...

#include <ltiTree.h>

List of all members.

Public Member Functions

 nodeManager (const int &n)
nodecreateNode (const int &n, node &theNewParent, const T &newData=T())
nodecreateNode (const int &n, node *theNewParent, const T &newData=T())
nodecreateNode (node &theNewParent, const T &newData=T())
void freeNode (node &theNode)
nodegetNode (const int &idx)
const nodegetNode (const int &idx) const
int getIndexOfNode (const node &aNode) const
const int & size () const

Protected Attributes

std::vector< node * > theNodes
std::list< int > freedNodes
int theSize
int theDegree

Detailed Description

template<class T>
class lti::tree< T >::nodeManager

The nodeManager takes care of the memory administration.

It is required to ensure that the iterators do not access invalid memory


Constructor & Destructor Documentation

template<class T>
lti::tree< T >::nodeManager::nodeManager ( const int &  n  )  [inline]

Constructor.

Parameters:
n the degree of each new node created

Member Function Documentation

template<class T>
node* lti::tree< T >::nodeManager::createNode ( node theNewParent,
const T &  newData = T() 
) [inline]

Creates a new node with the standard degree (specified in construction of the node manager) and returns the index of that node in theNodes.

Parameters:
theNewParent the parent node of this node
newData the data to be hold on this node
Returns:
the index of this node in theNodes

References lti::tree< T >::nodeManager::createNode(), and lti::tree< T >::nodeManager::theDegree.

template<class T>
node* lti::tree< T >::nodeManager::createNode ( const int &  n,
node theNewParent,
const T &  newData = T() 
) [inline]

Creates a new node and returns the index of that node in theNodes.

Parameters:
n initial number of children (degree) for this node
theNewParent pointer to the parent node of this node
newData the data to be hold on this node
Returns:
the index of this node in theNodes

References lti::tree< T >::nodeManager::freedNodes, lti::tree< T >::nodeManager::theNodes, and lti::tree< T >::nodeManager::theSize.

template<class T>
node* lti::tree< T >::nodeManager::createNode ( const int &  n,
node theNewParent,
const T &  newData = T() 
) [inline]

Creates a new node and returns the index of that node in theNodes.

Parameters:
n initial number of children (degree) for this node
theNewParent the parent node of this node
newData the data to be hold on this node
Returns:
the index of this node in theNodes

References lti::tree< T >::nodeManager::freedNodes, lti::tree< T >::nodeManager::theNodes, and lti::tree< T >::nodeManager::theSize.

Referenced by lti::tree< T >::node::appendChild(), lti::tree< T >::node::copy(), lti::tree< T >::nodeManager::createNode(), and lti::tree< T >::node::insertChild().

template<class T>
void lti::tree< T >::nodeManager::freeNode ( node theNode  )  [inline]
template<class T>
int lti::tree< T >::nodeManager::getIndexOfNode ( const node aNode  )  const [inline]
template<class T>
const node* lti::tree< T >::nodeManager::getNode ( const int &  idx  )  const [inline]

Get pointer to the node at the given index.

References lti::tree< T >::nodeManager::theNodes.

template<class T>
node* lti::tree< T >::nodeManager::getNode ( const int &  idx  )  [inline]
template<class T>
const int& lti::tree< T >::nodeManager::size (  )  const [inline]

Returns the number of valid nodes until now.

References lti::tree< T >::nodeManager::theSize.


Member Data Documentation

template<class T>
std::list<int> lti::tree< T >::nodeManager::freedNodes [protected]

Freed nodes.

This list contains the indices of freed nodes, which can be used by the next createNode

Referenced by lti::tree< T >::nodeManager::createNode(), and lti::tree< T >::nodeManager::freeNode().

template<class T>
int lti::tree< T >::nodeManager::theDegree [protected]

Tree degree.

Referenced by lti::tree< T >::nodeManager::createNode().

template<class T>
std::vector<node*> lti::tree< T >::nodeManager::theNodes [protected]
template<class T>
int lti::tree< T >::nodeManager::theSize [protected]

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

Generated on Sat Apr 10 15:28:48 2010 for LTI-Lib by Doxygen 1.6.1