All Projects → ReactiveX → Rxcpp

ReactiveX / Rxcpp

Licence: apache-2.0
Reactive Extensions for C++

Programming Languages

C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to Rxcpp

Rxkingfisher
Reactive extension for the Kingfisher image downloading and caching library
Stars: ✭ 190 (-92.44%)
Mutual labels:  reactivex
Rrt Algorithms
n-dimensional RRT, RRT* (RRT-Star)
Stars: ✭ 195 (-92.24%)
Mutual labels:  algorithms
Reactive Examples
Samples App using the Reactive Extensions and Reactive UI
Stars: ✭ 203 (-91.92%)
Mutual labels:  reactivex
Data Structures And Algorithms
Data Structures and Algorithms implementation in Go
Stars: ✭ 2,272 (-9.59%)
Mutual labels:  algorithms
Leetcode Java Solutions
Solutions to LeetCode Online Judge problems in Java
Stars: ✭ 194 (-92.28%)
Mutual labels:  algorithms
Competitive Programming Resources
This repository consists of data helpful for ACM ICPC programming contest, in general competitive programming.
Stars: ✭ 199 (-92.08%)
Mutual labels:  algorithms
Rust Algorithm Club
Learn algorithms and data structures with Rust
Stars: ✭ 184 (-92.68%)
Mutual labels:  algorithms
Cs50
🎓 Harvard CS50x — 2018 solutions 👨‍🏫
Stars: ✭ 206 (-91.8%)
Mutual labels:  algorithms
Awesome Coding Interview Question Patterns
The most common question-patterns for any coding-interview
Stars: ✭ 196 (-92.2%)
Mutual labels:  algorithms
Rust
All Algorithms implemented in Rust
Stars: ✭ 4,562 (+81.54%)
Mutual labels:  algorithms
Collections C
A library of generic data structures.
Stars: ✭ 2,297 (-8.6%)
Mutual labels:  algorithms
Learning
自己整理了一些网上和书籍中的知识与笔记,来应对技术面试可能遇到的一些问题,包括算法、操作系统、计算机网络、Java、C++、Python、Go。概念不是最重要的!概念不是最重要的!概念不是最重要的!练习题才是!重要的事情说三遍,概念是不是看了很多遍,看几遍忘几遍,题目做过几遍,是不是印象很深,精华是题目,笔者在大量练习后摘录了书籍、牛客网、赛码网、W3C、CSDN等各种渠道的练习题,较为基础的这里就不录入了,主要录入一些易混淆,不容易理解的题目。作者也不喜欢重复造轮子,某些知识点的解释有比较详细的博客,作者就简单引用了,只有作者觉得找不到解释较好的博客时,作者会自己写一篇然后引用,限于篇幅,具体还请点击链接详细了解。
Stars: ✭ 194 (-92.28%)
Mutual labels:  algorithms
Algorithms4
🔥Algorithms, 4th Edition SOLUTIONS🔥
Stars: ✭ 198 (-92.12%)
Mutual labels:  algorithms
Bet On Sibyl
Machine Learning Model for Sport Predictions (Football, Basketball, Baseball, Hockey, Soccer & Tennis)
Stars: ✭ 190 (-92.44%)
Mutual labels:  algorithms
Leetcodesolutions
Theoretical solutions for LeetCode problems.
Stars: ✭ 205 (-91.84%)
Mutual labels:  algorithms
Algorithms
This repository is for learning and understanding how algorithms work.
Stars: ✭ 189 (-92.48%)
Mutual labels:  algorithms
Openlib.cs
📚 A Collection of Free & Open Resources for University Coursework in Computer Science.
Stars: ✭ 198 (-92.12%)
Mutual labels:  algorithms
Delatin
A fast JavaScript terrain mesh generation tool based on Delaunay triangulation
Stars: ✭ 207 (-91.76%)
Mutual labels:  algorithms
Javacollection
Java开源项目之「自学编程之路」:学习指南+面试指南+资源分享+技术文章
Stars: ✭ 2,957 (+17.67%)
Mutual labels:  algorithms
Acmer Qualification Code
ACMer 入门级算法模板
Stars: ✭ 202 (-91.96%)
Mutual labels:  algorithms

The Reactive Extensions for C++ (RxCpp) is a library of algorithms for values-distributed-in-time. The Range-v3 library does the same for values-distributed-in-space.

Task Status
rxcpp CI rxcpp CI
Source Badges
Github GitHub license
GitHub release
GitHub commits
Gitter.im Join in on gitter.im
Packages NuGet version vcpkg port
Documentation rxcpp doxygen documentation
reactivex intro rx marble diagrams

Usage

RxCpp is a header-only C++ library that only depends on the standard library. The CMake build generates documentation and unit tests. The unit tests depend on a git submodule for the Catch library.

Example

Add Rx/v2/src to the include paths

lines from bytes

#include "rxcpp/rx.hpp"
namespace Rx {
using namespace rxcpp;
using namespace rxcpp::sources;
using namespace rxcpp::operators;
using namespace rxcpp::util;
}
using namespace Rx;

#include <regex>
#include <random>
using namespace std;
using namespace std::chrono;

