BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
SampleBuilderNode.h
Go to the documentation of this file.
1 // ************************************************************************** //
2 //
3 // BornAgain: simulate and fit scattering at grazing incidence
4 //
5 //! @file Sample/SampleBuilderEngine/SampleBuilderNode.h
6 //! @brief Defines class SampleBuilderNode.
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_SAMPLEBUILDERENGINE_SAMPLEBUILDERNODE_H
16 #define BORNAGAIN_CORE_SAMPLEBUILDERENGINE_SAMPLEBUILDERNODE_H
17 
18 #include "Param/Node/INode.h"
19 #include <memory>
20 
21 class ISampleBuilder;
22 
23 //! Wraps an ISampleBuilder, and puts it in an INode tree.
24 //! Used by SampleProvider.
25 //! @ingroup simulation_internal
26 
27 class SampleBuilderNode : public INode
28 {
29 public:
33 
34  void setSBN(const std::shared_ptr<ISampleBuilder>& sample_builder);
35 
36  void reset();
37 
38  void accept(INodeVisitor* visitor) const final { visitor->visit(this); }
39 
40  std::unique_ptr<MultiLayer> createMultiLayer();
41 
42  explicit operator bool() const;
43 
44  std::shared_ptr<ISampleBuilder> builder() const;
45 
46 private:
48 
49  std::shared_ptr<ISampleBuilder> m_sample_builder;
50 };
51 
52 #endif // BORNAGAIN_CORE_SAMPLEBUILDERENGINE_SAMPLEBUILDERNODE_H
Defines class INode.
Visitor interface to visit ISample objects.
Definition: INodeVisitor.h:149
Base class for tree-like structures containing parameterized objects.
Definition: INode.h:49
Interface to the class capable to build samples to simulate.
Wraps an ISampleBuilder, and puts it in an INode tree.
void setSBN(const std::shared_ptr< ISampleBuilder > &sample_builder)
Sets sample builder and borrows its parameters.
std::shared_ptr< ISampleBuilder > builder() const
Returns current sample builder.
void accept(INodeVisitor *visitor) const final
Calls the INodeVisitor's visit method.
void borrow_builder_parameters()
Fill local parameter pool with parameters from sample builder.
std::shared_ptr< ISampleBuilder > m_sample_builder
SampleBuilderNode & operator=(const SampleBuilderNode &other)
void reset()
Resets to initial state by removing builder and its borrowed parameters.
std::unique_ptr< MultiLayer > createMultiLayer()
Creates a multilayer using sample builder.