Templated Object factory for Default-constructible classes. The Factory is itself a singleton.
More...
#include <factory.h>
|
static Factory< BaseClass > & | Instance (void) |
| Singleton implementation: returns a reference to a singleton instance of the instantiated class. More...
|
|
template<class BaseClass>
class exotica::Factory< BaseClass >
Templated Object factory for Default-constructible classes. The Factory is itself a singleton.
- Parameters
-
Definition at line 61 of file factory.h.
◆ Factory()
template<class BaseClass >
Private Constructor.
Definition at line 114 of file factory.h.
◆ CreateInstance()
template<class BaseClass >
std::shared_ptr<BaseClass> exotica::Factory< BaseClass >::CreateInstance |
( |
const std::string & |
type | ) |
|
|
inline |
◆ GetDeclaredClasses()
template<class BaseClass >
Lists the valid implementations which are available and registered.
Definition at line 102 of file factory.h.
◆ Instance()
template<class BaseClass >
Singleton implementation: returns a reference to a singleton instance of the instantiated class.
< Declared static so will only be created once
< At other times, just return the reference to it
Definition at line 67 of file factory.h.
◆ RegisterType()
template<class BaseClass >
void exotica::Factory< BaseClass >::RegisterType |
( |
const std::string & |
type, |
|
|
BaseClass *(*)() |
creator_function |
|
) |
| |
|
inline |
Registers a new derived class type.
- Parameters
-
type[in] | The name of the class (string): must be a unique identifier |
creator[in] | A pointer to the creator function |
< If it does not already exist
Definition at line 76 of file factory.h.
◆ Registrar< BaseClass >
template<class BaseClass >
◆ base_type_
template<class BaseClass >
◆ type_registry_
template<class BaseClass >
std::map<std::string, BaseClass* (*)()> exotica::Factory< BaseClass >::type_registry_ |
|
private |
The Map containing the register of the different types of classes.
Definition at line 119 of file factory.h.
The documentation for this class was generated from the following file: