ReactiveX / RxCpp

Reactive Extensions for C++
Apache License 2.0
3.06k stars 396 forks source link

Documentation request: provide examples for C++ that match examples from the "Intro to Rx" article #597

Open bert-laverman opened 1 year ago

bert-laverman commented 1 year ago

I am kind of struggling to translate the Intro to Rx article into something that will help me use RxCpp. I am not looking for examples that parallel the ranges examples, but rather on how to construct my own observables, oberservers, and (more likely) subjects.

As background: I have a library that will need to process an asynchronous data stream, where the underlying API is a given. No API call is synchronous. Any response, error or reply, comes in through a message stream and is handed off to a callback that I can register with the API. The callback has to check what kind of message it has followed by message-specific attempts to match the message to a previous request. What appears to work well in C# using the .Net version of Rx, is registering collections of Subjects for each kind of message. Then the message dispatcher can just look up the collection of subscribers and call OnNext, OnError, or OnCompleted as needed. The user of my library can perform any request needed, receiving an Observable that it can subscribe to, or if the reply is known to be a single message, do a blocking Get().

I would have expected to be able to use the same approach in C++, but cannot find any hints on how to use RxCpp in this manner. The namespace structure does not match the packages in C# or Java and many of the classes from those implementations I cannot find. The online Doxygen documentation for most RxCpp classes looks pretty empty.

victimsnino commented 1 year ago

Hi

Documentation for all operators can be found in operators namespace

Rest part of the RxCpp has worse documentation.

If it is applicable for you, you can use ReactivePlusPlus documentation (ReactivePlusPlus is re-implementation of RxCpp on C++20). Most of the documentation and details are absolutely applicable to RxCpp

bert-laverman commented 1 year ago

Thank you. Operators were the last part for me to look at, as my library will produce observables or receive observers, rather than use them. I'll have a look at ReactivePlusPlus and the documentation. C++20 is my own target, so I hope you don't mind if I check it out a bit further.