yr.cpp_function

Contents

yr.cpp_function#

yr.cpp_function(function_name: str, function_urn: str) FunctionProxy[source]#

A proxy for constructing cpp functions and remotely calling cpp functions.

Parameters:
  • function_name (str) – cpp function name.

  • function_urn (str) – The URN (Uniform Resource Name) of cpp function.

Returns:

Return a proxy object for the remote C++ function. Data type is StatelessFunction.

Examples

#include "yr/yr.h"
int Square(int x)
{
    return x * x;
}

// Define the stateless function Square
YR_INVOKE(Square)
>>> import yr
>>> yr.init()
>>> cpp_function_urn = (
...     "sn:cn:yrk:default:"
...     "function:0-yr-defaultservice-cpp:$latest"
... )
>>> square_func = yr.cpp_function("Square", cpp_function_urn)
>>> result = square_func.invoke(5)
>>> print(yr.get(result))
>>> yr.finalize()