Home | Download | Screen shots | Discussion | Documentation |
---|
Public Member Functions | |
node_traverser () throw (std::bad_alloc) | |
Construct. | |
virtual | ~node_traverser ()=0 throw () |
Destroy. | |
void | traverse (node &n) |
Traverse a node. | |
void | traverse (const node_ptr &node) |
Traverse an sfnode. | |
void | traverse (const std::vector< node_ptr > &nodes) |
Traverse an mfnode. | |
Protected Member Functions | |
void | halt_traversal () throw () |
Halt the traversal. | |
Private Member Functions | |
node_traverser (const node_traverser &) | |
Not implemented. | |
node_traverser & | operator= (const node_traverser &) |
Not implemented. | |
virtual void | on_entering (node &n) |
Called for each node in the traversal before traversing the its descendants. | |
virtual void | on_leaving (node &n) |
Called for each node in the traversal after traversing the its descendants. | |
void | do_traversal (node &n) |
Traverse a node. | |
Private Attributes | |
std::set< node * > | traversed_nodes |
The set of nodes that have already been traversed. | |
bool | halt |
Flag to indicate if the traversal should be halted. |
The node_traverser provides a generalized traversal mechanism that avoids redundantly traversing branches of the node hierarchy. If a node occurs multiple places in a branch, the children of that node will be visted in the traversal only once.
For each node encountered in the traversal, node_traverser::performAction is called. Concrete subclasses of node_traverser implement this method in order to perform some operation on each node.
|
Construct.
|
|
Destroy.
|
|
Not implemented. node_traverser is not copyable. |
|
Traverse a node.
For internal use only.
|
|
Halt the traversal. If this method is called during a traversal, no more descendent nodes will be traversed. Note that if halt_traversal is called in the implementation of on_entering, on_leaving will still be called for the current node. |
|
Called for each node in the traversal before traversing the its descendants.
|
|
Called for each node in the traversal after traversing the its descendants.
|
|
Not implemented. node_traverser is not copyable. |
|
Traverse an mfnode. No guarantee is made about the state of the node_traverser instance in the event that this method throws. In addition to std::bad_alloc, this function throws any exception thrown from on_entering or on_leaving.
|
|
Traverse an sfnode. No guarantee is made about the state of the node_traverser instance in the event that this method throws. In addition to std::bad_alloc, this function throws any exception thrown from onEntering or onLeaving.
|
|
Traverse a node. No guarantee is made about the state of the node_traverser instance in the event that this method throws. In addition to std::bad_alloc, this function throws any exception thrown from onEntering or onLeaving.
|
|
Flag to indicate if the traversal should be halted.
|
|
The set of nodes that have already been traversed.
|