15 #ifndef VISIONTRANSFER_PARAMETERSET_H
16 #define VISIONTRANSFER_PARAMETERSET_H
28 #include <visiontransfer/common.h>
29 #include <visiontransfer/parameter.h>
31 namespace visiontransfer {
35 class ParameterSet:
public std::map<std::string, Parameter> {
42 typedef std::shared_ptr<ParameterSet> ptr;
44 VT_EXPORT Parameter&
get(
const std::string& uid) {
46 if (it==end())
throw std::runtime_error(std::string(
"Attempted to get nonexistent parameter ") + uid);
49 VT_EXPORT
bool add(
const Parameter& param) { operator[](param.getUid()) = param;
return true; }
54 if (it!=end())
return it->second.getCurrent<T>();
55 else return (T) fallback;
61 if (it!=end())
return it->second.getCurrent<T>();
62 else throw std::runtime_error(std::string(
"Parameter not found in the parameter set: ") + key);
65 VT_EXPORT
Parameter& setOrCreateSimpleScalar(
const std::string& uid,
int value);
66 VT_EXPORT
Parameter& setOrCreateSimpleScalar(
const std::string& uid,
bool value);
67 VT_EXPORT
Parameter& setOrCreateSimpleScalar(
const std::string& uid,
double value);
68 VT_EXPORT
Parameter& setOrCreateSimpleScalar(
const std::string& uid,
const std::string& value);