Evaluate the Expression Node child and assert that it is boolean.
362 {
363 typename AVariableManager::VarVariant ret = m_enode->evaluate(p);
364 if (std::holds_alternative<bool>(ret)) {
365 return std::get<bool>(ret);
366 } else if (std::holds_alternative<int>(ret)) {
367 return static_cast<bool>(std::get<int>(ret));
368 } else if (std::holds_alternative<double>(ret)) {
369 if (static_cast<bool>(std::get<double>(ret))) {
370
371 if (std::isnan(std::get<double>(ret))) {
372 return false;
373 }
374 if (std::get<double>(ret) != 1.0)
375 B2WARNING("Static casting of double value to bool in cutstring evaluation." << LogVar("Cut substring",
376 m_enode->decompile()) << LogVar(" Casted value", std::get<double>(ret)) << LogVar("Casted to", "true"));
377 } else {
378 if (std::get<double>(ret) != 0.0)
379 B2WARNING("Static casting of double value to bool in cutstring evaluation." << LogVar("Cut substring",
380 m_enode->decompile()) << LogVar(" Casted value", std::get<double>(ret)) << LogVar("Casted to", "false"));
381 }
382
383 return static_cast<bool>(std::get<double>(ret));
384 } else {
385 throw std::runtime_error("UnaryRelationalNode should evaluate to bool.");
386 }
387 }