June 2018
Intermediate to advanced
348 pages
8h 45m
English
It is difficult to visualize Rx Streams, as the data flows asynchronously. The designers of Rx systems have created a set of visualization cues called marble diagrams: Let us write a small program and depict logic of the map Operator as a marble diagram.
//------------------ Map.cpp
#include "rxcpp/rx.hpp"
#include "rxcpp/rx-test.hpp"
#include <ioStream>
#include <array>
int main() {
auto ints = rxcpp::observable<>::range(1,10).
map( [] ( int n ) {return n*n; });
ints.subscribe(
[](int v){printf("OnNext: %dn", v);},
[](){printf("OnCompletedn");});
}
Rather than giving a description of marble diagrams, let's look at a marble diagram that depicts the map operator:
The top part of ...