19namespace subscription {
44 , _unsubscribe(std::move(unsubscribe)) {}
49 other._unsubscribe =
nullptr;
56 _token = other._token;
57 _unsubscribe = std::move(other._unsubscribe);
59 other._unsubscribe =
nullptr;
78 _unsubscribe =
nullptr;
87 bool isActive() const noexcept {
return _token.isValid(); }
97 std::function<void()> _unsubscribe;
Opaque token identifying a subscription.
Move-only RAII wrapper that pairs a SubscriberToken with an unsubscribe callable. Destroying a Subscr...
Definition Subscription.hpp:30
void cancel() noexcept
Cancel the subscription. Safe to call multiple times (idempotent).
Definition Subscription.hpp:75
Subscription & operator=(Subscription &&other) noexcept
Move assignment operator.
Definition Subscription.hpp:53
Subscription(Subscription &&other) noexcept
Move constructor.
Definition Subscription.hpp:47
bool isActive() const noexcept
Check whether this subscription is still active.
Definition Subscription.hpp:87
~Subscription()
Destructor — automatically cancels an active subscription.
Definition Subscription.hpp:70
SubscriberToken token() const noexcept
Access the underlying token (e.g. for logging or debugging).
Definition Subscription.hpp:93
Subscription() noexcept=default
Default-construct an inactive Subscription.
Opaque token identifying a subscription (state or device group).
Definition SubscriberToken.hpp:22