Turi Create
4.0
|
Macros | |
#define | BEGIN_FUNCTION_REGISTRATION |
#define | REGISTER_FUNCTION(function, ...) |
#define | REGISTER_NAMED_FUNCTION(name, function, ...) |
#define | REGISTER_DOCSTRING(function, docstring) |
#define | END_FUNCTION_REGISTRATION |
The Function Extension Interface provides a collection of macros that automate the process of exporting a function to Python. The macros are located in sdk/toolkit_function_macros.hpp .
For detailed usage descriptions, see page_turicreate_extension_interface .
Example:
#define BEGIN_FUNCTION_REGISTRATION |
Begins a toolkit registration block.
The basic usage is:
Definition at line 61 of file toolkit_function_macros.hpp.
#define END_FUNCTION_REGISTRATION |
Ends a toolkit registration block.
The basic usage is:
Definition at line 173 of file toolkit_function_macros.hpp.
#define REGISTER_DOCSTRING | ( | function, | |
docstring | |||
) |
Sets a docstring on the function. If not provided, a default docstring describing the input arguments will be used. Must be called only after the function is registered. i.e. the matching REGISTER_FUNCTION must appear before, and it must be called with exactly the same function.
Definition at line 149 of file toolkit_function_macros.hpp.
#define REGISTER_FUNCTION | ( | function, | |
... | |||
) |
Registers a function to make it callable from Python.
Registers a function with no arguments.
Registers a function with 3 input arguments. The first input argument shall be named "a", the second named "b" and the 3rd named "c"
Example:
Namespaces are permitted. For instance:
Both will be published as "demo_to_string"; the namespacing is ignored.
The return value of the function will be returned to Python. The function can return void. If the function fails, it should throw an exception which will be forward back to Python as RuntimeError.
Definition at line 114 of file toolkit_function_macros.hpp.
#define REGISTER_NAMED_FUNCTION | ( | name, | |
function, | |||
... | |||
) |
Register a function, assigning it a different name than the name of the function.
Definition at line 131 of file toolkit_function_macros.hpp.