SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
valueconsumer.h
Go to the documentation of this file.
1#ifndef _value_consumer_H_
2#define _value_consumer_H_
3
4#include <ArduinoJson.h>
5#include <stdint.h>
6
7#include "sensesp.h"
8
9namespace sensesp {
10
11template <typename T>
12class ValueProducer;
13
21template <typename T>
23 public:
32 virtual void set_input(T new_value, uint8_t input_channel = 0) {}
33
44 this->set_input(producer->get(), input_channel);
45 });
46 }
47};
48
53
54} // namespace sensesp
55
56#endif
Construct a new transform based on a single function.
void attach(std::function< void()> observer)
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...
virtual void set_input(T new_value, uint8_t input_channel=0)
void connect_from(ValueProducer< T > *producer, uint8_t input_channel=0)
virtual const T & get() const
ValueConsumer< bool > BoolConsumer
ValueConsumer< float > FloatConsumer
ValueConsumer< String > StringConsumer
ValueConsumer< int > IntConsumer