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... >
 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...
 

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
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
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 47481267428736] Start task
[thread 47481267428736] Source emits, value = 1
[thread 47481267428736] Source emits, value = 2
[thread 47481267428736] Source emits, value = 3
[thread 47481267428736] Trigger emits, value = 1
[thread 47481267428736] Source emits, value = 4
[thread 47481311586048] OnNext: 4
[thread 47481267428736] Source emits, value = 5
[thread 47481311586048] OnNext: 5
[thread 47481267428736] Source emits, value = 6
[thread 47481311586048] OnNext: 6
[thread 47481267428736] Source emits, value = 7
[thread 47481311586048] OnNext: 7
[thread 47481311586048] OnCompleted
[thread 47481267428736] Finish task

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_SKIP_UNTIL_HPP