SensESP 2.7.2
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 > Class Template Reference

Construct a new transform based on a single function. More...

#include <sensesp/transforms/lambda_transform.h>

Inheritance diagram for sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >:
[legend]

Public Member Functions

 LambdaTransform (std::function< OUT(IN)> function, String config_path="")
 
 LambdaTransform (std::function< OUT(IN)> function, const ParamInfo *param_info, String config_path="")
 
 LambdaTransform (std::function< OUT(IN, P1)> function, P1 param1, const ParamInfo *param_info, String config_path="")
 
 LambdaTransform (std::function< OUT(IN, P1, P2)> function, P1 param1, P2 param2, const ParamInfo *param_info, String config_path="")
 LambdaTransform constructor for two-parameter function.
 
 LambdaTransform (std::function< OUT(IN, P1, P2, P3)> function, P1 param1, P2 param2, P3 param3, const ParamInfo *param_info, String config_path="")
 
 LambdaTransform (std::function< OUT(IN, P1, P2, P3, P4)> function, P1 param1, P2 param2, P3 param3, P4 param4, const ParamInfo *param_info, String config_path="")
 
 LambdaTransform (std::function< OUT(IN, P1, P2, P3, P4, P5)> function, P1 param1, P2 param2, P3 param3, P4 param4, P5 param5, const ParamInfo *param_info, String config_path="")
 
 LambdaTransform (std::function< OUT(IN, P1, P2, P3, P4, P5, P6)> function, P1 param1, P2 param2, P3 param3, P4 param4, P5 param5, P6 param6, const ParamInfo *param_info, String config_path="")
 
void set_input (IN input, uint8_t input_channel=0) override
 
void get_configuration (JsonObject &doc) override
 
bool set_configuration (const JsonObject &config) override
 
String get_config_schema () override
 
- Public Member Functions inherited from sensesp::Transform< IN, OUT >
 Transform (String config_path="")
 
Transform< IN, OUT > * connect_from (ValueProducer< OUT > *producer0, ValueProducer< OUT > *producer1=NULL, ValueProducer< OUT > *producer2=NULL, ValueProducer< OUT > *producer3=NULL, ValueProducer< OUT > *producer4=NULL)
 
- Public Member Functions inherited from sensesp::TransformBase
 TransformBase (String config_path="")
 
- Public Member Functions inherited from sensesp::Configurable
 Configurable (String config_path="", String description="", int sort_order=1000)
 
String get_description ()
 
void set_description (String description)
 Set the description of the Configurable.
 
int get_sort_order ()
 
void set_sort_order (int sort_order)
 
virtual void save_configuration ()
 
- Public Member Functions inherited from sensesp::Startable
 Startable (int priority=0)
 
virtual void start ()
 
const int get_start_priority ()
 
void set_start_priority (int priority)
 
- Public Member Functions inherited from sensesp::ValueConsumer< T >
virtual void set_input (T new_value, uint8_t input_channel=0)
 
void connect_from (ValueProducer< T > *producer, uint8_t input_channel=0)
 
- Public Member Functions inherited from sensesp::ValueProducer< T >
 ValueProducer ()
 
virtual const T & get () const
 
void connect_to (ValueConsumer< T > *consumer, uint8_t input_channel=0)
 
template<typename CT >
void connect_to (ValueConsumer< CT > *consumer, uint8_t input_channel=0)
 Connect a producer to a consumer of a different type.
 
template<typename T2 >
Transform< T, T2 > * connect_to (Transform< T, T2 > *consumer_producer, uint8_t input_channel=0)
 
template<typename TT , typename T2 >
Transform< TT, T2 > * connect_to (Transform< TT, T2 > *consumer_producer, uint8_t input_channel=0)
 Connect a producer to a transform with a different input type.
 
void emit (T new_value)
 
- Public Member Functions inherited from sensesp::Observable
 Observable ()
 
 Observable (Observable &&other)
 Move constructor.
 
void notify ()
 
void attach (std::function< void()> observer)
 

Additional Inherited Members

- Static Public Member Functions inherited from sensesp::TransformBase
static const std::set< TransformBase * > & get_transforms ()
 
- Static Public Member Functions inherited from sensesp::Startable
static void start_all ()
 
- Public Attributes inherited from sensesp::Configurable
const String config_path_
 
- Protected Member Functions inherited from sensesp::Configurable
virtual void load_configuration ()
 
- Protected Attributes inherited from sensesp::Configurable
String description_ = ""
 
