A helper class to automatically load modules based on the configuration.
More...
#include <ConfiguredModule.hpp>
|
| typedef std::function< void(const std::string &)> | fn |
| |
| typedef std::function< std::string()> | ofn |
| |
| typedef std::map< const std::string, std::pair< fn, ofn > > | map |
| |
|
| static const std::string | MODULE_PREFIX = "Modules" |
| | The configuration options section name for modules.
|
| |
A helper class to automatically load modules based on the configuration.
Definition at line 25 of file ConfiguredModule.hpp.
◆ fn
| std::function<void(const std::string&)> Nextsim::ConfiguredModule::fn |
◆ map
| std::map<const std::string, std::pair<fn, ofn> > Nextsim::ConfiguredModule::map |
◆ ofn
| std::function<std::string()> Nextsim::ConfiguredModule::ofn |
◆ addPrefix()
| std::string Nextsim::ConfiguredModule::addPrefix |
( |
const std::string & | moduleName | ) |
|
|
static |
Transforms a module name into a configuration option name.
- Parameters
-
| moduleName | The module name to be prefixed. |
Definition at line 47 of file ConfiguredModule.cpp.
◆ configureModule()
| void Nextsim::ConfiguredModule::configureModule |
( |
const std::string & | mod, |
|
|
const fn & | setter, |
|
|
const ofn & | getter ) |
|
static |
Adds the name of a module to the list to be configured
- Parameters
-
| mod | the name of the class to be configured. |
| setter | the void(std::string) function to set the implementation. |
| getter | the std::string() function to get the implementation. |
Definition at line 58 of file ConfiguredModule.cpp.
◆ getAllModuleConfigurations()
| ConfigMap Nextsim::ConfiguredModule::getAllModuleConfigurations |
( |
| ) |
|
|
static |
Returns a map from interface name to implementation name for all modules configured in this class.
Definition at line 68 of file ConfiguredModule.cpp.
◆ getModuleConfiguration()
| std::string Nextsim::ConfiguredModule::getModuleConfiguration |
( |
const std::string & | interface | ) |
|
|
static |
Gets the implementation name for a named module. Returns an empty string if there is no such module.
- Parameters
-
| interface | the name of the module to be checked. |
Definition at line 63 of file ConfiguredModule.cpp.
◆ parseConfigurator()
| void Nextsim::ConfiguredModule::parseConfigurator |
( |
| ) |
|
|
static |
Parse the configuration for all of the modules defined in ModuleLoader.
Definition at line 22 of file ConfiguredModule.cpp.
◆ setConfiguredModules()
| void Nextsim::ConfiguredModule::setConfiguredModules |
( |
const map & | ls | ) |
|
|
static |
Sets the names of all the modules to be configured
- Parameters
-
| ls | a map of Module names and the locations of implementation setter and getter functions. |
Definition at line 52 of file ConfiguredModule.cpp.
◆ MODULE_PREFIX
| const std::string Nextsim::ConfiguredModule::MODULE_PREFIX = "Modules" |
|
static |
The documentation for this class was generated from the following files: