BornAgain  1.18.0
Simulate and fit neutron and x-ray scattering at grazing incidence
IFactory< Key, AbstractProduct > Class Template Reference

Base class for all factories. More...

Public Types

typedef std::function< AbstractProduct *()> CreateItemCallback
 function which will be used to create object of AbstractProduct base type
 
typedef std::map< Key, CreateItemCallbackCallbackMap_t
 map for correspondance between object identifier and object creation function
 

Public Member Functions

AbstractProduct * createItem (const Key &item_key) const
 Creates object by calling creation function corresponded to given identifier.
 
std::unique_ptr< AbstractProduct > createItemPtr (const Key &item_key) const
 
bool registerItem (const Key &item_key, CreateItemCallback CreateFn)
 Registers object's creation function.
 
bool contains (const Key &item_key) const
 
size_t size () const
 Returns number of registered objects.
 

Protected Attributes

CallbackMap_t m_callbacks
 map of correspondence of objectsId and creation functions
 

Detailed Description

template<class Key, class AbstractProduct>
class IFactory< Key, AbstractProduct >

Base class for all factories.

Definition at line 28 of file IFactory.h.


The documentation for this class was generated from the following file: