SensESP 3.0.1
Universal Signal K sensor toolkit ESP32
Loading...
Searching...
No Matches
sensesp::TruthToText Class Reference

Consumes a boolean value and outputs one the appropriate truth string specified in the constructor. This is the inverse of TextToTruth. More...

#include <sensesp/transforms/truth_text.h>

Inheritance diagram for sensesp::TruthToText:
[legend]

Public Member Functions

 TruthToText (const String &true_value="ON", const String &false_value="OFF")
 
virtual void set (const bool &input) override
 
- Public Member Functions inherited from sensesp::Transform< bool, String >
 Transform (String config_path="")
 
Transform< bool, String > * connect_from (ValueProducer< String > *producer0, ValueProducer< String > *producer1=NULL, ValueProducer< String > *producer2=NULL, ValueProducer< String > *producer3=NULL, ValueProducer< String > *producer4=NULL)
 
- Public Member Functions inherited from sensesp::TransformBase
 TransformBase (const String &config_path)
 
- Public Member Functions inherited from sensesp::FileSystemSaveable
 FileSystemSaveable (const String &config_path)
 
virtual bool load () override
 Load and populate the object from a persistent storage.
 
virtual bool save () override
 Save the object to a persistent storage.
 
virtual bool clear () override
 Delete the data from a persistent storage.
 
bool find_config_file (const String &config_path, String &filename)
 
- Public Member Functions inherited from sensesp::Saveable
 Saveable (const String &config_path)
 
virtual bool refresh ()
 Refresh the object. This may or may not access the persistent storage but is not expected to overwrite the object's state.
 
const String & get_config_path () const
 
- Public Member Functions inherited from sensesp::Serializable
virtual bool to_json (JsonObject &root)
 
virtual bool from_json (const JsonObject &root)
 
- Public Member Functions inherited from sensesp::ValueConsumer< bool >
virtual void set_input (const bool &new_value)
 
void connect_from (ValueProducer< bool > *producer)
 
- Public Member Functions inherited from sensesp::ValueProducer< String >
 ValueProducer ()
 
 ValueProducer (const String &initial_value)
 
virtual const String & get () const
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< String, typenameVConsumer::input_type >::value, std::shared_ptr< VConsumer > >::type connect_to (std::shared_ptr< VConsumer > consumer)
 Connect a producer to a transform with a different input type.
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< String, typenameVConsumer::input_type >::value, VConsumer * >::type connect_to (VConsumer *consumer)
 
std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< String, typenameVConsumer::input_type >::value, VConsumer * >::type connect_to (VConsumer &consumer)
 
void emit (const String &new_value)
 
- Public Member Functions inherited from sensesp::Observable
 Observable ()
 
 Observable (Observable &&other)
 Move constructor.
 
void notify ()
 
void attach (std::function< void()> observer)
 

Protected Attributes

String truth_value_ [2]
 
- Protected Attributes inherited from sensesp::Saveable
const String config_path_
 
- Protected Attributes inherited from sensesp::ValueProducer< String >
String output_
 

Additional Inherited Members

- Public Types inherited from sensesp::ValueConsumer< bool >
using input_type
 
- Static Public Member Functions inherited from sensesp::TransformBase
static const std::set< TransformBase * > & get_transforms ()
 

Detailed Description

Consumes a boolean value and outputs one the appropriate truth string specified in the constructor. This is the inverse of TextToTruth.

See also
TextToTruth

Definition at line 48 of file truth_text.h.

Constructor & Destructor Documentation

◆ TruthToText()

sensesp::TruthToText::TruthToText ( const String & true_value = "ON",
const String & false_value = "OFF" )

Definition at line 44 of file truth_text.cpp.

Member Function Documentation

◆ set()

void sensesp::TruthToText::set ( const bool & new_value)
overridevirtual

Used to set an input of this consumer. It is called automatically by a ValueProducer but can also be called manually.

Parameters
new_valuethe value of the input

Reimplemented from sensesp::ValueConsumer< bool >.

Definition at line 47 of file truth_text.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ truth_value_

String sensesp::TruthToText::truth_value_[2]
protected

Definition at line 56 of file truth_text.h.


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