/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 | 59.2k | bool LessThan(Type t1, Type t2) { |
38 | 59.2k | return (t1 < t2); |
39 | 59.2k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<bool>(bool, bool) Line | Count | Source | 37 | 3.15k | bool LessThan(Type t1, Type t2) { | 38 | 3.15k | return (t1 < t2); | 39 | 3.15k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<long>(long, long) Line | Count | Source | 37 | 47.3k | bool LessThan(Type t1, Type t2) { | 38 | 47.3k | return (t1 < t2); | 39 | 47.3k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 37 | 888 | bool LessThan(Type t1, Type t2) { | 38 | 888 | return (t1 < t2); | 39 | 888 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<double>(double, double) Line | Count | Source | 37 | 7.79k | bool LessThan(Type t1, Type t2) { | 38 | 7.79k | return (t1 < t2); | 39 | 7.79k | } |
|
40 | | |
41 | | template <class Type> |
42 | 14.2k | bool LessThanOrEqual(Type t1, Type t2) { |
43 | 14.2k | return (t1 <= t2); |
44 | 14.2k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<bool>(bool, bool) Line | Count | Source | 42 | 2.16k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 2.16k | return (t1 <= t2); | 44 | 2.16k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<long>(long, long) Line | Count | Source | 42 | 7.13k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 7.13k | return (t1 <= t2); | 44 | 7.13k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 42 | 1.21k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 1.21k | return (t1 <= t2); | 44 | 1.21k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<double>(double, double) Line | Count | Source | 42 | 3.69k | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 3.69k | return (t1 <= t2); | 44 | 3.69k | } |
|
45 | | |
46 | | template <class Type> |
47 | 29.0k | bool GreaterThan(Type t1, Type t2) { |
48 | 29.0k | return LessThan(t2, t1); |
49 | 29.0k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<bool>(bool, bool) Line | Count | Source | 47 | 2.19k | bool GreaterThan(Type t1, Type t2) { | 48 | 2.19k | return LessThan(t2, t1); | 49 | 2.19k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<long>(long, long) Line | Count | Source | 47 | 25.0k | bool GreaterThan(Type t1, Type t2) { | 48 | 25.0k | return LessThan(t2, t1); | 49 | 25.0k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 47 | 456 | bool GreaterThan(Type t1, Type t2) { | 48 | 456 | return LessThan(t2, t1); | 49 | 456 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<double>(double, double) Line | Count | Source | 47 | 1.31k | bool GreaterThan(Type t1, Type t2) { | 48 | 1.31k | return LessThan(t2, t1); | 49 | 1.31k | } |
|
50 | | |
51 | | template <class Type> |
52 | 8.99k | bool GreaterThanOrEqual(Type t1, Type t2) { |
53 | 8.99k | return LessThanOrEqual(t2, t1); |
54 | 8.99k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<bool>(bool, bool) Line | Count | Source | 52 | 198 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 198 | return LessThanOrEqual(t2, t1); | 54 | 198 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<long>(long, long) Line | Count | Source | 52 | 4.79k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 4.79k | return LessThanOrEqual(t2, t1); | 54 | 4.79k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 52 | 908 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 908 | return LessThanOrEqual(t2, t1); | 54 | 908 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<double>(double, double) Line | Count | Source | 52 | 3.09k | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 3.09k | return LessThanOrEqual(t2, t1); | 54 | 3.09k | } |
|
55 | | |
56 | | // String value comparions specializations |
57 | | template <> |
58 | 351 | bool LessThan(const StringValue& t1, const StringValue& t2) { |
59 | 351 | return t1.Compare(t2) < 0; |
60 | 351 | } |
61 | | |
62 | | template <> |
63 | 39.1k | bool LessThanOrEqual(const StringValue& t1, const StringValue& t2) { |
64 | 39.1k | return t1.Compare(t2) <= 0; |
65 | 39.1k | } |
66 | | |
67 | | template <> |
68 | 627 | bool GreaterThan(const StringValue& t1, const StringValue& t2) { |
69 | 627 | return t1.Compare(t2) > 0; |
70 | 627 | } |
71 | | |
72 | | template <> |
73 | 519 | bool GreaterThanOrEqual(const StringValue& t1, const StringValue& t2) { |
74 | 519 | return t1.Compare(t2) >= 0; |
75 | 519 | } |
76 | | |
77 | | // bytes value comparions specializations |
78 | | template <> |
79 | 437 | bool LessThan(const BytesValue& t1, const BytesValue& t2) { |
80 | 437 | return t1.Compare(t2) < 0; |
81 | 437 | } |
82 | | |
83 | | template <> |
84 | 106 | bool LessThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
85 | 106 | return t1.Compare(t2) <= 0; |
86 | 106 | } |
87 | | |
88 | | template <> |
89 | 10.2k | bool GreaterThan(const BytesValue& t1, const BytesValue& t2) { |
90 | 10.2k | return t1.Compare(t2) > 0; |
91 | 10.2k | } |
92 | | |
93 | | template <> |
94 | 335 | bool GreaterThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
95 | 335 | return t1.Compare(t2) >= 0; |
96 | 335 | } |
97 | | |
98 | | // Duration comparison specializations |
99 | | template <> |
100 | 4.47k | bool LessThan(absl::Duration t1, absl::Duration t2) { |
101 | 4.47k | return absl::operator<(t1, t2); |
102 | 4.47k | } |
103 | | |
104 | | template <> |
105 | 333 | bool LessThanOrEqual(absl::Duration t1, absl::Duration t2) { |
106 | 333 | return absl::operator<=(t1, t2); |
107 | 333 | } |
108 | | |
109 | | template <> |
110 | 176 | bool GreaterThan(absl::Duration t1, absl::Duration t2) { |
111 | 176 | return absl::operator>(t1, t2); |
112 | 176 | } |
113 | | |
114 | | template <> |
115 | 214 | bool GreaterThanOrEqual(absl::Duration t1, absl::Duration t2) { |
116 | 214 | return absl::operator>=(t1, t2); |
117 | 214 | } |
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 | 189k | bool CrossNumericLessThan(T t, U u) { |
142 | 189k | return Number(t) < Number(u); |
143 | 189k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, long>(double, long) Line | Count | Source | 141 | 72.9k | bool CrossNumericLessThan(T t, U u) { | 142 | 72.9k | return Number(t) < Number(u); | 143 | 72.9k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 141 | 103k | bool CrossNumericLessThan(T t, U u) { | 142 | 103k | return Number(t) < Number(u); | 143 | 103k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 141 | 1.22k | bool CrossNumericLessThan(T t, U u) { | 142 | 1.22k | return Number(t) < Number(u); | 143 | 1.22k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 141 | 2.06k | bool CrossNumericLessThan(T t, U u) { | 142 | 2.06k | return Number(t) < Number(u); | 143 | 2.06k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, double>(long, double) Line | Count | Source | 141 | 2.58k | bool CrossNumericLessThan(T t, U u) { | 142 | 2.58k | return Number(t) < Number(u); | 143 | 2.58k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 141 | 7.45k | bool CrossNumericLessThan(T t, U u) { | 142 | 7.45k | return Number(t) < Number(u); | 143 | 7.45k | } |
|
144 | | |
145 | | template <typename T, typename U> |
146 | 79.6k | bool CrossNumericGreaterThan(T t, U u) { |
147 | 79.6k | return Number(t) > Number(u); |
148 | 79.6k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, long>(double, long) Line | Count | Source | 146 | 2.58k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 2.58k | return Number(t) > Number(u); | 148 | 2.58k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 146 | 52.7k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 52.7k | return Number(t) > Number(u); | 148 | 52.7k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 146 | 3.54k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 3.54k | return Number(t) > Number(u); | 148 | 3.54k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 146 | 1.76k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 1.76k | return Number(t) > Number(u); | 148 | 1.76k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, double>(long, double) Line | Count | Source | 146 | 10.4k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 10.4k | return Number(t) > Number(u); | 148 | 10.4k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 146 | 8.53k | bool CrossNumericGreaterThan(T t, U u) { | 147 | 8.53k | return Number(t) > Number(u); | 148 | 8.53k | } |
|
149 | | |
150 | | template <typename T, typename U> |
151 | 12.9k | bool CrossNumericLessOrEqualTo(T t, U u) { |
152 | 12.9k | return Number(t) <= Number(u); |
153 | 12.9k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, long>(double, long) Line | Count | Source | 151 | 3.95k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 3.95k | return Number(t) <= Number(u); | 153 | 3.95k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 151 | 2.11k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.11k | return Number(t) <= Number(u); | 153 | 2.11k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 151 | 2.53k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 2.53k | return Number(t) <= Number(u); | 153 | 2.53k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 151 | 1.84k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.84k | return Number(t) <= Number(u); | 153 | 1.84k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, double>(long, double) Line | Count | Source | 151 | 1.31k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.31k | return Number(t) <= Number(u); | 153 | 1.31k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 151 | 1.23k | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 1.23k | return Number(t) <= Number(u); | 153 | 1.23k | } |
|
154 | | |
155 | | template <typename T, typename U> |
156 | 54.6k | bool CrossNumericGreaterOrEqualTo(T t, U u) { |
157 | 54.6k | return Number(t) >= Number(u); |
158 | 54.6k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, long>(double, long) Line | Count | Source | 156 | 17.4k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 17.4k | return Number(t) >= Number(u); | 158 | 17.4k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 156 | 8.12k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 8.12k | return Number(t) >= Number(u); | 158 | 8.12k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 156 | 7.82k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 7.82k | return Number(t) >= Number(u); | 158 | 7.82k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 156 | 16.8k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 16.8k | return Number(t) >= Number(u); | 158 | 16.8k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, double>(long, double) Line | Count | Source | 156 | 2.48k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 2.48k | return Number(t) >= Number(u); | 158 | 2.48k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 156 | 1.89k | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 1.89k | return Number(t) >= Number(u); | 158 | 1.89k | } |
|
159 | | |
160 | | template <class Type> |
161 | | absl::Status RegisterComparisonFunctionsForType( |
162 | 173k | cel::FunctionRegistry& registry) { |
163 | 173k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; |
164 | 173k | CEL_RETURN_IF_ERROR(registry.Register( |
165 | 173k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), |
166 | 173k | FunctionAdapter::WrapFunction(LessThan<Type>))); |
167 | | |
168 | 173k | CEL_RETURN_IF_ERROR(registry.Register( |
169 | 173k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), |
170 | 173k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); |
171 | | |
172 | 173k | CEL_RETURN_IF_ERROR(registry.Register( |
173 | 173k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), |
174 | 173k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); |
175 | | |
176 | 173k | CEL_RETURN_IF_ERROR(registry.Register( |
177 | 173k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), |
178 | 173k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); |
179 | | |
180 | 173k | return absl::OkStatus(); |
181 | 173k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<bool>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<double>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::StringValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::BytesValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Duration>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260526::Time>(cel::FunctionRegistry&) Line | Count | Source | 162 | 21.6k | cel::FunctionRegistry& registry) { | 163 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 21.6k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 21.6k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 21.6k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 21.6k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 21.6k | return absl::OkStatus(); | 181 | 21.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 | 130k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { |
209 | 130k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; |
210 | 130k | CEL_RETURN_IF_ERROR(registry.Register( |
211 | 130k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, |
212 | 130k | /*receiver_style=*/false), |
213 | 130k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); |
214 | 130k | CEL_RETURN_IF_ERROR(registry.Register( |
215 | 130k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, |
216 | 130k | /*receiver_style=*/false), |
217 | 130k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); |
218 | 130k | CEL_RETURN_IF_ERROR(registry.Register( |
219 | 130k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, |
220 | 130k | /*receiver_style=*/false), |
221 | 130k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); |
222 | 130k | CEL_RETURN_IF_ERROR(registry.Register( |
223 | 130k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, |
224 | 130k | /*receiver_style=*/false), |
225 | 130k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); |
226 | 130k | return absl::OkStatus(); |
227 | 130k | } comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 21.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 21.6k | /*receiver_style=*/false), | 213 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 21.6k | /*receiver_style=*/false), | 217 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 21.6k | /*receiver_style=*/false), | 221 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 21.6k | /*receiver_style=*/false), | 225 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 21.6k | return absl::OkStatus(); | 227 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 21.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 21.6k | /*receiver_style=*/false), | 213 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 21.6k | /*receiver_style=*/false), | 217 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 21.6k | /*receiver_style=*/false), | 221 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 21.6k | /*receiver_style=*/false), | 225 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 21.6k | return absl::OkStatus(); | 227 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 21.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 21.6k | /*receiver_style=*/false), | 213 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 21.6k | /*receiver_style=*/false), | 217 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 21.6k | /*receiver_style=*/false), | 221 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 21.6k | /*receiver_style=*/false), | 225 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 21.6k | return absl::OkStatus(); | 227 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 21.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 21.6k | /*receiver_style=*/false), | 213 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 21.6k | /*receiver_style=*/false), | 217 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 21.6k | /*receiver_style=*/false), | 221 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 21.6k | /*receiver_style=*/false), | 225 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 21.6k | return absl::OkStatus(); | 227 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 21.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 21.6k | /*receiver_style=*/false), | 213 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 21.6k | /*receiver_style=*/false), | 217 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 21.6k | /*receiver_style=*/false), | 221 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 21.6k | /*receiver_style=*/false), | 225 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 21.6k | return absl::OkStatus(); | 227 | 21.6k | } |
comparison_functions.cc:absl::lts_20260526::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 21.6k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 21.6k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 21.6k | /*receiver_style=*/false), | 213 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 21.6k | /*receiver_style=*/false), | 217 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 21.6k | /*receiver_style=*/false), | 221 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 21.6k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 21.6k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 21.6k | /*receiver_style=*/false), | 225 | 21.6k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 21.6k | return absl::OkStatus(); | 227 | 21.6k | } |
|
228 | | |
229 | | absl::Status RegisterHeterogeneousComparisonFunctions( |
230 | 21.6k | cel::FunctionRegistry& registry) { |
231 | 21.6k | CEL_RETURN_IF_ERROR( |
232 | 21.6k | (RegisterCrossNumericComparisons<double, int64_t>(registry))); |
233 | 21.6k | CEL_RETURN_IF_ERROR( |
234 | 21.6k | (RegisterCrossNumericComparisons<double, uint64_t>(registry))); |
235 | | |
236 | 21.6k | CEL_RETURN_IF_ERROR( |
237 | 21.6k | (RegisterCrossNumericComparisons<uint64_t, double>(registry))); |
238 | 21.6k | CEL_RETURN_IF_ERROR( |
239 | 21.6k | (RegisterCrossNumericComparisons<uint64_t, int64_t>(registry))); |
240 | | |
241 | 21.6k | CEL_RETURN_IF_ERROR( |
242 | 21.6k | (RegisterCrossNumericComparisons<int64_t, double>(registry))); |
243 | 21.6k | CEL_RETURN_IF_ERROR( |
244 | 21.6k | (RegisterCrossNumericComparisons<int64_t, uint64_t>(registry))); |
245 | | |
246 | 21.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
247 | 21.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
248 | 21.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
249 | 21.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
250 | 21.6k | CEL_RETURN_IF_ERROR( |
251 | 21.6k | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
252 | 21.6k | CEL_RETURN_IF_ERROR( |
253 | 21.6k | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
254 | 21.6k | CEL_RETURN_IF_ERROR( |
255 | 21.6k | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
256 | 21.6k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
257 | | |
258 | 21.6k | return absl::OkStatus(); |
259 | 21.6k | } |
260 | | } // namespace |
261 | | |
262 | | absl::Status RegisterComparisonFunctions(FunctionRegistry& registry, |
263 | 21.6k | const RuntimeOptions& options) { |
264 | 21.6k | if (options.enable_heterogeneous_equality) { |
265 | 21.6k | CEL_RETURN_IF_ERROR(RegisterHeterogeneousComparisonFunctions(registry)); |
266 | 21.6k | } else { |
267 | 0 | CEL_RETURN_IF_ERROR(RegisterHomogenousComparisonFunctions(registry)); |
268 | 0 | } |
269 | 21.6k | return absl::OkStatus(); |
270 | 21.6k | } |
271 | | |
272 | | } // namespace cel |