netxsimdg
Loading...
Searching...
No Matches
ConfiguredModule.hpp
Go to the documentation of this file.
1
8#ifndef CONFIGUREDMODULE_HPP
9#define CONFIGUREDMODULE_HPP
10
11#include "include/ConfigMap.hpp"
12
13#include <functional>
14#include <list>
15#include <map>
16#include <string>
17#include <utility>
18
19namespace Nextsim {
20
26public:
27 typedef std::function<void(const std::string&)> fn;
28 typedef std::function<std::string()> ofn;
29 typedef std::map<const std::string, std::pair<fn, ofn>> map;
30 ConfiguredModule() = default;
31 virtual ~ConfiguredModule() = default;
32
34 static void parseConfigurator();
35
41 static void setConfiguredModules(const map& ls);
42
49 static void configureModule(const std::string& mod, const fn& setter, const ofn& getter);
50
57 static std::string getModuleConfiguration(const std::string& interface);
58
64 static ConfigMap getAllModuleConfigurations();
70 static std::string addPrefix(const std::string& moduleName);
71
73 static const std::string MODULE_PREFIX;
74
75private:
76 static map configuredModules;
77};
78
79} /* namespace Nextsim */
80
81#endif /* CONFIGUREDMODULE_HPP */
A helper class to automatically load modules based on the configuration.
static std::string addPrefix(const std::string &moduleName)
Transforms a module name into a configuration option name.
static void parseConfigurator()
Parse the configuration for all of the modules defined in ModuleLoader.
static void setConfiguredModules(const map &ls)
static void configureModule(const std::string &mod, const fn &setter, const ofn &getter)
static std::string getModuleConfiguration(const std::string &interface)
static ConfigMap getAllModuleConfigurations()
static const std::string MODULE_PREFIX
The configuration options section name for modules.