C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::flow::op::ucast_sub_state< T > Class Template Reference

Shared state between an operator that emits values and the subscribed observer. More...

#include <ucast.hpp>

Inheritance diagram for caf::flow::op::ucast_sub_state< T >:
caf::detail::plain_ref_counted caf::flow::op::pullable caf::flow::coordinated

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)
 
coordinatorparent () 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_countedoperator= (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
 
pullableoperator= (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_listenerlistener = 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_
 

Detailed Description

template<class T>
class caf::flow::op::ucast_sub_state< T >

Shared state between an operator that emits values and the subscribed observer.

Member Function Documentation

◆ deref_coordinated()

template<class T >
void caf::flow::op::ucast_sub_state< T >::deref_coordinated ( ) const
overridevirtualnoexcept

Decreases the reference count of the coordinated and destroys the object if necessary.

Implements caf::flow::coordinated.

◆ parent()

template<class T >
coordinator * caf::flow::op::ucast_sub_state< T >::parent ( ) const
overridevirtualnoexcept

Returns the coordinator this object lives on.

Implements caf::flow::coordinated.

◆ ref_coordinated()

template<class T >
void caf::flow::op::ucast_sub_state< T >::ref_coordinated ( ) const
overridevirtualnoexcept

Increases the reference count of the coordinated.

Implements caf::flow::coordinated.

Member Data Documentation

◆ err

template<class T >
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.

◆ listener

template<class T >
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.


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