VLink 2.0.0
A high-performance communication middleware
载入中...
搜索中...
未找到
runnable_plugin_interface.h 文件参考

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

runnable_plugin_interface.h 的引用(Include)关系图:

浏览该文件的源代码.

 Abstract plugin interface that provides its own MessageLoop event thread. 更多...

命名空间

详细描述

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.
定义 plugin.h:380
Host usage
auto instance = plugin.load<vlink::RunablePluginInterface>("my_plugin.so");
instance->async_run();
instance->on_init();
// ... run ...
instance->on_deinit();