BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
itemfactory.cpp
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.cpp
6 //! @brief Implements 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 #include "mvvm/model/itemfactory.h"
17 #include "mvvm/model/sessionitem.h"
18 
19 using namespace ModelView;
20 
21 ItemFactory::ItemFactory(std::unique_ptr<ItemCatalogue> catalogue)
22  : m_catalogue(std::move(catalogue))
23 {
24 }
25 
26 void ItemFactory::registerItem(const std::string& modelType, item_factory_func_t func,
27  const std::string& label)
28 {
29  m_catalogue->registerItem(modelType, func, label);
30 }
31 
32 ItemFactory::~ItemFactory() = default;
33 
34 std::unique_ptr<SessionItem> ItemFactory::createItem(const model_type& modelType) const
35 {
36  return m_catalogue->create(modelType);
37 }
std::unique_ptr< ItemCatalogue > m_catalogue
Definition: itemfactory.h:39
std::unique_ptr< SessionItem > createItem(const model_type &modelType) const override
ItemFactory(std::unique_ptr< ItemCatalogue > catalogue)
Defines class CLASS?
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
Definition: filesystem.h:81
Defines class CLASS?