Coverage Report

Created: 2026-05-27 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/runtime/function_provider.h
Line
Count
Source
1
// Copyright 2023 Google LLC
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
//     https://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14
15
#ifndef THIRD_PARTY_CEL_CPP_RUNTIME_FUNCTION_PROVIDER_H_
16
#define THIRD_PARTY_CEL_CPP_RUNTIME_FUNCTION_PROVIDER_H_
17
18
#include "absl/status/statusor.h"
19
#include "common/function_descriptor.h"
20
#include "runtime/activation_interface.h"
21
#include "runtime/function_overload_reference.h"
22
23
namespace cel::runtime_internal {
24
25
// Interface for providers of lazily bound functions.
26
//
27
// Lazily bound functions may have an implementation that is dependent on the
28
// evaluation context (as represented by the Activation).
29
class FunctionProvider {
30
 public:
31
0
  virtual ~FunctionProvider() = default;
32
33
  // Returns a reference to a function implementation based on the provided
34
  // Activation. Given the same activation, this should return the same Function
35
  // instance. The cel::FunctionOverloadReference is assumed to be stable for
36
  // the life of the Activation.
37
  //
38
  // An empty optional result is interpreted as no matching overload.
39
  virtual absl::StatusOr<absl::optional<FunctionOverloadReference>> GetFunction(
40
      const FunctionDescriptor& descriptor,
41
      const ActivationInterface& activation) const = 0;
42
};
43
44
}  // namespace cel::runtime_internal
45
46
#endif  // THIRD_PARTY_CEL_CPP_RUNTIME_FUNCTION_PROVIDER_H_