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

Method Evaluate

eval/public/cel_function_registry.cc:39–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37 : CelFunction(descriptor), implementation_(&implementation) {}
38
39 absl::Status Evaluate(absl::Span<const CelValue> args, CelValue* result,
40 google::protobuf::Arena* arena) const override {
41 // This is only safe for use during interop where the MemoryManager is
42 // assumed to always be backed by a google::protobuf::Arena instance. After all
43 // dependencies on legacy CelFunction are removed, we can remove this
44 // implementation.
45
46 std::vector<cel::Value> modern_args =
47 cel::interop_internal::LegacyValueToModernValueOrDie(arena, args);
48
49 CEL_ASSIGN_OR_RETURN(
50 auto modern_result,
51 implementation_->Invoke(
52 modern_args, google::protobuf::DescriptorPool::generated_pool(),
53 google::protobuf::MessageFactory::generated_factory(), arena));
54
55 *result = cel::interop_internal::ModernValueToLegacyValueOrDie(
56 arena, modern_result);
57
58 return absl::OkStatus();
59 }
60
61 private:
62 // owned by the registry

Callers

nothing calls this directly

Calls 2

Tested by

no test coverage detected