Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends

Factory< FactoryProduct > Class Template Reference
[Concept]

Returns FactoryProduct* based on the name of the desired concrete FactoryProduct. More...

#include <OpenMS/CONCEPT/Factory.h>

Inheritance diagram for Factory< FactoryProduct >:
FactoryBase

List of all members.

Static Public Member Functions

static FactoryProduct * create (const String &name)
 return FactoryProduct according to unique identifier name
static void registerProduct (const String &name, const FunctionType creator)
 register new concrete FactoryProduct
static bool isRegistered (const String &name)
 Returns if a factory product is registered.
static std::vector< StringregisteredProducts ()
 Returns a list of registered products.

Private Types

typedef FactoryProduct *(* FunctionType )()
 Function signature of creator function.
typedef std::map< String,
FunctionType
Map
typedef Map::const_iterator MapIterator
typedef Factory< FactoryProduct > FactoryType

Private Member Functions

virtual ~Factory ()
 Destructor.
 Factory ()
 Constructor.

Static Private Member Functions

static Factoryinstance_ ()
 singleton access to Factory

Private Attributes

Map inventory_

Static Private Attributes

static Factoryinstance_ptr_ = 0

Friends

class singletonsNeedNoFriends

Detailed Description

template<typename FactoryProduct>
class OpenMS::Factory< FactoryProduct >

Returns FactoryProduct* based on the name of the desired concrete FactoryProduct.

Every factory product base class T has to implement the static function registerChildren that registers all classes S derived from T at Factory<T>.

Every class S derived from T has to implement the function "static T* create()" which is going to be registered at Factory<T>. Additionally the function "static String getProductName()" is required, which returns the name the class is registered by.


Member Typedef Documentation

typedef Factory<FactoryProduct> FactoryType [private]
typedef FactoryProduct*(* FunctionType)() [private]

Function signature of creator function.

typedef std::map<String, FunctionType> Map [private]
typedef Map::const_iterator MapIterator [private]

Constructor & Destructor Documentation

virtual ~Factory (  )  [inline, private, virtual]

Destructor.

Factory (  )  [inline, private]

Constructor.

Referenced by Factory< FactoryProduct >::instance_().


Member Function Documentation

static FactoryProduct* create ( const String name  )  [inline, static]

return FactoryProduct according to unique identifier name

References Factory< FactoryProduct >::instance_(), and Factory< FactoryProduct >::inventory_.

static bool isRegistered ( const String name  )  [inline, static]

Returns if a factory product is registered.

References Factory< FactoryProduct >::instance_(), and Factory< FactoryProduct >::inventory_.

static std::vector<String> registeredProducts (  )  [inline, static]

Returns a list of registered products.

References Factory< FactoryProduct >::instance_(), and Factory< FactoryProduct >::inventory_.

static void registerProduct ( const String name,
const FunctionType  creator 
) [inline, static]

register new concrete FactoryProduct

Parameters:
name unique name for concrete FactoryProduct
creator default constructor for concrete FactoryProduct

References Factory< FactoryProduct >::instance_(), and Factory< FactoryProduct >::inventory_.


Friends And Related Function Documentation

friend class singletonsNeedNoFriends [friend]

Member Data Documentation

Factory< FactoryProduct > * instance_ptr_ = 0 [static, private]

OpenMS / TOPP release 1.10.0 Documentation generated on Thu Mar 7 2013 09:42:51 using doxygen 1.7.1