#include <component.h>
|
typedef std::function
< Component *()> | CreateComponentFunc |
| |
|
| static bool | CheckRegistered (const std::string &interfaceType, const std::string &implType) |
| |
| static bool | Register (const std::string &interfaceType, const std::string &implType, const CreateComponentFunc &func) |
| |
| static Component * | Create (const std::string &interfaceType, const std::string &implType) |
| |
| static void | LoadPlugins (const std::string &pluginDir) |
| |
| static void | UnloadPlugins () |
| |
| template<typename InterfaceType > |
| static bool | CheckRegistered (const std::string &implType) |
| |
| template<typename InterfaceType > |
| static InterfaceType * | Create (const std::string &implType) |
| |
| template<typename InterfaceType > |
| static InterfaceType * | Create () |
| |
Component factory. Factory class for components. All components are managed by the factory.
| bool ComponentFactory::CheckRegistered |
( |
const std::string & |
interfaceType, |
|
|
const std::string & |
implType |
|
) |
| |
|
static |
Check if the component is registered.
- Parameters
-
- Return values
-
| true | Component of the given type is registered. |
| false | Component of the given type is not registered. |
template<typename InterfaceType >
| static bool ComponentFactory::CheckRegistered |
( |
const std::string & |
implType | ) |
|
|
inlinestatic |
Check if the component is registered.
- Template Parameters
-
| InterfaceType | Interface type. |
- Parameters
-
- Return values
-
| true | Component of the given type is registered. |
| false | Component of the given type is not registered. |
| Component * ComponentFactory::Create |
( |
const std::string & |
interfaceType, |
|
|
const std::string & |
implType |
|
) |
| |
|
static |
Create an instance of a component.
- Parameters
-
- Returns
- Instance. nullptr if not registered.
template<typename InterfaceType >
| static InterfaceType* ComponentFactory::Create |
( |
const std::string & |
implType | ) |
|
|
inlinestatic |
Create an instance of a component with interface type. Creates an instance of a component with the type of the given interface.
- Template Parameters
-
| InterfaceType | Interface type. |
- Parameters
-
- Returns
- Instance. nullptr if not registered, or failed to cast.
template<typename InterfaceType >
| static InterfaceType* ComponentFactory::Create |
( |
| ) |
|
|
inlinestatic |
Create an instance of a component with interface type. This function creates default implementation for the givan interface.
- Template Parameters
-
| InterfaceType | Interface type. |
- Returns
- Instance. nullptr if not registered, or failed to cast.
| void ComponentFactory::LoadPlugins |
( |
const std::string & |
pluginDir | ) |
|
|
static |
Load plugins. This function must be called once in the initialization phase.
- Parameters
-
| pluginDir | Plugin directory. |
| bool ComponentFactory::Register |
( |
const std::string & |
interfaceType, |
|
|
const std::string & |
implType, |
|
|
const CreateComponentFunc & |
func |
|
) |
| |
|
static |
Register a component. Registers a component to the factory. Registered components can be instantiated with Create function.
- Parameters
-
| interfaceType | Component interface type. |
| implType | Component implementation type. |
| func | Instance creation function. |
- Return values
-
| true | Successfully registered. |
| false | Failed to register a component. |
| void ComponentFactory::UnloadPlugins |
( |
| ) |
|
|
static |
Unload plugins. Unloads loaded plugins.
The documentation for this class was generated from the following files:
- /home/travis/build/hi2p-perim/lightmetrica/include/lightmetrica/component.h
- /home/travis/build/hi2p-perim/lightmetrica/src/liblightmetrica/component.cpp