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_;
69 list = std::move(other.list);
70 source_ = std::move(other.source_);
74 source_->replaceSubscriber(&other.list, &
list);
85 list = std::move(other.list);
86 source_ = std::move(other.source_);
90 source_->replaceSubscriber(&other.list, &
list);
105 std::shared_ptr<Interest> interest,
106 bool notifyAboutExisting)
110 source_ = std::move(src);
111 source_->addSubscriber(std::move(interest), &
list, notifyAboutExisting);
119 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:104
Subscription & operator=(Subscription &&other) noexcept
Definition subscription.h:79
void release(bool notifyAboutExisting=true)
Detaches from the source, unregistering the list as a subscriber. Called automatically on destruction...
Definition subscription.h:115
~Subscription()
Definition subscription.h:98
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