| 1275 | } |
| 1276 | |
| 1277 | double TOPPBase::getDoubleOption_(const String& name) const |
| 1278 | { |
| 1279 | const ParameterInformation& p = findEntry_(name); |
| 1280 | if (p.type != ParameterInformation::DOUBLE) |
| 1281 | { |
| 1282 | throw WrongParameterType(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, name); |
| 1283 | } |
| 1284 | if (p.required && getParam_(name).isEmpty()) |
| 1285 | { |
| 1286 | throw RequiredParameterNotGiven(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, name); |
| 1287 | } |
| 1288 | double tmp = getParamAsDouble_(name, (double)p.default_value); |
| 1289 | if (p.required && std::isnan(tmp)) |
| 1290 | { |
| 1291 | throw RequiredParameterNotGiven(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, name); |
| 1292 | } |
| 1293 | writeDebug_(String("Value of double option '") + name + "': " + String(tmp), 1); |
| 1294 | |
| 1295 | //check if in valid range |
| 1296 | if (p.required || (!getParam_(name).isEmpty() && tmp != (double)p.default_value)) |
| 1297 | { |
| 1298 | if (tmp < p.min_float || tmp > p.max_float) |
| 1299 | { |
| 1300 | throw InvalidParameter(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, String("Invalid value '") + tmp + "' for float parameter '" + name + "' given. Out of valid range: '" + p.min_float + "'-'" + p.max_float + "'."); |
| 1301 | } |
| 1302 | } |
| 1303 | |
| 1304 | return tmp; |
| 1305 | } |
| 1306 | |
| 1307 | Int TOPPBase::getIntOption_(const String& name) const |
| 1308 | { |