/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 | 2.20k | bool LessThan(Type t1, Type t2) { |
38 | 2.20k | return (t1 < t2); |
39 | 2.20k | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<bool>(bool, bool) Line | Count | Source | 37 | 161 | bool LessThan(Type t1, Type t2) { | 38 | 161 | return (t1 < t2); | 39 | 161 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<long>(long, long) Line | Count | Source | 37 | 1.67k | bool LessThan(Type t1, Type t2) { | 38 | 1.67k | return (t1 < t2); | 39 | 1.67k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 37 | 231 | bool LessThan(Type t1, Type t2) { | 38 | 231 | return (t1 < t2); | 39 | 231 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThan<double>(double, double) Line | Count | Source | 37 | 140 | bool LessThan(Type t1, Type t2) { | 38 | 140 | return (t1 < t2); | 39 | 140 | } |
|
40 | | |
41 | | template <class Type> |
42 | 998 | bool LessThanOrEqual(Type t1, Type t2) { |
43 | 998 | return (t1 <= t2); |
44 | 998 | } comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<bool>(bool, bool) Line | Count | Source | 42 | 11 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 11 | return (t1 <= t2); | 44 | 11 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<long>(long, long) Line | Count | Source | 42 | 562 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 562 | return (t1 <= t2); | 44 | 562 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 42 | 274 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 274 | return (t1 <= t2); | 44 | 274 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::LessThanOrEqual<double>(double, double) Line | Count | Source | 42 | 151 | bool LessThanOrEqual(Type t1, Type t2) { | 43 | 151 | return (t1 <= t2); | 44 | 151 | } |
|
45 | | |
46 | | template <class Type> |
47 | 1.35k | bool GreaterThan(Type t1, Type t2) { |
48 | 1.35k | return LessThan(t2, t1); |
49 | 1.35k | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<bool>(bool, bool) Line | Count | Source | 47 | 143 | bool GreaterThan(Type t1, Type t2) { | 48 | 143 | return LessThan(t2, t1); | 49 | 143 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<long>(long, long) Line | Count | Source | 47 | 1.06k | bool GreaterThan(Type t1, Type t2) { | 48 | 1.06k | return LessThan(t2, t1); | 49 | 1.06k | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 47 | 86 | bool GreaterThan(Type t1, Type t2) { | 48 | 86 | return LessThan(t2, t1); | 49 | 86 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThan<double>(double, double) Line | Count | Source | 47 | 55 | bool GreaterThan(Type t1, Type t2) { | 48 | 55 | return LessThan(t2, t1); | 49 | 55 | } |
|
50 | | |
51 | | template <class Type> |
52 | 450 | bool GreaterThanOrEqual(Type t1, Type t2) { |
53 | 450 | return LessThanOrEqual(t2, t1); |
54 | 450 | } comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<bool>(bool, bool) Line | Count | Source | 52 | 11 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 11 | return LessThanOrEqual(t2, t1); | 54 | 11 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<long>(long, long) Line | Count | Source | 52 | 255 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 255 | return LessThanOrEqual(t2, t1); | 54 | 255 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<unsigned long>(unsigned long, unsigned long) Line | Count | Source | 52 | 101 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 101 | return LessThanOrEqual(t2, t1); | 54 | 101 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::GreaterThanOrEqual<double>(double, double) Line | Count | Source | 52 | 83 | bool GreaterThanOrEqual(Type t1, Type t2) { | 53 | 83 | return LessThanOrEqual(t2, t1); | 54 | 83 | } |
|
55 | | |
56 | | // String value comparions specializations |
57 | | template <> |
58 | 178 | bool LessThan(const StringValue& t1, const StringValue& t2) { |
59 | 178 | return t1.Compare(t2) < 0; |
60 | 178 | } |
61 | | |
62 | | template <> |
63 | 133 | bool LessThanOrEqual(const StringValue& t1, const StringValue& t2) { |
64 | 133 | return t1.Compare(t2) <= 0; |
65 | 133 | } |
66 | | |
67 | | template <> |
68 | 413 | bool GreaterThan(const StringValue& t1, const StringValue& t2) { |
69 | 413 | return t1.Compare(t2) > 0; |
70 | 413 | } |
71 | | |
72 | | template <> |
73 | 51 | bool GreaterThanOrEqual(const StringValue& t1, const StringValue& t2) { |
74 | 51 | return t1.Compare(t2) >= 0; |
75 | 51 | } |
76 | | |
77 | | // bytes value comparions specializations |
78 | | template <> |
79 | 129 | bool LessThan(const BytesValue& t1, const BytesValue& t2) { |
80 | 129 | return t1.Compare(t2) < 0; |
81 | 129 | } |
82 | | |
83 | | template <> |
84 | 39 | bool LessThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
85 | 39 | return t1.Compare(t2) <= 0; |
86 | 39 | } |
87 | | |
88 | | template <> |
89 | 28 | bool GreaterThan(const BytesValue& t1, const BytesValue& t2) { |
90 | 28 | return t1.Compare(t2) > 0; |
91 | 28 | } |
92 | | |
93 | | template <> |
94 | 204 | bool GreaterThanOrEqual(const BytesValue& t1, const BytesValue& t2) { |
95 | 204 | return t1.Compare(t2) >= 0; |
96 | 204 | } |
97 | | |
98 | | // Duration comparison specializations |
99 | | template <> |
100 | 0 | bool LessThan(absl::Duration t1, absl::Duration t2) { |
101 | 0 | return absl::operator<(t1, t2); |
102 | 0 | } |
103 | | |
104 | | template <> |
105 | 0 | bool LessThanOrEqual(absl::Duration t1, absl::Duration t2) { |
106 | 0 | return absl::operator<=(t1, t2); |
107 | 0 | } |
108 | | |
109 | | template <> |
110 | 0 | bool GreaterThan(absl::Duration t1, absl::Duration t2) { |
111 | 0 | return absl::operator>(t1, t2); |
112 | 0 | } |
113 | | |
114 | | template <> |
115 | 0 | bool GreaterThanOrEqual(absl::Duration t1, absl::Duration t2) { |
116 | 0 | return absl::operator>=(t1, t2); |
117 | 0 | } |
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 | 2.12k | bool CrossNumericLessThan(T t, U u) { |
142 | 2.12k | return Number(t) < Number(u); |
143 | 2.12k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, long>(double, long) Line | Count | Source | 141 | 342 | bool CrossNumericLessThan(T t, U u) { | 142 | 342 | return Number(t) < Number(u); | 143 | 342 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 141 | 215 | bool CrossNumericLessThan(T t, U u) { | 142 | 215 | return Number(t) < Number(u); | 143 | 215 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 141 | 213 | bool CrossNumericLessThan(T t, U u) { | 142 | 213 | return Number(t) < Number(u); | 143 | 213 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 141 | 650 | bool CrossNumericLessThan(T t, U u) { | 142 | 650 | return Number(t) < Number(u); | 143 | 650 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, double>(long, double) Line | Count | Source | 141 | 274 | bool CrossNumericLessThan(T t, U u) { | 142 | 274 | return Number(t) < Number(u); | 143 | 274 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 141 | 433 | bool CrossNumericLessThan(T t, U u) { | 142 | 433 | return Number(t) < Number(u); | 143 | 433 | } |
|
144 | | |
145 | | template <typename T, typename U> |
146 | 2.26k | bool CrossNumericGreaterThan(T t, U u) { |
147 | 2.26k | return Number(t) > Number(u); |
148 | 2.26k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, long>(double, long) Line | Count | Source | 146 | 305 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 305 | return Number(t) > Number(u); | 148 | 305 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<double, unsigned long>(double, unsigned long) Line | Count | Source | 146 | 194 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 194 | return Number(t) > Number(u); | 148 | 194 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, double>(unsigned long, double) Line | Count | Source | 146 | 176 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 176 | return Number(t) > Number(u); | 148 | 176 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<unsigned long, long>(unsigned long, long) Line | Count | Source | 146 | 696 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 696 | return Number(t) > Number(u); | 148 | 696 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, double>(long, double) Line | Count | Source | 146 | 208 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 208 | return Number(t) > Number(u); | 148 | 208 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterThan<long, unsigned long>(long, unsigned long) Line | Count | Source | 146 | 683 | bool CrossNumericGreaterThan(T t, U u) { | 147 | 683 | return Number(t) > Number(u); | 148 | 683 | } |
|
149 | | |
150 | | template <typename T, typename U> |
151 | 1.68k | bool CrossNumericLessOrEqualTo(T t, U u) { |
152 | 1.68k | return Number(t) <= Number(u); |
153 | 1.68k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, long>(double, long) Line | Count | Source | 151 | 281 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 281 | return Number(t) <= Number(u); | 153 | 281 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 151 | 229 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 229 | return Number(t) <= Number(u); | 153 | 229 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 151 | 182 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 182 | return Number(t) <= Number(u); | 153 | 182 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 151 | 431 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 431 | return Number(t) <= Number(u); | 153 | 431 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, double>(long, double) Line | Count | Source | 151 | 228 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 228 | return Number(t) <= Number(u); | 153 | 228 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericLessOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 151 | 336 | bool CrossNumericLessOrEqualTo(T t, U u) { | 152 | 336 | return Number(t) <= Number(u); | 153 | 336 | } |
|
154 | | |
155 | | template <typename T, typename U> |
156 | 1.73k | bool CrossNumericGreaterOrEqualTo(T t, U u) { |
157 | 1.73k | return Number(t) >= Number(u); |
158 | 1.73k | } comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, long>(double, long) Line | Count | Source | 156 | 291 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 291 | return Number(t) >= Number(u); | 158 | 291 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<double, unsigned long>(double, unsigned long) Line | Count | Source | 156 | 137 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 137 | return Number(t) >= Number(u); | 158 | 137 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, double>(unsigned long, double) Line | Count | Source | 156 | 229 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 229 | return Number(t) >= Number(u); | 158 | 229 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<unsigned long, long>(unsigned long, long) Line | Count | Source | 156 | 427 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 427 | return Number(t) >= Number(u); | 158 | 427 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, double>(long, double) Line | Count | Source | 156 | 303 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 303 | return Number(t) >= Number(u); | 158 | 303 | } |
comparison_functions.cc:bool cel::(anonymous namespace)::CrossNumericGreaterOrEqualTo<long, unsigned long>(long, unsigned long) Line | Count | Source | 156 | 343 | bool CrossNumericGreaterOrEqualTo(T t, U u) { | 157 | 343 | return Number(t) >= Number(u); | 158 | 343 | } |
|
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_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<bool>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<double>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::StringValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<cel::BytesValue const&>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260107::Duration>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterComparisonFunctionsForType<absl::lts_20260107::Time>(cel::FunctionRegistry&) Line | Count | Source | 162 | 14.5k | cel::FunctionRegistry& registry) { | 163 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, Type, Type>; | 164 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 165 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, false), | 166 | 14.5k | FunctionAdapter::WrapFunction(LessThan<Type>))); | 167 | | | 168 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 169 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, false), | 170 | 14.5k | FunctionAdapter::WrapFunction(LessThanOrEqual<Type>))); | 171 | | | 172 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 173 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, false), | 174 | 14.5k | FunctionAdapter::WrapFunction(GreaterThan<Type>))); | 175 | | | 176 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 177 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, false), | 178 | 14.5k | FunctionAdapter::WrapFunction(GreaterThanOrEqual<Type>))); | 179 | | | 180 | 14.5k | return absl::OkStatus(); | 181 | 14.5k | } |
|
182 | | |
183 | | absl::Status RegisterHomogenousComparisonFunctions( |
184 | 0 | cel::FunctionRegistry& registry) { |
185 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
186 | | |
187 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
188 | | |
189 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
190 | | |
191 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
192 | | |
193 | 0 | CEL_RETURN_IF_ERROR( |
194 | 0 | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
195 | | |
196 | 0 | CEL_RETURN_IF_ERROR( |
197 | 0 | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
198 | | |
199 | 0 | CEL_RETURN_IF_ERROR( |
200 | 0 | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
201 | | |
202 | 0 | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
203 | | |
204 | 0 | return absl::OkStatus(); |
205 | 0 | } |
206 | | |
207 | | template <typename T, typename U> |
208 | 87.1k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { |
209 | 87.1k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; |
210 | 87.1k | CEL_RETURN_IF_ERROR(registry.Register( |
211 | 87.1k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, |
212 | 87.1k | /*receiver_style=*/false), |
213 | 87.1k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); |
214 | 87.1k | CEL_RETURN_IF_ERROR(registry.Register( |
215 | 87.1k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, |
216 | 87.1k | /*receiver_style=*/false), |
217 | 87.1k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); |
218 | 87.1k | CEL_RETURN_IF_ERROR(registry.Register( |
219 | 87.1k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, |
220 | 87.1k | /*receiver_style=*/false), |
221 | 87.1k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); |
222 | 87.1k | CEL_RETURN_IF_ERROR(registry.Register( |
223 | 87.1k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, |
224 | 87.1k | /*receiver_style=*/false), |
225 | 87.1k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); |
226 | 87.1k | return absl::OkStatus(); |
227 | 87.1k | } comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.5k | /*receiver_style=*/false), | 213 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.5k | /*receiver_style=*/false), | 217 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.5k | /*receiver_style=*/false), | 221 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.5k | /*receiver_style=*/false), | 225 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.5k | return absl::OkStatus(); | 227 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<double, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.5k | /*receiver_style=*/false), | 213 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.5k | /*receiver_style=*/false), | 217 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.5k | /*receiver_style=*/false), | 221 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.5k | /*receiver_style=*/false), | 225 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.5k | return absl::OkStatus(); | 227 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.5k | /*receiver_style=*/false), | 213 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.5k | /*receiver_style=*/false), | 217 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.5k | /*receiver_style=*/false), | 221 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.5k | /*receiver_style=*/false), | 225 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.5k | return absl::OkStatus(); | 227 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<unsigned long, long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.5k | /*receiver_style=*/false), | 213 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.5k | /*receiver_style=*/false), | 217 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.5k | /*receiver_style=*/false), | 221 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.5k | /*receiver_style=*/false), | 225 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.5k | return absl::OkStatus(); | 227 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, double>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.5k | /*receiver_style=*/false), | 213 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.5k | /*receiver_style=*/false), | 217 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.5k | /*receiver_style=*/false), | 221 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.5k | /*receiver_style=*/false), | 225 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.5k | return absl::OkStatus(); | 227 | 14.5k | } |
comparison_functions.cc:absl::lts_20260107::Status cel::(anonymous namespace)::RegisterCrossNumericComparisons<long, unsigned long>(cel::FunctionRegistry&) Line | Count | Source | 208 | 14.5k | absl::Status RegisterCrossNumericComparisons(cel::FunctionRegistry& registry) { | 209 | 14.5k | using FunctionAdapter = BinaryFunctionAdapter<bool, T, U>; | 210 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 211 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLess, | 212 | 14.5k | /*receiver_style=*/false), | 213 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessThan<T, U>))); | 214 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 215 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreater, | 216 | 14.5k | /*receiver_style=*/false), | 217 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterThan<T, U>))); | 218 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 219 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kGreaterOrEqual, | 220 | 14.5k | /*receiver_style=*/false), | 221 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericGreaterOrEqualTo<T, U>))); | 222 | 14.5k | CEL_RETURN_IF_ERROR(registry.Register( | 223 | 14.5k | FunctionAdapter::CreateDescriptor(cel::builtin::kLessOrEqual, | 224 | 14.5k | /*receiver_style=*/false), | 225 | 14.5k | FunctionAdapter::WrapFunction(&CrossNumericLessOrEqualTo<T, U>))); | 226 | 14.5k | return absl::OkStatus(); | 227 | 14.5k | } |
|
228 | | |
229 | | absl::Status RegisterHeterogeneousComparisonFunctions( |
230 | 14.5k | cel::FunctionRegistry& registry) { |
231 | 14.5k | CEL_RETURN_IF_ERROR( |
232 | 14.5k | (RegisterCrossNumericComparisons<double, int64_t>(registry))); |
233 | 14.5k | CEL_RETURN_IF_ERROR( |
234 | 14.5k | (RegisterCrossNumericComparisons<double, uint64_t>(registry))); |
235 | | |
236 | 14.5k | CEL_RETURN_IF_ERROR( |
237 | 14.5k | (RegisterCrossNumericComparisons<uint64_t, double>(registry))); |
238 | 14.5k | CEL_RETURN_IF_ERROR( |
239 | 14.5k | (RegisterCrossNumericComparisons<uint64_t, int64_t>(registry))); |
240 | | |
241 | 14.5k | CEL_RETURN_IF_ERROR( |
242 | 14.5k | (RegisterCrossNumericComparisons<int64_t, double>(registry))); |
243 | 14.5k | CEL_RETURN_IF_ERROR( |
244 | 14.5k | (RegisterCrossNumericComparisons<int64_t, uint64_t>(registry))); |
245 | | |
246 | 14.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<bool>(registry)); |
247 | 14.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<int64_t>(registry)); |
248 | 14.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<uint64_t>(registry)); |
249 | 14.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<double>(registry)); |
250 | 14.5k | CEL_RETURN_IF_ERROR( |
251 | 14.5k | RegisterComparisonFunctionsForType<const StringValue&>(registry)); |
252 | 14.5k | CEL_RETURN_IF_ERROR( |
253 | 14.5k | RegisterComparisonFunctionsForType<const BytesValue&>(registry)); |
254 | 14.5k | CEL_RETURN_IF_ERROR( |
255 | 14.5k | RegisterComparisonFunctionsForType<absl::Duration>(registry)); |
256 | 14.5k | CEL_RETURN_IF_ERROR(RegisterComparisonFunctionsForType<absl::Time>(registry)); |
257 | | |
258 | 14.5k | return absl::OkStatus(); |
259 | 14.5k | } |
260 | | } // namespace |
261 | | |
262 | | absl::Status RegisterComparisonFunctions(FunctionRegistry& registry, |
263 | 14.5k | const RuntimeOptions& options) { |
264 | 14.5k | if (options.enable_heterogeneous_equality) { |
265 | 14.5k | CEL_RETURN_IF_ERROR(RegisterHeterogeneousComparisonFunctions(registry)); |
266 | 14.5k | } else { |
267 | 0 | CEL_RETURN_IF_ERROR(RegisterHomogenousComparisonFunctions(registry)); |
268 | 0 | } |
269 | 14.5k | return absl::OkStatus(); |
270 | 14.5k | } |
271 | | |
272 | | } // namespace cel |