/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 | 152k | bool LessThan(Type t1, Type t2) { |
38 | 152k | return (t1 < t2); |
39 | 152k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<bool>(bool, bool) Line | Count | Source | 37 | 628 | bool LessThan(Type t1, Type t2) { | 38 | 628 | return (t1 < t2); | 39 | 628 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<long>(long, long) Line | Count | Source | 37 | 145k | bool LessThan(Type t1, Type t2) { | 38 | 145k | return (t1 < t2); | 39 | 145k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 37 | 1.12k | bool LessThan(Type t1, Type t2) { | 38 | 1.12k | return (t1 < t2); | 39 | 1.12k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<double>(double, double) Line | Count | Source | 37 | 5.36k | bool LessThan(Type t1, Type t2) { | 38 | 5.36k | return (t1 < t2); | 39 | 5.36k | } |
|
40 | | |
41 | | template <class Type> |
42 | 9.68k | bool LessThanOrEqual(Type t1, Type t2) { |
43 | 9.68k | return (t1 <= t2); |
44 | 9.68k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<bool>(bool, bool) Line | Count | Source | 42 | 557 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 557 | return (t1 <= t2); | 44 | 557 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<long>(long, long) Line | Count | Source | 42 | 4.06k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 4.06k | return (t1 <= t2); | 44 | 4.06k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 42 | 877 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 877 | return (t1 <= t2); | 44 | 877 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<double>(double, double) Line | Count | Source | 42 | 4.18k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 4.18k | return (t1 <= t2); | 44 | 4.18k | } |
|
45 | | |
46 | | template <class Type> |
47 | 122k | bool GreaterThan(Type t1, Type t2) { |
48 | 122k | return LessThan(t2, t1); |
49 | 122k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<bool>(bool, bool) Line | Count | Source | 47 | 309 | bool GreaterThan(Type t1, Type t2) { | 48 | 309 | return LessThan(t2, t1); | 49 | 309 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<long>(long, long) Line | Count | Source | 47 | 121k | bool GreaterThan(Type t1, Type t2) { | 48 | 121k | return LessThan(t2, t1); | 49 | 121k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 47 | 305 | bool GreaterThan(Type t1, Type t2) { | 48 | 305 | return LessThan(t2, t1); | 49 | 305 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<double>(double, double) Line | Count | Source | 47 | 340 | bool GreaterThan(Type t1, Type t2) { | 48 | 340 | return LessThan(t2, t1); | 49 | 340 | } |
|
50 | | |
51 | | template <class Type> |
52 | 6.83k | bool GreaterThanOrEqual(Type t1, Type t2) { |
53 | 6.83k | return LessThanOrEqual(t2, t1); |
54 | 6.83k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<bool>(bool, bool) Line | Count | Source | 52 | 300 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 300 | return LessThanOrEqual(t2, t1); | 54 | 300 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<long>(long, long) Line | Count | Source | 52 | 1.97k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 1.97k | return LessThanOrEqual(t2, t1); | 54 | 1.97k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 52 | 610 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 610 | return LessThanOrEqual(t2, t1); | 54 | 610 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<double>(double, double) Line | Count | Source | 52 | 3.95k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 3.95k | return LessThanOrEqual(t2, t1); | 54 | 3.95k | } |
|
55 | | |
56 | | // String value comparions specializations |
57 | | template <> |
58 | 1.16k | bool LessThan(const StringValue& t1, const StringValue& t2) { |
59 | 1.16k | return t1.Compare(t2) < 0; |
60 | 1.16k | } |
61 | | |
62 | | template <> |
63 | 382 | bool LessThanOrEqual(const StringValue& t1, const StringValue& t2) { |
64 | 382 | return t1.Compare(t2) <= 0; |
65 | 382 | } |
66 | | |
67 | | template <> |
68 | 382 | bool GreaterThan(const StringValue& t1, const StringValue& t2) { |
69 | 382 | return t1.Compare(t2) > 0; |
70 | 382 | } |
71 | | |
72 | | template <> |
73 | 470 | bool GreaterThanOrEqual(const StringValue& t1, const StringValue& t2) { |
74 | 470 | return t1.Compare(t2) >= 0; |
75 | 470 | } |
76 | | |
77 | | // bytes value comparions specializations |
78 | | template <> |
79 | 978 | bool LessThan(const BytesValue& t1, const BytesValue& t2) { |
80 | 978 | return t1.Compare(t2) < 0; |
81 | 978 | } |
82 | | |
83 | | template <> |
84 | 328 | bool LessThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
85 | 328 | return t1.Compare(t2) <= 0; |
86 | 328 | } |
87 | | |
88 | | template <> |
89 | 2.34k | bool GreaterThan(const BytesValue& t1, const BytesValue& t2) { |
90 | 2.34k | return t1.Compare(t2) > 0; |
91 | 2.34k | } |
92 | | |
93 | | template <> |
94 | 291 | bool GreaterThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
95 | 291 | return t1.Compare(t2) >= 0; |
96 | 291 | } |
97 | | |
98 | | // Duration comparison specializations |
99 | | template <> |
100 | 817 | bool LessThan(absl::Duration t1, absl::Duration t2) { |
101 | 817 | return absl::operator<(t1, t2); |
102 | 817 | } |
103 | | |
104 | | template <> |
105 | 1.06k | bool LessThanOrEqual(absl::Duration t1, absl::Duration t2) { |
106 | 1.06k | return absl::operator<=(t1, t2); |
107 | 1.06k | } |
108 | | |
109 | | template <> |
110 | 679 | bool GreaterThan(absl::Duration t1, absl::Duration t2) { |
111 | 679 | return absl::operator>(t1, t2); |
112 | 679 | } |
113 | | |
114 | | template <> |
115 | 868 | bool GreaterThanOrEqual(absl::Duration t1, absl::Duration t2) { |
116 | 868 | return absl::operator>=(t1, t2); |
117 | 868 | } |
118 | | |
119 | | // Timestamp comparison specializations |
120 | | template <> |
121 | 610 | bool LessThan(absl::Time t1, absl::Time t2) { |
122 | 610 | return absl::operator<(t1, t2); |
123 | 610 | } |
124 | | |
125 | | template <> |
126 | 310 | bool LessThanOrEqual(absl::Time t1, absl::Time t2) { |
127 | 310 | return absl::operator<=(t1, t2); |
128 | 310 | } |
129 | | |
130 | | template <> |
131 | 82 | bool GreaterThan(absl::Time t1, absl::Time t2) { |
132 | 82 | return absl::operator>(t1, t2); |
133 | 82 | } |
134 | | |
135 | | template <> |
136 | 0 | bool GreaterThanOrEqual(absl::Time t1, absl::Time t2) { |
137 | 0 | return absl::operator>=(t1, t2); |
138 | 0 | } |
139 | | |
140 | | template <typename T, typename U> |
141 | 18.7k | bool CrossNumericLessThan(T t, U u) { |
142 | 18.7k | return Number(t) < Number(u); |
143 | 18.7k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, long>(double, long) Line | Count | Source | 141 | 4.24k | bool CrossNumericLessThan(T t, U u) { | 142 | 4.24k | return Number(t) < Number(u); | 143 | 4.24k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 141 | 6.01k | bool CrossNumericLessThan(T t, U u) { | 142 | 6.01k | return Number(t) < Number(u); | 143 | 6.01k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 141 | 1.26k | bool CrossNumericLessThan(T t, U u) { | 142 | 1.26k | return Number(t) < Number(u); | 143 | 1.26k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 141 | 1.74k | bool CrossNumericLessThan(T t, U u) { | 142 | 1.74k | return Number(t) < Number(u); | 143 | 1.74k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, double>(long, double) Line | Count | Source | 141 | 3.41k | bool CrossNumericLessThan(T t, U u) { | 142 | 3.41k | return Number(t) < Number(u); | 143 | 3.41k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 141 | 2.06k | bool CrossNumericLessThan(T t, U u) { | 142 | 2.06k | return Number(t) < Number(u); | 143 | 2.06k | } |
|
144 | | |
145 | | template <typename T, typename U> |
146 | 18.0k | bool CrossNumericGreaterThan(T t, U u) { |
147 | 18.0k | return Number(t) > Number(u); |
148 | 18.0k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, long>(double, long) Line | Count | Source | 146 | 7.41k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 7.41k | return Number(t) > Number(u); | 148 | 7.41k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 146 | 4.44k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 4.44k | return Number(t) > Number(u); | 148 | 4.44k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 146 | 1.21k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.21k | return Number(t) > Number(u); | 148 | 1.21k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 146 | 1.47k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.47k | return Number(t) > Number(u); | 148 | 1.47k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, double>(long, double) Line | Count | Source | 146 | 1.38k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.38k | return Number(t) > Number(u); | 148 | 1.38k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 146 | 2.07k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.07k | return Number(t) > Number(u); | 148 | 2.07k | } |
|
149 | | |
150 | | template <typename T, typename U> |
151 | 9.97k | bool CrossNumericLessOrEqualTo(T t, U u) { |
152 | 9.97k | return Number(t) <= Number(u); |
153 | 9.97k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, long>(double, long) Line | Count | Source | 151 | 1.86k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.86k | return Number(t) <= Number(u); | 153 | 1.86k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 151 | 2.15k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.15k | return Number(t) <= Number(u); | 153 | 2.15k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 151 | 1.04k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.04k | return Number(t) <= Number(u); | 153 | 1.04k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 151 | 1.65k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.65k | return Number(t) <= Number(u); | 153 | 1.65k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, double>(long, double) Line | Count | Source | 151 | 1.16k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.16k | return Number(t) <= Number(u); | 153 | 1.16k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 151 | 2.10k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.10k | return Number(t) <= Number(u); | 153 | 2.10k | } |
|
154 | | |
155 | | template <typename T, typename U> |
156 | 17.0k | bool CrossNumericGreaterOrEqualTo(T t, U u) { |
157 | 17.0k | return Number(t) >= Number(u); |
158 | 17.0k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, long>(double, long) Line | Count | Source | 156 | 2.11k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 2.11k | return Number(t) >= Number(u); | 158 | 2.11k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 156 | 2.39k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 2.39k | return Number(t) >= Number(u); | 158 | 2.39k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 156 | 5.60k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 5.60k | return Number(t) >= Number(u); | 158 | 5.60k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 156 | 2.05k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 2.05k | return Number(t) >= Number(u); | 158 | 2.05k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, double>(long, double) Line | Count | Source | 156 | 1.89k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.89k | return Number(t) >= Number(u); | 158 | 1.89k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 156 | 3.02k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 3.02k | return Number(t) >= Number(u); | 158 | 3.02k | } |
|
159 | | |
160 | | template <class Type> |
161 | | absl::Status RegisterComparisonFunctionsForType( |
162 | 198k | cel::FunctionRegistry& registry) { |
163 | 198k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; |
164 | 198k | CEL_RETURN_IF_ERROR(registry.Register( |
165 | 198k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), |
166 | 198k | FunctionAdapter::WrapFunction(LessThan<Type>))); |
167 | | |
168 | 198k | CEL_RETURN_IF_ERROR(registry.Register( |
169 | 198k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), |
170 | 198k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); |
171 | | |
172 | 198k | CEL_RETURN_IF_ERROR(registry.Register( |
173 | 198k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), |
174 | 198k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); |
175 | | |
176 | 198k | CEL_RETURN_IF_ERROR(registry.Register( |
177 | 198k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), |
178 | 198k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); |
179 | | |
180 | 198k | return absl::OkStatus(); |
181 | 198k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<bool>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<double>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::StringValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::BytesValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Duration>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Time>(cel::FunctionRegistry&) Line | Count | Source | 162 | 24.8k | cel::FunctionRegistry& registry) { | 163 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 24.8k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 24.8k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 24.8k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 24.8k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 24.8k | return absl::OkStatus(); | 181 | 24.8k | } |
|
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 | 148k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { |
209 | 148k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; |
210 | 148k | CEL_RETURN_IF_ERROR(registry.Register( |
211 | 148k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, |
212 | 148k | /*receiver_style=*/false), |
213 | 148k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); |
214 | 148k | CEL_RETURN_IF_ERROR(registry.Register( |
215 | 148k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, |
216 | 148k | /*receiver_style=*/false), |
217 | 148k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); |
218 | 148k | CEL_RETURN_IF_ERROR(registry.Register( |
219 | 148k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, |
220 | 148k | /*receiver_style=*/false), |
221 | 148k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); |
222 | 148k | CEL_RETURN_IF_ERROR(registry.Register( |
223 | 148k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, |
224 | 148k | /*receiver_style=*/false), |
225 | 148k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); |
226 | 148k | return absl::OkStatus(); |
227 | 148k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 24.8k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 24.8k | /*receiver_style=*/false), | 213 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 24.8k | /*receiver_style=*/false), | 217 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 24.8k | /*receiver_style=*/false), | 221 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 24.8k | /*receiver_style=*/false), | 225 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 24.8k | return absl::OkStatus(); | 227 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 24.8k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 24.8k | /*receiver_style=*/false), | 213 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 24.8k | /*receiver_style=*/false), | 217 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 24.8k | /*receiver_style=*/false), | 221 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 24.8k | /*receiver_style=*/false), | 225 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 24.8k | return absl::OkStatus(); | 227 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 24.8k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 24.8k | /*receiver_style=*/false), | 213 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 24.8k | /*receiver_style=*/false), | 217 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 24.8k | /*receiver_style=*/false), | 221 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 24.8k | /*receiver_style=*/false), | 225 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 24.8k | return absl::OkStatus(); | 227 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 24.8k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 24.8k | /*receiver_style=*/false), | 213 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 24.8k | /*receiver_style=*/false), | 217 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 24.8k | /*receiver_style=*/false), | 221 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 24.8k | /*receiver_style=*/false), | 225 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 24.8k | return absl::OkStatus(); | 227 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 24.8k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 24.8k | /*receiver_style=*/false), | 213 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 24.8k | /*receiver_style=*/false), | 217 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 24.8k | /*receiver_style=*/false), | 221 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 24.8k | /*receiver_style=*/false), | 225 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 24.8k | return absl::OkStatus(); | 227 | 24.8k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 24.8k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 24.8k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 24.8k | /*receiver_style=*/false), | 213 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 24.8k | /*receiver_style=*/false), | 217 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 24.8k | /*receiver_style=*/false), | 221 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 24.8k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 24.8k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 24.8k | /*receiver_style=*/false), | 225 | 24.8k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 24.8k | return absl::OkStatus(); | 227 | 24.8k | } |
|
228 | | |
229 | | absl::Status RegisterHeterogeneousComparisonFunctions( |
230 | 24.8k | cel::FunctionRegistry& registry) { |
231 | 24.8k | CEL_RETURN_IF_ERROR( |
232 | 24.8k | (RegisterCrossNumericComparisons<double, int64_t>(registry))); |
233 | 24.8k | CEL_RETURN_IF_ERROR( |
234 | 24.8k | (RegisterCrossNumericComparisons<double, uint64_t>(registry))); |
235 | | |
236 | 24.8k | CEL_RETURN_IF_ERROR( |
237 | 24.8k | (RegisterCrossNumericComparisons<uint64_t, double>(registry))); |
238 | 24.8k | CEL_RETURN_IF_ERROR( |
239 | 24.8k | (RegisterCrossNumericComparisons<uint64_t, int64_t>(registry))); |
240 | | |
241 | 24.8k | CEL_RETURN_IF_ERROR( |
242 | 24.8k | (RegisterCrossNumericComparisons<int64_t, double>(registry))); |
243 | 24.8k | CEL_RETURN_IF_ERROR( |
244 | 24.8k | (RegisterCrossNumericComparisons<int64_t, uint64_t>(registry))); |
245 | | |
246 | 24.8k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
247 | 24.8k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
248 | 24.8k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
249 | 24.8k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
250 | 24.8k | CEL_RETURN_IF_ERROR( |
251 | 24.8k | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
252 | 24.8k | CEL_RETURN_IF_ERROR( |
253 | 24.8k | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
254 | 24.8k | CEL_RETURN_IF_ERROR( |
255 | 24.8k | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
256 | 24.8k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
257 | | |
258 | 24.8k | return absl::OkStatus(); |
259 | 24.8k | } |
260 | | } // namespace |
261 | | |
262 | | absl::Status RegisterComparisonFunctions(FunctionRegistry& registry, |
263 | 24.8k | const RuntimeOptions& options) { |
264 | 24.8k | if (options.enable_heterogeneous_equality) { |
265 | 24.8k | CEL_RETURN_IF_ERROR(RegisterHeterogeneousComparisonFunctions(registry)); |
266 | 24.8k | } else { |
267 | 0 | CEL_RETURN_IF_ERROR(RegisterHomogenousComparisonFunctions(registry)); |
268 | 0 | } |
269 | 24.8k | return absl::OkStatus(); |
270 | 24.8k | } |
271 | | |
272 | | } // namespace cel |