static void setstate(eoValueParam<T>& _param, boost::python::tuple pickled) { std::string v = extract<std::string>(pickled[0]); std::string d = extract<std::string>(pickled[1]); std::string def = extract<std::string>(pickled[2]); std::string l = extract<std::string>(pickled[3]); char s = extract<char>(pickled[4]); bool r = extract<bool>(pickled[5]); _param = eoValueParam<T>(T(), l, d, s, r); _param.defValue(d); _param.setValue(v); }
numeric::array getv< std::vector<double>, numeric::array > (const eoValueParam< std::vector<double> >& param) { const std::vector<double>& v = param.value(); list result; for (unsigned i =0; i < v.size(); ++i) result.append(v[i]); return numeric::array(result); }
void setv< std::pair<double, double>, tuple > (eoValueParam< std::pair<double,double> >& p, tuple val) { extract<double> first(val[0]); extract<double> second(val[1]); if (!first.check()) throw std::runtime_error("doubles expected"); if (!second.check()) throw std::runtime_error("doubles expected"); p.value().first = first(); p.value().second = second(); }
void setv< std::vector<double>, numeric::array > (eoValueParam< std::vector<double> >& param, numeric::array val) { std::vector<double>& v = param.value(); v.resize( boost::python::len(val) ); for (unsigned i = 0; i < v.size(); ++i) { extract<double> x(val[i]); if (!x.check()) throw std::runtime_error("double expected"); v[i] = x(); } }
ConfigFlag<T>::ConfigFlag(const eoValueParam<T>& flag, Condition* condition) : FlagInterface(condition,!flag.required()), _flag(flag.value(), flag.longName(), flag.description(), flag.shortName(), flag.required()) { _processed = false; }
static boost::python::tuple getstate(const eoValueParam<T>& _param) { str v(_param.getValue()); str d(_param.description()); str def(_param.defValue()); str l(_param.longName()); object s(_param.shortName()); object r(_param.required()); return make_tuple(v,d,def,l,s,r); }
void setv(eoValueParam<T>& v, U val) { v.value() = val; }
U getv(const eoValueParam<T>& v) { return v.value(); }
tuple getv<std::pair<double, double>, tuple > (const eoValueParam< std::pair<double,double> >& p) { return make_tuple(p.value().first, p.value().second); }