ecor
Loading...
Searching...
No Matches
ecor::seq_source< K, S > Struct Template Reference

Keyed source that implements a scheduler that allows multiple receivers to be scheduled with the same completion signatures, and processes them in order based on a key provided at scheduling time. More...

#include <ecor.hpp>

Public Types

using sender_type = _sh_sender< K, S... >
 

Public Member Functions

bool empty () const
 Check if there are any scheduled receivers. More...
 
_sh_entry< K, S... > const & front () const
 Get a reference to the scheduled receiver with the smallest key. More...
 
_sh_sender< K, S... > schedule (K key) noexcept(noexcept(_sh_sender< K, S... >{ key, _sh }))
 Schedule a new sender with this scheduler, using the provided key for ordering. More...
 
template<typename E1 >
void set_error (E1 &&err)
 Send a set_error signal to the scheduled receiver with the smallest key. More...
 
void set_stopped ()
 Send a set_stopped signal to the scheduled receiver with the smallest key. More...
 
template<typename... V>
void set_value (V &&... value)
 Send a set_value signal to the scheduled receiver with the smallest key. More...
 

Detailed Description

template<typename K, signature... S>
struct ecor::seq_source< K, S >

Keyed source that implements a scheduler that allows multiple receivers to be scheduled with the same completion signatures, and processes them in order based on a key provided at scheduling time.

The key is used to order the scheduled receivers in a heap, and completion signals are delivered to the receiver with the smallest key.

Member Function Documentation

◆ empty()

template<typename K , signature... S>
bool ecor::seq_source< K, S >::empty ( ) const
inline

Check if there are any scheduled receivers.

This returns true if there are no scheduled receivers, and false otherwise.

◆ front()

template<typename K , signature... S>
_sh_entry< K, S... > const & ecor::seq_source< K, S >::front ( ) const
inline

Get a reference to the scheduled receiver with the smallest key.

This does not modify the heap, so the receiver remains scheduled and will receive the next completion signal sent to the source. The behavior is undefined if there are no scheduled receivers.

◆ schedule()

template<typename K , signature... S>
_sh_sender< K, S... > ecor::seq_source< K, S >::schedule ( key)
inlinenoexcept

Schedule a new sender with this scheduler, using the provided key for ordering.

The sender is returned with the key and a reference to the heap of the scheduler, and when connected and started, it will be linked into the heap based on the key.

◆ set_error()

template<typename K , signature... S>
template<typename E1 >
void ecor::seq_source< K, S >::set_error ( E1 &&  err)
inline

Send a set_error signal to the scheduled receiver with the smallest key.

The receiver is unregistered before the signal is sent, so it will only receive the first set_error signal sent after it is scheduled.

The error is perfectly forwarded.

◆ set_stopped()

template<typename K , signature... S>
void ecor::seq_source< K, S >::set_stopped ( )
inline

Send a set_stopped signal to the scheduled receiver with the smallest key.

The receiver is unregistered before the signal is sent, so it will only receive the first set_stopped signal sent after it is scheduled.

◆ set_value()

template<typename K , signature... S>
template<typename... V>
void ecor::seq_source< K, S >::set_value ( V &&...  value)
inline

Send a set_value signal to the scheduled receiver with the smallest key.

The receiver is unregistered before the signal is sent, so it will only receive the first set_value signal sent after it is scheduled.

Arguments are perfectly forwarded.


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