A base class for any sensor or piece of code that outputs a value for consumption elsewhere.
More...
#include <sensesp/system/valueproducer.h>
|
| | ValueProducer () |
| |
| | ValueProducer (const T &initial_value) |
| |
| virtual const T & | get () const |
| |
| template<typename VConsumer> |
| std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< T, 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.
|
| |
| template<typename VConsumer> |
| std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< T, typenameVConsumer::input_type >::value, VConsumer * >::type | connect_to (VConsumer *consumer) |
| |
| template<typename VConsumer> |
| std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< T, typenameVConsumer::input_type >::value, VConsumer * >::type | connect_to (VConsumer &consumer) |
| |
| void | emit (const T &new_value) |
| |
| | Observable () |
| |
| | Observable (Observable &&other) |
| | Move constructor.
|
| |
| void | notify () |
| |
| void | attach (std::function< void()> observer) |
| |
template<typename T>
class sensesp::ValueProducer< T >
A base class for any sensor or piece of code that outputs a value for consumption elsewhere.
They are Observable, allowing code to be notified whenever a new value is available. They can be connected directly to ValueConsumers of the same type using the connect_to() method.
- See also
- ValueConsumer
Definition at line 25 of file valueproducer.h.
◆ ValueProducer() [1/2]
◆ ValueProducer() [2/2]
◆ connect_to() [1/3]
template<typename T>
template<typename VConsumer>
| std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< T, typenameVConsumer::input_type >::value, std::shared_ptr< VConsumer > >::type sensesp::ValueProducer< T >::connect_to |
( |
std::shared_ptr< VConsumer > | consumer | ) |
|
|
inline |
Connect a producer to a transform with a different input type.
This allows you to connect a producer to a transform with a different input type. Automatic type conversion is performed.
- Template Parameters
-
- Parameters
-
| consumer_producer | Transform object to connect to |
- Returns
- std::shared_ptr<VConsumer> The connected consumer
Definition at line 52 of file valueproducer.h.
◆ connect_to() [2/3]
template<typename T>
template<typename VConsumer>
| std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< T, typenameVConsumer::input_type >::value, VConsumer * >::type sensesp::ValueProducer< T >::connect_to |
( |
VConsumer & | consumer | ) |
|
|
inline |
◆ connect_to() [3/3]
template<typename T>
template<typename VConsumer>
| std::enable_if< std::is_base_of< ValueConsumer< typenameVConsumer::input_type >, VConsumer >::value &&std::is_convertible< T, typenameVConsumer::input_type >::value, VConsumer * >::type sensesp::ValueProducer< T >::connect_to |
( |
VConsumer * | consumer | ) |
|
|
inline |
◆ emit()
◆ get()
Returns the current value of this producer
Definition at line 33 of file valueproducer.h.
◆ output_
The documentation for this class was generated from the following files: