Class TopicSubscriptionTransport

Inheritance Relationships

Derived Type

Class Documentation

class TopicSubscriptionTransport

Port for the trigger subsystem to subscribe to a topic and receive each sample as JSON. Replaces the direct TriggerTopicSubscriber * pointer the trigger manager currently holds; the adapter wraps the existing subscriber to preserve its destructor pattern.

Subclassed by ros2_medkit_gateway::ros2::Ros2TopicSubscriptionTransport

Public Types

using SampleCallback = std::function<void(const json &sample)>

Public Functions

TopicSubscriptionTransport() = default
TopicSubscriptionTransport(const TopicSubscriptionTransport&) = delete
TopicSubscriptionTransport &operator=(const TopicSubscriptionTransport&) = delete
TopicSubscriptionTransport(TopicSubscriptionTransport&&) = delete
TopicSubscriptionTransport &operator=(TopicSubscriptionTransport&&) = delete
virtual ~TopicSubscriptionTransport() = default
virtual std::unique_ptr<TopicSubscriptionHandle> subscribe(const std::string &topic_path, const std::string &msg_type, SampleCallback callback) = 0

Subscribe and return a handle. Returns nullptr on transport error (topic not advertised, type mismatch, etc.). The handle’s destructor guarantees no callback fires after destruction completes.