ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
rpp::details::observer_impl< Type, Strategy, DisposablesStrategy > Class Template Reference

Public Types

using preferred_disposable_strategy = observers::none_disposable_strategy
 
using on_next_lvalue = void (observer_impl::*)(const Type&) const noexcept
 
using on_next_rvalue = void (observer_impl::*)(Type&&) const noexcept
 

Public Member Functions

void set_upstream (const disposable_wrapper &d) noexcept
 Observable calls this method to pass disposable. Observer disposes this disposable WHEN observer wants to unsubscribe.
 
bool is_disposed () const noexcept
 Observable calls this method to check if observer interested or not in emissions.
 
void on_next (const Type &v) const noexcept
 Observable calls this method to notify observer about new value.
 
void on_next (Type &&v) const noexcept
 Observable calls this method to notify observer about new value.
 
void on_error (const std::exception_ptr &err) const noexcept
 Observable calls this method to notify observer about some error during generation next data.
 
void on_completed () const noexcept
 Observable calls this method to notify observer about completion of emissions.
 

Protected Member Functions

template<typename... Args>
requires constraint::is_constructible_from<Strategy, Args&&...>
 observer_impl (DisposablesStrategy strategy, Args &&... args)
 

Member Function Documentation

◆ is_disposed()

template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy, observers::constraint::disposable_strategy DisposablesStrategy>
bool rpp::details::observer_impl< Type, Strategy, DisposablesStrategy >::is_disposed ( ) const
inlinenoexcept

Observable calls this method to check if observer interested or not in emissions.

Returns
true if observer disposed and no longer interested in emissions
false if observer still interested in emissions

◆ on_completed()

template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy, observers::constraint::disposable_strategy DisposablesStrategy>
void rpp::details::observer_impl< Type, Strategy, DisposablesStrategy >::on_completed ( ) const
inlinenoexcept

Observable calls this method to notify observer about completion of emissions.

Warning
Obtaining this of this call means no any further on_next/on_error or on_completed calls from this Observable

◆ on_error()

template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy, observers::constraint::disposable_strategy DisposablesStrategy>
void rpp::details::observer_impl< Type, Strategy, DisposablesStrategy >::on_error ( const std::exception_ptr & err) const
inlinenoexcept

Observable calls this method to notify observer about some error during generation next data.

Warning
Obtaining this of this call means no any further on_next/on_error or on_completed calls from this Observable
Parameters
errdetails of error

◆ on_next() [1/2]

template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy, observers::constraint::disposable_strategy DisposablesStrategy>
void rpp::details::observer_impl< Type, Strategy, DisposablesStrategy >::on_next ( const Type & v) const
inlinenoexcept

Observable calls this method to notify observer about new value.

Note
obtains value by const-reference to original object.

◆ on_next() [2/2]

template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy, observers::constraint::disposable_strategy DisposablesStrategy>
void rpp::details::observer_impl< Type, Strategy, DisposablesStrategy >::on_next ( Type && v) const
inlinenoexcept

Observable calls this method to notify observer about new value.

Note
obtains value by rvalue-reference to original object

◆ set_upstream()

template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy, observers::constraint::disposable_strategy DisposablesStrategy>
void rpp::details::observer_impl< Type, Strategy, DisposablesStrategy >::set_upstream ( const disposable_wrapper & d)
inlinenoexcept

Observable calls this method to pass disposable. Observer disposes this disposable WHEN observer wants to unsubscribe.

Note
This method can be called multiple times.

The documentation for this class was generated from the following file: