Base class for any observer used in RPP. It handles core callbacks of observers. Objects of this class would be passed to subscribe of observable.
More...
|
|
using | DisposableStrategy = details::observers::deduce_optimal_disposables_strategy_t<Strategy::preferred_disposables_mode> |
|
using | Base = details::observer_impl<Type, Strategy, DisposableStrategy> |
|
using | on_next_lvalue |
|
using | on_next_rvalue |
|
|
template<typename... Args> |
| | observer (DisposableStrategy strategy, Args &&... args) |
|
template<typename... Args> |
| | observer (Args &&... args) |
|
| observer (const observer &)=delete |
|
| observer (observer &&) noexcept=default |
|
dynamic_observer< Type > | as_dynamic () && |
| | Convert current observer to type-erased version. Useful if you need to COPY your observer or to store different observers in same container.
|
| 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_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.
|
|
|
static constexpr auto | preferred_disposables_mode |
|
| observer_impl (DisposablesStrategy strategy, Args &&... args) |
template<constraint::decayed_type Type, constraint::observer_strategy< Type > Strategy>
class rpp::observer< Type, Strategy >
Base class for any observer used in RPP. It handles core callbacks of observers. Objects of this class would be passed to subscribe of observable.
- Warning
- By default observer is not copyable, only movable. If you need to COPY your observer, you need to convert it to rpp::dynamic_observer via rpp::observer::as_dynamic
-
Expected that observer would be subscribed only to ONE observable ever. It can keep internal state and track it it was disposed or not. So, subscribing same observer multiple time follows unspecified behavior.
-
If you are passing disposable to ctor, then state of this disposable would be used used (if empty disposable or disposed -> observer is disposed by default)
-
It is expected that members of this observer are called in a SERIAL manner. This means no parallel or concurrent calls are allowed—only serial calls or those guarded under a lock.
- Template Parameters
-
| Type | of value this observer can handle |
| Strategy | used to provide logic over observer's callbacks |
The documentation for this class was generated from the following files: