VLink  2.0.0
A high-performance communication middleware
schema_plugin_manager.h 文件参考

Process-wide singleton wrapper that loads and owns a SchemaPluginInterface implementation. 更多...

#include <memory>
#include <string>
#include "./schema_plugin_interface.h"
schema_plugin_manager.h 的引用(Include)关系图:

浏览源代码.

class  vlink::SchemaPluginManager
 Singleton accessor that owns a lazily loaded SchemaPluginInterface plugin. 更多...
 

命名空间

 

详细描述

Process-wide singleton wrapper that loads and owns a SchemaPluginInterface implementation.

SchemaPluginManager hides the dynamic-loader plumbing required to surface a single shared SchemaPluginInterface to every component of the running process. It is the recommended entry point for CLI tools (eproto, efbs), webviz converters, and bag writers that need to resolve Protobuf and FlatBuffers metadata without each subsystem rolling its own loader.

Manager state machine
+-------------+ first get(path) +-----------+ library missing +---------+
| not built | ------------------------> | resolving | ------------------> | invalid |
+-------------+ +-----------+ +---------+
| load ok
v
+---------+
| valid | <-- get_interface() returns plugin
+---------+
|
v process exit
+---------+
| unloaded | interface released before loader
+---------+
Resolution order
  1. The schema_plugin_path argument supplied to the very first get() call.
  2. The VLINK_SCHEMA_PLUGIN environment variable when the argument is empty.
  3. No plugin loaded (the manager reports is_valid() == false).
Example
auto& mgr = vlink::SchemaPluginManager::get("/opt/vlink/libschema_plugin.so");
if (mgr.is_valid()) {
auto plugin = mgr.get_interface();
auto schema = plugin->search_schema("demo.proto.PointCloud", vlink::SchemaType::kProtobuf);
VLOG_I("loaded schema: ", schema.name);
}
#define VLOG_I(...)
Definition: logger.h:785