Represents a set of parameters that can be loaded from a YAML file.
More...
#include <Config.h>
|
using | Ptr = std::shared_ptr< Config > |
|
using | ParamMap = std::map< std::string, ParameterBase * > |
|
|
| Config (const std::string &config_name) |
|
virtual | ~Config () |
|
void | addParameter (const std::string ¶m_name, ParameterBase *param, ParamPolicy policy=ParamPolicy::Required, std::function< void()> on_loading_success=0) |
| Returns true if all params added with have been set. More...
|
|
template<class T > |
void | addParameter (const std::string ¶m_name, T ¶m, ParamPolicy policy=ParamPolicy::Required, std::function< void()> on_loading_success=0) |
|
ParameterBase * | getParameter (const std::string ¶m_name) |
| Returns a param via its name. More...
|
|
void | print () const |
| Print all parameters to std::cout. More...
|
|
bool | loadFromFile (const std::string &yaml_url) |
| Configure the task from YAML/JSON file. It must contain all the required parameters. More...
|
|
bool | loadFromString (const std::string &yaml_str) |
| Configure the task from YAML/JSON string. It must contain all the required parameters. More...
|
|
bool | areAllRequiredParametersSet () const |
|
const ParamMap & | getAllParameters () const |
|
void | onSuccess (std::function< void()> f) |
|
| OrcaObject (const std::string &name) |
|
virtual | ~OrcaObject () |
|
const std::string & | getName () const |
|
void | setName (const std::string &name) |
|
Represents a set of parameters that can be loaded from a YAML file.
Config::Config |
( |
const std::string & |
config_name | ) |
|
void Config::addParameter |
( |
const std::string & |
param_name, |
|
|
ParameterBase * |
param, |
|
|
ParamPolicy |
policy = ParamPolicy::Required , |
|
|
std::function< void()> |
on_loading_success = 0 |
|
) |
| |
Returns true if all params added with have been set.
- Returns
- true is all the required parameters are loaded properly
template<class T >
void orca::common::Config::addParameter |
( |
const std::string & |
param_name, |
|
|
T & |
param, |
|
|
ParamPolicy |
policy = ParamPolicy::Required , |
|
|
std::function< void()> |
on_loading_success = 0 |
|
) |
| |
|
inline |
bool Config::areAllRequiredParametersSet |
( |
| ) |
const |
ParameterBase * Config::getParameter |
( |
const std::string & |
param_name | ) |
|
Returns a param via its name.
- Parameters
-
param_name | The name of the param (might not exist) |
- Returns
- orca::common::ParameterBase* The param pointer, nullptr if if does not exists
bool Config::loadFromFile |
( |
const std::string & |
yaml_url | ) |
|
Configure the task from YAML/JSON file. It must contain all the required parameters.
- Returns
- true is all the required parameters are loaded properly
bool Config::loadFromString |
( |
const std::string & |
yaml_str | ) |
|
Configure the task from YAML/JSON string. It must contain all the required parameters.
- Returns
- true is all the required parameters are loaded properly
void Config::onSuccess |
( |
std::function< void()> |
f | ) |
|
void Config::print |
( |
| ) |
const |
Print all parameters to std::cout.
The documentation for this class was generated from the following files:
- /home/docs/checkouts/readthedocs.org/user_builds/orca-controller/checkouts/dev/include/orca/common/Config.h
- /home/docs/checkouts/readthedocs.org/user_builds/orca-controller/checkouts/dev/src/common/Config.cc