BornAgain
1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
|
Base class for all factories.
Definition at line 29 of file IFactory.h.
Public Types | |
using | CallbackMap_t = std::map< Key, CreateItemCallback > |
map for correspondence between object identifier and object creation function More... | |
using | CreateItemCallback = std::function< AbstractProduct *()> |
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... | |
using IFactory< Key, AbstractProduct >::CallbackMap_t = std::map<Key, CreateItemCallback> |
map for correspondence between object identifier and object creation function
Definition at line 35 of file IFactory.h.
using IFactory< Key, AbstractProduct >::CreateItemCallback = std::function<AbstractProduct*()> |
function which will be used to create object of AbstractProduct base type
Definition at line 32 of file IFactory.h.
|
inline |
Definition at line 57 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
|
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 45 of file IFactory.h.
References IFactory< Key, AbstractProduct >::createItem().
|
inline |
Registers object's creation function.
Definition at line 51 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
|
inline |
Returns number of registered objects.
Definition at line 63 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
|
protected |
map of correspondence of objectsId and creation functions
Definition at line 66 of file IFactory.h.
Referenced by IFactory< Key, AbstractProduct >::contains(), IFactory< Key, AbstractProduct >::createItem(), IFactory< Key, AbstractProduct >::registerItem(), and IFactory< Key, AbstractProduct >::size().