Class GlobalDef#
Defined in File registry.h
Inheritance Relationships#
Base Type#
public ReflectionDefBase
Class Documentation#
-
class GlobalDef : public ReflectionDefBase#
GlobalDef helper to register a global function.
namespace refl = tvm::ffi::reflection; refl::GlobalDef().def("my_ffi_extension.my_function", MyFunction);
Public Functions
-
template<typename Func, typename ...Extra>
inline GlobalDef &def(const char *name, Func &&func, Extra&&... extra)# Define a global function.
- Template Parameters:
Func – The function type.
Extra – The extra arguments.
- Parameters:
name – The name of the function.
func – The function to be registered.
extra – The extra arguments that can be docstring or subclass of FieldInfoTrait.
- Returns:
The reflection definition.
-
template<typename Func, typename ...Extra>
inline GlobalDef &def_packed(const char *name, Func func, Extra&&... extra)# Define a global function in ffi::PackedArgs format.
- Template Parameters:
Func – The function type.
Extra – The extra arguments.
- Parameters:
name – The name of the function.
func – The function to be registered.
extra – The extra arguments that can be docstring or subclass of FieldInfoTrait.
- Returns:
The reflection definition.
-
template<typename Func, typename ...Extra>
inline GlobalDef &def_method(const char *name, Func &&func, Extra&&... extra)# Expose a class method as a global function.
An argument will be added to the first position if the function is not static.
- Template Parameters:
Class – The class type.
Func – The function type.
- Parameters:
name – The name of the method.
func – The function to be registered.
extra – The extra arguments that can be docstring.
- Returns:
The reflection definition.
-
template<typename Func, typename ...Extra>