21namespace subscription {
46 , _unsubscribe(std::move(unsubscribe)) {}
51 other._unsubscribe =
nullptr;
58 _token = other._token;
59 _unsubscribe = std::move(other._unsubscribe);
61 other._unsubscribe =
nullptr;
80 _unsubscribe =
nullptr;
89 bool isActive() const noexcept {
return _token.isValid(); }
99 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:32
Subscription(Subscription &&other) noexcept
Move constructor.
Definition Subscription.hpp:49
~Subscription()
Destructor — automatically cancels an active subscription.
Definition Subscription.hpp:72
bool isActive() const noexcept
Check whether this subscription is still active.
Definition Subscription.hpp:89
Subscription & operator=(Subscription &&other) noexcept
Move assignment operator.
Definition Subscription.hpp:55
SubscriberToken token() const noexcept
Access the underlying token (e.g. for logging or debugging).
Definition Subscription.hpp:95
Subscription() noexcept=default
Default-construct an inactive Subscription.
void cancel() noexcept
Cancel the subscription. Safe to call multiple times (idempotent).
Definition Subscription.hpp:77
Opaque token identifying a subscription (state or device group).
Definition SubscriberToken.hpp:25