public

Inheritance Graph

graph BT
	Factory
	click Factory "classUtil_1_1Factory"

Description

Generic factory for objects.

The factory template can be instaniated to generate different kinds of factories. The generated factory generates objects of typeObjectType.

Parameters

ObjectType
Base type for all objects that are generated by the factory
IdentifierType
Type of the identifier that specifies which object creator to call
** ObjectCreator **
Type for callable entities that generate an object of typeWrapperType
FallbackPolicy
Template with a functiononUnknownType()that handles the case that the requested object type was not found

Author: Benjamin Eikel

Date: 2012-02-07

See also: Patterns from Chapter 8 in Andrei Alexandrescu: Modern C++ Design. Addison-Wesley, 2001.

Public Types

   
   
typedef FallbackPolicy< ObjectType, IdentifierType > fallbackPolicy_t

Public Attributes

   
   
fallbackPolicy_t fallbackPolicy

Public Functions

   
   
  Factory()
   
  Factory( fallbackPolicy_t policy)
   
bool registerType(const IdentifierType & id, ObjectCreator creator)
   
bool unregisterType(const IdentifierType & id)
   
ObjectType create(const IdentifierType & id)

Documentation

typedef
Util::Factory::fallbackPolicy_t

public
 
 
typedef FallbackPolicy< ObjectType, IdentifierType > fallbackPolicy_t

Defined in Util/Factory/Factory.h:48


variable
Util::Factory::fallbackPolicy

public
 
 
fallbackPolicy_t fallbackPolicy

Defined in Util/Factory/Factory.h:49


function
Util::Factory::Factory

public inline
   
   
Factory( )

Defined in Util/Factory/Factory.h:50


function
Util::Factory::Factory

public inline
     
     
Factory( fallbackPolicy_t policy )

Defined in Util/Factory/Factory.h:52


function
Util::Factory::registerType

public inline
     
     
bool registerType( const IdentifierType & id,
  ObjectCreator creator
)    

Defined in Util/Factory/Factory.h:55


function
Util::Factory::unregisterType

public inline
     
     
bool unregisterType( const IdentifierType & id )

Defined in Util/Factory/Factory.h:59


function
Util::Factory::create

public inline
     
     
ObjectType create( const IdentifierType & id )

Defined in Util/Factory/Factory.h:63