JAPAn
Just Another Parity Analyzer
Loading...
Searching...
No Matches
QwFactory< base_t, type_t > Class Template Reference

Concrete templated factory for creating specific object types. 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.
 
base_t * Create (const std::string &name) const override
 Concrete type creation.
 
type_t * Cast (base_t *base) const override
 Dynamic cast of type.
 
- Public Member Functions inherited from VQwFactory< base_t >
virtual ~VQwFactory ()
 Default virtual destructor.
 

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

Detailed Description

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

Concrete templated factory for creating specific object types.

Template specialization that provides concrete object creation for a specific derived type. Automatically registers itself in the factory registry during static initialization. Used by RegisterSomethingFactory macros to enable runtime type creation.

Definition at line 112 of file QwFactory.h.

Constructor & Destructor Documentation

◆ QwFactory()

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 117 of file QwFactory.h.

117 {
119 }
static std::map< std::string, VQwFactory * > & GetRegisteredTypes()
Map from string to concrete type factories.
Definition QwFactory.h:69
Concrete templated factory for creating specific object types.
Definition QwFactory.h:112

References VQwFactory< base_t >::GetRegisteredTypes().

+ Here is the call graph for this function:

Member Function Documentation

◆ Cast()

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

Dynamic cast of type.

Implements VQwFactory< base_t >.

Definition at line 127 of file QwFactory.h.

127 {
128 return dynamic_cast<type_t*>(base);
129 }

◆ Create()

template<class base_t, class type_t>
base_t * QwFactory< base_t, type_t >::Create ( const std::string & name) const
inlineoverridevirtual

Concrete type creation.

Implements VQwFactory< base_t >.

Definition at line 122 of file QwFactory.h.

122 {
123 return new type_t(name);
124 }

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