2#ifndef PFLIB_CONFIG_PARAMETERS_H
3#define PFLIB_CONFIG_PARAMETERS_H
9#include <boost/core/demangle.hpp>
18#include "pflib/Exception.h"
45 if (not overlay and
exists(name)) {
46 PFEXCEPTION_RAISE(
"Config",
47 "The parameter " + name +
48 " already exists in the list of parameters.");
79 "Parameter '" + name +
"' does not exist in list of parameters.");
84 }
catch (
const std::bad_any_cast& e) {
87 "Parameter '" + name +
"' of type '" +
89 "' is being cast to incorrect type '" +
90 boost::core::demangle(
typeid(T).name()) +
"'.");
104 template <
typename T>
106 if (not
exists(name))
return def;
Class encapsulating parameters for generically holding configuration parameters.
Definition Parameters.h:31
const T & get(const std::string &name, const T &def) const
Retrieve a parameter with a default specified.
Definition Parameters.h:105
std::vector< std::string > keys() const
Get a list of the keys available.
Definition Parameters.cxx:104
bool exists(const std::string &name) const
Check to see if a parameter exists.
Definition Parameters.cxx:100
const T & get(const std::string &name) const
Retrieve the parameter of the given name.
Definition Parameters.h:73
void from_yaml(const std::string &filepath, bool overlay=true)
Load parameters from a YAML file.
Definition Parameters.cxx:110
void add(const std::string &name, const T &value, bool overlay=false)
Add a parameter to the parameter list.
Definition Parameters.h:44
std::map< std::string, std::any > parameters_
container holding parameter names and their values
Definition Parameters.h:132
This version of the fast control code interfaces with the CMS Fast control library which can be contr...
Definition Backend.cxx:3