ReactivePlusPlus
ReactiveX implementation for C++20
|
Base class for any observable used in RPP. It handles core callbacks of observable. More...
#include <observable.hpp>
Public Types | |
using | value_type = Type |
using | strategy_type = Strategy |
using | optimal_disposables_strategy = typename Strategy::optimal_disposables_strategy |
Public Member Functions | |
template<typename... Args> requires (!constraint::variadic_decayed_same_as<observable<Type, Strategy>, Args...> && constraint::is_constructible_from<Strategy, Args && ...>) | |
observable (Args &&... args) | |
template<constraint::observer_strategy< Type > ObserverStrategy> | |
void | subscribe (observer< Type, ObserverStrategy > &&observer) const |
Subscribes passed observer to emissions from this observable. | |
void | subscribe (dynamic_observer< Type > observer) const |
Subscribe passed observer to emissions from this observable. | |
template<constraint::observer_strategy< Type > ObserverStrategy> requires (!constraint::observer<ObserverStrategy>) | |
void | subscribe (ObserverStrategy &&observer_strategy) const |
Subscribes passed observer strategy to emissions from this observable via construction of observer. | |
template<constraint::observer_strategy< Type > ObserverStrategy> | |
composite_disposable_wrapper | subscribe (const composite_disposable_wrapper &d, observer< Type, ObserverStrategy > &&obs) const |
Subscribe passed observer to emissions from this observable. | |
template<constraint::observer_strategy< Type > ObserverStrategy> requires (!constraint::observer<ObserverStrategy>) | |
composite_disposable_wrapper | subscribe (const composite_disposable_wrapper &d, ObserverStrategy &&observer_strategy) const |
Subscribes passed observer strategy to emissions from this observable via construction of observer. | |
template<constraint::observer_strategy< Type > ObserverStrategy> | |
composite_disposable_wrapper | subscribe_with_disposable (observer< Type, ObserverStrategy > &&observer) const |
Subscribes passed observer to emissions from this observable. | |
template<constraint::observer_strategy< Type > ObserverStrategy> requires (!constraint::observer<ObserverStrategy>) | |
composite_disposable_wrapper | subscribe_with_disposable (ObserverStrategy &&observer_strategy) const |
Subscribes observer strategy to emissions from this observable. | |
composite_disposable_wrapper | subscribe_with_disposable (dynamic_observer< Type > observer) const |
Subscribe passed observer to emissions from this observable. | |
template<std::invocable< Type > OnNext, std::invocable< const std::exception_ptr & > OnError = rpp::utils::rethrow_error_t, std::invocable<> OnCompleted = rpp::utils::empty_function_t<>> | |
void | subscribe (OnNext &&on_next, OnError &&on_error={}, OnCompleted &&on_completed={}) const |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable. | |
template<std::invocable< Type > OnNext, std::invocable<> OnCompleted> | |
void | subscribe (OnNext &&on_next, OnCompleted &&on_completed) const |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable. | |
template<std::invocable< Type > OnNext, std::invocable< const std::exception_ptr & > OnError = rpp::utils::rethrow_error_t, std::invocable<> OnCompleted = rpp::utils::empty_function_t<>> | |
composite_disposable_wrapper | subscribe_with_disposable (OnNext &&on_next, OnError &&on_error={}, OnCompleted &&on_completed={}) const |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable. | |
template<std::invocable< Type > OnNext, std::invocable<> OnCompleted> | |
composite_disposable_wrapper | subscribe_with_disposable (OnNext &&on_next, OnCompleted &&on_completed) const |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable. | |
template<std::invocable< Type > OnNext, std::invocable< const std::exception_ptr & > OnError = rpp::utils::rethrow_error_t, std::invocable<> OnCompleted = rpp::utils::empty_function_t<>> | |
composite_disposable_wrapper | subscribe (const composite_disposable_wrapper &d, OnNext &&on_next, OnError &&on_error={}, OnCompleted &&on_completed={}) const |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable. | |
template<std::invocable< Type > OnNext, std::invocable<> OnCompleted> | |
composite_disposable_wrapper | subscribe (const composite_disposable_wrapper &d, OnNext &&on_next, OnCompleted &&on_completed) const |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable. | |
auto | as_dynamic () const & |
Convert observable to type-erased version. | |
auto | as_dynamic () && |
Convert observable to type-erased version. | |
template<typename Subscribe> requires rpp::utils::is_base_of_v<std::decay_t<Subscribe>, rpp::operators::details::subscribe_t> | |
auto | operator| (Subscribe &&op) const |
template<typename Op> requires (!rpp::utils::is_base_of_v<std::decay_t<Op>, rpp::operators::details::subscribe_t>) | |
rpp::constraint::observable auto | operator| (Op &&op) const & |
template<typename Op> requires (!rpp::utils::is_base_of_v<std::decay_t<Op>, rpp::operators::details::subscribe_t>) | |
rpp::constraint::observable auto | operator| (Op &&op) && |
template<typename Op> | |
auto | pipe (Op &&op) const & |
template<typename Op> | |
auto | pipe (Op &&op) && |
Base class for any observable used in RPP. It handles core callbacks of observable.
Observable provides only one core function: subscribe - it accepts observer (or any way to construct it) and then invokes underlying Strategy to emit emissions somehow.
Type
, you can use type-erased version: rpp::dynamic_observable
Type | of value this observable would provide. Only observers of same type can be subscribed to this observable. |
Strategy | used to provide logic over observable's callbacks. |
|
inline |
Subscribe passed observer to emissions from this observable.
This overloading attaches passed disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
d | is disposable to be attached to observer. If disposable is nullptr or disposed -> no any subscription happens |
obs | is observer to subscribe to this observable |
|
inline |
Subscribes passed observer strategy to emissions from this observable via construction of observer.
This overloading attaches passed disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
d | is disposable to be attached to observer. If disposable is nullptr or disposed -> no any subscription happens |
observer_strategy | is strategy to create observer to subscribe to this observable |
|
inline |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable.
This overloading attaches passed disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
d | is disposable to be attached to observer. If disposable is nullptr or disposed -> no any subscription happens |
on_next | is callback to handle values from this observable |
on_completed | is callback to handle completion of this observable |
|
inline |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable.
This overloading attaches passed disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
d | is disposable to be attached to observer. If disposable is nullptr or disposed -> no any subscription happens |
on_next | is callback to handle values from this observable |
on_error | is callback to handle error from this observable |
on_completed | is callback to handle completion of this observable |
|
inline |
Subscribe passed observer to emissions from this observable.
Special overloading for dynamic observer to enable copy of observer
|
inline |
Subscribes passed observer to emissions from this observable.
|
inlinenodiscard |
Subscribe passed observer to emissions from this observable.
This overloading attaches disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
Special overloading for dynamic observer to enable copy of observer
|
inlinenodiscard |
Subscribes passed observer to emissions from this observable.
This overloading attaches disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
|
inlinenodiscard |
Subscribes observer strategy to emissions from this observable.
This overloading attaches disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
|
inlinenodiscard |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable.
This overloading attaches disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.
|
inlinenodiscard |
Construct rpp::lambda_observer on the fly and subscribe it to emissions from this observable.
This overloading attaches disposable to observer and return it to provide ability to dispose/disconnect observer early if needed.