BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
itemfactory.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/itemfactory.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_ITEMFACTORY_H
16 #define BORNAGAIN_MVVM_MODEL_MVVM_MODEL_ITEMFACTORY_H
17 
19 #include "mvvm/model_export.h"
20 #include <memory>
21 
22 namespace ModelView {
23 
24 class ItemCatalogue;
25 
26 //! Default SessionItem factory.
27 
28 class MVVM_MODEL_EXPORT ItemFactory : public ItemFactoryInterface {
29 public:
30  ItemFactory(std::unique_ptr<ItemCatalogue> catalogue);
31  ~ItemFactory() override;
32 
33  void registerItem(const std::string& modelType, item_factory_func_t func,
34  const std::string& label) override;
35 
36  std::unique_ptr<SessionItem> createItem(const model_type& modelType) const override;
37 
38 protected:
39  std::unique_ptr<ItemCatalogue> m_catalogue;
40 };
41 
42 } // namespace ModelView
43 
44 #endif // BORNAGAIN_MVVM_MODEL_MVVM_MODEL_ITEMFACTORY_H
Interface class for all factories capable of producing SessionItem's.
std::unique_ptr< ItemCatalogue > m_catalogue
Definition: itemfactory.h:39
void registerItem(const std::string &modelType, item_factory_func_t func, const std::string &label) override
std::unique_ptr< SessionItem > createItem(const model_type &modelType) const override
ItemFactory(std::unique_ptr< ItemCatalogue > catalogue)
Defines class CLASS?
materialitems.h Collection of materials to populate MaterialModel.
std::function< std::unique_ptr< SessionItem >()> item_factory_func_t
Definition for item factory funciton.
std::string model_type
Definition: types.h:23