QwAnalysis
QwFactory< base_t, type_t > Class Template Reference

Concrete templated type factory. More...

#include <QwFactory.h>

+ Inheritance diagram for QwFactory< base_t, type_t >:
+ Collaboration diagram for QwFactory< base_t, type_t >:

Public Member Functions

 QwFactory (const std::string &type)
 Constructor which stores type name in list of registered types. More...
 
base_t * Create (const std::string &name) const
 Concrete type creation. More...
 
type_t * Cast (base_t *base) const
 Dynamic cast of type. More...
 
- Public Member Functions inherited from VQwFactory< base_t >
virtual ~VQwFactory ()
 Default virtual destructor. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from VQwFactory< base_t >
static base_t * Create (const std::string &type, const std::string &name)
 Create an object of type with name. More...
 
static base_t * Cast (base_t *base, const std::string &type)
 Dynamic cast of object into type. More...
 
static bool InheritsFrom (base_t *base, const std::string &type)
 Test whether object inherits from type. More...
 
- Static Protected Member Functions inherited from VQwFactory< base_t >
static std::map< std::string,
VQwFactory * > & 
GetRegisteredTypes ()
 Map from string to concrete type factories. More...
 
static void ListRegisteredTypes ()
 List available type factories. More...
 
static VQwFactoryGetFactory (const std::string &type)
 Get a concrete type factory by string. More...
 

Detailed Description

template<class base_t, class type_t>
class QwFactory< base_t, type_t >

Concrete templated type factory.

This class represents concrete instances of the virtual VQwFactory from which it inherits. Each concrete factory can create types with a given name.

Definition at line 105 of file QwFactory.h.

Constructor & Destructor Documentation

template<class base_t, class type_t>
QwFactory< base_t, type_t >::QwFactory ( const std::string &  type)
inline

Constructor which stores type name in list of registered types.

Definition at line 110 of file QwFactory.h.

110  {
112  }
static std::map< std::string, VQwFactory * > & GetRegisteredTypes()
Map from string to concrete type factories.
Definition: QwFactory.h:63

Member Function Documentation

template<class base_t, class type_t>
type_t* QwFactory< base_t, type_t >::Cast ( base_t *  base) const
inlinevirtual

Dynamic cast of type.

Implements VQwFactory< base_t >.

Definition at line 120 of file QwFactory.h.

120  {
121  return dynamic_cast<type_t*>(base);
122  }
template<class base_t, class type_t>
base_t* QwFactory< base_t, type_t >::Create ( const std::string &  name) const
inlinevirtual

Concrete type creation.

Implements VQwFactory< base_t >.

Definition at line 115 of file QwFactory.h.

115  {
116  return new type_t(name);
117  }

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