int main()
{
    random_device rd;   // non-deterministic generator
    mt19937 gen(rd());
    uniform_int_distribution<> dist(4, 18);

    // for testing purposes, produce byte stream that from lines of text
    auto bytes = range(0, 10) |
        flat_map([&](int i){
            auto body = from((uint8_t)('A' + i)) |
                repeat(dist(gen)) |
                as_dynamic();
            auto delim = from((uint8_t)'\r');
            return from(body, delim) | concat();
        }) |
        window(17) |
        flat_map([](observable<uint8_t> w){
            return w |
                reduce(
                    vector<uint8_t>(),
                    [](vector<uint8_t> v, uint8_t b){
                        v.push_back(b);
                        return v;
                    }) |
                as_dynamic();
        }) |
        tap([](vector<uint8_t>& v){
            // print input packet of bytes
            copy(v.begin(), v.end(), ostream_iterator<long>(cout, " "));
            cout << endl;
        });

    //
    // recover lines of text from byte stream
    //
    
    auto removespaces = [](string s){
        s.erase(remove_if(s.begin(), s.end(), ::isspace), s.end());
        return s;
    };

    // create strings split on \r
    auto strings = bytes |
        concat_map([](vector<uint8_t> v){
            string s(v.begin(), v.end());
            regex delim(R"/(\r)/");
            cregex_token_iterator cursor(&s[0], &s[0] + s.size(), delim, {-1, 0});
            cregex_token_iterator end;
            vector<string> splits(cursor, end);
            return iterate(move(splits));
        }) |
        filter([](const string& s){
            return !s.empty();
        }) |
        publish() |
        ref_count();

    // filter to last string in each line
    auto closes = strings |
        filter(
            [](const string& s){
                return s.back() == '\r';
            }) |
        Rx::map([](const string&){return 0;});

    // group strings by line
    auto linewindows = strings |
        window_toggle(closes | start_with(0), [=](int){return closes;});

    // reduce the strings for a line into one string
    auto lines = linewindows |
        flat_map([&](observable<string> w) {
            return w | start_with<string>("") | sum() | Rx::map(removespaces);
        });

    // print result
    lines |
        subscribe<string>(println(cout));

    return 0;
}

Reactive Extensions

The ReactiveX Observable model allows you to treat streams of asynchronous events with the same sort of simple, composable operations that you use for collections of data items like arrays. It frees you from tangled webs of callbacks, and thereby makes your code more readable and less prone to bugs.

Credit ReactiveX.io

Other language implementations

Resources

Cloning RxCpp

RxCpp uses a git submodule (in ext/catch) for the excellent Catch library. The easiest way to ensure that the submodules are included in the clone is to add --recursive in the clone command.

git clone --recursive https://github.com/ReactiveX/RxCpp.git
cd RxCpp

Installing

To install RxCpp into your OS you need to follow standart procedure:

mkdir build
cd build
cmake ..
make install 

If you're using the vcpkg dependency manager, you can install RxCpp using a single one-line command:

vcpkg install rxcpp

Vcpkg will acquire RxCpp, build it from source in your computer, and provide CMake integration support for your projects.

See the vcpkg repository for more information.

Importing

After you have successfully installed RxCpp you can import it into any project by simply adding to your CMakeLists.txt:

find_package(rxcpp CONFIG)

Building RxCpp Unit Tests

  • RxCpp is regularly tested on OSX and Windows.
  • RxCpp is regularly built with Clang, Gcc and VC
  • RxCpp depends on the latest compiler releases.

RxCpp uses CMake to create build files for several platforms and IDE's

ide builds

XCode

mkdir projects/build
cd projects/build
cmake -G"Xcode" ../CMake -B.

Visual Studio 2017

mkdir projects\build
cd projects\build
cmake -G "Visual Studio 15" ..\CMake\
msbuild Project.sln

makefile builds

OSX

mkdir projects/build
cd projects/build
cmake -G"Unix Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake
make

Linux --- Clang

mkdir projects/build
cd projects/build
cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++" -B. ../CMake
make

Linux --- GCC

mkdir projects/build
cd projects/build
cmake -G"Unix Makefiles" -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ../CMake
make

Windows

mkdir projects\build
cd projects\build
cmake -G"NMake Makefiles" -DCMAKE_BUILD_TYPE=RelWithDebInfo -B. ..\CMake
nmake

The build only produces test and example binaries.

Running tests

  • You can use the CMake test runner ctest
  • You can run the test binaries directly rxcpp_test_*
  • Tests can be selected by name or tag Example of by-tag

rxcpp_test_subscription [perf]

Documentation

RxCpp uses Doxygen to generate project documentation.

When Doxygen+Graphviz is installed, CMake creates a special build task named doc. It creates actual documentation and puts it to projects/doxygen/html/ folder, which can be published to the gh-pages branch. Each merged pull request will build the docs and publish them.

Developers Material

Contributing Code

Before submitting a feature or substantial code contribution please discuss it with the team and ensure it follows the product roadmap. Note that all code submissions will be rigorously reviewed and tested by the Rx Team, and only those that meet an extremely high bar for both quality and design/roadmap appropriateness will be merged into the source.

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].