60 template <
typename FactoryProduct>
68 typedef FactoryProduct * (*FunctionType)();
69 typedef std::map<String, FunctionType>
Map;
98 FactoryProduct::registerChildren();
119 static std::mutex factory_create_mutex;
120 std::lock_guard<std::mutex> lock(factory_create_mutex);
125 return (*(it->second))();
129 throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"This FactoryProduct is not registered!", name.c_str());
157 std::vector<String> list;
160 list.push_back(it->first);
171 template <
typename FactoryProduct>
static bool isRegistered(String name)
Returns if a factory is registered.
Definition: SingletonRegistry.h:107
A more convenient string class.
Definition: String.h:57
Factory< FactoryProduct > FactoryType
Definition: Factory.h:71
static Factory * instance_()
singleton access to Factory
Definition: Factory.h:82
FactoryProduct *(* FunctionType)()
Function signature of creator function.
Definition: Factory.h:68
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct. ...
Definition: Factory.h:61
static void registerProduct(const String &name, const FunctionType creator)
register new concrete FactoryProduct
Definition: Factory.h:139
static bool isRegistered(const String &name)
Returns if a factory product is registered.
Definition: Factory.h:145
static Factory * instance_ptr_
Definition: Factory.h:168
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
~Factory() override
Destructor.
Definition: Factory.h:74
static FactoryProduct * create(const String &name)
return FactoryProduct according to unique identifier name
Definition: Factory.h:112
Factory()
Constructor.
Definition: Factory.h:77
Base class for Factory<T>
Definition: FactoryBase.h:48
static FactoryBase * getFactory(const String &name)
return DefaultParamHandler according to unique identifier name
Definition: SingletonRegistry.h:82
Invalid value exception.
Definition: Exception.h:335
static std::vector< String > registeredProducts()
Returns a list of registered products.
Definition: Factory.h:155
friend class singletonsNeedNoFriends
Definition: Factory.h:64
Map inventory_
Definition: Factory.h:167
Map::const_iterator MapIterator
Definition: Factory.h:70
std::map< String, FunctionType > Map
Definition: Factory.h:69
static void registerFactory(const String &name, FactoryBase *instance)
register new concrete Factory
Definition: SingletonRegistry.h:101