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>
Invalid value exception.
Definition: Exception.h:329
Base class for Factory<T>
Definition: FactoryBase.h:49
Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.
Definition: Factory.h:63
static void registerProduct(const String &name, const FunctionType creator)
register new concrete FactoryProduct
Definition: Factory.h:139
Map inventory_
Definition: Factory.h:167
static bool isRegistered(const String &name)
Returns if a factory product is registered.
Definition: Factory.h:145
static FactoryProduct * create(const String &name)
return FactoryProduct according to unique identifier name
Definition: Factory.h:112
friend class singletonsNeedNoFriends
Definition: Factory.h:64
FactoryProduct *(* FunctionType)()
Function signature of creator function.
Definition: Factory.h:68
Map::const_iterator MapIterator
Definition: Factory.h:70
static Factory * instance_ptr_
Definition: Factory.h:168
std::map< String, FunctionType > Map
Definition: Factory.h:69
static std::vector< String > registeredProducts()
Returns a list of registered products.
Definition: Factory.h:155
~Factory() override
Destructor.
Definition: Factory.h:74
Factory< FactoryProduct > FactoryType
Definition: Factory.h:71
Factory()
Constructor.
Definition: Factory.h:77
static Factory * instance_()
singleton access to Factory
Definition: Factory.h:82
static bool isRegistered(String name)
Returns if a factory is registered.
Definition: SingletonRegistry.h:107
static FactoryBase * getFactory(const String &name)
return DefaultParamHandler according to unique identifier name
Definition: SingletonRegistry.h:82
static void registerFactory(const String &name, FactoryBase *instance)
register new concrete Factory
Definition: SingletonRegistry.h:101
A more convenient string class.
Definition: String.h:60
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47