1#ifndef SENSESP_SRC_TRANSFORMS_FILTER_H_
2#define SENSESP_SRC_TRANSFORMS_FILTER_H_
18 Filter(std::function<
bool(
const T&)> filter, String config_path =
"")
19 :
Transform<T, T>(config_path), filter_{filter} {
22 virtual void set(
const T& new_value)
override {
23 if (filter_(new_value)) {
24 this->
emit(new_value);
29 std::function<bool(
const T&)> filter_;
virtual bool load() override
Load and populate the object from a persistent storage.
Transform that only emits the output if the filter condition returns true.
Filter(std::function< bool(const T &)> filter, String config_path="")
virtual void set(const T &new_value) override
void emit(const T &new_value)