6 #ifndef TURI_UNITY_TOOLKIT_FUNCTION_MACROS_HPP 7 #define TURI_UNITY_TOOLKIT_FUNCTION_MACROS_HPP 8 #include <model_server/lib/toolkit_util.hpp> 9 #include <model_server/lib/toolkit_function_specification.hpp> 10 #include <model_server/lib/toolkit_function_wrapper_impl.hpp> 11 #include <model_server/lib/toolkit_class_wrapper_impl.hpp> 61 #define BEGIN_FUNCTION_REGISTRATION \ 62 __attribute__((visibility("default"))) \ 63 std::vector<::turi::toolkit_function_specification> \ 64 get_toolkit_function_registration() { \ 65 std::vector<::turi::toolkit_function_specification> specs; 114 #define REGISTER_FUNCTION(function, ...) \ 115 specs.push_back(toolkit_function_wrapper_impl::make_spec_indirect(function, #function, \ 131 #define REGISTER_NAMED_FUNCTION(name, function, ...) \ 132 specs.push_back(toolkit_function_wrapper_impl::make_spec_indirect(function, name, \ 149 #define REGISTER_DOCSTRING(function, docstring) \ 150 for (auto& i: specs) { \ 151 if (i.description.count("_raw_fn_pointer_") && \ 152 i.description.at("_raw_fn_pointer_") == reinterpret_cast<size_t>(function)) { \ 153 i.description["documentation"] = docstring; \ 173 #define END_FUNCTION_REGISTRATION \ 179 #endif // TURI_UNITY_TOOLKIT_MAGIC_MACROS_HPP