copasi API  0.1
Classes | Public Types | Public Member Functions | Friends
CCopasiTree< _Node > Class Template Reference

#include <CCopasiTree.h>

List of all members.

Classes

class  const_iterator
class  iterator

Public Types

typedef _Node Node

Public Member Functions

 CCopasiTree ()
 ~CCopasiTree ()
iterator begin () const
iterator end () const
_Node * getRoot ()
_Node::Data getData () const
bool attachNode (_Node *pNode, _Node *pParent=NULL, _Node *pAfterChild=NULL)
bool removeNode (_Node *pNode)
bool moveNode (_Node *pNode, _Node *pParent=NULL, _Node *pAfterChild=NULL)
bool detachNode (_Node *pNode)

Friends

std::ostream & operator<< (std::ostream &os, const CCopasiTree< _Node > &A)

Detailed Description

template<class _Node>
class CCopasiTree< _Node >

The template class CCopasiTree takes as template argument a class derived from the class CCopasiNode. It allows the construction of a tree with four simple methods. It assures that each node in the tree is unique.

In addition it provides a forward iterator useful to traverse the tree.

Note: The tree takes ownership of all nodes. Therefore, you must not use pointers to automatically created nodes in the attachNode() Function unless you use the detach node function prior to the destruction of the tree.


Member Typedef Documentation

template<class _Node>
typedef _Node CCopasiTree< _Node >::Node

Constructor & Destructor Documentation

template<class _Node>
CCopasiTree< _Node >::CCopasiTree ( ) [inline]

Default constructor

template<class _Node>
CCopasiTree< _Node >::~CCopasiTree ( ) [inline]

Destructor


Member Function Documentation

template<class _Node>
bool CCopasiTree< _Node >::attachNode ( _Node *  pNode,
_Node *  pParent = NULL,
_Node *  pAfterChild = NULL 
) [inline]

Attach a Node to the tree Note: If pAfterChild == pParent then the child will be inserted as the first child

Parameters:
Node* pNode
Node* pParent (default: NULL equivalent to the root of the tree)
Node* pAfterChild (default: NULL at the end of the children)
Returns:
bool Success
template<class _Node>
iterator CCopasiTree< _Node >::begin ( ) const [inline]

Retrieve an iterator pointing to the beginning of the tree

Returns:
iterator begin
template<class _Node>
bool CCopasiTree< _Node >::detachNode ( _Node *  pNode) [inline]

Detach node. Node: After detachment of a node the tree no longer has the ownership.

Parameters:
Node* pNode
Returns:
bool Success
template<class _Node>
iterator CCopasiTree< _Node >::end ( ) const [inline]

Retrieve an iterator pointing beyond the end of the tree

Returns:
iterator end
template<class _Node>
_Node::Data CCopasiTree< _Node >::getData ( ) const [inline]

Retrieve the data of the Tree.

Returns:
Data data
template<class _Node>
_Node* CCopasiTree< _Node >::getRoot ( ) [inline]

Retrieve the root node of the tree

Returns:
Node * root
template<class _Node>
bool CCopasiTree< _Node >::moveNode ( _Node *  pNode,
_Node *  pParent = NULL,
_Node *  pAfterChild = NULL 
) [inline]

Move a given node from its current place in the tree to the one specified by pParent and pAfterChild. The insertion behavior is similar to addChild().

Parameters:
Node* pNode
Node* pParent (default: NULL equivalent to the root of the tree)
Node* pAfterChild (default: NULL at the end of the children)
Returns:
bool Success
template<class _Node>
bool CCopasiTree< _Node >::removeNode ( _Node *  pNode) [inline]

Remove the given node of the tree

Parameters:
Node* pNode
Returns:
bool Success

Friends And Related Function Documentation

template<class _Node>
std::ostream& operator<< ( std::ostream &  os,
const CCopasiTree< _Node > &  A 
) [friend]

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines