BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Base class for all factories. More...
Public Types | |
typedef std::map< Key, CreateItemCallback > | CallbackMap_t |
map for correspondence between object identifier and object creation function More... | |
typedef std::function< AbstractProduct *()> | CreateItemCallback |
function which will be used to create object of AbstractProduct base type More... | |
Public Member Functions | |
bool | contains (const Key &item_key) const |
AbstractProduct * | createItem (const Key &item_key) const |
Creates object by calling creation function corresponded to given identifier. More... | |
std::unique_ptr< AbstractProduct > | createItemPtr (const Key &item_key) const |
bool | registerItem (const Key &item_key, CreateItemCallback CreateFn) |
Registers object's creation function. More... | |
size_t | size () const |
Returns number of registered objects. More... | |
Protected Attributes | |
CallbackMap_t | m_callbacks |
map of correspondence of objectsId and creation functions More... | |
Base class for all factories.
Definition at line 29 of file IFactory.h.
typedef std::map<Key, CreateItemCallback> IFactory< Key, AbstractProduct >::CallbackMap_t |
map for correspondence between object identifier and object creation function
Definition at line 35 of file IFactory.h.
typedef std::function<AbstractProduct*()> IFactory< Key, AbstractProduct >::CreateItemCallback |
function which will be used to create object of AbstractProduct base type
Definition at line 32 of file IFactory.h.
|
inline |
Definition at line 59 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
Referenced by ItemCatalog::createItemPtr().
|
inline |
Creates object by calling creation function corresponded to given identifier.
Definition at line 38 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
Referenced by IFactory< Key, AbstractProduct >::createItemPtr().
|
inline |
Definition at line 46 of file IFactory.h.
References IFactory< Key, AbstractProduct >::createItem().
Referenced by ItemCatalog::createItemPtr(), and ItemComboWidget::setPresentation().
|
inline |
Registers object's creation function.
Definition at line 53 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
Referenced by ItemCatalog::add(), and ItemComboWidget::registerWidget().
|
inline |
Returns number of registered objects.
Definition at line 65 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
|
protected |
map of correspondence of objectsId and creation functions
Definition at line 68 of file IFactory.h.
Referenced by IFactory< Key, AbstractProduct >::contains(), IFactory< Key, AbstractProduct >::createItem(), IFactory< Key, AbstractProduct >::registerItem(), and IFactory< Key, AbstractProduct >::size().