CppFunctionHandler#
package: org.yuanrong.call.
public class CppFunctionHandler<R>#
Class for creating instances of stateless functions in C++.
Note
The CppFunctionHandler class is a handle for a C++ function created on the cloud by a Java function. It is the return type of the interface YR.function(CppFunction<R> func).
Users can use CppFunctionHandler to create and invoke C++ function instances.
Interface description#
public CppFunctionHandler(CppFunction<R> func)#
CppFunctionHandler constructor.
Parameters:
func - CppFunction class instance.
public ObjectRef invoke(Object… args) throws YRException#
Cpp function call interface.
CppFunctionHandler cppFuncHandler = YR.function(CppFunction.of("Add", int.class));
ObjectRef ref = cppFuncHandler.invoke(1);
int result = YR.get(ref, 15);
Parameters:
args - The input parameters required to call the specified method.
Returns:
ObjectRef: The “id” of the method’s return value in the data system. Use YR.get() to get the actual return value of the method.
Throws:
YRException - Unified exception types thrown.
public CppFunctionHandler<R> setUrn(String urn)#
When Java calls a stateless function in C++, set the functionUrn for the function.
Parameters:
urn - functionUrn, can be obtained after the function is deployed.
Returns:
CppFunctionHandler<R>, with built-in invoke method, can create and call the cpp function instance.
public CppFunctionHandler<R> options(InvokeOptions opt)#
Used to dynamically modify the parameters of the called function.
Parameters:
opt - See InvokeOptions for details.
Returns:
CppFunctionHandler<R>, Handles processed by C++ functions.