BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
INodeVisitor.cpp File Reference
Include dependency graph for INodeVisitor.cpp:

Go to the source code of this file.

Functions

void VisitNodesPreorder (const INode &node, INodeVisitor &visitor)
 
void VisitNodesPostorder (const INode &node, INodeVisitor &visitor)
 

Detailed Description

Implements class INodeVisitor.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file INodeVisitor.cpp.

Function Documentation

◆ VisitNodesPreorder()

void VisitNodesPreorder ( const INode node,
INodeVisitor visitor 
)

Definition at line 18 of file INodeVisitor.cpp.

19 {
21  it.first();
22  while (!it.isDone()) {
23  visitor.setDepth(it.depth());
24  const INode* child = it.getCurrent();
25  child->accept(&visitor);
26  it.next();
27  }
28 }
void setDepth(int depth)
Sets depth of the visitor in the composite hierarchy.
Definition: INodeVisitor.h:283
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
virtual void accept(INodeVisitor *visitor) const =0
Calls the INodeVisitor's visit method.
Iterator through INode tree of objects.
Definition: NodeIterator.h:90

References INode::accept(), NodeIterator< Strategy >::depth(), NodeIterator< Strategy >::first(), NodeIterator< Strategy >::getCurrent(), NodeIterator< Strategy >::isDone(), NodeIterator< Strategy >::next(), and INodeVisitor::setDepth().

Here is the call graph for this function:

◆ VisitNodesPostorder()

void VisitNodesPostorder ( const INode node,
INodeVisitor visitor 
)

Definition at line 30 of file INodeVisitor.cpp.

31 {
33  it.first();
34  while (!it.isDone()) {
35  visitor.setDepth(it.depth());
36  const INode* child = it.getCurrent();
37  child->accept(&visitor);
38  it.next();
39  }
40 }

References INode::accept(), NodeIterator< Strategy >::depth(), NodeIterator< Strategy >::first(), NodeIterator< Strategy >::getCurrent(), NodeIterator< Strategy >::isDone(), NodeIterator< Strategy >::next(), and INodeVisitor::setDepth().

Here is the call graph for this function: