/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 | 111k | bool LessThan(Type t1, Type t2) { |
38 | 111k | return (t1 < t2); |
39 | 111k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<bool>(bool, bool) Line | Count | Source | 37 | 778 | bool LessThan(Type t1, Type t2) { | 38 | 778 | return (t1 < t2); | 39 | 778 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<long>(long, long) Line | Count | Source | 37 | 108k | bool LessThan(Type t1, Type t2) { | 38 | 108k | return (t1 < t2); | 39 | 108k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 37 | 1.19k | bool LessThan(Type t1, Type t2) { | 38 | 1.19k | return (t1 < t2); | 39 | 1.19k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<double>(double, double) Line | Count | Source | 37 | 702 | bool LessThan(Type t1, Type t2) { | 38 | 702 | return (t1 < t2); | 39 | 702 | } |
|
40 | | |
41 | | template <class Type> |
42 | 9.93k | bool LessThanOrEqual(Type t1, Type t2) { |
43 | 9.93k | return (t1 <= t2); |
44 | 9.93k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<bool>(bool, bool) Line | Count | Source | 42 | 291 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 291 | return (t1 <= t2); | 44 | 291 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<long>(long, long) Line | Count | Source | 42 | 8.83k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 8.83k | return (t1 <= t2); | 44 | 8.83k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 42 | 434 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 434 | return (t1 <= t2); | 44 | 434 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<double>(double, double) Line | Count | Source | 42 | 384 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 384 | return (t1 <= t2); | 44 | 384 | } |
|
45 | | |
46 | | template <class Type> |
47 | 27.0k | bool GreaterThan(Type t1, Type t2) { |
48 | 27.0k | return LessThan(t2, t1); |
49 | 27.0k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<bool>(bool, bool) Line | Count | Source | 47 | 571 | bool GreaterThan(Type t1, Type t2) { | 48 | 571 | return LessThan(t2, t1); | 49 | 571 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<long>(long, long) Line | Count | Source | 47 | 26.0k | bool GreaterThan(Type t1, Type t2) { | 48 | 26.0k | return LessThan(t2, t1); | 49 | 26.0k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 47 | 42 | bool GreaterThan(Type t1, Type t2) { | 48 | 42 | return LessThan(t2, t1); | 49 | 42 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<double>(double, double) Line | Count | Source | 47 | 337 | bool GreaterThan(Type t1, Type t2) { | 48 | 337 | return LessThan(t2, t1); | 49 | 337 | } |
|
50 | | |
51 | | template <class Type> |
52 | 7.97k | bool GreaterThanOrEqual(Type t1, Type t2) { |
53 | 7.97k | return LessThanOrEqual(t2, t1); |
54 | 7.97k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<bool>(bool, bool) Line | Count | Source | 52 | 217 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 217 | return LessThanOrEqual(t2, t1); | 54 | 217 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<long>(long, long) Line | Count | Source | 52 | 7.22k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 7.22k | return LessThanOrEqual(t2, t1); | 54 | 7.22k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 52 | 221 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 221 | return LessThanOrEqual(t2, t1); | 54 | 221 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<double>(double, double) Line | Count | Source | 52 | 315 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 315 | return LessThanOrEqual(t2, t1); | 54 | 315 | } |
|
55 | | |
56 | | // String value comparions specializations |
57 | | template <> |
58 | 246 | bool LessThan(const StringValue& t1, const StringValue& t2) { |
59 | 246 | return t1.Compare(t2) < 0; |
60 | 246 | } |
61 | | |
62 | | template <> |
63 | 245 | bool LessThanOrEqual(const StringValue& t1, const StringValue& t2) { |
64 | 245 | return t1.Compare(t2) <= 0; |
65 | 245 | } |
66 | | |
67 | | template <> |
68 | 261 | bool GreaterThan(const StringValue& t1, const StringValue& t2) { |
69 | 261 | return t1.Compare(t2) > 0; |
70 | 261 | } |
71 | | |
72 | | template <> |
73 | 224 | bool GreaterThanOrEqual(const StringValue& t1, const StringValue& t2) { |
74 | 224 | return t1.Compare(t2) >= 0; |
75 | 224 | } |
76 | | |
77 | | // bytes value comparions specializations |
78 | | template <> |
79 | 355 | bool LessThan(const BytesValue& t1, const BytesValue& t2) { |
80 | 355 | return t1.Compare(t2) < 0; |
81 | 355 | } |
82 | | |
83 | | template <> |
84 | 372 | bool LessThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
85 | 372 | return t1.Compare(t2) <= 0; |
86 | 372 | } |
87 | | |
88 | | template <> |
89 | 258 | bool GreaterThan(const BytesValue& t1, const BytesValue& t2) { |
90 | 258 | return t1.Compare(t2) > 0; |
91 | 258 | } |
92 | | |
93 | | template <> |
94 | 119 | bool GreaterThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
95 | 119 | return t1.Compare(t2) >= 0; |
96 | 119 | } |
97 | | |
98 | | // Duration comparison specializations |
99 | | template <> |
100 | 613 | bool LessThan(absl::Duration t1, absl::Duration t2) { |
101 | 613 | return absl::operator<(t1, t2); |
102 | 613 | } |
103 | | |
104 | | template <> |
105 | 685 | bool LessThanOrEqual(absl::Duration t1, absl::Duration t2) { |
106 | 685 | return absl::operator<=(t1, t2); |
107 | 685 | } |
108 | | |
109 | | template <> |
110 | 674 | bool GreaterThan(absl::Duration t1, absl::Duration t2) { |
111 | 674 | return absl::operator>(t1, t2); |
112 | 674 | } |
113 | | |
114 | | template <> |
115 | 864 | bool GreaterThanOrEqual(absl::Duration t1, absl::Duration t2) { |
116 | 864 | return absl::operator>=(t1, t2); |
117 | 864 | } |
118 | | |
119 | | // Timestamp comparison specializations |
120 | | template <> |
121 | 470 | bool LessThan(absl::Time t1, absl::Time t2) { |
122 | 470 | return absl::operator<(t1, t2); |
123 | 470 | } |
124 | | |
125 | | template <> |
126 | 635 | bool LessThanOrEqual(absl::Time t1, absl::Time t2) { |
127 | 635 | return absl::operator<=(t1, t2); |
128 | 635 | } |
129 | | |
130 | | template <> |
131 | 514 | bool GreaterThan(absl::Time t1, absl::Time t2) { |
132 | 514 | return absl::operator>(t1, t2); |
133 | 514 | } |
134 | | |
135 | | template <> |
136 | 488 | bool GreaterThanOrEqual(absl::Time t1, absl::Time t2) { |
137 | 488 | return absl::operator>=(t1, t2); |
138 | 488 | } |
139 | | |
140 | | template <typename T, typename U> |
141 | 86.8k | bool CrossNumericLessThan(T t, U u) { |
142 | 86.8k | return Number(t) < Number(u); |
143 | 86.8k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, long>(double, long) Line | Count | Source | 141 | 7.45k | bool CrossNumericLessThan(T t, U u) { | 142 | 7.45k | return Number(t) < Number(u); | 143 | 7.45k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 141 | 1.83k | bool CrossNumericLessThan(T t, U u) { | 142 | 1.83k | return Number(t) < Number(u); | 143 | 1.83k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 141 | 10.2k | bool CrossNumericLessThan(T t, U u) { | 142 | 10.2k | return Number(t) < Number(u); | 143 | 10.2k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 141 | 7.24k | bool CrossNumericLessThan(T t, U u) { | 142 | 7.24k | return Number(t) < Number(u); | 143 | 7.24k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, double>(long, double) Line | Count | Source | 141 | 57.4k | bool CrossNumericLessThan(T t, U u) { | 142 | 57.4k | return Number(t) < Number(u); | 143 | 57.4k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 141 | 2.67k | bool CrossNumericLessThan(T t, U u) { | 142 | 2.67k | return Number(t) < Number(u); | 143 | 2.67k | } |
|
144 | | |
145 | | template <typename T, typename U> |
146 | 17.1k | bool CrossNumericGreaterThan(T t, U u) { |
147 | 17.1k | return Number(t) > Number(u); |
148 | 17.1k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, long>(double, long) Line | Count | Source | 146 | 1.34k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.34k | return Number(t) > Number(u); | 148 | 1.34k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 146 | 1.46k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.46k | return Number(t) > Number(u); | 148 | 1.46k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 146 | 7.94k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 7.94k | return Number(t) > Number(u); | 148 | 7.94k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 146 | 2.62k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.62k | return Number(t) > Number(u); | 148 | 2.62k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, double>(long, double) Line | Count | Source | 146 | 966 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 966 | return Number(t) > Number(u); | 148 | 966 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 146 | 2.75k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.75k | return Number(t) > Number(u); | 148 | 2.75k | } |
|
149 | | |
150 | | template <typename T, typename U> |
151 | 21.3k | bool CrossNumericLessOrEqualTo(T t, U u) { |
152 | 21.3k | return Number(t) <= Number(u); |
153 | 21.3k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, long>(double, long) Line | Count | Source | 151 | 1.63k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.63k | return Number(t) <= Number(u); | 153 | 1.63k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 151 | 1.35k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.35k | return Number(t) <= Number(u); | 153 | 1.35k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 151 | 1.23k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.23k | return Number(t) <= Number(u); | 153 | 1.23k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 151 | 5.82k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 5.82k | return Number(t) <= Number(u); | 153 | 5.82k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, double>(long, double) Line | Count | Source | 151 | 8.52k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 8.52k | return Number(t) <= Number(u); | 153 | 8.52k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 151 | 2.82k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.82k | return Number(t) <= Number(u); | 153 | 2.82k | } |
|
154 | | |
155 | | template <typename T, typename U> |
156 | 15.0k | bool CrossNumericGreaterOrEqualTo(T t, U u) { |
157 | 15.0k | return Number(t) >= Number(u); |
158 | 15.0k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, long>(double, long) Line | Count | Source | 156 | 1.37k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.37k | return Number(t) >= Number(u); | 158 | 1.37k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 156 | 1.03k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.03k | return Number(t) >= Number(u); | 158 | 1.03k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 156 | 1.01k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.01k | return Number(t) >= Number(u); | 158 | 1.01k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 156 | 8.15k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 8.15k | return Number(t) >= Number(u); | 158 | 8.15k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, double>(long, double) Line | Count | Source | 156 | 1.19k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.19k | return Number(t) >= Number(u); | 158 | 1.19k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 156 | 2.27k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 2.27k | return Number(t) >= Number(u); | 158 | 2.27k | } |
|
159 | | |
160 | | template <class Type> |
161 | | absl::Status RegisterComparisonFunctionsForType( |
162 | 201k | cel::FunctionRegistry& registry) { |
163 | 201k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; |
164 | 201k | CEL_RETURN_IF_ERROR(registry.Register( |
165 | 201k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), |
166 | 201k | FunctionAdapter::WrapFunction(LessThan<Type>))); |
167 | | |
168 | 201k | CEL_RETURN_IF_ERROR(registry.Register( |
169 | 201k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), |
170 | 201k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); |
171 | | |
172 | 201k | CEL_RETURN_IF_ERROR(registry.Register( |
173 | 201k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), |
174 | 201k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); |
175 | | |
176 | 201k | CEL_RETURN_IF_ERROR(registry.Register( |
177 | 201k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), |
178 | 201k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); |
179 | | |
180 | 201k | return absl::OkStatus(); |
181 | 201k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<bool>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<double>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::StringValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::BytesValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Duration>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Time>(cel::FunctionRegistry&) Line | Count | Source | 162 | 25.2k | cel::FunctionRegistry& registry) { | 163 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 25.2k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 25.2k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 25.2k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 25.2k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 25.2k | return absl::OkStatus(); | 181 | 25.2k | } |
|
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 | 151k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { |
209 | 151k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; |
210 | 151k | CEL_RETURN_IF_ERROR(registry.Register( |
211 | 151k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, |
212 | 151k | /*receiver_style=*/false), |
213 | 151k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); |
214 | 151k | CEL_RETURN_IF_ERROR(registry.Register( |
215 | 151k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, |
216 | 151k | /*receiver_style=*/false), |
217 | 151k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); |
218 | 151k | CEL_RETURN_IF_ERROR(registry.Register( |
219 | 151k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, |
220 | 151k | /*receiver_style=*/false), |
221 | 151k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); |
222 | 151k | CEL_RETURN_IF_ERROR(registry.Register( |
223 | 151k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, |
224 | 151k | /*receiver_style=*/false), |
225 | 151k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); |
226 | 151k | return absl::OkStatus(); |
227 | 151k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 25.2k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 25.2k | /*receiver_style=*/false), | 213 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 25.2k | /*receiver_style=*/false), | 217 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 25.2k | /*receiver_style=*/false), | 221 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 25.2k | /*receiver_style=*/false), | 225 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 25.2k | return absl::OkStatus(); | 227 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 25.2k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 25.2k | /*receiver_style=*/false), | 213 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 25.2k | /*receiver_style=*/false), | 217 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 25.2k | /*receiver_style=*/false), | 221 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 25.2k | /*receiver_style=*/false), | 225 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 25.2k | return absl::OkStatus(); | 227 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 25.2k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 25.2k | /*receiver_style=*/false), | 213 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 25.2k | /*receiver_style=*/false), | 217 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 25.2k | /*receiver_style=*/false), | 221 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 25.2k | /*receiver_style=*/false), | 225 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 25.2k | return absl::OkStatus(); | 227 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 25.2k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 25.2k | /*receiver_style=*/false), | 213 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 25.2k | /*receiver_style=*/false), | 217 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 25.2k | /*receiver_style=*/false), | 221 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 25.2k | /*receiver_style=*/false), | 225 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 25.2k | return absl::OkStatus(); | 227 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 25.2k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 25.2k | /*receiver_style=*/false), | 213 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 25.2k | /*receiver_style=*/false), | 217 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 25.2k | /*receiver_style=*/false), | 221 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 25.2k | /*receiver_style=*/false), | 225 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 25.2k | return absl::OkStatus(); | 227 | 25.2k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 25.2k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 25.2k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 25.2k | /*receiver_style=*/false), | 213 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 25.2k | /*receiver_style=*/false), | 217 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 25.2k | /*receiver_style=*/false), | 221 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 25.2k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 25.2k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 25.2k | /*receiver_style=*/false), | 225 | 25.2k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 25.2k | return absl::OkStatus(); | 227 | 25.2k | } |
|
228 | | |
229 | | absl::Status RegisterHeterogeneousComparisonFunctions( |
230 | 25.2k | cel::FunctionRegistry& registry) { |
231 | 25.2k | CEL_RETURN_IF_ERROR( |
232 | 25.2k | (RegisterCrossNumericComparisons<double, int64_t>(registry))); |
233 | 25.2k | CEL_RETURN_IF_ERROR( |
234 | 25.2k | (RegisterCrossNumericComparisons<double, uint64_t>(registry))); |
235 | | |
236 | 25.2k | CEL_RETURN_IF_ERROR( |
237 | 25.2k | (RegisterCrossNumericComparisons<uint64_t, double>(registry))); |
238 | 25.2k | CEL_RETURN_IF_ERROR( |
239 | 25.2k | (RegisterCrossNumericComparisons<uint64_t, int64_t>(registry))); |
240 | | |
241 | 25.2k | CEL_RETURN_IF_ERROR( |
242 | 25.2k | (RegisterCrossNumericComparisons<int64_t, double>(registry))); |
243 | 25.2k | CEL_RETURN_IF_ERROR( |
244 | 25.2k | (RegisterCrossNumericComparisons<int64_t, uint64_t>(registry))); |
245 | | |
246 | 25.2k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
247 | 25.2k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
248 | 25.2k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
249 | 25.2k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
250 | 25.2k | CEL_RETURN_IF_ERROR( |
251 | 25.2k | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
252 | 25.2k | CEL_RETURN_IF_ERROR( |
253 | 25.2k | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
254 | 25.2k | CEL_RETURN_IF_ERROR( |
255 | 25.2k | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
256 | 25.2k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
257 | | |
258 | 25.2k | return absl::OkStatus(); |
259 | 25.2k | } |
260 | | } // namespace |
261 | | |
262 | | absl::Status RegisterComparisonFunctions(FunctionRegistry& registry, |
263 | 25.2k | const RuntimeOptions& options) { |
264 | 25.2k | if (options.enable_heterogeneous_equality) { |
265 | 25.2k | CEL_RETURN_IF_ERROR(RegisterHeterogeneousComparisonFunctions(registry)); |
266 | 25.2k | } else { |
267 | 0 | CEL_RETURN_IF_ERROR(RegisterHomogenousComparisonFunctions(registry)); |
268 | 0 | } |
269 | 25.2k | return absl::OkStatus(); |
270 | 25.2k | } |
271 | | |
272 | | } // namespace cel |