Gazebo Plugin

API Reference

2.0.3
gz/plugin/RegisterStatic.hh File Reference
#include <gz/plugin/detail/RegisterStatic.hh>

Go to the source code of this file.

Macros

#define GZ_ADD_STATIC_PLUGIN(PluginClass, ...)    DETAIL_GZ_ADD_STATIC_PLUGIN(PluginClass, __VA_ARGS__)
 Add a plugin and interface from this static library. More...
 
#define GZ_ADD_STATIC_PLUGIN_ALIAS(PluginClass, ...)    DETAIL_GZ_ADD_STATIC_PLUGIN_ALIAS(PluginClass, __VA_ARGS__)
 Add an alias for one of your plugins. More...
 

Macro Definition Documentation

◆ GZ_ADD_STATIC_PLUGIN

#define GZ_ADD_STATIC_PLUGIN (   PluginClass,
  ... 
)     DETAIL_GZ_ADD_STATIC_PLUGIN(PluginClass, __VA_ARGS__)

Add a plugin and interface from this static library.

This macro can be put in any namespace and may be called any number of times. It can be called multiple times on the same plugin class in order to register multiple interfaces, e.g.:

GZ_ADD_STATIC_PLUGIN(PluginClass, Interface1)
GZ_ADD_STATIC_PLUGIN(PluginClass, Interface2)
/* Some other code */
GZ_ADD_STATIC_PLUGIN(PluginClass, Interface3)

Or you can list multiple interfaces in a single call to the macro, e.g.:

GZ_ADD_STATIC_PLUGIN(PluginClass, Interface1, Interface2, Interface3)

This macro version is to be used when the plugin library is expected to be linked statically into the same program as the loader that instantiates the plugin. Multiple translation units in the same library may include the gz/plugins/RegisterStatic.hh header.

◆ GZ_ADD_STATIC_PLUGIN_ALIAS

#define GZ_ADD_STATIC_PLUGIN_ALIAS (   PluginClass,
  ... 
)     DETAIL_GZ_ADD_STATIC_PLUGIN_ALIAS(PluginClass, __VA_ARGS__)

Add an alias for one of your plugins.

This macro can be put in any namespace and may be called any number of times. It can be called multiple times on the same plugin class in order to register multiple aliases, e.g.:

GZ_ADD_STATIC_PLUGIN_ALIAS(PluginClass, "PluginClass")
GZ_ADD_STATIC_PLUGIN_ALIAS(PluginClass, "SomeOtherName", "Yet another name")
GZ_ADD_STATIC_PLUGIN_ALIAS(AnotherPluginClass, "Foo", "Bar", "Baz")

You can give the same alias to multiple plugins, but then that alias can no longer be used to instantiate any plugin.

If you give a plugin an alias string that matches the demangled symbol name of another plugin, then the Loader will always prefer to instantiate the plugin whose symbol name matches that string.