VLink 2.0.0
A high-performance communication middleware
Loading...
Searching...
No Matches
runnable_plugin_interface.h File Reference

Plugin interface for self-contained, event-loop-driven plugin components. More...

Include dependency graph for runnable_plugin_interface.h:

Go to the source code of this file.

Classes

 Abstract plugin interface that provides its own MessageLoop event thread. More...

Namespaces

Detailed Description

Plugin interface for self-contained, event-loop-driven plugin components.

RunablePluginInterface (note: intentional spelling) combines a MessageLoop with the Plugin system to allow dynamic plugins to carry their own event loop.

A plugin that inherits this interface runs in its own MessageLoop thread, started by async_run() after loading. The host calls on_init() to initialise the plugin and on_deinit() to clean up before unloading.

Plugin implementation example
class MyPlugin : public vlink::RunablePluginInterface {
public:
void on_init() override {
// set up subscriptions, timers, etc.
}
void on_deinit() override {
// stop timers, unsubscribe
}
};
#define VLINK_PLUGIN_DECLARE(ImplementType, VersionMajor, VersionMinor)
Declares a plugin creation and destruction interface.
Definition plugin.h:380
Host usage
auto instance = plugin.load<vlink::RunablePluginInterface>("my_plugin.so");
instance->async_run();
instance->on_init();
// ... run ...
instance->on_deinit();