BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
viewmodelcontrollerbuilder.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // qt-mvvm: Model-view-view-model framework for large GUI applications
4 //
5 //! @file mvvm/viewmodel/mvvm/factories/viewmodelcontrollerbuilder.h
6 //! @brief Defines class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Gennady Pospelov et al, Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_MVVM_VIEWMODEL_MVVM_FACTORIES_VIEWMODELCONTROLLERBUILDER_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_FACTORIES_VIEWMODELCONTROLLERBUILDER_H
17 
19 #include "mvvm/viewmodel_export.h"
20 #include <memory>
21 
22 namespace ModelView {
23 
24 class SessionModel;
25 class ViewModelBase;
26 class ChildrenStrategyInterface;
27 class RowStrategyInterface;
28 
29 //! Builder class for ViewModelController.
30 
31 class MVVM_VIEWMODEL_EXPORT ViewModelControllerBuilder {
32 public:
34 
37 
40 
41  self& model(SessionModel* model);
42  self& viewModel(ViewModelBase* view_model);
43  self& childrenStrategy(std::unique_ptr<ChildrenStrategyInterface> children_strategy);
44  self& rowStrategy(std::unique_ptr<RowStrategyInterface> row_strategy);
45 
46  operator std::unique_ptr<ViewModelController>();
47 
48 private:
49  //! Components necessary to build ViewModelController
50  struct Context {
51  SessionModel* model{nullptr};
52  ViewModelBase* view_model{nullptr};
53  std::unique_ptr<ChildrenStrategyInterface> children_strategy;
54  std::unique_ptr<RowStrategyInterface> row_strategy;
55  };
56 
58 };
59 
60 } // namespace ModelView
61 
62 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_FACTORIES_VIEWMODELCONTROLLERBUILDER_H
Main class to hold hierarchy of SessionItem objects.
Definition: sessionmodel.h:37
Base class for all view models to show content of SessionModel in Qt views.
Definition: viewmodelbase.h:31
Builder class for ViewModelController.
ViewModelControllerBuilder(const ViewModelControllerBuilder &other)=delete
ViewModelControllerBuilder & operator=(const ViewModelControllerBuilder &other)=delete
materialitems.h Collection of materials to populate MaterialModel.
Components necessary to build ViewModelController.
std::unique_ptr< ChildrenStrategyInterface > children_strategy
std::unique_ptr< RowStrategyInterface > row_strategy
Defines class CLASS?