Class ChannelSet

Class Documentation

class ChannelSet

A helper for building topic and schema metadata for a StreamedSource.

Handles schema extraction from Foxglove schema types, schema ID assignment, and deduplication. If multiple channels share the same schema, only one schema entry will be created.

foxglove::data_provider::ChannelSet channels;
channels.insert<foxglove::schemas::Vector3>("/topic1");
channels.insert<foxglove::schemas::Vector3>("/topic2"); // reuses schema ID

foxglove::data_provider::StreamedSource source;
source.topics = std::move(channels.topics);
source.schemas = std::move(channels.schemas);

Public Functions

template<typename T>
inline void insert(const std::string &topic)

Insert a channel for schema type T on the given topic.

T must have a static schema() method returning foxglove::Schema (all generated types in foxglove::schemas satisfy this). The message encoding is assumed to be “protobuf”.

Template Parameters:

T – A Foxglove schema type (e.g. foxglove::schemas::Vector3).

Parameters:

topic – The topic name for this channel.

Throws:

std::overflow_error – if more than 65535 distinct schemas are added.

Public Members

std::vector<Topic> topics

The accumulated topics.

std::vector<Schema> schemas

The accumulated schemas (deduplicated).