/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 | 24.4k | bool LessThan(Type t1, Type t2) { |
38 | 24.4k | return (t1 < t2); |
39 | 24.4k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<bool>(bool, bool) Line | Count | Source | 37 | 3.07k | bool LessThan(Type t1, Type t2) { | 38 | 3.07k | return (t1 < t2); | 39 | 3.07k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<long>(long, long) Line | Count | Source | 37 | 19.7k | bool LessThan(Type t1, Type t2) { | 38 | 19.7k | return (t1 < t2); | 39 | 19.7k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 37 | 842 | bool LessThan(Type t1, Type t2) { | 38 | 842 | return (t1 < t2); | 39 | 842 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<double>(double, double) Line | Count | Source | 37 | 756 | bool LessThan(Type t1, Type t2) { | 38 | 756 | return (t1 < t2); | 39 | 756 | } |
|
40 | | |
41 | | template <class Type> |
42 | 12.6k | bool LessThanOrEqual(Type t1, Type t2) { |
43 | 12.6k | return (t1 <= t2); |
44 | 12.6k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<bool>(bool, bool) Line | Count | Source | 42 | 1.59k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 1.59k | return (t1 <= t2); | 44 | 1.59k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<long>(long, long) Line | Count | Source | 42 | 5.71k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 5.71k | return (t1 <= t2); | 44 | 5.71k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 42 | 1.14k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 1.14k | return (t1 <= t2); | 44 | 1.14k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<double>(double, double) Line | Count | Source | 42 | 4.21k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 4.21k | return (t1 <= t2); | 44 | 4.21k | } |
|
45 | | |
46 | | template <class Type> |
47 | 16.7k | bool GreaterThan(Type t1, Type t2) { |
48 | 16.7k | return LessThan(t2, t1); |
49 | 16.7k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<bool>(bool, bool) Line | Count | Source | 47 | 2.06k | bool GreaterThan(Type t1, Type t2) { | 48 | 2.06k | return LessThan(t2, t1); | 49 | 2.06k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<long>(long, long) Line | Count | Source | 47 | 13.9k | bool GreaterThan(Type t1, Type t2) { | 48 | 13.9k | return LessThan(t2, t1); | 49 | 13.9k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 47 | 535 | bool GreaterThan(Type t1, Type t2) { | 48 | 535 | return LessThan(t2, t1); | 49 | 535 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<double>(double, double) Line | Count | Source | 47 | 207 | bool GreaterThan(Type t1, Type t2) { | 48 | 207 | return LessThan(t2, t1); | 49 | 207 | } |
|
50 | | |
51 | | template <class Type> |
52 | 8.11k | bool GreaterThanOrEqual(Type t1, Type t2) { |
53 | 8.11k | return LessThanOrEqual(t2, t1); |
54 | 8.11k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<bool>(bool, bool) Line | Count | Source | 52 | 347 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 347 | return LessThanOrEqual(t2, t1); | 54 | 347 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<long>(long, long) Line | Count | Source | 52 | 3.18k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 3.18k | return LessThanOrEqual(t2, t1); | 54 | 3.18k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 52 | 845 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 845 | return LessThanOrEqual(t2, t1); | 54 | 845 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<double>(double, double) Line | Count | Source | 52 | 3.73k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 3.73k | return LessThanOrEqual(t2, t1); | 54 | 3.73k | } |
|
55 | | |
56 | | // String value comparions specializations |
57 | | template <> |
58 | 186 | bool LessThan(const StringValue& t1, const StringValue& t2) { |
59 | 186 | return t1.Compare(t2) < 0; |
60 | 186 | } |
61 | | |
62 | | template <> |
63 | 99 | bool LessThanOrEqual(const StringValue& t1, const StringValue& t2) { |
64 | 99 | return t1.Compare(t2) <= 0; |
65 | 99 | } |
66 | | |
67 | | template <> |
68 | 216 | bool GreaterThan(const StringValue& t1, const StringValue& t2) { |
69 | 216 | return t1.Compare(t2) > 0; |
70 | 216 | } |
71 | | |
72 | | template <> |
73 | 180 | bool GreaterThanOrEqual(const StringValue& t1, const StringValue& t2) { |
74 | 180 | return t1.Compare(t2) >= 0; |
75 | 180 | } |
76 | | |
77 | | // bytes value comparions specializations |
78 | | template <> |
79 | 376 | bool LessThan(const BytesValue& t1, const BytesValue& t2) { |
80 | 376 | return t1.Compare(t2) < 0; |
81 | 376 | } |
82 | | |
83 | | template <> |
84 | 92 | bool LessThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
85 | 92 | return t1.Compare(t2) <= 0; |
86 | 92 | } |
87 | | |
88 | | template <> |
89 | 369 | bool GreaterThan(const BytesValue& t1, const BytesValue& t2) { |
90 | 369 | return t1.Compare(t2) > 0; |
91 | 369 | } |
92 | | |
93 | | template <> |
94 | 566 | bool GreaterThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
95 | 566 | return t1.Compare(t2) >= 0; |
96 | 566 | } |
97 | | |
98 | | // Duration comparison specializations |
99 | | template <> |
100 | 47 | bool LessThan(absl::Duration t1, absl::Duration t2) { |
101 | 47 | return absl::operator<(t1, t2); |
102 | 47 | } |
103 | | |
104 | | template <> |
105 | 165 | bool LessThanOrEqual(absl::Duration t1, absl::Duration t2) { |
106 | 165 | return absl::operator<=(t1, t2); |
107 | 165 | } |
108 | | |
109 | | template <> |
110 | 53 | bool GreaterThan(absl::Duration t1, absl::Duration t2) { |
111 | 53 | return absl::operator>(t1, t2); |
112 | 53 | } |
113 | | |
114 | | template <> |
115 | 78 | bool GreaterThanOrEqual(absl::Duration t1, absl::Duration t2) { |
116 | 78 | return absl::operator>=(t1, t2); |
117 | 78 | } |
118 | | |
119 | | // Timestamp comparison specializations |
120 | | template <> |
121 | 0 | bool LessThan(absl::Time t1, absl::Time t2) { |
122 | 0 | return absl::operator<(t1, t2); |
123 | 0 | } |
124 | | |
125 | | template <> |
126 | 0 | bool LessThanOrEqual(absl::Time t1, absl::Time t2) { |
127 | 0 | return absl::operator<=(t1, t2); |
128 | 0 | } |
129 | | |
130 | | template <> |
131 | 0 | bool GreaterThan(absl::Time t1, absl::Time t2) { |
132 | 0 | return absl::operator>(t1, t2); |
133 | 0 | } |
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 | 203k | bool CrossNumericLessThan(T t, U u) { |
142 | 203k | return Number(t) < Number(u); |
143 | 203k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, long>(double, long) Line | Count | Source | 141 | 12.0k | bool CrossNumericLessThan(T t, U u) { | 142 | 12.0k | return Number(t) < Number(u); | 143 | 12.0k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 141 | 184k | bool CrossNumericLessThan(T t, U u) { | 142 | 184k | return Number(t) < Number(u); | 143 | 184k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 141 | 1.09k | bool CrossNumericLessThan(T t, U u) { | 142 | 1.09k | return Number(t) < Number(u); | 143 | 1.09k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 141 | 1.67k | bool CrossNumericLessThan(T t, U u) { | 142 | 1.67k | return Number(t) < Number(u); | 143 | 1.67k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, double>(long, double) Line | Count | Source | 141 | 896 | bool CrossNumericLessThan(T t, U u) { | 142 | 896 | return Number(t) < Number(u); | 143 | 896 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 141 | 2.49k | bool CrossNumericLessThan(T t, U u) { | 142 | 2.49k | return Number(t) < Number(u); | 143 | 2.49k | } |
|
144 | | |
145 | | template <typename T, typename U> |
146 | 17.5k | bool CrossNumericGreaterThan(T t, U u) { |
147 | 17.5k | return Number(t) > Number(u); |
148 | 17.5k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, long>(double, long) Line | Count | Source | 146 | 2.04k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.04k | return Number(t) > Number(u); | 148 | 2.04k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 146 | 1.89k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.89k | return Number(t) > Number(u); | 148 | 1.89k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 146 | 6.35k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 6.35k | return Number(t) > Number(u); | 148 | 6.35k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 146 | 1.71k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.71k | return Number(t) > Number(u); | 148 | 1.71k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, double>(long, double) Line | Count | Source | 146 | 1.11k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.11k | return Number(t) > Number(u); | 148 | 1.11k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 146 | 4.41k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 4.41k | return Number(t) > Number(u); | 148 | 4.41k | } |
|
149 | | |
150 | | template <typename T, typename U> |
151 | 10.8k | bool CrossNumericLessOrEqualTo(T t, U u) { |
152 | 10.8k | return Number(t) <= Number(u); |
153 | 10.8k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, long>(double, long) Line | Count | Source | 151 | 1.45k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.45k | return Number(t) <= Number(u); | 153 | 1.45k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 151 | 2.30k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.30k | return Number(t) <= Number(u); | 153 | 2.30k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 151 | 4.89k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 4.89k | return Number(t) <= Number(u); | 153 | 4.89k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 151 | 853 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 853 | return Number(t) <= Number(u); | 153 | 853 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, double>(long, double) Line | Count | Source | 151 | 439 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 439 | return Number(t) <= Number(u); | 153 | 439 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 151 | 917 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 917 | return Number(t) <= Number(u); | 153 | 917 | } |
|
154 | | |
155 | | template <typename T, typename U> |
156 | 59.5k | bool CrossNumericGreaterOrEqualTo(T t, U u) { |
157 | 59.5k | return Number(t) >= Number(u); |
158 | 59.5k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, long>(double, long) Line | Count | Source | 156 | 17.6k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 17.6k | return Number(t) >= Number(u); | 158 | 17.6k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 156 | 776 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 776 | return Number(t) >= Number(u); | 158 | 776 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 156 | 26.6k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 26.6k | return Number(t) >= Number(u); | 158 | 26.6k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 156 | 11.4k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 11.4k | return Number(t) >= Number(u); | 158 | 11.4k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, double>(long, double) Line | Count | Source | 156 | 2.29k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 2.29k | return Number(t) >= Number(u); | 158 | 2.29k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 156 | 710 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 710 | return Number(t) >= Number(u); | 158 | 710 | } |
|
159 | | |
160 | | template <class Type> |
161 | | absl::Status RegisterComparisonFunctionsForType( |
162 | 116k | cel::FunctionRegistry& registry) { |
163 | 116k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; |
164 | 116k | CEL_RETURN_IF_ERROR(registry.Register( |
165 | 116k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), |
166 | 116k | FunctionAdapter::WrapFunction(LessThan<Type>))); |
167 | | |
168 | 116k | CEL_RETURN_IF_ERROR(registry.Register( |
169 | 116k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), |
170 | 116k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); |
171 | | |
172 | 116k | CEL_RETURN_IF_ERROR(registry.Register( |
173 | 116k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), |
174 | 116k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); |
175 | | |
176 | 116k | CEL_RETURN_IF_ERROR(registry.Register( |
177 | 116k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), |
178 | 116k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); |
179 | | |
180 | 116k | return absl::OkStatus(); |
181 | 116k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<bool>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<double>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::StringValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::BytesValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Duration>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Time>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.6k | cel::FunctionRegistry& registry) { | 163 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.6k | return absl::OkStatus(); | 181 | 14.6k | } |
|
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 | 87.7k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { |
209 | 87.7k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; |
210 | 87.7k | CEL_RETURN_IF_ERROR(registry.Register( |
211 | 87.7k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, |
212 | 87.7k | /*receiver_style=*/false), |
213 | 87.7k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); |
214 | 87.7k | CEL_RETURN_IF_ERROR(registry.Register( |
215 | 87.7k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, |
216 | 87.7k | /*receiver_style=*/false), |
217 | 87.7k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); |
218 | 87.7k | CEL_RETURN_IF_ERROR(registry.Register( |
219 | 87.7k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, |
220 | 87.7k | /*receiver_style=*/false), |
221 | 87.7k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); |
222 | 87.7k | CEL_RETURN_IF_ERROR(registry.Register( |
223 | 87.7k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, |
224 | 87.7k | /*receiver_style=*/false), |
225 | 87.7k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); |
226 | 87.7k | return absl::OkStatus(); |
227 | 87.7k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.6k | /*receiver_style=*/false), | 213 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.6k | /*receiver_style=*/false), | 217 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.6k | /*receiver_style=*/false), | 221 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.6k | /*receiver_style=*/false), | 225 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.6k | return absl::OkStatus(); | 227 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.6k | /*receiver_style=*/false), | 213 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.6k | /*receiver_style=*/false), | 217 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.6k | /*receiver_style=*/false), | 221 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.6k | /*receiver_style=*/false), | 225 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.6k | return absl::OkStatus(); | 227 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.6k | /*receiver_style=*/false), | 213 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.6k | /*receiver_style=*/false), | 217 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.6k | /*receiver_style=*/false), | 221 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.6k | /*receiver_style=*/false), | 225 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.6k | return absl::OkStatus(); | 227 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.6k | /*receiver_style=*/false), | 213 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.6k | /*receiver_style=*/false), | 217 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.6k | /*receiver_style=*/false), | 221 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.6k | /*receiver_style=*/false), | 225 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.6k | return absl::OkStatus(); | 227 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.6k | /*receiver_style=*/false), | 213 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.6k | /*receiver_style=*/false), | 217 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.6k | /*receiver_style=*/false), | 221 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.6k | /*receiver_style=*/false), | 225 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.6k | return absl::OkStatus(); | 227 | 14.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.6k | /*receiver_style=*/false), | 213 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.6k | /*receiver_style=*/false), | 217 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.6k | /*receiver_style=*/false), | 221 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.6k | /*receiver_style=*/false), | 225 | 14.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.6k | return absl::OkStatus(); | 227 | 14.6k | } |
|
228 | | |
229 | | absl::Status RegisterHeterogeneousComparisonFunctions( |
230 | 14.6k | cel::FunctionRegistry& registry) { |
231 | 14.6k | CEL_RETURN_IF_ERROR( |
232 | 14.6k | (RegisterCrossNumericComparisons<double, int64_t>(registry))); |
233 | 14.6k | CEL_RETURN_IF_ERROR( |
234 | 14.6k | (RegisterCrossNumericComparisons<double, uint64_t>(registry))); |
235 | | |
236 | 14.6k | CEL_RETURN_IF_ERROR( |
237 | 14.6k | (RegisterCrossNumericComparisons<uint64_t, double>(registry))); |
238 | 14.6k | CEL_RETURN_IF_ERROR( |
239 | 14.6k | (RegisterCrossNumericComparisons<uint64_t, int64_t>(registry))); |
240 | | |
241 | 14.6k | CEL_RETURN_IF_ERROR( |
242 | 14.6k | (RegisterCrossNumericComparisons<int64_t, double>(registry))); |
243 | 14.6k | CEL_RETURN_IF_ERROR( |
244 | 14.6k | (RegisterCrossNumericComparisons<int64_t, uint64_t>(registry))); |
245 | | |
246 | 14.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
247 | 14.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
248 | 14.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
249 | 14.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
250 | 14.6k | CEL_RETURN_IF_ERROR( |
251 | 14.6k | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
252 | 14.6k | CEL_RETURN_IF_ERROR( |
253 | 14.6k | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
254 | 14.6k | CEL_RETURN_IF_ERROR( |
255 | 14.6k | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
256 | 14.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
257 | | |
258 | 14.6k | return absl::OkStatus(); |
259 | 14.6k | } |
260 | | } // namespace |
261 | | |
262 | | absl::Status RegisterComparisonFunctions(FunctionRegistry& registry, |
263 | 14.6k | const RuntimeOptions& options) { |
264 | 14.6k | if (options.enable_heterogeneous_equality) { |
265 | 14.6k | CEL_RETURN_IF_ERROR(RegisterHeterogeneousComparisonFunctions(registry)); |
266 | 14.6k | } else { |
267 | 0 | CEL_RETURN_IF_ERROR(RegisterHomogenousComparisonFunctions(registry)); |
268 | 0 | } |
269 | 14.6k | return absl::OkStatus(); |
270 | 14.6k | } |
271 | | |
272 | | } // namespace cel |