/proc/self/cwd/runtime/standard/comparison_functions.cc
Line | Count | Source |
1 | | // Copyright 2021 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 | | #include "runtime/standard/comparison_functions.h" |
16 | | |
17 | | #include <cstdint> |
18 | | |
19 | | #include "absl/status/status.h" |
20 | | #include "absl/time/time.h" |
21 | | #include "base/builtins.h" |
22 | | #include "base/function_adapter.h" |
23 | | #include "common/value.h" |
24 | | #include "internal/number.h" |
25 | | #include "internal/status_macros.h" |
26 | | #include "runtime/function_registry.h" |
27 | | #include "runtime/runtime_options.h" |
28 | | |
29 | | namespace cel { |
30 | | |
31 | | namespace { |
32 | | |
33 | | using ::cel::internal::Number; |
34 | | |
35 | | // Comparison template functions |
36 | | template <class Type> |
37 | 117k | bool LessThan(Type t1, Type t2) { |
38 | 117k | return (t1 < t2); |
39 | 117k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<bool>(bool, bool) Line | Count | Source | 37 | 1.29k | bool LessThan(Type t1, Type t2) { | 38 | 1.29k | return (t1 < t2); | 39 | 1.29k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<long>(long, long) Line | Count | Source | 37 | 113k | bool LessThan(Type t1, Type t2) { | 38 | 113k | return (t1 < t2); | 39 | 113k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 37 | 555 | bool LessThan(Type t1, Type t2) { | 38 | 555 | return (t1 < t2); | 39 | 555 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<double>(double, double) Line | Count | Source | 37 | 1.75k | bool LessThan(Type t1, Type t2) { | 38 | 1.75k | return (t1 < t2); | 39 | 1.75k | } |
|
40 | | |
41 | | template <class Type> |
42 | 30.5k | bool LessThanOrEqual(Type t1, Type t2) { |
43 | 30.5k | return (t1 <= t2); |
44 | 30.5k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<bool>(bool, bool) Line | Count | Source | 42 | 195 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 195 | return (t1 <= t2); | 44 | 195 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<long>(long, long) Line | Count | Source | 42 | 29.0k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 29.0k | return (t1 <= t2); | 44 | 29.0k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 42 | 597 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 597 | return (t1 <= t2); | 44 | 597 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<double>(double, double) Line | Count | Source | 42 | 642 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 642 | return (t1 <= t2); | 44 | 642 | } |
|
45 | | |
46 | | template <class Type> |
47 | 37.1k | bool GreaterThan(Type t1, Type t2) { |
48 | 37.1k | return LessThan(t2, t1); |
49 | 37.1k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<bool>(bool, bool) Line | Count | Source | 47 | 926 | bool GreaterThan(Type t1, Type t2) { | 48 | 926 | return LessThan(t2, t1); | 49 | 926 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<long>(long, long) Line | Count | Source | 47 | 35.9k | bool GreaterThan(Type t1, Type t2) { | 48 | 35.9k | return LessThan(t2, t1); | 49 | 35.9k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 47 | 58 | bool GreaterThan(Type t1, Type t2) { | 48 | 58 | return LessThan(t2, t1); | 49 | 58 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<double>(double, double) Line | Count | Source | 47 | 240 | bool GreaterThan(Type t1, Type t2) { | 48 | 240 | return LessThan(t2, t1); | 49 | 240 | } |
|
50 | | |
51 | | template <class Type> |
52 | 9.22k | bool GreaterThanOrEqual(Type t1, Type t2) { |
53 | 9.22k | return LessThanOrEqual(t2, t1); |
54 | 9.22k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<bool>(bool, bool) Line | Count | Source | 52 | 127 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 127 | return LessThanOrEqual(t2, t1); | 54 | 127 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<long>(long, long) Line | Count | Source | 52 | 8.37k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 8.37k | return LessThanOrEqual(t2, t1); | 54 | 8.37k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 52 | 374 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 374 | return LessThanOrEqual(t2, t1); | 54 | 374 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<double>(double, double) Line | Count | Source | 52 | 348 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 348 | return LessThanOrEqual(t2, t1); | 54 | 348 | } |
|
55 | | |
56 | | // String value comparions specializations |
57 | | template <> |
58 | 127 | bool LessThan(const StringValue& t1, const StringValue& t2) { |
59 | 127 | return t1.Compare(t2) < 0; |
60 | 127 | } |
61 | | |
62 | | template <> |
63 | 511 | bool LessThanOrEqual(const StringValue& t1, const StringValue& t2) { |
64 | 511 | return t1.Compare(t2) <= 0; |
65 | 511 | } |
66 | | |
67 | | template <> |
68 | 268 | bool GreaterThan(const StringValue& t1, const StringValue& t2) { |
69 | 268 | return t1.Compare(t2) > 0; |
70 | 268 | } |
71 | | |
72 | | template <> |
73 | 77 | bool GreaterThanOrEqual(const StringValue& t1, const StringValue& t2) { |
74 | 77 | return t1.Compare(t2) >= 0; |
75 | 77 | } |
76 | | |
77 | | // bytes value comparions specializations |
78 | | template <> |
79 | 386 | bool LessThan(const BytesValue& t1, const BytesValue& t2) { |
80 | 386 | return t1.Compare(t2) < 0; |
81 | 386 | } |
82 | | |
83 | | template <> |
84 | 182 | bool LessThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
85 | 182 | return t1.Compare(t2) <= 0; |
86 | 182 | } |
87 | | |
88 | | template <> |
89 | 283 | bool GreaterThan(const BytesValue& t1, const BytesValue& t2) { |
90 | 283 | return t1.Compare(t2) > 0; |
91 | 283 | } |
92 | | |
93 | | template <> |
94 | 72 | bool GreaterThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
95 | 72 | return t1.Compare(t2) >= 0; |
96 | 72 | } |
97 | | |
98 | | // Duration comparison specializations |
99 | | template <> |
100 | 1.02k | bool LessThan(absl::Duration t1, absl::Duration t2) { |
101 | 1.02k | return absl::operator<(t1, t2); |
102 | 1.02k | } |
103 | | |
104 | | template <> |
105 | 659 | bool LessThanOrEqual(absl::Duration t1, absl::Duration t2) { |
106 | 659 | return absl::operator<=(t1, t2); |
107 | 659 | } |
108 | | |
109 | | template <> |
110 | 437 | bool GreaterThan(absl::Duration t1, absl::Duration t2) { |
111 | 437 | return absl::operator>(t1, t2); |
112 | 437 | } |
113 | | |
114 | | template <> |
115 | 127 | bool GreaterThanOrEqual(absl::Duration t1, absl::Duration t2) { |
116 | 127 | return absl::operator>=(t1, t2); |
117 | 127 | } |
118 | | |
119 | | // Timestamp comparison specializations |
120 | | template <> |
121 | 449 | bool LessThan(absl::Time t1, absl::Time t2) { |
122 | 449 | return absl::operator<(t1, t2); |
123 | 449 | } |
124 | | |
125 | | template <> |
126 | 717 | bool LessThanOrEqual(absl::Time t1, absl::Time t2) { |
127 | 717 | return absl::operator<=(t1, t2); |
128 | 717 | } |
129 | | |
130 | | template <> |
131 | 293 | bool GreaterThan(absl::Time t1, absl::Time t2) { |
132 | 293 | return absl::operator>(t1, t2); |
133 | 293 | } |
134 | | |
135 | | template <> |
136 | 520 | bool GreaterThanOrEqual(absl::Time t1, absl::Time t2) { |
137 | 520 | return absl::operator>=(t1, t2); |
138 | 520 | } |
139 | | |
140 | | template <typename T, typename U> |
141 | 74.5k | bool CrossNumericLessThan(T t, U u) { |
142 | 74.5k | return Number(t) < Number(u); |
143 | 74.5k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, long>(double, long) Line | Count | Source | 141 | 8.10k | bool CrossNumericLessThan(T t, U u) { | 142 | 8.10k | return Number(t) < Number(u); | 143 | 8.10k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 141 | 2.25k | bool CrossNumericLessThan(T t, U u) { | 142 | 2.25k | return Number(t) < Number(u); | 143 | 2.25k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 141 | 12.6k | bool CrossNumericLessThan(T t, U u) { | 142 | 12.6k | return Number(t) < Number(u); | 143 | 12.6k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 141 | 7.79k | bool CrossNumericLessThan(T t, U u) { | 142 | 7.79k | return Number(t) < Number(u); | 143 | 7.79k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, double>(long, double) Line | Count | Source | 141 | 38.2k | bool CrossNumericLessThan(T t, U u) { | 142 | 38.2k | return Number(t) < Number(u); | 143 | 38.2k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 141 | 5.50k | bool CrossNumericLessThan(T t, U u) { | 142 | 5.50k | return Number(t) < Number(u); | 143 | 5.50k | } |
|
144 | | |
145 | | template <typename T, typename U> |
146 | 33.8k | bool CrossNumericGreaterThan(T t, U u) { |
147 | 33.8k | return Number(t) > Number(u); |
148 | 33.8k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, long>(double, long) Line | Count | Source | 146 | 1.16k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.16k | return Number(t) > Number(u); | 148 | 1.16k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 146 | 2.13k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.13k | return Number(t) > Number(u); | 148 | 2.13k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 146 | 7.96k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 7.96k | return Number(t) > Number(u); | 148 | 7.96k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 146 | 2.13k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.13k | return Number(t) > Number(u); | 148 | 2.13k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, double>(long, double) Line | Count | Source | 146 | 17.2k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 17.2k | return Number(t) > Number(u); | 148 | 17.2k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 146 | 3.20k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 3.20k | return Number(t) > Number(u); | 148 | 3.20k | } |
|
149 | | |
150 | | template <typename T, typename U> |
151 | 22.7k | bool CrossNumericLessOrEqualTo(T t, U u) { |
152 | 22.7k | return Number(t) <= Number(u); |
153 | 22.7k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, long>(double, long) Line | Count | Source | 151 | 1.49k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.49k | return Number(t) <= Number(u); | 153 | 1.49k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 151 | 1.24k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.24k | return Number(t) <= Number(u); | 153 | 1.24k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 151 | 1.92k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.92k | return Number(t) <= Number(u); | 153 | 1.92k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 151 | 3.18k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 3.18k | return Number(t) <= Number(u); | 153 | 3.18k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, double>(long, double) Line | Count | Source | 151 | 12.1k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 12.1k | return Number(t) <= Number(u); | 153 | 12.1k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 151 | 2.73k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.73k | return Number(t) <= Number(u); | 153 | 2.73k | } |
|
154 | | |
155 | | template <typename T, typename U> |
156 | 13.2k | bool CrossNumericGreaterOrEqualTo(T t, U u) { |
157 | 13.2k | return Number(t) >= Number(u); |
158 | 13.2k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, long>(double, long) Line | Count | Source | 156 | 1.05k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.05k | return Number(t) >= Number(u); | 158 | 1.05k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 156 | 1.22k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.22k | return Number(t) >= Number(u); | 158 | 1.22k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 156 | 1.05k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.05k | return Number(t) >= Number(u); | 158 | 1.05k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 156 | 7.22k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 7.22k | return Number(t) >= Number(u); | 158 | 7.22k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, double>(long, double) Line | Count | Source | 156 | 987 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 987 | return Number(t) >= Number(u); | 158 | 987 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 156 | 1.69k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.69k | return Number(t) >= Number(u); | 158 | 1.69k | } |
|
159 | | |
160 | | template <class Type> |
161 | | absl::Status RegisterComparisonFunctionsForType( |
162 | 180k | cel::FunctionRegistry& registry) { |
163 | 180k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; |
164 | 180k | CEL_RETURN_IF_ERROR(registry.Register( |
165 | 180k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), |
166 | 180k | FunctionAdapter::WrapFunction(LessThan<Type>))); |
167 | | |
168 | 180k | CEL_RETURN_IF_ERROR(registry.Register( |
169 | 180k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), |
170 | 180k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); |
171 | | |
172 | 180k | CEL_RETURN_IF_ERROR(registry.Register( |
173 | 180k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), |
174 | 180k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); |
175 | | |
176 | 180k | CEL_RETURN_IF_ERROR(registry.Register( |
177 | 180k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), |
178 | 180k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); |
179 | | |
180 | 180k | return absl::OkStatus(); |
181 | 180k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<bool>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<double>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::StringValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::BytesValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Duration>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Time>(cel::FunctionRegistry&) Line | Count | Source | 162 | 22.5k | cel::FunctionRegistry& registry) { | 163 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 22.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 22.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 22.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 22.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 22.5k | return absl::OkStatus(); | 181 | 22.5k | } |
|
182 | | |
183 | | absl::Status RegisterHomogenousComparisonFunctions( |
184 | 0 | cel::FunctionRegistry& registry) { |
185 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
186 | | |
187 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
188 | | |
189 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
190 | | |
191 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
192 | | |
193 | 0 | CEL_RETURN_IF_ERROR( |
194 | 0 | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
195 | | |
196 | 0 | CEL_RETURN_IF_ERROR( |
197 | 0 | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
198 | | |
199 | 0 | CEL_RETURN_IF_ERROR( |
200 | 0 | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
201 | | |
202 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
203 | | |
204 | 0 | return absl::OkStatus(); |
205 | 0 | } |
206 | | |
207 | | template <typename T, typename U> |
208 | 135k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { |
209 | 135k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; |
210 | 135k | CEL_RETURN_IF_ERROR(registry.Register( |
211 | 135k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, |
212 | 135k | /*receiver_style=*/false), |
213 | 135k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); |
214 | 135k | CEL_RETURN_IF_ERROR(registry.Register( |
215 | 135k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, |
216 | 135k | /*receiver_style=*/false), |
217 | 135k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); |
218 | 135k | CEL_RETURN_IF_ERROR(registry.Register( |
219 | 135k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, |
220 | 135k | /*receiver_style=*/false), |
221 | 135k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); |
222 | 135k | CEL_RETURN_IF_ERROR(registry.Register( |
223 | 135k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, |
224 | 135k | /*receiver_style=*/false), |
225 | 135k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); |
226 | 135k | return absl::OkStatus(); |
227 | 135k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 22.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 22.5k | /*receiver_style=*/false), | 213 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 22.5k | /*receiver_style=*/false), | 217 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 22.5k | /*receiver_style=*/false), | 221 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 22.5k | /*receiver_style=*/false), | 225 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 22.5k | return absl::OkStatus(); | 227 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 22.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 22.5k | /*receiver_style=*/false), | 213 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 22.5k | /*receiver_style=*/false), | 217 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 22.5k | /*receiver_style=*/false), | 221 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 22.5k | /*receiver_style=*/false), | 225 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 22.5k | return absl::OkStatus(); | 227 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 22.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 22.5k | /*receiver_style=*/false), | 213 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 22.5k | /*receiver_style=*/false), | 217 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 22.5k | /*receiver_style=*/false), | 221 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 22.5k | /*receiver_style=*/false), | 225 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 22.5k | return absl::OkStatus(); | 227 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 22.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 22.5k | /*receiver_style=*/false), | 213 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 22.5k | /*receiver_style=*/false), | 217 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 22.5k | /*receiver_style=*/false), | 221 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 22.5k | /*receiver_style=*/false), | 225 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 22.5k | return absl::OkStatus(); | 227 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 22.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 22.5k | /*receiver_style=*/false), | 213 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 22.5k | /*receiver_style=*/false), | 217 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 22.5k | /*receiver_style=*/false), | 221 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 22.5k | /*receiver_style=*/false), | 225 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 22.5k | return absl::OkStatus(); | 227 | 22.5k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 22.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 22.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 22.5k | /*receiver_style=*/false), | 213 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 22.5k | /*receiver_style=*/false), | 217 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 22.5k | /*receiver_style=*/false), | 221 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 22.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 22.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 22.5k | /*receiver_style=*/false), | 225 | 22.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 22.5k | return absl::OkStatus(); | 227 | 22.5k | } |
|
228 | | |
229 | | absl::Status RegisterHeterogeneousComparisonFunctions( |
230 | 22.5k | cel::FunctionRegistry& registry) { |
231 | 22.5k | CEL_RETURN_IF_ERROR( |
232 | 22.5k | (RegisterCrossNumericComparisons<double, int64_t>(registry))); |
233 | 22.5k | CEL_RETURN_IF_ERROR( |
234 | 22.5k | (RegisterCrossNumericComparisons<double, uint64_t>(registry))); |
235 | | |
236 | 22.5k | CEL_RETURN_IF_ERROR( |
237 | 22.5k | (RegisterCrossNumericComparisons<uint64_t, double>(registry))); |
238 | 22.5k | CEL_RETURN_IF_ERROR( |
239 | 22.5k | (RegisterCrossNumericComparisons<uint64_t, int64_t>(registry))); |
240 | | |
241 | 22.5k | CEL_RETURN_IF_ERROR( |
242 | 22.5k | (RegisterCrossNumericComparisons<int64_t, double>(registry))); |
243 | 22.5k | CEL_RETURN_IF_ERROR( |
244 | 22.5k | (RegisterCrossNumericComparisons<int64_t, uint64_t>(registry))); |
245 | | |
246 | 22.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
247 | 22.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
248 | 22.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
249 | 22.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
250 | 22.5k | CEL_RETURN_IF_ERROR( |
251 | 22.5k | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
252 | 22.5k | CEL_RETURN_IF_ERROR( |
253 | 22.5k | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
254 | 22.5k | CEL_RETURN_IF_ERROR( |
255 | 22.5k | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
256 | 22.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
257 | | |
258 | 22.5k | return absl::OkStatus(); |
259 | 22.5k | } |
260 | | } // namespace |
261 | | |
262 | | absl::Status RegisterComparisonFunctions(FunctionRegistry& registry, |
263 | 22.5k | const RuntimeOptions& options) { |
264 | 22.5k | if (options.enable_heterogeneous_equality) { |
265 | 22.5k | CEL_RETURN_IF_ERROR(RegisterHeterogeneousComparisonFunctions(registry)); |
266 | 22.5k | } else { |
267 | 0 | CEL_RETURN_IF_ERROR(RegisterHomogenousComparisonFunctions(registry)); |
268 | 0 | } |
269 | 22.5k | return absl::OkStatus(); |
270 | 22.5k | } |
271 | | |
272 | | } // namespace cel |