COPASI API
4.16.103
|
#include <CCopasiTree.h>
Classes | |
class | const_iterator |
class | iterator |
Public Types | |
typedef _Node | Node |
Public Member Functions | |
bool | attachNode (_Node *pNode, _Node *pParent=NULL, _Node *pAfterChild=NULL) |
iterator | begin () const |
CCopasiTree () | |
bool | detachNode (_Node *pNode) |
iterator | end () const |
_Node::Data | getData () const |
_Node * | getRoot () |
bool | moveNode (_Node *pNode, _Node *pParent=NULL, _Node *pAfterChild=NULL) |
bool | removeNode (_Node *pNode) |
~CCopasiTree () | |
Private Attributes | |
std::set< _Node * > | mList |
_Node * | mpRoot |
Friends | |
std::ostream & | operator<< (std::ostream &os, const CCopasiTree< _Node > &A) |
CCopasiTree class. The template class CCopasiTree describes a tree of Nodes.
Created for COPASI by Stefan Hoops 2003
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.
Definition at line 37 of file CCopasiTree.h.
typedef _Node CCopasiTree< _Node >::Node |
Definition at line 59 of file CCopasiTree.h.
|
inline |
Default constructor
Definition at line 250 of file CCopasiTree.h.
References CCopasiTree< _Node >::mList, and CCopasiTree< _Node >::mpRoot.
|
inline |
Destructor
Definition at line 258 of file CCopasiTree.h.
References CCopasiTree< _Node >::mpRoot, and pdelete.
|
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) |
Definition at line 293 of file CCopasiTree.h.
References CCopasiTree< _Node >::end(), CCopasiTree< _Node >::mList, and CCopasiTree< _Node >::mpRoot.
Referenced by CCopasiTree< _Node >::moveNode().
|
inline |
Retrieve an iterator pointing to the beginning of the tree
Definition at line 264 of file CCopasiTree.h.
References CCopasiTree< _Node >::mpRoot.
Referenced by operator<<().
|
inline |
Detach node. Node: After detachment of a node the tree no longer has the ownership.
Node | * pNode |
Definition at line 370 of file CCopasiTree.h.
References CCopasiTree< _Node >::end(), CCopasiTree< _Node >::mList, and CCopasiTree< _Node >::mpRoot.
Referenced by CCopasiTree< _Node >::moveNode().
|
inline |
Retrieve an iterator pointing beyond the end of the tree
Definition at line 270 of file CCopasiTree.h.
Referenced by CCopasiTree< _Node >::attachNode(), CCopasiTree< _Node >::detachNode(), operator<<(), and CCopasiTree< _Node >::removeNode().
|
inline |
Retrieve the data of the Tree.
Definition at line 282 of file CCopasiTree.h.
References CCopasiTree< _Node >::mpRoot.
|
inline |
Retrieve the root node of the tree
Definition at line 276 of file CCopasiTree.h.
References CCopasiTree< _Node >::mpRoot.
|
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) |
Definition at line 358 of file CCopasiTree.h.
References CCopasiTree< _Node >::attachNode(), and CCopasiTree< _Node >::detachNode().
|
inline |
Remove the given node of the tree
Node | * pNode |
Definition at line 332 of file CCopasiTree.h.
References CCopasiTree< _Node >::end(), CCopasiTree< _Node >::mList, and CCopasiTree< _Node >::mpRoot.
|
friend |
Definition at line 395 of file CCopasiTree.h.
|
private |
The list of all nodes. This is used to keep the tree consistent by avoiding multiple inserts of the same node.
Definition at line 72 of file CCopasiTree.h.
Referenced by CCopasiTree< _Node >::attachNode(), CCopasiTree< _Node >::CCopasiTree(), CCopasiTree< _Node >::detachNode(), and CCopasiTree< _Node >::removeNode().
|
private |
The root of the tree
Definition at line 66 of file CCopasiTree.h.
Referenced by CCopasiTree< _Node >::attachNode(), CCopasiTree< _Node >::begin(), CCopasiTree< _Node >::CCopasiTree(), CCopasiTree< _Node >::detachNode(), CCopasiTree< _Node >::getData(), CCopasiTree< _Node >::getRoot(), CCopasiTree< _Node >::removeNode(), and CCopasiTree< _Node >::~CCopasiTree().