SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
lambda_consumer.h
Go to the documentation of this file.
1#ifndef _lambda_consumer_H_
2#define _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_input(IN input, uint8_t input_channel = 0) override {
31 function(input);
32 }
33
34 protected:
35 std::function<void(IN)> function;
36};
37
38} // namespace sensesp
39
40#endif
Provides an easy way of calling a function based on the output of any ValueProducer.
void set_input(IN input, uint8_t input_channel=0) override
std::function< void(IN)> function
LambdaConsumer(std::function< void(IN)> function)
Construct a new transform based on a single function.
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...