Interface for configuration back ends.
More...
#include <ConfigurationInterface.h>
|
virtual void | putString (const std::string &path, const std::string &value)=0 |
|
virtual boost::optional
< std::string > | getString (const std::string &path)=0 |
|
template<typename T > |
void | put (const std::string &path, const T &value) |
|
virtual void | putRecursive (const std::string &path, const boost::property_tree::ptree &tree) |
|
template<typename T > |
T | get (const std::string &path) |
|
template<typename T > |
T | get (const std::string &path, const T &defaultValue) |
|
virtual void | setPrefix (const std::string &prefix)=0 |
|
virtual KeyValueMap | getRecursiveMap (const std::string &path={})=0 |
|
virtual boost::property_tree::ptree | getRecursive (const std::string &path={})=0 |
|
template<> |
void | put (const std::string &path, const std::string &value) |
|
template<> |
void | put (const std::string &path, const int &value) |
|
template<> |
void | put (const std::string &path, const double &value) |
|
template<> |
std::string | get (const std::string &path) |
|
template<> |
int | get (const std::string &path) |
|
template<> |
double | get (const std::string &path) |
|
template<> |
auto | get (const std::string &path, const std::string &defaultValue) -> std::string |
|
template<> |
auto | get (const std::string &path, const int &defaultValue) -> int |
|
template<> |
auto | get (const std::string &path, const double &defaultValue) -> double |
|
Interface for configuration back ends.
Interface for configuration back-ends, to put and get configuration parameters.
To maintain runtime polymorphism, while also having a convenient template-like interface, the implementations of put/get operations are in the virtual methods.
template<typename T >
T o2::configuration::ConfigurationInterface::get |
( |
const std::string & |
path | ) |
|
Template convenience interface for get operations.
- Parameters
-
path | The path of the value |
- Returns
- The retrieved value.
- Exceptions
-
std::runtime_error | when value does not exist |
template<typename T >
T o2::configuration::ConfigurationInterface::get |
( |
const std::string & |
path, |
|
|
const T & |
defaultValue |
|
) |
| |
Template convenience interface for get operations with a default value
- Parameters
-
path | The path of the value |
defaultValue | default value which is returned when requested key does not exist |
virtual boost::property_tree::ptree o2::configuration::ConfigurationInterface::getRecursive |
( |
const std::string & |
path = {} | ) |
|
|
pure virtual |
Provides subtree from given path
- Parameters
-
path | The path to the subtree |
- Returns
- Subtree
virtual KeyValueMap o2::configuration::ConfigurationInterface::getRecursiveMap |
( |
const std::string & |
path = {} | ) |
|
|
pure virtual |
Gets key-values recursively from the given path
- Parameters
-
path | The path of the values to get |
- Returns
- A map containing the key-values
virtual boost::optional<std::string> o2::configuration::ConfigurationInterface::getString |
( |
const std::string & |
path | ) |
|
|
pure virtual |
Retrieves a string value from the configuration.
- Parameters
-
path | The path of the value |
- Returns
- The retrieved value
template<typename T >
void o2::configuration::ConfigurationInterface::put |
( |
const std::string & |
path, |
|
|
const T & |
value |
|
) |
| |
Template convenience interface for put operations. Redirects to the appropriate virtual method.
- Parameters
-
T | The type of the value. Supported types are "std::string", "int" and "double" |
path | The path of the value |
value | The value to put |
void o2::configuration::ConfigurationInterface::putRecursive |
( |
const std::string & |
path, |
|
|
const boost::property_tree::ptree & |
tree |
|
) |
| |
|
virtual |
Recursively puts values to the given path
- Parameters
-
path | The path to the destination |
tree | Tree-like data structure |
virtual void o2::configuration::ConfigurationInterface::putString |
( |
const std::string & |
path, |
|
|
const std::string & |
value |
|
) |
| |
|
pure virtual |
Puts a string into the configuration.
- Parameters
-
path | The path of the value |
value | The value to put |
virtual void o2::configuration::ConfigurationInterface::setPrefix |
( |
const std::string & |
prefix | ) |
|
|
pure virtual |
Sets a prefix After this call, all paths given to this object will be prefixed with this. The implementation of this is very backend-dependent and it may not be a trivial call.
- Parameters
-
The documentation for this class was generated from the following files:
- /home/travis/build/AliceO2Group/Configuration/include/Configuration/ConfigurationInterface.h
- /home/travis/build/AliceO2Group/Configuration/src/ConfigurationInterface.cxx