Loading [MathJax]/jax/output/HTML-CSS/config.js
SensESP 3.1.0
Universal Signal K sensor toolkit ESP32
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
lambda_consumer.h
Go to the documentation of this file.
1#ifndef SENSESP_SYSTEM_LAMBDA_CONSUMER_H
2#define SENSESP_SYSTEM_LAMBDA_CONSUMER_H
3
4#include "valueconsumer.h"
5
6namespace sensesp {
7
24template <class IN>
25class LambdaConsumer : public ValueConsumer<IN> {
26 public:
27 LambdaConsumer(std::function<void(IN)> function)
29
30 void set(const IN& input) override { function(input); }
31
32 protected:
33 std::function<void(IN)> function;
34};
35
36} // namespace sensesp
37
38#endif
Provides an easy way of calling a function based on the output of any ValueProducer.
std::function< void(IN)> function
void set(const IN &input) override
LambdaConsumer(std::function< void(IN)> function)
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...