MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / CompileAndEvaluateWithBoolVar

Function CompileAndEvaluateWithBoolVar

codelab/exercise2.cc:109–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107} // namespace
108
109absl::StatusOr<bool> CompileAndEvaluateWithBoolVar(absl::string_view cel_expr,
110 bool bool_var) {
111 CEL_ASSIGN_OR_RETURN(std::unique_ptr<cel::Compiler> compiler,
112 MakeCelCompiler());
113
114 CEL_ASSIGN_OR_RETURN(CheckedExpr checked_expr,
115 CompileToCheckedExpr(*compiler, cel_expr));
116
117 Activation activation;
118 google::protobuf::Arena arena;
119 // === Start Codelab ===
120 // Update the activation to bind the bool argument to 'bool_var'
121 // === End Codelab ===
122
123 return EvalCheckedExpr(checked_expr, activation, &arena);
124}
125
126absl::StatusOr<bool> CompileAndEvaluateWithContext(
127 absl::string_view cel_expr, const AttributeContext& context) {

Callers 2

TruthTableTestFunction · 0.70
TESTFunction · 0.70

Calls 3

MakeCelCompilerFunction · 0.70
EvalCheckedExprFunction · 0.70
CEL_ASSIGN_OR_RETURNFunction · 0.50

Tested by 2

TruthTableTestFunction · 0.56
TESTFunction · 0.56