8#ifndef SEN_CORE_OBJ_SUBSCRIPTION_H
9#define SEN_CORE_OBJ_SUBSCRIPTION_H
43 void attachTo(std::shared_ptr<ObjectSource> src, std::shared_ptr<Interest> interest,
bool notifyAboutExisting);
48 void release(
bool notifyAboutExisting =
true);
51 [[nodiscard]] std::shared_ptr<ObjectSource>
getSource()
const {
return source_; }
57 std::shared_ptr<ObjectSource> source_;
66 :
list(std::move(other.list)), source_(std::move(other.source_))
76 list = std::move(other.list);
77 source_ = std::move(other.source_);
91 std::shared_ptr<Interest> interest,
92 bool notifyAboutExisting)
96 source_ = std::move(src);
97 source_->addSubscriber(std::move(interest), &
list, notifyAboutExisting);
105 source_->removeSubscriber(&
list, notifyAboutExisting);
A list of objects that is managed by some source based on user-expressed interests.
Definition object_list.h:30
void attachTo(std::shared_ptr< ObjectSource > src, std::shared_ptr< Interest > interest, bool notifyAboutExisting)
Attaches this subscription to a source and registers the given interest. Objects matching the interes...
Definition subscription.h:90
Subscription & operator=(Subscription &&other) noexcept
Definition subscription.h:71
void release(bool notifyAboutExisting=true)
Detaches from the source, unregistering the list as a subscriber. Called automatically on destruction...
Definition subscription.h:101
~Subscription()
Definition subscription.h:84
Subscription(Subscription &&other) noexcept
Definition subscription.h:65
ObjectList< T > list
Definition subscription.h:54
std::shared_ptr< ObjectSource > getSource() const
Returns the source currently attached to this subscription, or nullptr if none.
Definition subscription.h:51