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

Process-local lookup table for compiled-in FlatBuffers BFBS reflection blobs. 更多...

#include <cstddef>
#include <mutex>
#include <shared_mutex>
#include <string>
#include <unordered_map>
#include <vector>
#include "../impl/types.h"
flatbuffers_registry.h 的引用(Include)关系图:
此图展示该文件直接或间接的被哪些文件引用了:

浏览源代码.

详细描述

Process-local lookup table for compiled-in FlatBuffers BFBS reflection blobs.

Protobuf ships with a built-in process-wide registry of generated descriptors (google::protobuf::DescriptorPool::generated_pool()). FlatBuffers offers no such runtime pool, so VLink keeps a small singleton table that stores BFBS reflection blobs embedded inside the running binary. The schema plugin reads from this table when BagWriter or the proxy frontends need to attach FlatBuffers schemas to recorded URLs.

The registry is intentionally minimal and never touches the filesystem – it does not read VLINK_FBS_DIR / VLINK_PROTO_DIR and does not own the BFBS buffer memory. Three operations are supported:

API Purpose
register_schema<BinarySchema>(name) Register a generated *BinarySchema helper
register_schema(name, bfbs_data, bfbs_size) Register raw BFBS bytes
search_schema(name) Look up one entry by root type name
get_all_schemas() Enumerate every registered entry

Type resolution flow:

*   generated *BinarySchema  --register_schema-->  +-------------------+
*                                                  |   BFBS map        |
*                                                  | (name -> Schema)  |
*   user lookup (root type)  --search_schema--->   +-------------------+   --> SchemaData
* 
Example
#include "helloworld/fbs/User_generated.h"
// Auto-register at static initialisation time:
VLINK_REGISTER_FLATBUFFERS("Helloworld.fbs.User", Helloworld::fbs::UserBinarySchema);
void inspect() {
auto schema = vlink::FlatbuffersRegistry::get().search_schema("Helloworld.fbs.User");
if (!schema.data.empty()) {
// Use schema.data to populate bag metadata or webviz channel info.
}
}
Process-local lookup table for compiled-in FlatBuffers BFBS reflection blobs.