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-time_interval.hpp File Reference

Returns an observable that emits indications of the amount of time lapsed between consecutive emissions of the source observable. The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item. More...

#include "../rx-includes.hpp"
Include dependency graph for rx-time_interval.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< time_interval_tag >
 

Namespaces

 rxcpp
 
 rxcpp::operators
 

Macros

#define RXCPP_OPERATORS_RX_TIME_INTERVAL_HPP
 

Functions

template<class... AN>
auto rxcpp::operators::time_interval (AN &&...an) -> operator_factory< time_interval_tag, AN... >
 Returns an observable that emits indications of the amount of time lapsed between consecutive emissions of the source observable. The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item. More...
 

Detailed Description

Returns an observable that emits indications of the amount of time lapsed between consecutive emissions of the source observable. The first emission from this new Observable indicates the amount of time lapsed between the time when the observer subscribed to the Observable and the time when the source Observable emitted its first item.

Template Parameters
Coordinationthe type of the scheduler.
Parameters
coordinationthe scheduler for time intervals.
Returns
Observable that emits a time_duration to indicate the amount of time lapsed between pairs of emissions.
Sample Code
typedef rxcpp::schedulers::scheduler::clock_type::time_point::duration duration_type;
using namespace std::chrono;
auto values = rxcpp::observable<>::interval(milliseconds(100))
.time_interval()
.take(3);
values.
[&](duration_type v) {
long long int ms = duration_cast<milliseconds>(v).count();
printf("OnNext: @%lldms\n", ms);
},
[](std::exception_ptr ep) {
try {
std::rethrow_exception(ep);
} catch (const std::exception& ex) {
printf("OnError: %s\n", ex.what());
}
},
[]() { printf("OnCompleted\n"); });
OnNext: @0ms
OnNext: @100ms
OnNext: @100ms
OnCompleted

Macro Definition Documentation

#define RXCPP_OPERATORS_RX_TIME_INTERVAL_HPP