ReactivePlusPlus
One more implementation of ReactiveX approach in C++ with care about performance and templates in mind
 
Loading...
Searching...
No Matches
rpp::subjects::behavior_subject< T > Class Template Referencefinal

Subject which multicasts values to observers subscribed on it and sends last emitted value (or initial value) on subscribe. It contains two parts: subscriber and observable at the same time. More...

#include <behavior_subject.hpp>

Inheritance diagram for rpp::subjects::behavior_subject< T >:
rpp::subjects::details::base_subject< T, details::behavior_strategy< T > > rpp::subjects::details::subject_tag

Public Member Functions

 behavior_subject (const T &initial_value, const composite_subscription &sub)
 
 behavior_subject (T &&initial_value, const composite_subscription &sub)
 
 behavior_subject (const T &initial_value, composite_subscription &&sub=composite_subscription{})
 
 behavior_subject (T &&initial_value, composite_subscription &&sub=composite_subscription{})
 
get_value () const
 
- Public Member Functions inherited from rpp::subjects::details::base_subject< T, details::behavior_strategy< T > >
auto get_subscriber () const
 
auto get_observable () const
 

Additional Inherited Members

- Protected Member Functions inherited from rpp::subjects::details::base_subject< T, details::behavior_strategy< T > >
 base_subject (auto &&...args)
 
const Strategy & get_strategy () const
 

Detailed Description

template<rpp::constraint::decayed_type T>
class rpp::subjects::behavior_subject< T >

Subject which multicasts values to observers subscribed on it and sends last emitted value (or initial value) on subscribe. It contains two parts: subscriber and observable at the same time.

Each subscriber obtains only last/initial value + values which emitted after corresponding subscribe. on_error/on_completer/unsubscribe cached and provided to new subscribers if any

Warning
this subject is not synchronized/serialized! It means, that expected to call callbacks of subscriber in the serialized way to follow observable contract: "Observables must issue notifications to observers serially (not in parallel).". If you are not sure or need extra serialization, please, use serialized_subject.
Template Parameters
Tvalue provided by this subject
See also
https://reactivex.io/documentation/subject.html

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