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

Returns an observable that emits an integer at the specified time point. More...

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

Functions

template<class TimePointOrDuration >
auto rxcpp::sources::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
 Returns an observable that emits an integer at the specified time point. More...
 
template<class TimePointOrDuration , class Coordination >
auto rxcpp::sources::timer (TimePointOrDuration when, Coordination cn) -> typename std::enable_if< detail::defer_timer< TimePointOrDuration, Coordination >::value, typename detail::defer_timer< TimePointOrDuration, Coordination >::observable_type >::type
 Returns an observable that emits an integer at the specified time point. More...
 

Detailed Description

Returns an observable that emits an integer at the specified time point.

Template Parameters
Coordinationthe type of the scheduler (optional)
Parameters
whentime point when the value is emitted
cnthe scheduler to use for scheduling the items (optional)
Returns
Observable that emits an integer at the specified time point
Sample Code
auto start = std::chrono::steady_clock::now() + std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::timer(start);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnCompleted
Sample Code
auto period = std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::timer(period);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnCompleted
Sample Code
auto scheduler = rxcpp::observe_on_new_thread();
auto start = scheduler.now() + std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::timer(start, scheduler);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnCompleted
Sample Code
auto scheduler = rxcpp::observe_on_new_thread();
auto period = std::chrono::milliseconds(1);
auto values = rxcpp::observable<>::timer(period, scheduler);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnCompleted

Macro Definition Documentation

#define RXCPP_SOURCES_RX_TIMER_HPP