BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
function_types.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/model/mvvm/model/function_types.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_MODEL_MVVM_MODEL_FUNCTION_TYPES_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_MODEL_FUNCTION_TYPES_H
17 
18 #include <functional>
19 #include <memory>
20 
21 namespace ModelView {
22 
23 class SessionItem;
24 
25 //! Definition for item factory funciton.
26 using item_factory_func_t = std::function<std::unique_ptr<SessionItem>()>;
27 
28 //! Creates factory function for item of specific type.
30 {
31  return []() { return std::make_unique<T>(); };
32 }
33 
34 } // namespace ModelView
35 
36 #endif // BORNAGAIN_MVVM_MODEL_MVVM_MODEL_FUNCTION_TYPES_H
materialitems.h Collection of materials to populate MaterialModel.
std::function< std::unique_ptr< SessionItem >()> item_factory_func_t
Definition for item factory funciton.
item_factory_func_t ItemFactoryFunction()
Creates factory function for item of specific type.