BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
viewmodelcontrollerfactory.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/viewmodelcontrollerfactory.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_VIEWMODELCONTROLLERFACTORY_H
16 #define BORNAGAIN_MVVM_VIEWMODEL_MVVM_FACTORIES_VIEWMODELCONTROLLERFACTORY_H
17 
19 #include "mvvm/viewmodel_export.h"
20 #include <memory>
21 
22 namespace ModelView {
23 
24 class SessionModel;
25 class ViewModelBase;
26 class ViewModelController;
27 
28 namespace Factory {
29 
30 //! Create universal controller.
31 
32 template <typename ChildrenStrategy, typename RowStrategy>
33 std::unique_ptr<ViewModelController> CreateController(SessionModel* session_model,
34  ViewModelBase* view_model)
35 {
37  .model(session_model)
38  .viewModel(view_model)
39  .childrenStrategy(std::make_unique<ChildrenStrategy>())
40  .rowStrategy(std::make_unique<RowStrategy>());
41 }
42 
43 } // namespace Factory
44 
45 } // namespace ModelView
46 
47 #endif // BORNAGAIN_MVVM_VIEWMODEL_MVVM_FACTORIES_VIEWMODELCONTROLLERFACTORY_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.
self & childrenStrategy(std::unique_ptr< ChildrenStrategyInterface > children_strategy)
self & viewModel(ViewModelBase *view_model)
self & rowStrategy(std::unique_ptr< RowStrategyInterface > row_strategy)
std::unique_ptr< ViewModelController > CreateController(SessionModel *session_model, ViewModelBase *view_model)
Create universal controller.
materialitems.h Collection of materials to populate MaterialModel.
Defines class CLASS?