MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / expr_binary_op

Function expr_binary_op

extensions/expression-language/Expression.cpp:864–874  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

862}
863
864Value expr_binary_op(const std::vector<Value> &args, long double (*ldop)(long double, long double), int64_t (*iop)(int64_t, int64_t), bool long_only = false) {
865 try {
866 if (!long_only && !args[0].isDecimal() && !args[1].isDecimal()) {
867 return Value(iop(args[0].asSignedLong(), args[1].asSignedLong()));
868 } else {
869 return Value(ldop(args[0].asLongDouble(), args[1].asLongDouble()));
870 }
871 } catch (const std::exception &) {
872 return Value();
873 }
874}
875
876Value expr_plus(const std::vector<Value> &args) {
877 return expr_binary_op(args, [](long double a, long double b) {return a + b;}, [](int64_t a, int64_t b) {return a + b;});

Callers 5

expr_plusFunction · 0.85
expr_minusFunction · 0.85
expr_multiplyFunction · 0.85
expr_divideFunction · 0.85
expr_modFunction · 0.85

Calls 4

isDecimalMethod · 0.80
asSignedLongMethod · 0.80
asLongDoubleMethod · 0.80
ValueClass · 0.50

Tested by

no test coverage detected