Go to the documentation of this file.
9 #ifndef MC_RTC_BUILD_STATIC
11 # include <mc_rtc/version.h>
22 # define ROBOT_MODULE_CHECK_VERSION(NAME) \
23 if(mc_rtc::MC_RTC_VERSION != mc_rtc::version()) \
25 mc_rtc::log::error("{} was compiled with {} but mc_rtc is currently at version {}, you might experience subtle " \
26 "issues and should recompile your code", \
27 NAME, mc_rtc::MC_RTC_VERSION, mc_rtc::version()); \
34 # define ROBOT_MODULE_COMMON(NAME) \
35 ROBOT_MODULE_API void MC_RTC_ROBOT_MODULE(std::vector<std::string> & names) \
37 ROBOT_MODULE_CHECK_VERSION(NAME) \
40 ROBOT_MODULE_API void destroy(mc_rbdyn::RobotModule * ptr) \
50 # define ROBOT_MODULE_DEFAULT_CONSTRUCTOR(NAME, TYPE) \
53 ROBOT_MODULE_COMMON(NAME) \
54 ROBOT_MODULE_API unsigned int create_args_required() \
58 ROBOT_MODULE_API mc_rbdyn::RobotModule * create(const std::string &) \
68 # define ROBOT_MODULE_CANONIC_CONSTRUCTOR(NAME, TYPE) \
71 ROBOT_MODULE_COMMON(NAME) \
72 ROBOT_MODULE_API unsigned int create_args_required() \
76 ROBOT_MODULE_API mc_rbdyn::RobotModule * create(const std::string &, \
77 const std::string & path, \
78 const std::string & name) \
80 return new TYPE(path, name); \
88 # define ROBOT_MODULE_DEFAULT_CONSTRUCTOR(NAME, TYPE) \
91 static auto registered = []() \
93 using fn_t = std::function<TYPE *()>; \
94 mc_rbdyn::RobotLoader::register_object(NAME, fn_t([]() { return new TYPE(); })); \
99 # define ROBOT_MODULE_CANONIC_CONSTRUCTOR(NAME, TYPE) \
102 static auto registered = []() \
104 using fn_t = std::function<TYPE *(const std::string &, const std::string &)>; \
105 mc_rbdyn::RobotLoader::register_object( \
106 NAME, fn_t([](const std::string & path, const std::string & name) { return new TYPE(path, name); })); \