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

A multicaster pushes items to any number of subscribers. More...

#include <multicaster.hpp>

Public Types

using impl_ptr = intrusive_ptr<op::mcast<T>>
 

Public Member Functions

 multicaster (coordinator *parent)
 
 multicaster (impl_ptr ptr) noexcept
 
 multicaster (multicaster &&) noexcept=default
 
multicasteroperator= (multicaster &&) noexcept=default
 
 multicaster (const multicaster &)=delete
 
multicasteroperator= (const multicaster &)=delete
 
bool push (const T &item)
 Pushes an item to all subscribed observers.
 
template<class Iterator , class Sentinel >
size_t push (Iterator first, Sentinel last)
 Pushes the items in range [first, last) to all subscribed observers.
 
size_t push (std::initializer_list< T > items)
 Pushes the items from the initializer list to all subscribed observers.
 
void close ()
 Closes the publisher, eventually emitting on_complete on all observers.
 
void abort (const error &reason)
 Closes the publisher, eventually emitting on_error on all observers.
 
size_t demand () const noexcept
 Queries how many items the publisher may emit immediately to subscribed observers.
 
size_t buffered () const noexcept
 Queries how many items are currently waiting in a buffer until the observer requests additional items.
 
bool has_observers () const noexcept
 Queries whether there is at least one observer subscribed to the operator.
 
observable< T > as_observable () const
 Converts the publisher to an observable.
 
disposable subscribe (observer< T > out)
 Subscribes a new observer to the output of the publisher.
 

Detailed Description

template<class T>
class caf::flow::multicaster< T >

A multicaster pushes items to any number of subscribers.

Member Function Documentation

◆ push() [1/3]

template<class T >
bool caf::flow::multicaster< T >::push ( const T & item)

Pushes an item to all subscribed observers.

The publisher drops the item if no subscriber exists.

◆ push() [2/3]

template<class T >
template<class Iterator , class Sentinel >
size_t caf::flow::multicaster< T >::push ( Iterator first,
Sentinel last )

Pushes the items in range [first, last) to all subscribed observers.

The publisher drops the items if no subscriber exists.

◆ push() [3/3]

template<class T >
size_t caf::flow::multicaster< T >::push ( std::initializer_list< T > items)

Pushes the items from the initializer list to all subscribed observers.

The publisher drops the items if no subscriber exists.


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