Class Ros2LogSource

Inheritance Relationships

Base Type

Class Documentation

class Ros2LogSource : public ros2_medkit_gateway::LogSource

rclcpp adapter implementing LogSource by subscribing to /rosout.

Owns the rclcpp::Subscription<rcl_interfaces::msg::Log> that previously lived inside LogManager. Performs the rcl_interfaces::msg::Log -> LogEntry conversion (level, name, message, function/file/line, timestamp) and delivers each entry to the registered callback. The manager body then lives in the ROS-free build layer.

Threading: the underlying rclcpp callback is invoked on the gateway’s executor thread. The shutdown guard pattern ensures that any in-flight callback short-circuits before the subscription is released, so the registered EntryCallback is guaranteed not to fire after stop() returns.

Public Functions

explicit Ros2LogSource(rclcpp::Node *node)
Parameters:

node – Non-owning ROS node used for subscription creation.

~Ros2LogSource() override
Ros2LogSource(const Ros2LogSource&) = delete
Ros2LogSource &operator=(const Ros2LogSource&) = delete
Ros2LogSource(Ros2LogSource&&) = delete
Ros2LogSource &operator=(Ros2LogSource&&) = delete
virtual void start(EntryCallback callback) override

Subscribe to /rosout and route each message through to callback. Idempotent: a second start() replaces the previous callback and reuses the existing subscription.

virtual void stop() override

Stop delivering entries. Idempotent. After stop() returns the registered callback is guaranteed not to fire again, even if rclcpp has not yet drained queued messages.