| 19 | } |
| 20 | |
| 21 | int main() // NOLINT(bugprone-exception-escape) |
| 22 | { |
| 23 | auto raw_keyboard_events = rpp::source::from_callable(&::getchar) |
| 24 | | rpp::operators::repeat() |
| 25 | | rpp::operators::subscribe_on(rpp::schedulers::new_thread{}) |
| 26 | | rpp::operators::publish() |
| 27 | | rpp::operators::ref_count(); |
| 28 | |
| 29 | auto termination = raw_keyboard_events |
| 30 | | rpp::operators::filter([](char v) { return v == '0'; }); |
| 31 | |
| 32 | auto chars = raw_keyboard_events |
| 33 | | rpp::operators::filter([](char v) { return !std::isdigit(v) && v != '\n'; }) |
| 34 | | rpp::operators::map(&::toupper) |
| 35 | | rpp::operators::map(format_message<char>); |
| 36 | |
| 37 | |
| 38 | start = rpp::schedulers::clock_type::now(); |
| 39 | std::cout << format_message("main thread") << std::endl; |
| 40 | |
| 41 | rpp::source::interval(std::chrono::seconds{1}, rpp::schedulers::new_thread{}) |
| 42 | | rpp::operators::map([](size_t i) { return format_message(std::string{"counter "} + std::to_string(i)); }) |
| 43 | | rpp::operators::merge_with(chars) |
| 44 | | rpp::operators::observe_on(rpp::schedulers::new_thread{}) |
| 45 | | rpp::operators::take_until(termination) |
| 46 | | rpp::operators::as_blocking() |
| 47 | | rpp::operators::subscribe([](const std::string& event) { |
| 48 | std::cout << event << std::endl; |
| 49 | }); |
| 50 | |
| 51 | std::cout << "EXIT" << std::endl; |
| 52 | |
| 53 | return 0; |
| 54 | } |
nothing calls this directly
no test coverage detected