/proc/self/cwd/eval/public/builtin_func_registrar.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 "eval/public/builtin_func_registrar.h" |
16 | | |
17 | | #include "absl/status/status.h" |
18 | | #include "eval/public/cel_function_registry.h" |
19 | | #include "eval/public/cel_options.h" |
20 | | #include "internal/status_macros.h" |
21 | | #include "runtime/function_registry.h" |
22 | | #include "runtime/runtime_options.h" |
23 | | #include "runtime/standard/arithmetic_functions.h" |
24 | | #include "runtime/standard/comparison_functions.h" |
25 | | #include "runtime/standard/container_functions.h" |
26 | | #include "runtime/standard/container_membership_functions.h" |
27 | | #include "runtime/standard/equality_functions.h" |
28 | | #include "runtime/standard/logical_functions.h" |
29 | | #include "runtime/standard/regex_functions.h" |
30 | | #include "runtime/standard/string_functions.h" |
31 | | #include "runtime/standard/time_functions.h" |
32 | | #include "runtime/standard/type_conversion_functions.h" |
33 | | |
34 | | namespace google::api::expr::runtime { |
35 | | |
36 | | absl::Status RegisterBuiltinFunctions(CelFunctionRegistry* registry, |
37 | 14.5k | const InterpreterOptions& options) { |
38 | 14.5k | cel::FunctionRegistry& modern_registry = registry->InternalGetRegistry(); |
39 | 14.5k | cel::RuntimeOptions runtime_options = ConvertToRuntimeOptions(options); |
40 | | |
41 | 14.5k | CEL_RETURN_IF_ERROR( |
42 | 14.5k | cel::RegisterLogicalFunctions(modern_registry, runtime_options)); |
43 | 14.5k | CEL_RETURN_IF_ERROR( |
44 | 14.5k | cel::RegisterComparisonFunctions(modern_registry, runtime_options)); |
45 | 14.5k | CEL_RETURN_IF_ERROR( |
46 | 14.5k | cel::RegisterContainerFunctions(modern_registry, runtime_options)); |
47 | 14.5k | CEL_RETURN_IF_ERROR(cel::RegisterContainerMembershipFunctions( |
48 | 14.5k | modern_registry, runtime_options)); |
49 | 14.5k | CEL_RETURN_IF_ERROR( |
50 | 14.5k | cel::RegisterTypeConversionFunctions(modern_registry, runtime_options)); |
51 | 14.5k | CEL_RETURN_IF_ERROR( |
52 | 14.5k | cel::RegisterArithmeticFunctions(modern_registry, runtime_options)); |
53 | 14.5k | CEL_RETURN_IF_ERROR( |
54 | 14.5k | cel::RegisterTimeFunctions(modern_registry, runtime_options)); |
55 | 14.5k | CEL_RETURN_IF_ERROR( |
56 | 14.5k | cel::RegisterStringFunctions(modern_registry, runtime_options)); |
57 | 14.5k | CEL_RETURN_IF_ERROR( |
58 | 14.5k | cel::RegisterRegexFunctions(modern_registry, runtime_options)); |
59 | 14.5k | CEL_RETURN_IF_ERROR( |
60 | 14.5k | cel::RegisterEqualityFunctions(modern_registry, runtime_options)); |
61 | | |
62 | 14.5k | return absl::OkStatus(); |
63 | 14.5k | } |
64 | | |
65 | | } // namespace google::api::expr::runtime |