SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::Zip5< T1, T2, T3, T4, T5 > Class Template Reference

Zip five producer values into a tuple. More...

#include <sensesp/transforms/zip.h>

Inheritance diagram for sensesp::Zip5< T1, T2, T3, T4, T5 >:
[legend]

Public Member Functions

 Zip5 (long max_age=0)
 
- Public Member Functions inherited from sensesp::ZipBase< 5 >
 ZipBase (long max_age=0)
 
- Public Member Functions inherited from sensesp::ValueProducer< std::tuple< T1, T2, T3, T4, T5 > >
 ValueProducer ()
 
 ValueProducer (const std::tuple< T1, T2, T3, T4, T5 > &initial_value)
 
virtual const std::tuple< T1, T2, T3, T4, T5 > & get () const
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< std::tuple< T1, T2, T3, T4, T5 >, typenameVConsumer::input_type >::value, std::shared_ptr< VConsumer > >::type connect_to (std::shared_ptr< VConsumer > consumer)
 Connect a producer to a transform with a different input type.
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< std::tuple< T1, T2, T3, T4, T5 >, typenameVConsumer::input_type >::value, VConsumer * >::type connect_to (VConsumer *consumer)
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< std::tuple< T1, T2, T3, T4, T5 >, typenameVConsumer::input_type >::value, VConsumer * >::type connect_to (VConsumer &consumer)
 
void emit (const std::tuple< T1, T2, T3, T4, T5 > &new_value)
 
- Public Member Functions inherited from sensesp::Observable
 Observable ()
 
 Observable (Observable &&other)
 Move constructor.
 
void notify ()
 
void attach (std::function< void()> observer)
 

Public Attributes

std::tuple< LambdaConsumer< T1 >, LambdaConsumer< T2 >, LambdaConsumer< T3 >, LambdaConsumer< T4 >, LambdaConsumer< T5 > > consumers
 

Protected Member Functions

void emit_tuple () override
 
- Protected Member Functions inherited from sensesp::ZipBase< 5 >
virtual void check_emit ()
 

Protected Attributes

std::tuple< T1, T2, T3, T4, T5 > values
 
- Protected Attributes inherited from sensesp::ZipBase< 5 >
elapsedMillis age_ [N]
 
bool fresh_ [N]
 
long max_age_
 
- Protected Attributes inherited from sensesp::ValueProducer< std::tuple< T1, T2, T3, T4, T5 > >
std::tuple< T1, T2, T3, T4, T5 > output_
 

Detailed Description

template<typename T1, typename T2, typename T3, typename T4, typename T5>
class sensesp::Zip5< T1, T2, T3, T4, T5 >

Zip five producer values into a tuple.

Zips the connected producers' values into a tuple. The tuple is emitted once all producers have emitted a new value within max_age milliseconds.

Definition at line 173 of file zip.h.

Constructor & Destructor Documentation

◆ Zip5()

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
sensesp::Zip5< T1, T2, T3, T4, T5 >::Zip5 ( long max_age = 0)
inline

Definition at line 176 of file zip.h.

Member Function Documentation

◆ emit_tuple()

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
void sensesp::Zip5< T1, T2, T3, T4, T5 >::emit_tuple ( )
inlineoverrideprotectedvirtual

Implements sensesp::ZipBase< 5 >.

Definition at line 216 of file zip.h.

Here is the call graph for this function:

Member Data Documentation

◆ consumers

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
std::tuple<LambdaConsumer<T1>, LambdaConsumer<T2>, LambdaConsumer<T3>, LambdaConsumer<T4>, LambdaConsumer<T5> > sensesp::Zip5< T1, T2, T3, T4, T5 >::consumers
Initial value:
= {LambdaConsumer<T1>([this](T1 value) {
std::get<0>(values) = value;
age_[0] = 0;
fresh_[0] = true;
}),
LambdaConsumer<T2>([this](T2 value) {
std::get<1>(values) = value;
age_[1] = 0;
fresh_[1] = true;
}),
LambdaConsumer<T3>([this](T3 value) {
std::get<2>(values) = value;
age_[2] = 0;
fresh_[2] = true;
}),
LambdaConsumer<T4>([this](T4 value) {
std::get<3>(values) = value;
age_[3] = 0;
fresh_[3] = true;
}),
LambdaConsumer<T5>([this](T5 value) {
std::get<4>(values) = value;
age_[4] = 0;
fresh_[4] = true;
})}
Provides an easy way of calling a function based on the output of any ValueProducer.
std::tuple< T1, T2, T3, T4, T5 > values
Definition zip.h:214
virtual void check_emit()
Definition zip.h:34
bool fresh_[N]
Definition zip.h:29
elapsedMillis age_[N]
Definition zip.h:28

Definition at line 182 of file zip.h.

◆ values

template<typename T1 , typename T2 , typename T3 , typename T4 , typename T5 >
std::tuple<T1, T2, T3, T4, T5> sensesp::Zip5< T1, T2, T3, T4, T5 >::values
protected

Definition at line 214 of file zip.h.


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