1#ifndef SENSESP_TRANSFORMS_INTEGRATOR_H_
2#define SENSESP_TRANSFORMS_INTEGRATOR_H_
18template <
class C,
class P>
28 Integrator(P k = 1, P value = 0, String config_path =
"")
29 :
Transform<C, P>(config_path), k{k}, value{value} {
34 virtual void set(
const C& input)
override final {
41 virtual bool to_json(JsonObject& doc)
override final {
45 virtual bool from_json(
const JsonObject& config)
override final {
46 if (!config[
"k"].is<P>()) {
60 return R
"({"type":"object","properties":{"k":{"title":"Multiplier","type":"number"}}})";
virtual bool load() override
Load and populate the object from a persistent storage.
Integrator integrates (accumulates) the incoming values.
virtual bool to_json(JsonObject &doc) override final
virtual void set(const C &input) override final
Integrator(P k=1, P value=0, String config_path="")
Construct a new Integrator T object.
virtual bool from_json(const JsonObject &config) override final
void emit(const P &new_value)
const String ConfigSchema(const SmartSwitchController &obj)
Integrator< float, float > FloatIntegrator
Integrator< int, int > Accumulator