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) \
48 # define ROBOT_MODULE_DEFAULT_CONSTRUCTOR(NAME, TYPE) \
51 ROBOT_MODULE_COMMON(NAME) \
52 ROBOT_MODULE_API unsigned int create_args_required() \
54 ROBOT_MODULE_API mc_rbdyn::RobotModule * create(const std::string &) \
55 { return new TYPE(); } \
62 # define ROBOT_MODULE_CANONIC_CONSTRUCTOR(NAME, TYPE) \
65 ROBOT_MODULE_COMMON(NAME) \
66 ROBOT_MODULE_API unsigned int create_args_required() \
68 ROBOT_MODULE_API mc_rbdyn::RobotModule * create(const std::string &, \
69 const std::string & path, \
70 const std::string & name) \
71 { return new TYPE(path, name); } \
78 # define ROBOT_MODULE_DEFAULT_CONSTRUCTOR(NAME, TYPE) \
81 static auto registered = []() \
83 using fn_t = std::function<TYPE *()>; \
84 mc_rbdyn::RobotLoader::register_object(NAME, fn_t([]() { return new TYPE(); })); \
89 # define ROBOT_MODULE_CANONIC_CONSTRUCTOR(NAME, TYPE) \
92 static auto registered = []() \
94 using fn_t = std::function<TYPE *(const std::string &, const std::string &)>; \
95 mc_rbdyn::RobotLoader::register_object( \
96 NAME, fn_t([](const std::string & path, const std::string & name) { return new TYPE(path, name); })); \