35 #ifndef OPENMS_CONCEPT_SINGLETONREGISTRY_H 36 #define OPENMS_CONCEPT_SINGLETONREGISTRY_H 57 friend class singletonsNeedNoFriends;
61 typedef std::map<String, FactoryBase *>
Map;
73 if (!singletonRegistryInstance_)
77 return singletonRegistryInstance_;
85 MapIterator it = instance_()->inventory_.find(name);
86 if (it != instance_()->inventory_.end())
92 throw Exception::InvalidValue(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
"This Factory is not registered with SingletonRegistry!", name.c_str());
104 instance_()->inventory_[name] = instance;
110 if (instance_()->inventory_.find(name) != instance_()->inventory_.end())
125 #endif //OPENMS_CONCEPT_SINGLETONREGISTRY_H static bool isRegistered(String name)
Returns if a factory is registered.
Definition: SingletonRegistry.h:108
static SingletonRegistry * instance_()
singleton access to SingletonRegistry
Definition: SingletonRegistry.h:71
Map inventory_
Definition: SingletonRegistry.h:119
A more convenient string class.
Definition: String.h:57
std::map< String, FactoryBase * > Map
Function signature of creator function.
Definition: SingletonRegistry.h:61
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
SingletonRegistry()
C'Tor.
Definition: SingletonRegistry.h:68
Base class for Factory<T>
Definition: FactoryBase.h:49
static FactoryBase * getFactory(const String &name)
return DefaultParamHandler according to unique identifier name
Definition: SingletonRegistry.h:83
Invalid value exception.
Definition: Exception.h:336
virtual ~SingletonRegistry()
destructor
Definition: SingletonRegistry.h:65
static SingletonRegistry * singletonRegistryInstance_
Definition: SingletonRegistry.h:120
Holds pointers to unique instance of a singleton factory.
Definition: SingletonRegistry.h:55
Map::const_iterator MapIterator
Definition: SingletonRegistry.h:62
static void registerFactory(const String &name, FactoryBase *instance)
register new concrete Factory
Definition: SingletonRegistry.h:102