ESPHome 2026.8.2
Loading...
Searching...
No Matches
esphome::binary_sensor::StatelessLambdaFilter Class Reference

Optimized lambda filter for stateless lambdas (no capture). More...

#include <filter.h>

Inheritance diagram for esphome::binary_sensor::StatelessLambdaFilter:
esphome::binary_sensor::Filter

Public Member Functions

 StatelessLambdaFilter (optional< bool >(*f)(bool))
 
optional< bool > new_value (bool value) override
 
- Public Member Functions inherited from esphome::binary_sensor::Filter
virtual void input (bool value)
 
void output (bool value)
 

Protected Attributes

optional< bool >(* f_ )(bool)
 
- Protected Attributes inherited from esphome::binary_sensor::Filter
friend BinarySensor
 
Filternext_ {nullptr}
 
BinarySensorparent_ {nullptr}
 
Deduplicator< bool > dedup_
 

Detailed Description

Optimized lambda filter for stateless lambdas (no capture).

Uses function pointer instead of std::function to reduce memory overhead. Memory: 4 bytes (function pointer on 32-bit) vs 32 bytes (std::function).

Definition at line 134 of file filter.h.

Constructor & Destructor Documentation

◆ StatelessLambdaFilter()

esphome::binary_sensor::StatelessLambdaFilter::StatelessLambdaFilter ( optional< bool >(* )(bool))
inlineexplicit

Definition at line 136 of file filter.h.

Member Function Documentation

◆ new_value()

optional< bool > esphome::binary_sensor::StatelessLambdaFilter::new_value ( bool value)
inlineoverridevirtual

Implements esphome::binary_sensor::Filter.

Definition at line 138 of file filter.h.

Field Documentation

◆ f_

optional< bool >(* esphome::binary_sensor::StatelessLambdaFilter::f_) (bool)
protected

Definition at line 138 of file filter.h.


The documentation for this class was generated from the following file: