copasi API
0.1
|
#include <CCopasiTree.h>
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) |
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.
typedef _Node CCopasiTree< _Node >::Node |
CCopasiTree< _Node >::CCopasiTree | ( | ) | [inline] |
Default constructor
CCopasiTree< _Node >::~CCopasiTree | ( | ) | [inline] |
Destructor
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
Node | * pNode |
Node | * pParent (default: NULL equivalent to the root of the tree) |
Node | * pAfterChild (default: NULL at the end of the children) |
iterator CCopasiTree< _Node >::begin | ( | ) | const [inline] |
Retrieve an iterator pointing to the beginning of the tree
bool CCopasiTree< _Node >::detachNode | ( | _Node * | pNode | ) | [inline] |
Detach node. Node: After detachment of a node the tree no longer has the ownership.
Node | * pNode |
iterator CCopasiTree< _Node >::end | ( | ) | const [inline] |
Retrieve an iterator pointing beyond the end of the tree
_Node::Data CCopasiTree< _Node >::getData | ( | ) | const [inline] |
Retrieve the data of the Tree.
_Node* CCopasiTree< _Node >::getRoot | ( | ) | [inline] |
Retrieve the root node of the tree
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().
Node | * pNode |
Node | * pParent (default: NULL equivalent to the root of the tree) |
Node | * pAfterChild (default: NULL at the end of the children) |
bool CCopasiTree< _Node >::removeNode | ( | _Node * | pNode | ) | [inline] |
Remove the given node of the tree
Node | * pNode |
std::ostream& operator<< | ( | std::ostream & | os, |
const CCopasiTree< _Node > & | A | ||
) | [friend] |