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

Method checkMetaOk

src/topp/FileFilter.cpp:438–491  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

436 }
437
438 bool checkMetaOk(const MetaInfoInterface& mi, const StringList& meta_info)
439 {
440 if (!mi.metaValueExists(meta_info[0]))
441 {
442 return true; // not having the meta value means passing the test
443 }
444 DataValue v_data = mi.getMetaValue(meta_info[0]);
445 DataValue v_user;
446 if (v_data.valueType() == DataValue::STRING_VALUE)
447 {
448 v_user = String(meta_info[2]);
449 }
450 else if (v_data.valueType() == DataValue::INT_VALUE)
451 {
452 v_user = String(meta_info[2]).toInt();
453 }
454 else if (v_data.valueType() == DataValue::DOUBLE_VALUE)
455 {
456 v_user = String(meta_info[2]).toDouble();
457 }
458 else if (v_data.valueType() == DataValue::STRING_LIST)
459 {
460 v_user = (StringList)ListUtils::create<String>(meta_info[2]);
461 }
462 else if (v_data.valueType() == DataValue::INT_LIST)
463 {
464 v_user = ListUtils::create<Int>(meta_info[2]);
465 }
466 else if (v_data.valueType() == DataValue::DOUBLE_LIST)
467 {
468 v_user = ListUtils::create<double>(meta_info[2]);
469 }
470 else if (v_data.valueType() == DataValue::EMPTY_VALUE)
471 {
472 v_user = DataValue::EMPTY;
473 }
474 if (meta_info[1] == "lt")
475 {
476 return !(v_data < v_user);
477 }
478 else if (meta_info[1] == "eq")
479 {
480 return !(v_data == v_user);
481 }
482 else if (meta_info[1] == "gt")
483 {
484 return !(v_data > v_user);
485 }
486 else
487 {
488 writeLogError_("Internal Error. Meta value filtering got invalid comparison operator ('" + meta_info[1] + "'), which should have been caught before! Aborting!");
489 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Illegal meta value filtering operator!");
490 }
491 }
492
493 ExitCodes main_(int, const char**) override
494 {

Callers

nothing calls this directly

Calls 5

metaValueExistsMethod · 0.80
getMetaValueMethod · 0.80
toIntMethod · 0.80
toDoubleMethod · 0.80
StringClass · 0.50

Tested by

no test coverage detected