MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / getDoubleOption_

Method getDoubleOption_

src/openms/source/APPLICATIONS/TOPPBase.cpp:1277–1305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers 1

main_Method · 0.80

Calls 2

StringClass · 0.50
isEmptyMethod · 0.45

Tested by

no test coverage detected