C++ Actor Framework 1.0.0
Loading...
Searching...
No Matches
caf::flow::observable_builder Class Reference

Factory for observable objects. More...

#include <observable_builder.hpp>

Public Member Functions

 observable_builder (const observable_builder &) noexcept=default
 
observable_builderoperator= (const observable_builder &) noexcept=default
 
template<class Generator >
generation< Generator > from_generator (Generator generator) const
 Creates a generation that emits values by repeatedly calling generator.pull(...).
 
template<class T >
auto just (T value) const
 Creates a generation that emits value once.
 
template<class T >
generation< gen::repeat< T > > repeat (T value) const
 Creates a generation that emits value repeatedly.
 
template<class T >
generation< gen::iota< T > > iota (T value) const
 Creates a generation that emits ascending values.
 
template<class T >
generation< gen::empty< T > > empty ()
 Creates an observable without any values that calls on_complete after subscribing to it.
 
template<class Container >
generation< gen::from_container< Container > > from_container (Container values) const
 Creates a generation that emits ascending values.
 
template<class F >
generation< gen::from_callable< F > > from_callable (F fn) const
 Creates a generation that emits ascending values.
 
template<class T >
auto range (T init, size_t num) const
 Creates a generation that emits num ascending values, starting with init.
 
template<class T >
observable< T > from_resource (async::consumer_resource< T > res) const
 Creates an observable that reads and emits all values from res.
 
template<class Rep , class Period >
observable< int64_t > interval (std::chrono::duration< Rep, Period > initial_delay, std::chrono::duration< Rep, Period > period)
 Creates an observable that emits a sequence of integers spaced by the period.
 
template<class Rep , class Period >
observable< int64_t > interval (std::chrono::duration< Rep, Period > delay)
 Creates an observable that emits a sequence of integers spaced by the delay.
 
template<class Rep , class Period >
observable< int64_t > timer (std::chrono::duration< Rep, Period > delay)
 Creates an observable that emits a single item after the delay.
 
template<class T >
observable< T > never ()
 Creates an observable without any values that also never terminates.
 
template<class T >
observable< T > fail (error what)
 Creates an observable without any values that fails immediately when subscribing to it by calling on_error on the subscriber.
 
template<class Factory >
auto defer (Factory factory)
 Create a fresh observable for each observer using the factory.
 
template<class Input , class... Inputs>
auto merge (Input x, Inputs... xs)
 Creates an observable that combines the items emitted from all passed source observables.
 
template<class Input , class... Inputs>
auto concat (Input &&x, Inputs &&... xs)
 Creates an observable that concatenates the items emitted from all passed source observables.
 
template<class F , class T0 , class T1 , class... Ts>
auto zip_with (F fn, T0 input0, T1 input1, Ts... inputs)
 Creates an observable that combines the emitted from all passed source observables by applying a function object.
 

Friends

class coordinator
 

Detailed Description

Factory for observable objects.

Member Function Documentation

◆ interval() [1/2]

template<class Rep , class Period >
observable< int64_t > caf::flow::observable_builder::interval ( std::chrono::duration< Rep, Period > delay)

Creates an observable that emits a sequence of integers spaced by the delay.

Parameters
delayTime delay between two integer values.

◆ interval() [2/2]

template<class Rep , class Period >
observable< int64_t > caf::flow::observable_builder::interval ( std::chrono::duration< Rep, Period > initial_delay,
std::chrono::duration< Rep, Period > period )

Creates an observable that emits a sequence of integers spaced by the period.

Parameters
initial_delayDelay of the first integer after subscribing.
periodDelay of each consecutive integer after the first value.

◆ zip_with()

template<class F , class T0 , class T1 , class... Ts>
auto caf::flow::observable_builder::zip_with ( F fn,
T0 input0,
T1 input1,
Ts... inputs )

Creates an observable that combines the emitted from all passed source observables by applying a function object.

Parameters
fnThe zip function. Takes one element from each input at a time and reduces them into a single result.
input0The input at index 0.
input1The input at index 1.
inputsThe inputs for index > 1, if any.

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