There will always be a global instance of this object available as globalConfiguration; it can be set up by use of config files, (in the future) environment variables, and possibly command line arguments.
This will replace the former behavior of CommsManager::parseOptions, instead making all non-standard options which are specified in the optstring argument of that method available via getOption.
Definition at line 56 of file WURDEConfiguration.H.
Public Member Functions | |
| WURDEConfiguration () | |
| Default constructor, sets up sensible defaults. | |
| ~WURDEConfiguration () | |
| std::string | getDataDirectory () |
| std::string | getBinDirectory () |
| std::string | getConfigDirectory () |
| std::string | getMCPConfigFile () |
| std::string | getLogDirectory () |
| std::string | getModuleName () |
| int | getLogLevel () |
| void | setDataDirectory (std::string val) |
| void | setBinDirectory (std::string val) |
| void | setConfigDirectory (std::string val) |
| void | setMCPConfigFile (std::string val) |
| void | setLogDirectory (std::string val) |
| void | setModuleName (std::string val) |
| void | setLogLevel (int val) |
| bool | haveOption (std::string name) |
| Check if we have a particular named option. | |
| std::string | getOption (std::string name) |
| Get the value of a particular named option. | |
| void | setOption (std::string name, std::string value) |
| Sets a named option. | |
| bool | haveModuleOption (std::string module, std::string name) |
| Check if we have a particular module-specific option. | |
| std::string | getModuleOption (std::string module, std::string name) |
| Get the value of a particular module-specific option. | |
| void | setModuleOption (std::string module, std::string name, std::string value) |
| Sets the value of a module-specific option. | |
| void | readEnvironment () |
| Checks for relevant environment variables: $WURDE_DATA_DIR $WURDE_CONFIG_DIR $WURDE_BIN_DIR $WURDE_MCP_CONFIG $WURDE_MCP_MAPPINGS $WURDE_LOG_LEVEL $WURDE_LOG_DIRECTORY. | |
Protected Attributes | |
| std::string | m_moduleName |
| std::string | m_dataDir |
| std::string | m_binDir |
| std::string | m_configDir |
| std::string | m_mcpConfigFile |
| std::string | m_logDirectory |
| int | m_logLevel |
| std::multimap< std::string, std::string > | m_options |
| This will store other possible global options. | |
| std::multimap< std::string, std::multimap< std::string, std::string > > | m_moduleOptions |
| This is a multimap of module-specific config options. | |
Default constructor, sets up sensible defaults.
Definition at line 40 of file WURDEConfiguration.cpp.
References WURDEConfiguration::m_binDir, WURDEConfiguration::m_configDir, WURDEConfiguration::m_dataDir, WURDEConfiguration::m_logDirectory, WURDEConfiguration::m_logLevel, WURDEConfiguration::m_mcpConfigFile, and WURDEConfiguration::m_moduleName.
| ~WURDEConfiguration | ( | ) | [inline] |
Definition at line 62 of file WURDEConfiguration.H.
| std::string getDataDirectory | ( | ) | [inline] |
Definition at line 64 of file WURDEConfiguration.H.
References WURDEConfiguration::m_dataDir.
Referenced by StereoDataCollector::initOperator(), ImageWriter::initOperator(), DataCollector::initOperator(), and main().
| std::string getBinDirectory | ( | ) | [inline] |
Definition at line 65 of file WURDEConfiguration.H.
References WURDEConfiguration::m_binDir.
Referenced by Module::startUp().
| std::string getConfigDirectory | ( | ) | [inline] |
Definition at line 66 of file WURDEConfiguration.H.
References WURDEConfiguration::m_configDir.
Referenced by main().
| std::string getMCPConfigFile | ( | ) | [inline] |
Definition at line 67 of file WURDEConfiguration.H.
References WURDEConfiguration::m_mcpConfigFile.
Referenced by main().
| std::string getLogDirectory | ( | ) | [inline] |
Definition at line 68 of file WURDEConfiguration.H.
References WURDEConfiguration::m_logDirectory.
Referenced by Module::startUp().
| std::string getModuleName | ( | ) | [inline] |
| int getLogLevel | ( | ) | [inline] |
Definition at line 71 of file WURDEConfiguration.H.
References WURDEConfiguration::m_logLevel.
Referenced by Logger::initLogger(), and CommsManager::parseOptions().
| void setDataDirectory | ( | std::string | val | ) | [inline] |
Definition at line 73 of file WURDEConfiguration.H.
References WURDEConfiguration::m_dataDir.
Referenced by WURDE::parseWURDEConfig(), and WURDEConfiguration::readEnvironment().
| void setBinDirectory | ( | std::string | val | ) | [inline] |
Definition at line 74 of file WURDEConfiguration.H.
References WURDEConfiguration::m_binDir.
Referenced by WURDE::parseWURDEConfig(), and WURDEConfiguration::readEnvironment().
| void setConfigDirectory | ( | std::string | val | ) | [inline] |
Definition at line 75 of file WURDEConfiguration.H.
References WURDEConfiguration::m_configDir.
Referenced by WURDE::parseWURDEConfig(), and WURDEConfiguration::readEnvironment().
| void setMCPConfigFile | ( | std::string | val | ) | [inline] |
Definition at line 76 of file WURDEConfiguration.H.
References WURDEConfiguration::m_mcpConfigFile.
Referenced by WURDE::parseWURDEConfig(), and WURDEConfiguration::readEnvironment().
| void setLogDirectory | ( | std::string | val | ) | [inline] |
Definition at line 77 of file WURDEConfiguration.H.
References WURDEConfiguration::m_logDirectory.
Referenced by WURDE::parseWURDEConfig(), and WURDEConfiguration::readEnvironment().
| void setModuleName | ( | std::string | val | ) | [inline] |
| void setLogLevel | ( | int | val | ) | [inline] |
Definition at line 80 of file WURDEConfiguration.H.
References WURDEConfiguration::m_logLevel.
Referenced by WURDE::parseWURDEConfig(), and WURDEConfiguration::readEnvironment().
| bool haveOption | ( | std::string | name | ) |
Check if we have a particular named option.
Definition at line 51 of file WURDEConfiguration.cpp.
References WURDE::g_logdebug, and WURDEConfiguration::m_options.
Referenced by main(), and WURDEConfiguration::setOption().
| std::string getOption | ( | std::string | name | ) |
Get the value of a particular named option.
Returns "empty" if not present. If there are multiple options with this name, returns the first.
Definition at line 62 of file WURDEConfiguration.cpp.
References WURDEConfiguration::m_options.
Referenced by initializeLaser(), and main().
| void setOption | ( | std::string | name, | |
| std::string | value | |||
| ) |
Sets a named option.
Definition at line 73 of file WURDEConfiguration.cpp.
References WURDE::g_logdebug, WURDEConfiguration::haveOption(), and WURDEConfiguration::m_options.
Referenced by parseLaserConfig(), CommsManager::parseOptions(), parseRflexConfig(), and WURDE::parseWURDEConfig().
| bool haveModuleOption | ( | std::string | module, | |
| std::string | name | |||
| ) |
Check if we have a particular module-specific option.
Definition at line 86 of file WURDEConfiguration.cpp.
References WURDEConfiguration::m_moduleOptions.
Referenced by StereoDataCollector::initOperator(), ImageWriter::initOperator(), ImagePublisher::initOperator(), and DataCollector::initOperator().
| std::string getModuleOption | ( | std::string | module, | |
| std::string | name | |||
| ) |
Get the value of a particular module-specific option.
Returns "empty" if not present. If there are multiple options with this name, returns the first.
Definition at line 102 of file WURDEConfiguration.cpp.
References WURDEConfiguration::m_moduleOptions.
Referenced by StereoDataCollector::initOperator(), ImageWriter::initOperator(), ImagePublisher::initOperator(), and DataCollector::initOperator().
| void setModuleOption | ( | std::string | module, | |
| std::string | name, | |||
| std::string | value | |||
| ) |
Sets the value of a module-specific option.
Definition at line 120 of file WURDEConfiguration.cpp.
References WURDEConfiguration::m_moduleOptions.
Referenced by WURDEVision::parseVisionFile(), and WURDE::parseWURDEConfig().
| void readEnvironment | ( | ) |
Checks for relevant environment variables: $WURDE_DATA_DIR $WURDE_CONFIG_DIR $WURDE_BIN_DIR $WURDE_MCP_CONFIG $WURDE_MCP_MAPPINGS $WURDE_LOG_LEVEL $WURDE_LOG_DIRECTORY.
Definition at line 135 of file WURDEConfiguration.cpp.
References WURDEConfiguration::setBinDirectory(), WURDEConfiguration::setConfigDirectory(), WURDEConfiguration::setDataDirectory(), WURDEConfiguration::setLogDirectory(), WURDEConfiguration::setLogLevel(), and WURDEConfiguration::setMCPConfigFile().
Referenced by CommsManager::parseOptions().
std::string m_moduleName [protected] |
Definition at line 129 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getModuleName(), WURDEConfiguration::setModuleName(), and WURDEConfiguration::WURDEConfiguration().
std::string m_dataDir [protected] |
Definition at line 131 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getDataDirectory(), WURDEConfiguration::setDataDirectory(), and WURDEConfiguration::WURDEConfiguration().
std::string m_binDir [protected] |
Definition at line 132 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getBinDirectory(), WURDEConfiguration::setBinDirectory(), and WURDEConfiguration::WURDEConfiguration().
std::string m_configDir [protected] |
Definition at line 133 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getConfigDirectory(), WURDEConfiguration::setConfigDirectory(), and WURDEConfiguration::WURDEConfiguration().
std::string m_mcpConfigFile [protected] |
Definition at line 134 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getMCPConfigFile(), WURDEConfiguration::setMCPConfigFile(), and WURDEConfiguration::WURDEConfiguration().
std::string m_logDirectory [protected] |
Definition at line 135 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getLogDirectory(), WURDEConfiguration::setLogDirectory(), and WURDEConfiguration::WURDEConfiguration().
int m_logLevel [protected] |
Definition at line 137 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getLogLevel(), WURDEConfiguration::setLogLevel(), and WURDEConfiguration::WURDEConfiguration().
std::multimap<std::string,std::string> m_options [protected] |
This will store other possible global options.
Definition at line 141 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getOption(), WURDEConfiguration::haveOption(), and WURDEConfiguration::setOption().
std::multimap<std::string,std::multimap<std::string,std::string> > m_moduleOptions [protected] |
This is a multimap of module-specific config options.
Use this for specific instances of modules; referenced by the name of the CommsManager.
Definition at line 147 of file WURDEConfiguration.H.
Referenced by WURDEConfiguration::getModuleOption(), WURDEConfiguration::haveModuleOption(), and WURDEConfiguration::setModuleOption().
1.5.1