ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States > Class Template Reference

Special type of specific_observer which has some state which this observer stores and pass to each callback. Actually it is base class for all observers. More...

#include <state_observer.hpp>

Inheritance diagram for rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States >:
rpp::details::typed_observer_tag< T > rpp::details::observer_tag rpp::specific_observer< T, OnNext, OnError, OnCompleted >

Public Member Functions

template<typename ... TStates>
requires (constraint::decayed_same_as<States, TStates> && ...)
 state_observer (std::invocable< T, States... > auto &&on_next, std::invocable< std::exception_ptr, States... > auto &&on_error, std::invocable< States... > auto &&on_completed, TStates &&...states)
 
void on_next (const T &v) const
 Observable calls this methods to notify observer about new value.
 
void on_next (T &&v) const
 Observable calls this methods to notify observer about new value.
 
void on_error (const std::exception_ptr &err) const
 Observable calls this method to notify observer about some error during generation next data.
 
void on_completed () const
 Observable calls this method to notify observer about finish of work.
 

Detailed Description

template<constraint::decayed_type T, typename OnNext, typename OnError, typename OnCompleted, constraint::decayed_type ... States>
requires (std::invocable<OnNext, T, States...> && std::invocable<OnError, std::exception_ptr, States...> && std::invocable<OnCompleted, States...>)
class rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States >

Special type of specific_observer which has some state which this observer stores and pass to each callback. Actually it is base class for all observers.

Member Function Documentation

◆ on_completed()

template<constraint::decayed_type T, typename OnNext , typename OnError , typename OnCompleted , constraint::decayed_type ... States>
void rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States >::on_completed ( ) const
inline

Observable calls this method to notify observer about finish of work.

Warning
Obtaining this call means no any further on_next calls

◆ on_error()

template<constraint::decayed_type T, typename OnNext , typename OnError , typename OnCompleted , constraint::decayed_type ... States>
void rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States >::on_error ( const std::exception_ptr &  err) const
inline

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

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

◆ on_next() [1/2]

template<constraint::decayed_type T, typename OnNext , typename OnError , typename OnCompleted , constraint::decayed_type ... States>
void rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States >::on_next ( const T &  v) const
inline

Observable calls this methods to notify observer about new value.

Note
obtains value by const-reference to original object.

◆ on_next() [2/2]

template<constraint::decayed_type T, typename OnNext , typename OnError , typename OnCompleted , constraint::decayed_type ... States>
void rpp::details::state_observer< T, OnNext, OnError, OnCompleted, States >::on_next ( T &&  v) const
inline

Observable calls this methods to notify observer about new value.

Note
obtains value by rvalue-reference to original object

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