COPASI API
4.40.278
|
#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 () |
const _Node * | getRoot () const |
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.
typedef _Node CCopasiTree< _Node >::Node |
|
inline |
Default constructor
References CCopasiTree< _Node >::mList, and CCopasiTree< _Node >::mpRoot.
|
inline |
Destructor
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) |
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
References CCopasiTree< _Node >::mpRoot.
|
inline |
Detach node. Node: After detachment of a node the tree no longer has the ownership.
Node | * pNode |
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
Referenced by CCopasiTree< _Node >::attachNode(), CCopasiTree< _Node >::detachNode(), and CCopasiTree< _Node >::removeNode().
|
inline |
|
inline |
|
inline |
|
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) |
References CCopasiTree< _Node >::attachNode(), and CCopasiTree< _Node >::detachNode().
|
inline |
Remove the given node of the tree
Node | * pNode |
References CCopasiTree< _Node >::end(), CCopasiTree< _Node >::mList, and CCopasiTree< _Node >::mpRoot.
|
friend |
|
private |
The list of all nodes. This is used to keep the tree consistent by avoiding multiple inserts of the same node.
Referenced by CCopasiTree< _Node >::attachNode(), CCopasiTree< _Node >::CCopasiTree(), CCopasiTree< _Node >::detachNode(), and CCopasiTree< _Node >::removeNode().
|
private |
The root of the tree
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().