BornAgain
1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
|
Public Types | |
typedef std::function< AbstractProduct *()> | CreateItemCallback |
typedef std::map< Key, CreateItemCallback > | CallbackMap_t |
Public Member Functions | |
AbstractProduct * | createItem (const Key &item_key) const |
std::unique_ptr< AbstractProduct > | createItemPtr (const Key &item_key) const |
bool | registerItem (const Key &item_key, CreateItemCallback CreateFn) |
bool | contains (const Key &item_key) const |
size_t | size () const |
Protected Attributes | |
CallbackMap_t | m_callbacks |
Base class for all factories.
Definition at line 28 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.
typedef std::map<Key, CreateItemCallback> IFactory< Key, AbstractProduct >::CallbackMap_t |
map for correspondance between object identifier and object creation function
Definition at line 35 of file IFactory.h.
|
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().
|
inline |
Registers object's creation function.
Definition at line 53 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
|
inline |
Definition at line 59 of file IFactory.h.
References IFactory< Key, AbstractProduct >::m_callbacks.
|
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().