Coverage Report

Created: 2026-05-27 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/proc/self/cwd/eval/public/base_activation.h
Line
Count
Source
1
#ifndef THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_BASE_ACTIVATION_H_
2
#define THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_BASE_ACTIVATION_H_
3
4
#include <vector>
5
6
#include "google/protobuf/field_mask.pb.h"
7
#include "absl/base/nullability.h"
8
#include "absl/strings/string_view.h"
9
#include "eval/public/cel_attribute.h"
10
#include "eval/public/cel_function.h"
11
#include "eval/public/cel_value.h"
12
#include "runtime/internal/attribute_matcher.h"
13
14
namespace cel::runtime_internal {
15
class ActivationAttributeMatcherAccess;
16
}
17
18
namespace google::api::expr::runtime {
19
20
// Base class for an activation.
21
class BaseActivation {
22
 public:
23
9.92k
  BaseActivation() = default;
24
25
  // Non-copyable/non-assignable
26
  BaseActivation(const BaseActivation&) = delete;
27
  BaseActivation& operator=(const BaseActivation&) = delete;
28
29
  // Move-constructible/move-assignable
30
  BaseActivation(BaseActivation&& other) = default;
31
  BaseActivation& operator=(BaseActivation&& other) = default;
32
33
  // Return a list of function overloads for the given name.
34
  virtual std::vector<const CelFunction*> FindFunctionOverloads(
35
      absl::string_view) const = 0;
36
37
  // Provide the value that is bound to the name, if found.
38
  // arena parameter is provided to support the case when we want to pass the
39
  // ownership of returned object ( Message/List/Map ) to Evaluator.
40
  virtual absl::optional<CelValue> FindValue(absl::string_view,
41
                                             google::protobuf::Arena*) const = 0;
42
43
  // Return the collection of attribute patterns that determine missing
44
  // attributes.
45
  virtual const std::vector<CelAttributePattern>& missing_attribute_patterns()
46
0
      const {
47
0
    static const std::vector<CelAttributePattern>* empty =
48
0
        new std::vector<CelAttributePattern>({});
49
0
    return *empty;
50
0
  }
51
52
  // Return the collection of attribute patterns that determine "unknown"
53
  // values.
54
  virtual const std::vector<CelAttributePattern>& unknown_attribute_patterns()
55
0
      const {
56
0
    static const std::vector<CelAttributePattern>* empty =
57
0
        new std::vector<CelAttributePattern>({});
58
0
    return *empty;
59
0
  }
60
61
9.92k
  virtual ~BaseActivation() = default;
62
63
 private:
64
  friend class cel::runtime_internal::ActivationAttributeMatcherAccess;
65
66
  // Internal getter for overriding the attribute matching behavior.
67
  virtual const cel::runtime_internal::AttributeMatcher* absl_nullable
68
0
  GetAttributeMatcher() const {
69
0
    return nullptr;
70
0
  }
71
};
72
73
}  // namespace google::api::expr::runtime
74
75
#endif  // THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_BASE_ACTIVATION_H_