openModeller  Version 1.5.0
PreFactory< T, Arg > Class Template Referenceabstract

#include <PreFactory.hh>

Collaboration diagram for PreFactory< T, Arg >:
Collaboration graph

Public Types

typedef map< string,
PreFactory< T, Arg > * > 
PreFactoryMap
 

Public Member Functions

 PreFactory (const string &factoryName)
 
virtual ~PreFactory ()
 

Static Public Member Functions

static PreFactoryMapinstance ()
 
static T * make (string name, const Arg &arg)
 

Protected Member Functions

virtual T * build (const Arg &arg)=0
 

Private Attributes

string Fname_
 

Detailed Description

template<class T, class Arg>
class PreFactory< T, Arg >

Implements a template for the "PreFactory" pattern.

The "factory" pattern is a technique for creating new instances of objects which defines an abstract interface, (represented by the "Make" module). The subclasses of factory decide which class to instantiate.

Each subclass of factory "registers" itself at compile time; therefore, the addition of a new factory requires no change the parent class.

author: Gilberto Camara

Definition at line 51 of file PreFactory.hh.

Member Typedef Documentation

template<class T , class Arg >
typedef map<string, PreFactory<T,Arg>* > PreFactory< T, Arg >::PreFactoryMap

Definition at line 56 of file PreFactory.hh.

Constructor & Destructor Documentation

template<class T , class Arg >
PreFactory< T, Arg >::PreFactory ( const string &  factoryName)

Definition at line 85 of file PreFactory.hh.

References PreFactory< T, Arg >::instance().

Here is the call graph for this function:

template<class T , class Arg >
virtual PreFactory< T, Arg >::~PreFactory ( )
inlinevirtual

Definition at line 69 of file PreFactory.hh.

Member Function Documentation

template<class T , class Arg >
virtual T* PreFactory< T, Arg >::build ( const Arg &  arg)
protectedpure virtual
template<class T , class Arg >
static PreFactoryMap& PreFactory< T, Arg >::instance ( )
inlinestatic

Definition at line 59 of file PreFactory.hh.

Referenced by PreFactory< T, Arg >::make(), and PreFactory< T, Arg >::PreFactory().

template<class T , class Arg >
T * PreFactory< T, Arg >::make ( string  name,
const Arg &  arg 
)
static

Definition at line 94 of file PreFactory.hh.

References Log::error(), Log::instance(), and PreFactory< T, Arg >::instance().

Here is the call graph for this function:

Member Data Documentation

template<class T , class Arg >
string PreFactory< T, Arg >::Fname_
private

Definition at line 80 of file PreFactory.hh.


The documentation for this class was generated from the following file: