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

Resembles a regular observable, except that it does not begin emitting items when it is subscribed to. More...

#include <observable.hpp>

Public Types

using output_type = T
 The type of emitted items.
 
using pimpl_type = intrusive_ptr<op::publish<T>>
 The pointer-to-implementation type.
 

Public Member Functions

 connectable (pimpl_type pimpl) noexcept
 
connectableoperator= (std::nullptr_t) noexcept
 
 connectable (connectable &&) noexcept=default
 
 connectable (const connectable &) noexcept=default
 
connectableoperator= (connectable &&) noexcept=default
 
connectableoperator= (const connectable &) noexcept=default
 
observable< T > auto_connect (size_t subscriber_threshold=1) &
 Returns an observable that automatically connects to this connectable when reaching subscriber_threshold subscriptions.
 
observable< T > auto_connect (size_t subscriber_threshold=1) &&
 Similar to the lvalue overload, but converts this connectable directly if possible, thus saving one hop on the pipeline.
 
observable< T > ref_count (size_t subscriber_threshold=1) &
 Returns an observable that automatically connects to this connectable when reaching subscriber_threshold subscriptions and disconnects automatically after the last subscriber canceled its subscription.
 
observable< T > ref_count (size_t subscriber_threshold=1) &&
 Similar to the lvalue overload, but converts this connectable directly if possible, thus saving one hop on the pipeline.
 
disposable connect ()
 Connects to the source observable, thus starting to emit items.
 
template<class Fn >
auto compose (Fn &&fn) &&
 Transforms this observable by applying a function object to it.
 
template<class... Ts>
disposable subscribe (Ts &&... xs)
 
observable< T > as_observable () const &
 
observable< T > as_observable () &&
 
const pimpl_typepimpl () const noexcept
 
bool valid () const noexcept
 
 operator bool () const noexcept
 
bool operator! () const noexcept
 
void swap (connectable &other)
 
coordinatorparent () const
 

Detailed Description

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

Resembles a regular observable, except that it does not begin emitting items when it is subscribed to.

Only after calling connect will the connectable start to emit items.

Member Function Documentation

◆ compose()

template<class T >
template<class Fn >
auto caf::flow::connectable< T >::compose ( Fn && fn) &&

Transforms this observable by applying a function object to it.

◆ parent()

template<class T >
coordinator * caf::flow::connectable< T >::parent ( ) const
Precondition
valid()

◆ ref_count()

template<class T >
observable< T > caf::flow::connectable< T >::ref_count ( size_t subscriber_threshold = 1) &

Returns an observable that automatically connects to this connectable when reaching subscriber_threshold subscriptions and disconnects automatically after the last subscriber canceled its subscription.

Note
The threshold only applies to the initial connect, not to any re-connects.

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