GlobalPluginMacros.h File Reference
#include <mc_control/GlobalPlugin.h>
#include <mc_rtc/version.h>
Include dependency graph for GlobalPluginMacros.h:

Go to the source code of this file.

Macros

#define MC_RTC_GLOBAL_PLUGIN_CHECK_VERSION(NAME)
 
#define EXPORT_MC_RTC_PLUGIN(NAME, TYPE)
 

Macro Definition Documentation

◆ EXPORT_MC_RTC_PLUGIN

#define EXPORT_MC_RTC_PLUGIN (   NAME,
  TYPE 
)
Value:
extern "C" \
{ \
GLOBAL_PLUGIN_API void MC_RTC_GLOBAL_PLUGIN(std::vector<std::string> & names) \
{ \
MC_RTC_GLOBAL_PLUGIN_CHECK_VERSION(NAME) \
names = {NAME}; \
} \
\
GLOBAL_PLUGIN_API void destroy(mc_control::GlobalPlugin * ptr) \
{ \
delete ptr; \
} \
\
GLOBAL_PLUGIN_API mc_control::GlobalPlugin * create(const std::string &) \
{ \
return new TYPE(); \
} \
}

◆ MC_RTC_GLOBAL_PLUGIN_CHECK_VERSION

#define MC_RTC_GLOBAL_PLUGIN_CHECK_VERSION (   NAME)
Value:
if(mc_rtc::MC_RTC_VERSION != mc_rtc::version()) \
{ \
mc_rtc::log::error("{} was compiled with {} but mc_rtc is currently at version {}, you might experience subtle " \
"issues and should recompile your code", \
NAME, mc_rtc::MC_RTC_VERSION, mc_rtc::version()); \
}

A simple compile-time versus run-time version checking macro

If you are not relying on EXPORT_MC_RTC_PLUGIN you should use this in your MC_RTC_GLOBAL_PLUGIN implementation

mc_control::GlobalPlugin
Definition: GlobalPlugin.h:21
mc_rtc::log::error
void error(Args &&... args)
Definition: logging.h:63