23 #include <visiontransfer/parameterset.h>
25 namespace visiontransfer {
28 class ParameterSet::Pimpl {
32 Parameter& ParameterSet::setOrCreateSimpleScalar(
const std::string& uid,
int value) {
36 par.setType(ParameterValue::TYPE_INT).setCurrent(value);
37 operator[](uid) = par;
39 if (it->second.isTensor() || it->second.isCommand()) {
40 throw std::runtime_error(
"setOrCreateSimpleScalar(): refusing to overwrite a Tensor or Command parameter");
42 operator[](uid).setCurrent(value);
44 return operator[](uid);
46 Parameter& ParameterSet::setOrCreateSimpleScalar(
const std::string& uid,
bool value) {
50 par.setType(ParameterValue::TYPE_BOOL).setCurrent(value);
51 operator[](uid) = par;
53 if (it->second.isTensor() || it->second.isCommand()) {
54 throw std::runtime_error(
"setOrCreateSimpleScalar(): refusing to overwrite a Tensor or Command parameter");
56 operator[](uid).setCurrent(value);
58 return operator[](uid);
60 Parameter& ParameterSet::setOrCreateSimpleScalar(
const std::string& uid,
double value) {
64 par.setType(ParameterValue::TYPE_DOUBLE).setCurrent(value);
65 operator[](uid) = par;
67 if (it->second.isTensor() || it->second.isCommand()) {
68 throw std::runtime_error(
"setOrCreateSimpleScalar(): refusing to overwrite a Tensor or Command parameter");
70 operator[](uid).setCurrent(value);
72 return operator[](uid);
74 Parameter& ParameterSet::setOrCreateSimpleScalar(
const std::string& uid,
const std::string& value) {
78 par.setType(ParameterValue::TYPE_STRING).setCurrent(value);
79 operator[](uid) = par;
81 if (it->second.isTensor() || it->second.isCommand()) {
82 throw std::runtime_error(
"setOrCreateSimpleScalar(): refusing to overwrite a Tensor or Command parameter");
84 operator[](uid).setCurrent(value);
86 return operator[](uid);