int sort_order_ = 1000
 
- Protected Attributes inherited from sensesp::ValueProducer< T >
output
 

Detailed Description

template<class IN, class OUT, class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
class sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >

Construct a new transform based on a single function.

LambdaTransform provides an easy way of creating custom transformations without having to create new Transform classes. You just create a transform function and feed that to a LambdaTransform constructor together with possible configuration parameters values and configuration parameter metadata (key names and descriptions).

Template Parameters
INTransform function input value type
OUTTransform function output value type
P1Transform function parameter 1 type
P2Transform function parameter 2 type
P3Transform function parameter 3 type
P4Transform function parameter 4 type
P5Transform function parameter 5 type
P6Transform function parameter 6 type

Definition at line 71 of file lambda_transform.h.

Constructor & Destructor Documentation

◆ LambdaTransform() [1/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN)>  function,
String  config_path = "" 
)
inline

Definition at line 73 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [2/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN)>  function,
const ParamInfo param_info,
String  config_path = "" 
)
inline

Definition at line 78 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [3/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN, P1)>  function,
P1  param1,
const ParamInfo param_info,
String  config_path = "" 
)
inline

Definition at line 87 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [4/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN, P1, P2)>  function,
P1  param1,
P2  param2,
const ParamInfo param_info,
String  config_path = "" 
)
inline

LambdaTransform constructor for two-parameter function.

Construct a new LambdaTransform object which takes an input and two configuration parameters. Multiple overloaded constructors exist; their arguments can be extrapolated from this one.

Parameters
functionFunction to be executed for every new input value
param1Configuration parameter 1
param2Configuration parameter 2
param_infoKeys and Descriptions of each configuration parameter
config_pathConfiguration path for the transform

Definition at line 110 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [5/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN, P1, P2, P3)>  function,
P1  param1,
P2  param2,
P3  param3,
const ParamInfo param_info,
String  config_path = "" 
)
inline

Definition at line 121 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [6/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN, P1, P2, P3, P4)>  function,
P1  param1,
P2  param2,
P3  param3,
P4  param4,
const ParamInfo param_info,
String  config_path = "" 
)
inline

Definition at line 134 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [7/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN, P1, P2, P3, P4, P5)>  function,
P1  param1,
P2  param2,
P3  param3,
P4  param4,
P5  param5,
const ParamInfo param_info,
String  config_path = "" 
)
inline

Definition at line 148 of file lambda_transform.h.

Here is the call graph for this function:

◆ LambdaTransform() [8/8]

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::LambdaTransform ( std::function< OUT(IN, P1, P2, P3, P4, P5, P6)>  function,
P1  param1,
P2  param2,
P3  param3,
P4  param4,
P5  param5,
P6  param6,
const ParamInfo param_info,
String  config_path = "" 
)
inline

Definition at line 163 of file lambda_transform.h.

Here is the call graph for this function:

Member Function Documentation

◆ get_config_schema()

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
String sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::get_config_schema ( )
inlineoverridevirtual

Returns a configuration schema that specifies the key/value pairs that can be expected when calling get_configuration(), or are expected by set_configuration(). The schema will be in JSON Schema format

See also
https://json-schema.org

Reimplemented from sensesp::Configurable.

Definition at line 260 of file lambda_transform.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_configuration()

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
void sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::get_configuration ( JsonObject configObject)
inlineoverridevirtual

Returns the current configuration data as a JsonObject. In general, the current state of local member variables are saved to a new object created with JsonDocument::as<JsonObject>() and returned.

Reimplemented from sensesp::Configurable.

Definition at line 210 of file lambda_transform.h.

Here is the caller graph for this function:

◆ set_configuration()

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
bool sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::set_configuration ( const JsonObject config)
inlineoverridevirtual

Sets the current state of local member variables using the data stored in config.

Reimplemented from sensesp::Configurable.

Definition at line 229 of file lambda_transform.h.

Here is the caller graph for this function:

◆ set_input()

template<class IN , class OUT , class P1 = bool, class P2 = bool, class P3 = bool, class P4 = bool, class P5 = bool, class P6 = bool>
void sensesp::LambdaTransform< IN, OUT, P1, P2, P3, P4, P5, P6 >::set_input ( IN  input,
uint8_t  input_channel = 0 
)
inlineoverride

Definition at line 180 of file lambda_transform.h.

Here is the call graph for this function:
Here is the caller graph for this function:

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