VLink  2.0.0
A high-performance communication middleware
vlink::ConvertPluginInterface类 参考abstract

Abstract plugin base translating between VLink payloads and visualisation backends. 更多...

#include <convert_plugin_interface.h>

vlink::ConvertPluginInterface 的协作图:

struct  FrontendChannel
 Frontend-advertised channel description used by inbound conversion hooks. 更多...
 
struct  PublishInfo
 VLink publish destination resolved from an inbound frontend channel. 更多...
 
struct  SchemaInfo
 Backend channel schema metadata returned by get_schema(). 更多...
 

Public 类型

enum class  Target : uint8_t { kFoxglove = 0 , kRerun = 1 }
 Visualisation backend identifier carried by every conversion hook. 更多...
 

Public 成员函数

virtual bool init (const std::string &config)=0
 Initialises the plugin with an opaque configuration string. 更多...
 
virtual bool can_convert (const std::string &ser_type, Target target)=0
 Reports whether this plugin handles a (serialisation, target) pair. 更多...
 
virtual bool get_schema (const std::string &ser_type, Target target, SchemaInfo &schema_info)=0
 Provides schema metadata for an accepted (serialisation, target) pair. 更多...
 
virtual bool convert (const std::string &ser_type, const Bytes &raw, Target target, Bytes &payload)=0
 Converts a single raw VLink payload to the backend-specific representation. 更多...
 
virtual int64_t get_timestamp (const std::string &ser_type, const Bytes &raw, Target target)
 Optionally extracts a per-message timestamp from the raw payload. 更多...
 
virtual bool can_publish (const FrontendChannel &channel, Target target)
 Inbound counterpart of can_convert() for frontend-published channels. 更多...
 
virtual bool get_publish (const FrontendChannel &channel, Target target, PublishInfo &publish_info)
 Resolves the VLink publish destination for an inbound frontend channel. 更多...
 
virtual bool convert_publish (const FrontendChannel &channel, const Bytes &raw, Target target, Bytes &payload)
 Converts a frontend-published payload into a raw VLink payload. 更多...
 

Protected 成员函数

 ConvertPluginInterface ()=default
 
virtual ~ConvertPluginInterface ()=default
 

详细描述

Abstract plugin base translating between VLink payloads and visualisation backends.

Loaded via Plugin::load<ConvertPluginInterface>(). The plugin must be thread-safe: convert() and the inbound convert_publish() hooks may run concurrently from multiple ProxyAPI worker threads. A plugin that only supports one backend should return false from can_convert() / can_publish() for the others.

成员枚举类型说明

◆ Target

Visualisation backend identifier carried by every conversion hook.

Allows a single plugin to support multiple backends from one binary – the plugin branches on this value to produce the appropriate payload format.

枚举值
kFoxglove 

Foxglove Studio (WebSocket transport, FlatBuffers/Protobuf payloads).

kRerun 

Rerun Viewer (gRPC + Arrow IPC; plugin payload is UTF-8 JSON).

构造及析构函数说明

◆ ConvertPluginInterface()

vlink::ConvertPluginInterface::ConvertPluginInterface ( )
protecteddefault

◆ ~ConvertPluginInterface()

virtual vlink::ConvertPluginInterface::~ConvertPluginInterface ( )
protectedvirtualdefault

成员函数说明

◆ can_convert()

virtual bool vlink::ConvertPluginInterface::can_convert ( const std::string &  ser_type,
Target  target 
)
pure virtual

Reports whether this plugin handles a (serialisation, target) pair.

Polled during channel discovery for each new VLink type. A true answer commits the plugin to subsequent get_schema() and convert() calls for that pair.

参数
ser_typeVLink serialisation type name (e.g. "proto.VehiclePose").
targetVisualisation backend asking about the conversion.
返回
true when the plugin can produce a payload for target.

◆ can_publish()

virtual bool vlink::ConvertPluginInterface::can_publish ( const FrontendChannel channel,
Target  target 
)
inlinevirtual

Inbound counterpart of can_convert() for frontend-published channels.

Default implementation returns false; override to opt in to clientPublish-style command flows.

◆ convert()

virtual bool vlink::ConvertPluginInterface::convert ( const std::string &  ser_type,
const Bytes raw,
Target  target,
Bytes payload 
)
pure virtual

Converts a single raw VLink payload to the backend-specific representation.

Invoked once per incoming message on accepted types. Must be thread-safe.

参数
[in]ser_typeVLink serialisation type name.
[in]rawRaw serialised VLink payload.
[in]targetVisualisation backend.
[out]payloadOutput buffer that receives the backend payload.
返回
true on success.

◆ convert_publish()

virtual bool vlink::ConvertPluginInterface::convert_publish ( const FrontendChannel channel,
const Bytes raw,
Target  target,
Bytes payload 
)
inlinevirtual

Converts a frontend-published payload into a raw VLink payload.

Invoked once per inbound message after get_publish() routed the channel. Default implementation returns false.

◆ get_publish()

virtual bool vlink::ConvertPluginInterface::get_publish ( const FrontendChannel channel,
Target  target,
PublishInfo publish_info 
)
inlinevirtual

Resolves the VLink publish destination for an inbound frontend channel.

Returning true allows the host to provision the required VLink publishers ahead of time. Default implementation returns false.

◆ get_schema()

virtual bool vlink::ConvertPluginInterface::get_schema ( const std::string &  ser_type,
Target  target,
SchemaInfo schema_info 
)
pure virtual

Provides schema metadata for an accepted (serialisation, target) pair.

Called once per accepted pair when registering the frontend channel. Outputs differ per target:

  • kFoxglove: fill schema_info with type, encoding and schema bytes (typically the bytes of a compiled BFBS file).
  • kRerun: fill schema_info.type_name with the archetype name and schema_info.encoding with "json"; schema payload fields are unused.
参数
[in]ser_typeVLink serialisation type name.
[in]targetVisualisation backend.
[out]schema_infoBackend channel schema metadata.
返回
true on success.

◆ get_timestamp()

virtual int64_t vlink::ConvertPluginInterface::get_timestamp ( const std::string &  ser_type,
const Bytes raw,
Target  target 
)
inlinevirtual

Optionally extracts a per-message timestamp from the raw payload.

Called after convert() so the frontend can prefer a sensor or content timestamp over the proxy transport timestamp. The default implementation returns -1, causing the host to fall back to the transport-level timestamp.

参数
[in]ser_typeVLink serialisation type name.
[in]rawRaw serialised VLink payload.
[in]targetVisualisation backend.
返回
Timestamp in nanoseconds since epoch, or -1 when unavailable.

◆ init()

virtual bool vlink::ConvertPluginInterface::init ( const std::string &  config)
pure virtual

Initialises the plugin with an opaque configuration string.

Called once after the plugin is loaded; the config string may be a file path, JSON document or anything the plugin defines. Returning false causes the host to unload the plugin.

参数
configConfiguration payload; may be empty.
返回
true on success.

该类的文档由以下文件生成: