MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / RegisterMathExtensionFunctions

Function RegisterMathExtensionFunctions

extensions/math_ext.cc:310–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308} // namespace
309
310absl::Status RegisterMathExtensionFunctions(FunctionRegistry& registry,
311 const RuntimeOptions& options,
312 int version) {
313 CEL_RETURN_IF_ERROR(
314 (UnaryFunctionAdapter<Value, int64_t>::RegisterGlobalOverload(
315 kMathMin, Identity<int64_t>, registry)));
316 CEL_RETURN_IF_ERROR(
317 (UnaryFunctionAdapter<Value, double>::RegisterGlobalOverload(
318 kMathMin, Identity<double>, registry)));
319 CEL_RETURN_IF_ERROR(
320 (UnaryFunctionAdapter<Value, uint64_t>::RegisterGlobalOverload(
321 kMathMin, Identity<uint64_t>, registry)));
322 CEL_RETURN_IF_ERROR(
323 (BinaryFunctionAdapter<Value, int64_t, int64_t>::RegisterGlobalOverload(
324 kMathMin, Min<int64_t, int64_t>, registry)));
325 CEL_RETURN_IF_ERROR(
326 (BinaryFunctionAdapter<Value, double, double>::RegisterGlobalOverload(
327 kMathMin, Min<double, double>, registry)));
328 CEL_RETURN_IF_ERROR(
329 (BinaryFunctionAdapter<Value, uint64_t, uint64_t>::RegisterGlobalOverload(
330 kMathMin, Min<uint64_t, uint64_t>, registry)));
331 CEL_RETURN_IF_ERROR((RegisterCrossNumericMin<int64_t, uint64_t>(registry)));
332 CEL_RETURN_IF_ERROR((RegisterCrossNumericMin<int64_t, double>(registry)));
333 CEL_RETURN_IF_ERROR((RegisterCrossNumericMin<double, uint64_t>(registry)));
334 CEL_RETURN_IF_ERROR((
335 UnaryFunctionAdapter<absl::StatusOr<Value>,
336 ListValue>::RegisterGlobalOverload(kMathMin, MinList,
337 registry)));
338
339 CEL_RETURN_IF_ERROR(
340 (UnaryFunctionAdapter<Value, int64_t>::RegisterGlobalOverload(
341 kMathMax, Identity<int64_t>, registry)));
342 CEL_RETURN_IF_ERROR(
343 (UnaryFunctionAdapter<Value, double>::RegisterGlobalOverload(
344 kMathMax, Identity<double>, registry)));
345 CEL_RETURN_IF_ERROR(
346 (UnaryFunctionAdapter<Value, uint64_t>::RegisterGlobalOverload(
347 kMathMax, Identity<uint64_t>, registry)));
348 CEL_RETURN_IF_ERROR(
349 (BinaryFunctionAdapter<Value, int64_t, int64_t>::RegisterGlobalOverload(
350 kMathMax, Max<int64_t, int64_t>, registry)));
351 CEL_RETURN_IF_ERROR(
352 (BinaryFunctionAdapter<Value, double, double>::RegisterGlobalOverload(
353 kMathMax, Max<double, double>, registry)));
354 CEL_RETURN_IF_ERROR(
355 (BinaryFunctionAdapter<Value, uint64_t, uint64_t>::RegisterGlobalOverload(
356 kMathMax, Max<uint64_t, uint64_t>, registry)));
357 CEL_RETURN_IF_ERROR((RegisterCrossNumericMax<int64_t, uint64_t>(registry)));
358 CEL_RETURN_IF_ERROR((RegisterCrossNumericMax<int64_t, double>(registry)));
359 CEL_RETURN_IF_ERROR((RegisterCrossNumericMax<double, uint64_t>(registry)));
360 CEL_RETURN_IF_ERROR((
361 UnaryFunctionAdapter<absl::StatusOr<Value>,
362 ListValue>::RegisterGlobalOverload(kMathMax, MaxList,
363 registry)));
364 if (version == 0) {
365 return absl::OkStatus();
366 }
367

Callers 6

TESTFunction · 0.85
ExpectResultFunction · 0.85
TEST_PFunction · 0.85
CreateMethod · 0.85
SetupMethod · 0.85

Calls 1

ConvertToRuntimeOptionsFunction · 0.85

Tested by 3

TESTFunction · 0.68
ExpectResultFunction · 0.68
TEST_PFunction · 0.68