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

Blocking interface for emitting items to an asynchronous consumer. More...

#include <blocking_consumer.hpp>

Public Types

using impl_ptr = intrusive_ptr<impl>
 

Public Member Functions

 blocking_consumer (const blocking_consumer &)=delete
 
blocking_consumeroperator= (const blocking_consumer &)=delete
 
 blocking_consumer (blocking_consumer &&)=default
 
blocking_consumeroperator= (blocking_consumer &&)=default
 
 blocking_consumer (impl_ptr ptr)
 
 blocking_consumer (spsc_buffer_ptr< T > buf)
 
template<class ErrorPolicy >
read_result pull (ErrorPolicy policy, T &item)
 Fetches the next item.
 
template<class ErrorPolicy , class Clock , class Duration = typename Clock::duration>
read_result pull (ErrorPolicy policy, T &item, std::chrono::time_point< Clock, Duration > timeout)
 Fetches the next item.
 
template<class ErrorPolicy , class Rep , class Period >
read_result pull (ErrorPolicy policy, T &item, std::chrono::duration< Rep, Period > timeout)
 Fetches the next item.
 
error abort_reason () const
 

Detailed Description

template<class T>
class caf::async::blocking_consumer< T >

Blocking interface for emitting items to an asynchronous consumer.

Member Function Documentation

◆ pull() [1/3]

template<class T >
template<class ErrorPolicy >
read_result caf::async::blocking_consumer< T >::pull ( ErrorPolicy policy,
T & item )

Fetches the next item.

If there is no item available, this functions blocks unconditionally.

Parameters
policyEither instant_error, delay_error or ignore_errors.
itemOutput parameter for storing the received item.
Returns
the status of the read operation. The function writes to item only when also returning read_result::ok.

◆ pull() [2/3]

template<class T >
template<class ErrorPolicy , class Rep , class Period >
read_result caf::async::blocking_consumer< T >::pull ( ErrorPolicy policy,
T & item,
std::chrono::duration< Rep, Period > timeout )

Fetches the next item.

If there is no item available, this functions blocks until the relative timeout was reached.

Parameters
policyEither instant_error, delay_error or ignore_errors.
itemOutput parameter for storing the received item.
timeoutMaximum duration before returning from the function.
Returns
the status of the read operation. The function writes to item only when also returning read_result::ok.

◆ pull() [3/3]

template<class T >
template<class ErrorPolicy , class Clock , class Duration = typename Clock::duration>
read_result caf::async::blocking_consumer< T >::pull ( ErrorPolicy policy,
T & item,
std::chrono::time_point< Clock, Duration > timeout )

Fetches the next item.

If there is no item available, this functions blocks until the absolute timeout was reached.

Parameters
policyEither instant_error, delay_error or ignore_errors.
itemOutput parameter for storing the received item.
timeoutAbsolute timeout for the receive operation.
Returns
the status of the read operation. The function writes to item only when also returning read_result::ok.

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