RxCpp
The Reactive Extensions for Native (RxCpp) is a library for composing asynchronous and event-based programs using observable sequences and LINQ-style query operators in both C and C++.
Classes | Namespaces | Macros | Functions
rx-skip_until.hpp File Reference

Make new observable with items skipped until on_next occurs on the trigger observable or until the specified time. skip_until takes (TriggerObservable, optional Coordination) or (TimePoint, optional Coordination) More...

#include "../rx-includes.hpp"
Include dependency graph for rx-skip_until.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rxcpp::member_overload< skip_until_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::skip_until (AN &&... an) -> operator_factory< skip_until_tag, AN... >
 

Detailed Description

Make new observable with items skipped until on_next occurs on the trigger observable or until the specified time. skip_until takes (TriggerObservable, optional Coordination) or (TimePoint, optional Coordination)

Template Parameters
TriggerSourcethe type of the trigger observable.
Coordinationthe type of the scheduler (optional).
Parameters
tan observable that has to emit an item before the source observable's elements begin to be mirrored by the resulting observable.
cnthe scheduler to use for scheduling the items (optional).
Returns
An observable that skips items from the source observable until the second observable emits an item or the time runs out, then emits the remaining items.
Sample Code\n
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7);
auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25));
auto values = source.skip_until(trigger);
values.
[](long v){printf("OnNext: %ld\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 4
OnNext: 5
OnNext: 6
OnNext: 7
OnCompleted
Sample Code\n
printf("[thread %s] Start task\n", get_pid().c_str());
auto source = rxcpp::observable<>::interval(std::chrono::milliseconds(10)).take(7).map([](long v){
printf("[thread %s] Source emits, value = %ld\n", get_pid().c_str(), v);
return v;
});
auto trigger = rxcpp::observable<>::timer(std::chrono::milliseconds(25)).map([](long v){
printf("[thread %s] Trigger emits, value = %ld\n", get_pid().c_str(), v);
return v;
});
auto values = source.skip_until(trigger, rxcpp::observe_on_new_thread());
values.
[](long v){printf("[thread %s] OnNext: %ld\n", get_pid().c_str(), v);},
[](){printf("[thread %s] OnCompleted\n", get_pid().c_str());});
printf("[thread %s] Finish task\n", get_pid().c_str());
[thread 3070107664] Start task
[thread 3070107664] Source emits, value = 1
[thread 3070107664] Source emits, value = 2
[thread 3070107664] Source emits, value = 3
[thread 3070107664] Trigger emits, value = 1
[thread 3070107664] Source emits, value = 4
[thread 2975855680] OnNext: 4
[thread 3070107664] Source emits, value = 5
[thread 2975855680] OnNext: 5
[thread 3070107664] Source emits, value = 6
[thread 2975855680] OnNext: 6
[thread 3070107664] Source emits, value = 7
[thread 2975855680] OnNext: 7
[thread 2975855680] OnCompleted
[thread 3070107664] Finish task

Macro Definition Documentation

◆ RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP

#define RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP
rxcpp::sources::timer
auto timer(TimePointOrDuration when) -> typename std::enable_if< detail::defer_timer< TimePointOrDuration, identity_one_worker >::value, typename detail::defer_timer< TimePointOrDuration, identity_one_worker >::observable_type >::type
Definition: rx-timer.hpp:114
rxcpp::observe_on_new_thread
observe_on_one_worker observe_on_new_thread()
Definition: rx-observe_on.hpp:328
rxcpp::operators::as_blocking
auto as_blocking() -> detail::blocking_factory
Definition: rx-subscribe.hpp:144
rxcpp::operators::subscribe
auto subscribe(ArgN &&... an) -> detail::subscribe_factory< decltype(make_subscriber< T >(std::forward< ArgN >(an)...))>
Definition: rx-subscribe.hpp:87
rxcpp::sources::interval
auto interval(Duration period) -> typename std::enable_if< detail::defer_interval< Duration, identity_one_worker >::value, typename detail::defer_interval< Duration, identity_one_worker >::observable_type >::type
Definition: rx-interval.hpp:113