Class Point3Channel

Class Documentation

class Point3Channel

A channel for logging Point3 messages to a topic.

Note

While channels are fully thread-safe, the Point3 struct is not thread-safe. Avoid modifying it concurrently or during a log operation.

Public Functions

FoxgloveError log(const Point3 &msg, std::optional<uint64_t> log_time = std::nullopt, std::optional<uint64_t> sink_id = std::nullopt) noexcept

Log a message to the channel.

Parameters:
  • msg – The Point3 message to log.

  • log_time – The timestamp of the message, as nanoseconds since epoch. If omitted, the current time is used.

  • sink_id – The ID of the sink to log to. If omitted, the message is logged to all sinks.

void close() noexcept

Close the channel.

You can use this to explicitly unadvertise the channel to sinks that subscribe to channels dynamically, such as the WebSocketServer.

Attempts to log on a closed channel will elicit a throttled warning message.

uint64_t id() const noexcept

Uniquely identifies a channel in the context of this program.

Returns:

The ID of the channel.

bool has_sinks() const noexcept

Find out if any sinks have been added to the channel.

Returns:

True if sinks have been added to the channel, false otherwise.

Point3Channel(const Point3Channel &other) noexcept = delete
Point3Channel &operator=(const Point3Channel &other) noexcept = delete
Point3Channel(Point3Channel &&other) noexcept = default

Default move constructor.

Point3Channel &operator=(Point3Channel &&other) noexcept = default

Default move assignment.

~Point3Channel() = default

Default destructor.

Public Static Functions

static FoxgloveResult<Point3Channel> create(const std::string_view &topic, const Context &context = Context())

Create a new channel.

Parameters:
  • topic – The topic name. You should choose a unique topic name per channel for compatibility with the Foxglove app.

  • context – The context which associates logs to a sink. If omitted, the default context is used.