ESPHome 2025.9.0-dev
Loading...
Searching...
No Matches
esphome::TemplatableValue< T, X > Class Template Reference

#include <automation.h>

Public Member Functions

 TemplatableValue ()
 
template<typename F , enable_if_t<!is_invocable< F, X... >::value, int > = 0>
 TemplatableValue (F value)
 
template<typename F , enable_if_t< is_invocable< F, X... >::value, int > = 0>
 TemplatableValue (F f)
 
 TemplatableValue (const TemplatableValue &other)
 
 TemplatableValue (TemplatableValue &&other) noexcept
 
TemplatableValueoperator= (const TemplatableValue &other)
 
TemplatableValueoperator= (TemplatableValue &&other) noexcept
 
 ~TemplatableValue ()
 
bool has_value ()
 
value (X... x)
 
optional< T > optional_value (X... x)
 
value_or (X... x, T default_value)
 

Protected Types

enum  : uint8_t { NONE , VALUE , LAMBDA }
 

Protected Attributes

enum esphome::TemplatableValue:: { ... }  type_
 
union { 
 
   T   value_ 
 
   std::function< T(X...)> *   f_ 
 
};  
 

Detailed Description

template<typename T, typename... X>
class esphome::TemplatableValue< T, X >

Definition at line 26 of file automation.h.

Member Enumeration Documentation

◆ anonymous enum

template<typename T , typename... X>
anonymous enum : uint8_t
protected
Enumerator
NONE 
VALUE 
LAMBDA 

Definition at line 108 of file automation.h.

Constructor & Destructor Documentation

◆ TemplatableValue() [1/5]

template<typename T , typename... X>
esphome::TemplatableValue< T, X >::TemplatableValue ( )
inline

Definition at line 28 of file automation.h.

◆ TemplatableValue() [2/5]

template<typename T , typename... X>
template<typename F , enable_if_t<!is_invocable< F, X... >::value, int > = 0>
esphome::TemplatableValue< T, X >::TemplatableValue ( F value)
inline

Definition at line 30 of file automation.h.

◆ TemplatableValue() [3/5]

template<typename T , typename... X>
template<typename F , enable_if_t< is_invocable< F, X... >::value, int > = 0>
esphome::TemplatableValue< T, X >::TemplatableValue ( F f)
inline

Definition at line 34 of file automation.h.

◆ TemplatableValue() [4/5]

template<typename T , typename... X>
esphome::TemplatableValue< T, X >::TemplatableValue ( const TemplatableValue< T, X > & other)
inline

Definition at line 39 of file automation.h.

◆ TemplatableValue() [5/5]

template<typename T , typename... X>
esphome::TemplatableValue< T, X >::TemplatableValue ( TemplatableValue< T, X > && other)
inlinenoexcept

Definition at line 48 of file automation.h.

◆ ~TemplatableValue()

template<typename T , typename... X>
esphome::TemplatableValue< T, X >::~TemplatableValue ( )
inline

Definition at line 75 of file automation.h.

Member Function Documentation

◆ has_value()

template<typename T , typename... X>
bool esphome::TemplatableValue< T, X >::has_value ( )
inline

Definition at line 83 of file automation.h.

◆ operator=() [1/2]

template<typename T , typename... X>
TemplatableValue & esphome::TemplatableValue< T, X >::operator= ( const TemplatableValue< T, X > & other)
inline

Definition at line 59 of file automation.h.

◆ operator=() [2/2]

template<typename T , typename... X>
TemplatableValue & esphome::TemplatableValue< T, X >::operator= ( TemplatableValue< T, X > && other)
inlinenoexcept

Definition at line 67 of file automation.h.

◆ optional_value()

template<typename T , typename... X>
optional< T > esphome::TemplatableValue< T, X >::optional_value ( X... x)
inline

Definition at line 93 of file automation.h.

◆ value()

template<typename T , typename... X>
T esphome::TemplatableValue< T, X >::value ( X... x)
inline

Definition at line 85 of file automation.h.

◆ value_or()

template<typename T , typename... X>
T esphome::TemplatableValue< T, X >::value_or ( X... x,
T default_value )
inline

Definition at line 100 of file automation.h.

Field Documentation

◆ [union]

union { ... } esphome::TemplatableValue< T, X >

◆ f_

template<typename T , typename... X>
std::function<T(X...)>* esphome::TemplatableValue< T, X >::f_

Definition at line 116 of file automation.h.

◆ []

enum { ... } esphome::TemplatableValue< T, X >::type_

◆ value_

template<typename T , typename... X>
T esphome::TemplatableValue< T, X >::value_

Definition at line 115 of file automation.h.


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