1#ifndef FRAMEWORK_PARAMETERS_H
2#define FRAMEWORK_PARAMETERS_H
8#include <boost/core/demangle.hpp>
17#include "Framework/Exception/Exception.h"
42 void add(
const std::string& name,
const T& value) {
44 EXCEPTION_RAISE(
"Config",
45 "The parameter " + name +
46 " already exists in the list of parameters.");
42 void add(
const std::string& name,
const T& value) {
…}
53 void addParameter(
const std::string& name,
const T& value) {
63 bool exists(
const std::string& name)
const {
63 bool exists(
const std::string& name)
const {
…}
78 const T&
get(
const std::string& name)
const {
82 EXCEPTION_RAISE(
"Config",
"Parameter '" + name +
83 "' does not exist in list of parameters.");
87 return std::any_cast<const T&>(
parameters_.at(name));
88 }
catch (
const std::bad_any_cast& e) {
91 "Parameter '" + name +
"' of type '" +
92 boost::core::demangle(
parameters_.at(name).type().name()) +
93 "' is being cast to incorrect type '" +
94 boost::core::demangle(
typeid(T).name()) +
"'.");
78 const T&
get(
const std::string& name)
const {
…}
99 const T& getParameter(
const std::string& name)
const {
113 template <
typename T>
114 const T&
get(
const std::string& name,
const T& def)
const {
115 if (not
exists(name))
return def;
114 const T&
get(
const std::string& name,
const T& def)
const {
…}
121 template <
typename T>
122 const T& getParameter(
const std::string& name,
const T& def)
const {
134 std::vector<std::string>
keys()
const {
135 std::vector<std::string> key;
134 std::vector<std::string>
keys()
const {
…}
Class encapsulating parameters for configuring a processor.
std::vector< std::string > keys() const
Get a list of the keys available.
void add(const std::string &name, const T &value)
Add a parameter to the parameter list.
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
const T & get(const std::string &name, const T &def) const
Retrieve a parameter with a default specified.
bool exists(const std::string &name) const
Check to see if a parameter exists.
std::map< std::string, std::any > parameters_
container holding parameter names and their values
python execution and parameter extraction