/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/macros.h" |
8 | | #include "absl/strings/string_view.h" |
9 | | #include "base/attribute_matcher.h" |
10 | | #include "eval/public/cel_attribute.h" |
11 | | #include "eval/public/cel_function.h" |
12 | | #include "eval/public/cel_value.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 | 18.9k | 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 | | ABSL_DEPRECATE_AND_INLINE() |
46 | 0 | std::vector<CelAttributePattern> missing_attribute_patterns() const { |
47 | 0 | return GetMissingAttributeMatcher().GetAttributes(); |
48 | 0 | } |
49 | | |
50 | | // Return the collection of attribute patterns that determine "unknown" |
51 | | // values. |
52 | | ABSL_DEPRECATE_AND_INLINE() |
53 | 0 | std::vector<CelAttributePattern> unknown_attribute_patterns() const { |
54 | 0 | return GetUnknownAttributeMatcher().GetAttributes(); |
55 | 0 | } |
56 | | |
57 | 0 | virtual const cel::AttributeMatcher& GetUnknownAttributeMatcher() const { |
58 | 0 | return cel::EmptyAttributeMatcher(); |
59 | 0 | } |
60 | | |
61 | 0 | virtual const cel::AttributeMatcher& GetKnownAttributeMatcher() const { |
62 | 0 | return cel::EmptyAttributeMatcher(); |
63 | 0 | } |
64 | | |
65 | 0 | virtual const cel::AttributeMatcher& GetMissingAttributeMatcher() const { |
66 | 0 | return cel::EmptyAttributeMatcher(); |
67 | 0 | } |
68 | | |
69 | 18.9k | virtual ~BaseActivation() = default; |
70 | | }; |
71 | | |
72 | | } // namespace google::api::expr::runtime |
73 | | |
74 | | #endif // THIRD_PARTY_CEL_CPP_EVAL_PUBLIC_BASE_ACTIVATION_H_ |