C++ Actor Framework 1.0.0
|
Shared state between an operator that emits values and the subscribed observer. More...
#include <ucast.hpp>
Classes | |
class | abstract_listener |
Interface for listeners that want to be notified when a ucast_sub_state is disposed, has consumed some items, or when its demand hast changed. More... | |
Public Member Functions | |
ucast_sub_state (coordinator *parent) | |
ucast_sub_state (coordinator *parent, observer< T > obs) | |
bool | push (const T &item) |
Returns true if item was consumed, false when it was buffered. | |
void | close () |
void | request (size_t n) |
void | abort (const error &reason) |
void | dispose () |
void | cancel () |
void | set_observer (observer< T > obs) |
coordinator * | parent () const noexcept override |
Returns the coordinator this object lives on. | |
void | ref_coordinated () const noexcept override |
Increases the reference count of the coordinated. | |
void | deref_coordinated () const noexcept override |
Decreases the reference count of the coordinated and destroys the object if necessary. | |
Public Member Functions inherited from caf::detail::plain_ref_counted | |
plain_ref_counted (const plain_ref_counted &) | |
plain_ref_counted & | operator= (const plain_ref_counted &) |
void | ref () const noexcept |
Increases reference count by one. | |
void | deref () const noexcept |
Decreases reference count by one and calls request_deletion when it drops to zero. | |
bool | unique () const noexcept |
Queries whether there is exactly one reference. | |
size_t | get_reference_count () const noexcept |
Queries the current reference count for this object. | |
Public Member Functions inherited from caf::flow::op::pullable | |
pullable (const pullable &)=delete | |
pullable & | operator= (const pullable &)=delete |
bool | is_pulling () const noexcept |
Checks whether this operator is currently running do_pull or is scheduled to do so. | |
Public Attributes | |
std::deque< T > | buf |
The buffer for storing items until the observer requests them. | |
size_t | demand = 0 |
The number items that the observer has requested but not yet received. | |
observer< T > | out |
The observer to send items to. | |
bool | disposed = false |
Keeps track of whether this object has been disposed. | |
bool | closed = false |
Keeps track of whether this object has been closed. | |
error | err |
The error to pass to the observer after the last on_next call. | |
abstract_listener * | listener = nullptr |
The listener for state changes. | |
Friends | |
void | intrusive_ptr_add_ref (const ucast_sub_state *ptr) noexcept |
void | intrusive_ptr_release (const ucast_sub_state *ptr) noexcept |
Additional Inherited Members | |
Protected Member Functions inherited from caf::flow::op::pullable | |
void | pull (flow::coordinator *parent, size_t n) |
Protected Attributes inherited from caf::detail::plain_ref_counted | |
size_t | rc_ |
Related Symbols inherited from caf::flow::coordinated | |
using | coordinated_ptr = intrusive_ptr<coordinated> |
Shared state between an operator that emits values and the subscribed observer.
|
overridevirtualnoexcept |
Decreases the reference count of the coordinated and destroys the object if necessary.
Implements caf::flow::coordinated.
|
overridevirtualnoexcept |
Returns the coordinator this object lives on.
Implements caf::flow::coordinated.
|
overridevirtualnoexcept |
Increases the reference count of the coordinated.
Implements caf::flow::coordinated.
error caf::flow::op::ucast_sub_state< T >::err |
The error to pass to the observer after the last on_next
call.
If this error is default-constructed, then the observer receives on_complete
. Otherwise, the observer receives on_error
.
abstract_listener* caf::flow::op::ucast_sub_state< T >::listener = nullptr |
The listener for state changes.
We hold a non-owning pointer to the listener, because the listener owns the state.