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
-
◆ Factory()
template<class BaseClass >
◆ 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.
◆ 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
◆ 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
◆ 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.
The documentation for this class was generated from the following file:
- /tmp/exotica/exotica_core/include/exotica_core/factory.h