VLink  2.0.0
A high-performance communication middleware
vlink::ConvertPluginInterface Class Referenceabstract

Abstract plugin base translating between VLink payloads and visualisation backends. More...

#include <convert_plugin_interface.h>

Collaboration diagram for vlink::ConvertPluginInterface:

Classes

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

Public Types

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

Public Member Functions

virtual bool init (const std::string &config)=0
 Initialises the plugin with an opaque configuration string. More...
 
virtual bool can_convert (const std::string &ser_type, Target target)=0
 Reports whether this plugin handles a (serialisation, target) pair. More...
 
virtual bool get_schema (const std::string &ser_type, Target target, SchemaInfo &schema_info)=0
 Provides schema metadata for an accepted (serialisation, target) pair. More...
 
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. More...
 
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. More...
 
virtual bool can_publish (const FrontendChannel &channel, Target target)
 Inbound counterpart of can_convert() for frontend-published channels. More...
 
virtual bool get_publish (const FrontendChannel &channel, Target target, PublishInfo &publish_info)
 Resolves the VLink publish destination for an inbound frontend channel. More...
 
virtual bool convert_publish (const FrontendChannel &channel, const Bytes &raw, Target target, Bytes &payload)
 Converts a frontend-published payload into a raw VLink payload. More...
 

Protected Member Functions

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

Detailed Description

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.

Member Enumeration Documentation

◆ 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.

Enumerator
kFoxglove 

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

kRerun 

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

Constructor & Destructor Documentation

◆ ConvertPluginInterface()

vlink::ConvertPluginInterface::ConvertPluginInterface ( )
protecteddefault

◆ ~ConvertPluginInterface()

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

Member Function Documentation

◆ 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.

Parameters
ser_typeVLink serialisation type name (e.g. "proto.VehiclePose").
targetVisualisation backend asking about the conversion.
Returns
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.

Parameters
[in]ser_typeVLink serialisation type name.
[in]rawRaw serialised VLink payload.
[in]targetVisualisation backend.
[out]payloadOutput buffer that receives the backend payload.
Returns
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.
Parameters
[in]ser_typeVLink serialisation type name.
[in]targetVisualisation backend.
[out]schema_infoBackend channel schema metadata.
Returns
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.

Parameters
[in]ser_typeVLink serialisation type name.
[in]rawRaw serialised VLink payload.
[in]targetVisualisation backend.
Returns
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.

Parameters
configConfiguration payload; may be empty.
Returns
true on success.

The documentation for this class was generated from the following file: