34 template <
typename FactoryProduct>
42 typedef FactoryProduct * (*FunctionType)();
43 typedef std::map<String, FunctionType>
Map;
72 FactoryProduct::registerChildren();
93 static std::mutex factory_create_mutex;
94 std::lock_guard<std::mutex> lock(factory_create_mutex);
99 return (*(it->second))();
103 throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"This FactoryProduct is not registered!", name.c_str());
131 std::vector<String> list;
134 list.push_back(it->first);
145 template <
typename FactoryProduct>
Invalid value exception.
Definition: Exception.h:303
Base class for Factory<T>
Definition: FactoryBase.h:23
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.
Definition: Factory.h:37
static void registerProduct(const String &name, const FunctionType creator)
register new concrete FactoryProduct
Definition: Factory.h:113
Map inventory_
Definition: Factory.h:141
static bool isRegistered(const String &name)
Returns if a factory product is registered.
Definition: Factory.h:119
static FactoryProduct * create(const String &name)
return FactoryProduct according to unique identifier name
Definition: Factory.h:86
friend class singletonsNeedNoFriends
Definition: Factory.h:38
FactoryProduct *(* FunctionType)()
Function signature of creator function.
Definition: Factory.h:42
Map::const_iterator MapIterator
Definition: Factory.h:44
static Factory * instance_ptr_
Definition: Factory.h:142
std::map< String, FunctionType > Map
Definition: Factory.h:43
static std::vector< String > registeredProducts()
Returns a list of registered products.
Definition: Factory.h:129
~Factory() override
Destructor.
Definition: Factory.h:48
Factory< FactoryProduct > FactoryType
Definition: Factory.h:45
Factory()
Constructor.
Definition: Factory.h:51
static Factory * instance_()
singleton access to Factory
Definition: Factory.h:56
static bool isRegistered(String name)
Returns if a factory is registered.
Definition: SingletonRegistry.h:81
static FactoryBase * getFactory(const String &name)
return DefaultParamHandler according to unique identifier name
Definition: SingletonRegistry.h:56
static void registerFactory(const String &name, FactoryBase *instance)
register new concrete Factory
Definition: SingletonRegistry.h:75
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:22