1#ifndef SENSESP_TRANSFORMS_CURVEINTERPOLATOR_H_
2#define SENSESP_TRANSFORMS_CURVEINTERPOLATOR_H_
47 Sample(
float input,
float output);
57 const String& config_path =
"");
60 void set(
const float& input)
override;
73 virtual bool to_json(JsonObject& doc)
override;
74 virtual bool from_json(
const JsonObject& doc)
override;
92 static const char schema[] = R
"({"type":"object","properties":{"samples":{"title":"Sample values","type":"array","format":"table","items":{"type":"object","properties":{"input":{"type":"number","title":"%s"},"output":{"type":"number","title":"%s"}}}}}})";
93 static char buf[
sizeof(schema) + 160];
94 snprintf(buf,
sizeof(buf), schema, obj.
input_title_.c_str(),
friend bool operator<(const Sample &lhs, const Sample &rhs)
Implement a piecewise linear interpolation transform.
CurveInterpolator * set_input_title(String input_title)
void set(const float &input) override
CurveInterpolator * set_output_title(String output_title)
std::set< Sample > samples_
virtual bool to_json(JsonObject &doc) override
friend const char * ConfigSchema(const CurveInterpolator &obj)
void add_sample(const Sample &new_sample)
CurveInterpolator(std::set< Sample > *defaults=NULL, const String &config_path="")
Construct a new CurveInterpolator object.
virtual bool from_json(const JsonObject &doc) override
const std::set< Sample > & get_samples() const
const String ConfigSchema(const SmartSwitchController &obj)