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++.
Namespaces | Macros | Functions
rx-interval.hpp File Reference

Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler. More...

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

Go to the source code of this file.

Namespaces

 rxcpp
 
 rxcpp::sources
 

Macros

#define RXCPP_SOURCES_RX_INTERVAL_HPP
 

Functions

template<class Duration >
auto rxcpp::sources::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
 Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler. More...
 
template<class Coordination >
auto rxcpp::sources::interval (rxsc::scheduler::clock_type::duration period, Coordination cn) -> typename std::enable_if< detail::defer_interval< rxsc::scheduler::clock_type::duration, Coordination >::value, typename detail::defer_interval< rxsc::scheduler::clock_type::duration, Coordination >::observable_type >::type
 Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler. More...
 
template<class Duration >
auto rxcpp::sources::interval (rxsc::scheduler::clock_type::time_point when, 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
 Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler. More...
 
template<class Coordination >
auto rxcpp::sources::interval (rxsc::scheduler::clock_type::time_point when, rxsc::scheduler::clock_type::duration period, Coordination cn) -> typename std::enable_if< detail::defer_interval< rxsc::scheduler::clock_type::duration, Coordination >::value, typename detail::defer_interval< rxsc::scheduler::clock_type::duration, Coordination >::observable_type >::type
 Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler. More...
 

Detailed Description

Returns an observable that emits a sequential integer every specified time interval, on the specified scheduler.

Template Parameters
Coordinationthe type of the scheduler (optional)
Parameters
periodperiod between emitted values
cnthe scheduler to use for scheduling the items (optional)
Returns
Observable that sends a sequential integer each time interval
Sample Code
auto start = std::chrono::steady_clock::now() + std::chrono::milliseconds(1);
auto period = std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::interval(start, period);
values.
take(3).
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnCompleted
Sample Code
auto period = std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::interval(period);
values.
take(3).
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnCompleted
Sample Code
auto scheduler = rxcpp::identity_current_thread();
auto start = scheduler.now() + std::chrono::milliseconds(1);
auto period = std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::interval(start, period, scheduler);
values.
take(3).
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnCompleted
Sample Code
auto scheduler = rxcpp::identity_current_thread();
auto period = std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::interval(period, scheduler);
values.
take(3).
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnCompleted

Macro Definition Documentation

#define RXCPP_SOURCES_RX_INTERVAL_HPP