| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "na64util/functions.hh" | ||
| 2 | #include "na64util/str-fmt.hh" | ||
| 3 | |||
| 4 | #include <cstdio> | ||
| 5 | #include <cstring> | ||
| 6 | #include <stdexcept> | ||
| 7 | |||
| 8 | namespace na64dp { | ||
| 9 | namespace functions { | ||
| 10 | |||
| 11 | ✗ | static bool _gt(double a, double b) { return a > b; } | |
| 12 | ✗ | static bool _ge(double a, double b) { return a >= b; } | |
| 13 | ✗ | static bool _lt(double a, double b) { return a < b; } | |
| 14 | ✗ | static bool _le(double a, double b) { return a <= b; } | |
| 15 | |||
| 16 | ✗ | Comparator get_comparator(const char * strExpr) { | |
| 17 | ✗ | if( !strcmp(strExpr, ">") || !strcmp(strExpr, "gt") ) { | |
| 18 | ✗ | return _gt; | |
| 19 | ✗ | } else if( !strcmp(strExpr, ">=") || !strcmp(strExpr, "ge") ) { | |
| 20 | ✗ | return _ge; | |
| 21 | ✗ | } else if( !strcmp(strExpr, "<") || !strcmp(strExpr, "lt") ) { | |
| 22 | ✗ | return _lt; | |
| 23 | ✗ | } else if( !strcmp(strExpr, "<=") || !strcmp(strExpr, "le") ) { | |
| 24 | ✗ | return _le; | |
| 25 | } else { | ||
| 26 | ✗ | NA64DP_RUNTIME_ERROR( "Can not interpret \"%s\" as comparison expression." | |
| 27 | , strExpr ); | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | } | ||
| 32 | } | ||
| 33 |