Lines Matching defs:subscription
67 class subscription : public subscription_base
109 friend bool operator<(const subscription&, const subscription&);
110 friend bool operator==(const subscription&, const subscription&);
113 subscription(weak_state_type w)
121 explicit subscription(std::shared_ptr<base_subscription_state> s)
130 subscription()
138 explicit subscription(U u, typename std::enable_if<!is_subscription<U>::value, void**>::type = nullptr)
146 explicit subscription(U u, typename std::enable_if<!std::is_same<subscription, U>::value && is_subscription<U>::value, void**>::type = nullptr)
148 : state(std::move((*static_cast<subscription*>(&u)).state))
154 subscription(const subscription& o)
161 subscription(subscription&& o)
168 subscription& operator=(subscription o) {
190 // Atomically promote weak subscription to strong.
192 static subscription lock(weak_state_type w) {
193 return subscription(w);
196 // Atomically try to promote weak subscription to strong.
198 static rxu::maybe<subscription> maybe_lock(weak_state_type w) {
201 return rxu::detail::maybe<subscription>{};
203 return rxu::detail::maybe<subscription>{subscription{std::move(strong_subscription)}};
208 inline bool operator<(const subscription& lhs, const subscription& rhs) {
211 inline bool operator==(const subscription& lhs, const subscription& rhs) {
214 inline bool operator!=(const subscription& lhs, const subscription& rhs) {
220 -> subscription {
221 return subscription();
226 subscription>::type {
227 return subscription(std::forward<I>(i));
232 subscription>::type {
233 return subscription(static_subscription<Unsubscribe>(std::forward<Unsubscribe>(u)));
245 typedef subscription::weak_state_type weak_subscription;
249 std::set<subscription> subscriptions;
253 // never call subscription::unsubscribe with lock held.
284 inline weak_subscription add(subscription s) {
307 rxu::maybe<subscription> maybe_subscription = subscription::maybe_lock(w);
310 // Do nothing if the subscription has already expired.
318 subscription& s = maybe_subscription.get();
343 std::set<subscription> v(std::move(subscriptions));
347 [](const subscription& s) {
373 std::set<subscription> v(std::move(subscriptions));
377 [](const subscription& s) {
423 inline weak_subscription add(subscription s) const {
461 , public subscription
465 typedef subscription::weak_state_type weak_subscription;
469 , subscription() // use empty base
477 , subscription(*static_cast<const inner_type*>(this))
483 , subscription(static_cast<const subscription&>(o))
488 , subscription(std::move(static_cast<subscription&>(o)))
495 subscription::operator=(std::move(*static_cast<subscription*>(&o)));
503 using subscription::is_subscribed;
504 using subscription::unsubscribe;
508 inline weak_subscription add(subscription s) const {
509 if (s == static_cast<const subscription&>(*this)) {
510 // do not nest the same subscription
514 auto that = this->subscription::state.get();
528 auto that = this->subscription::state.get();
536 return static_cast<const subscription&>(lhs) < static_cast<const subscription&>(rhs);
539 subscription&>(lhs) == static_cast<const subscription&>(rhs);
588 weak_subscription add(subscription s) const {