COPASI API
4.40.278
|
#include <CMathDependencyNodeIterator.h>
Classes | |
class | CStackElement |
Public Types | |
typedef CFlags< State > | Flag |
enum | State { Start , Before , After , Intermediate , End , Recursive , __SIZE } |
enum | Type { Dependents , Prerequisites } |
Public Member Functions | |
CMathDependencyNodeIterator () | |
CMathDependencyNodeIterator (CMathDependencyNode *pNode, const Type &type=Dependents) | |
CMathDependencyNodeIterator (const CMathDependencyNodeIterator &src) | |
Flag | getProcessingModes () const |
size_t | level () const |
bool | next () |
CMathDependencyNode * | operator* () |
CMathDependencyNode * | operator-> () |
const CMathDependencyNode * | parent () |
void | setProcessingModes (const Flag &processingModes) |
const State & | skipChildren () |
const State & | state () const |
~CMathDependencyNodeIterator () | |
Public Attributes | |
std::stack< CStackElement > | mStack |
Private Member Functions | |
void | increment () |
Private Attributes | |
State | mCurrentState |
Flag | mProcessingModes |
Type | mType |
std::set< const CMathDependencyNode * > | mVisited |
This class allows to iterator over the nodes of a dependency graph in both directions (Dependents and Prerequisites) which is indicated by the type.
typedef CFlags< State > CMathDependencyNodeIterator::Flag |
A flag indicating to which state the iterator should advance. These may be any combination of the enumeration value State. Please note the iterator will always return and End and Recursive
CMathDependencyNodeIterator::CMathDependencyNodeIterator | ( | ) |
Default constructor
CMathDependencyNodeIterator::CMathDependencyNodeIterator | ( | const CMathDependencyNodeIterator & | src | ) |
Copy constructor
const | CMathDependencyNodeIterator & src |
CMathDependencyNodeIterator::CMathDependencyNodeIterator | ( | CMathDependencyNode * | pNode, |
const Type & | type = Dependents |
||
) |
Specific constructor
CMathDependencyNode | * pNode |
const | Type & type (default: Dependents) |
CMathDependencyNodeIterator::~CMathDependencyNodeIterator | ( | ) |
Destructor
CMathDependencyNodeIterator::Flag CMathDependencyNodeIterator::getProcessingModes | ( | ) | const |
Retrieve the valid states for which the method next() should return
References End, mProcessingModes, and Recursive.
|
private |
This method advances the iterator to the next internal state. The tree is traversed depth first.
Please note that the iterator points to the same node multiple times, once before every child, and once after the last child to allow pre and post processing. This behavior is also true for childless nodes. To determine whether the iterator is in the pre, intermediate or post processing phase one may check the processing mode with: const State & state()
References After, Before, End, Intermediate, mCurrentState, CMathDependencyNodeIterator::CStackElement::mEndChild, CMathDependencyNodeIterator::CStackElement::mItChild, CMathDependencyNodeIterator::CStackElement::mpNode, mStack, CMathDependencyNodeIterator::CStackElement::mType, mVisited, and Recursive.
Referenced by next().
size_t CMathDependencyNodeIterator::level | ( | ) | const |
bool CMathDependencyNodeIterator::next | ( | ) |
This method advances the iterator to the next node and state combination for which the state is in the Flag of processing modes. A return value of true indicates that such a node has been found whereas false indicates the iteration has been completed or failed. To determine the current state of the iterator use: const State & state()
References Before, End, increment(), CFlags< Enum >::isSet(), mCurrentState, mProcessingModes, and Start.
Referenced by CMathDependencyNode::buildUpdateSequence(), CMathDependencyNode::updateCalculatedState(), CMathDependencyNode::updateDependentState(), CMathDependencyNode::updateIgnoredState(), and CMathDependencyNode::updatePrerequisiteState().
CMathDependencyNode * CMathDependencyNodeIterator::operator* | ( | ) |
This operator dereferences the iterator and returns a pointer the node of the graph
References mStack.
CMathDependencyNode * CMathDependencyNodeIterator::operator-> | ( | ) |
This operator dereferences the iterator and returns a pointer the node of the graph
References mStack.
const CMathDependencyNode * CMathDependencyNodeIterator::parent | ( | ) |
Retrieve the pointer to the parent node of the current node if known otherwise NULL
References mStack.
Referenced by CMathDependencyNode::buildUpdateSequence(), CMathDependencyNode::updateCalculatedState(), CMathDependencyNode::updateDependentState(), CMathDependencyNode::updateIgnoredState(), and CMathDependencyNode::updatePrerequisiteState().
void CMathDependencyNodeIterator::setProcessingModes | ( | const Flag & | processingModes | ) |
Set the valid states for which the method next() should return
const | Flag & processingModes |
References End, mProcessingModes, and Recursive.
Referenced by CMathDependencyNode::buildUpdateSequence(), CMathDependencyNode::updateCalculatedState(), CMathDependencyNode::updateDependentState(), CMathDependencyNode::updateIgnoredState(), and CMathDependencyNode::updatePrerequisiteState().
const CMathDependencyNodeIterator::State & CMathDependencyNodeIterator::skipChildren | ( | ) |
Calling this method causes the iterator to skip processing the children of the current node and advance to the State to next state allowed by the processing mode
References After, mCurrentState, CMathDependencyNodeIterator::CStackElement::mEndChild, CMathDependencyNodeIterator::CStackElement::mItChild, and mStack.
Referenced by CMathDependencyNode::buildUpdateSequence(), CMathDependencyNode::updateCalculatedState(), CMathDependencyNode::updateDependentState(), and CMathDependencyNode::updatePrerequisiteState().
const CMathDependencyNodeIterator::State & CMathDependencyNodeIterator::state | ( | ) | const |
Retrieve the current state of the iterator
References mCurrentState.
Referenced by CMathDependencyNode::buildUpdateSequence(), CMathDependencyNode::updateCalculatedState(), CMathDependencyNode::updateDependentState(), CMathDependencyNode::updateIgnoredState(), and CMathDependencyNode::updatePrerequisiteState().
|
private |
The current state of the iterator
Referenced by increment(), next(), skipChildren(), and state().
|
private |
The flag indicating to which state the iterator should advance. These may be any combination of the enumeration value State. Please note that this flag will always include return and End and Recursive
Referenced by getProcessingModes(), next(), and setProcessingModes().
std::stack< CStackElement > CMathDependencyNodeIterator::mStack |
A stack of context for each nesting level of the iterator
Referenced by CMathDependencyNodeIterator(), increment(), level(), operator*(), operator->(), parent(), and skipChildren().
|
private |
The iterator type (Dependents or Prerequisites)
Referenced by CMathDependencyNodeIterator().
|
private |
A set of currently visited nodes in the stack used to determine loops or recursive dependencies
Referenced by CMathDependencyNodeIterator(), and increment().