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

Returns an observable that makes an observable by the specified observable factory using the resource provided by the specified resource factory for each new observer that subscribes. More...

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

Functions

template<class ResourceFactory , class ObservableFactory >
auto rxcpp::sources::scope (ResourceFactory rf, ObservableFactory of) -> observable< rxu::value_type_t< detail::scope_traits< ResourceFactory, ObservableFactory >>, detail::scope< ResourceFactory, ObservableFactory >>
 Returns an observable that makes an observable by the specified observable factory using the resource provided by the specified resource factory for each new observer that subscribes. More...
 

Detailed Description

Returns an observable that makes an observable by the specified observable factory using the resource provided by the specified resource factory for each new observer that subscribes.

Template Parameters
ResourceFactorythe type of the resource factory
ObservableFactorythe type of the observable factory
Parameters
rfthe resource factory function that resturn the rxcpp::resource that is used as a resource by the observable factory
ofthe observable factory function to invoke for each observer that subscribes to the resulting observable
Returns
observable that makes an observable by the specified observable factory using the resource provided by the specified resource factory for each new observer that subscribes.
Sample Code
auto resource_factory = [](){return resource(rxcpp::util::to_vector({1, 2, 3, 4, 5}));};
auto observable_factory = [](resource res){return rxcpp::observable<>::iterate(res.get());};
auto values = rxcpp::observable<>::scope(resource_factory, observable_factory);
values.
[](int v){printf("OnNext: %d\n", v);},
[](){printf("OnCompleted\n");});
OnNext: 1
OnNext: 2
OnNext: 3
OnNext: 4
OnNext: 5
OnCompleted

Macro Definition Documentation

#define RXCPP_SOURCES_RX_SCOPE_HPP