BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IterationStrategy.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Param/Node/IterationStrategy.h
6 //! @brief Defines class IterationStrategy and children.
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************** //
14 
15 #ifndef BORNAGAIN_CORE_PARAMETRIZATION_ITERATIONSTRATEGY_H
16 #define BORNAGAIN_CORE_PARAMETRIZATION_ITERATIONSTRATEGY_H
17 
18 class INode;
19 class IteratorMemento;
20 
21 //! Abstract base class for tree traversal strategies, for use in INodeVisitor.
22 //!
23 //! For definition of different strategies see https://en.wikipedia.org/wiki/Tree_traversal.
24 
26 {
27 public:
28  virtual IterationStrategy* clone() const = 0;
29 
30  virtual IteratorMemento first(const INode* p_root) = 0;
31  virtual void next(IteratorMemento& iterator_stack) const = 0;
32  virtual bool isDone(IteratorMemento& iterator_stack) const = 0;
33 };
34 
35 //! Traverse tree; visit parents before their children.
37 {
38 public:
40 
41  virtual PreorderStrategy* clone() const;
42 
43  virtual IteratorMemento first(const INode* p_root);
44  virtual void next(IteratorMemento& iterator_stack) const;
45  virtual bool isDone(IteratorMemento& iterator_stack) const;
46 };
47 
48 //! Traverse tree; visit children before their parents.
50 {
51 public:
53 
54  virtual PostorderStrategy* clone() const;
55 
56  virtual IteratorMemento first(const INode* p_root);
57  virtual void next(IteratorMemento& iterator_stack) const;
58  virtual bool isDone(IteratorMemento& iterator_stack) const;
59 };
60 
61 #endif // BORNAGAIN_CORE_PARAMETRIZATION_ITERATIONSTRATEGY_H
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
Abstract base class for tree traversal strategies, for use in INodeVisitor.
virtual IterationStrategy * clone() const =0
virtual void next(IteratorMemento &iterator_stack) const =0
virtual IteratorMemento first(const INode *p_root)=0
virtual bool isDone(IteratorMemento &iterator_stack) const =0
Holds all iterator states encountered for SampleTreeIterator.
Definition: NodeIterator.h:56
Traverse tree; visit children before their parents.
virtual PostorderStrategy * clone() const
virtual void next(IteratorMemento &iterator_stack) const
virtual IteratorMemento first(const INode *p_root)
virtual bool isDone(IteratorMemento &iterator_stack) const
Traverse tree; visit parents before their children.
virtual IteratorMemento first(const INode *p_root)
virtual void next(IteratorMemento &iterator_stack) const
virtual bool isDone(IteratorMemento &iterator_stack) const
virtual PreorderStrategy * clone() const