diff options
author | Grigoriy Chudnov <g.chudnov@gmail.com> | 2017-01-25 00:41:16 +0300 |
---|---|---|
committer | Kirk Shoop <kirk.shoop@microsoft.com> | 2017-01-24 16:22:31 -0800 |
commit | 40432165a831a8e7f23197a5559916676747610d (patch) | |
tree | fa371b09fd072b43a9f87a5fb56a10b57ba3d00f /Rx/v2/src/rxcpp/rx-observable.hpp | |
parent | 6f4ca1198079ed2a439f53865d494729b975bbb7 (diff) | |
download | platform_external_Reactive-Extensions_RxCpp-40432165a831a8e7f23197a5559916676747610d.tar.gz platform_external_Reactive-Extensions_RxCpp-40432165a831a8e7f23197a5559916676747610d.tar.bz2 platform_external_Reactive-Extensions_RxCpp-40432165a831a8e7f23197a5559916676747610d.zip |
decouple replay from observable
Diffstat (limited to 'Rx/v2/src/rxcpp/rx-observable.hpp')
-rw-r--r-- | Rx/v2/src/rxcpp/rx-observable.hpp | 217 |
1 files changed, 5 insertions, 212 deletions
diff --git a/Rx/v2/src/rxcpp/rx-observable.hpp b/Rx/v2/src/rxcpp/rx-observable.hpp index f121cf7..0a5ccbe 100644 --- a/Rx/v2/src/rxcpp/rx-observable.hpp +++ b/Rx/v2/src/rxcpp/rx-observable.hpp @@ -1280,222 +1280,15 @@ public: static_assert(sizeof...(AN) == 0, "publish(value_type, composite_subscription) was passed too many arguments."); } - /*! Turn a cold observable hot, send all earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay all of its items and notifications to any future observer. - - \sample - \snippet replay.cpp replay sample - \snippet output.txt replay sample - */ - template<class... AN> - auto replay(AN**...) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, identity_one_worker>(identity_current_thread(), composite_subscription()))) - /// \endcond - { - composite_subscription cs; - return multicast(rxsub::replay<T, identity_one_worker>(identity_current_thread(), cs)); - static_assert(sizeof...(AN) == 0, "replay() was passed too many arguments."); - } - - /*! Turn a cold observable hot, send all earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay all of its items and notifications to any future observer. - - \sample - \snippet replay.cpp replay sample - \snippet output.txt replay sample - */ - template<class... AN> - auto replay(composite_subscription cs, AN**...) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, identity_one_worker>(identity_current_thread(), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, identity_one_worker>(identity_current_thread(), cs)); - static_assert(sizeof...(AN) == 0, "replay(composite_subscription) was passed too many arguments."); - } - - /*! Turn a cold observable hot, send all earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \tparam Coordination the type of the scheduler - - \param cn a scheduler all values are queued and delivered on - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay all of its items and notifications to any future observer. - - \sample - \snippet replay.cpp threaded replay sample - \snippet output.txt threaded replay sample - */ - template<class Coordination, - class Requires = typename std::enable_if<is_coordination<Coordination>::value, rxu::types_checked>::type> - auto replay(Coordination cn, composite_subscription cs = composite_subscription()) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, Coordination>(std::move(cn), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, Coordination>(std::move(cn), cs)); - } - - /*! Turn a cold observable hot, send at most count of earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \param count the maximum number of the most recent items sent to new observers - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay at most count items to any future observer. - - \sample - \snippet replay.cpp replay count sample - \snippet output.txt replay count sample - */ - template<class... AN> - auto replay(std::size_t count, AN**...) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, identity_one_worker>(count, identity_current_thread(), composite_subscription()))) - /// \endcond - { - composite_subscription cs; - return multicast(rxsub::replay<T, identity_one_worker>(count, identity_current_thread(), cs)); - static_assert(sizeof...(AN) == 0, "replay(count) was passed too many arguments."); - } - - /*! Turn a cold observable hot, send at most count of earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \param count the maximum number of the most recent items sent to new observers - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay at most count items to any future observer. - - \sample - \snippet replay.cpp replay count sample - \snippet output.txt replay count sample - */ + /*! @copydoc rx-replay.hpp + */ template<class... AN> - auto replay(std::size_t count, composite_subscription cs, AN**...) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, identity_one_worker>(count, identity_current_thread(), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, identity_one_worker>(count, identity_current_thread(), cs)); - static_assert(sizeof...(AN) == 0, "replay(count, composite_subscription) was passed too many arguments."); - } - - /*! Turn a cold observable hot, send at most count of earlier emitted values to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \tparam Coordination the type of the scheduler - - \param count the maximum number of the most recent items sent to new observers - \param cn a scheduler all values are queued and delivered on - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay at most count items to any future observer. - - \sample - \snippet replay.cpp threaded replay count sample - \snippet output.txt threaded replay count sample - */ - template<class Coordination, - class Requires = typename std::enable_if<is_coordination<Coordination>::value, rxu::types_checked>::type> - auto replay(std::size_t count, Coordination cn, composite_subscription cs = composite_subscription()) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, Coordination>(count, std::move(cn), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, Coordination>(count, std::move(cn), cs)); - } - - /*! Turn a cold observable hot, send values emitted within a specified time window to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \param period the duration of the window in which the replayed items must be emitted - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay items emitted within a specified time window to any future observer. - - \sample - \snippet replay.cpp replay period sample - \snippet output.txt replay period sample - */ - template<class Duration> - auto replay(Duration period, composite_subscription cs = composite_subscription()) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, identity_one_worker>(period, identity_current_thread(), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, identity_one_worker>(period, identity_current_thread(), cs)); - } - - /*! Turn a cold observable hot, send values emitted within a specified time window to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \tparam Coordination the type of the scheduler - - \param period the duration of the window in which the replayed items must be emitted - \param cn a scheduler all values are queued and delivered on - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay items emitted within a specified time window to any future observer. - - \sample - \snippet replay.cpp threaded replay period sample - \snippet output.txt threaded replay period sample - */ - template<class Coordination, - class Requires = typename std::enable_if<is_coordination<Coordination>::value, rxu::types_checked>::type> - auto replay(rxsc::scheduler::clock_type::duration period, Coordination cn, composite_subscription cs = composite_subscription()) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, Coordination>(period, std::move(cn), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, Coordination>(period, std::move(cn), cs)); - } - - /*! Turn a cold observable hot, send at most count of values emitted within a specified time window to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \param count the maximum number of the most recent items sent to new observers - \param period the duration of the window in which the replayed items must be emitted - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay at most count of items emitted within a specified time window to any future observer. - - \sample - \snippet replay.cpp replay count+period sample - \snippet output.txt replay count+period sample - */ - template<class Duration> - auto replay(std::size_t count, Duration period, composite_subscription cs = composite_subscription()) const - /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, identity_one_worker>(count, period, identity_current_thread(), cs))) - /// \endcond - { - return multicast(rxsub::replay<T, identity_one_worker>(count, period, identity_current_thread(), cs)); - } - - /*! Turn a cold observable hot, send at most count of values emitted within a specified time window to any new subscriber, and allow connections to the source to be independent of subscriptions. - - \tparam Coordination the type of the scheduler - - \param count the maximum number of the most recent items sent to new observers - \param period the duration of the window in which the replayed items must be emitted - \param cn a scheduler all values are queued and delivered on - \param cs the subscription to control lifetime - - \return rxcpp::connectable_observable that shares a single subscription to the underlying observable that will replay at most count of items emitted within a specified time window to any future observer. - - \sample - \snippet replay.cpp threaded replay count+period sample - \snippet output.txt threaded replay count+period sample - */ - template<class Coordination, - class Requires = typename std::enable_if<is_coordination<Coordination>::value, rxu::types_checked>::type> - auto replay(std::size_t count, rxsc::scheduler::clock_type::duration period, Coordination cn, composite_subscription cs = composite_subscription()) const + auto replay(AN&&... an) const /// \cond SHOW_SERVICE_MEMBERS - -> decltype(EXPLICIT_THIS multicast(rxsub::replay<T, Coordination>(count, period, std::move(cn), cs))) + -> decltype(observable_member(replay_tag{}, *(this_type*)nullptr, std::forward<AN>(an)...)) /// \endcond { - return multicast(rxsub::replay<T, Coordination>(count, period, std::move(cn), cs)); + return observable_member(replay_tag{}, *this, std::forward<AN>(an)...); } /*! @copydoc rx-subscribe_on.hpp |