41 template <
typename SensorFnT>
42 class sensor_down_signal
43 :
public down_signal<estd::decay_t<estd::result_of_t<SensorFnT()> > >
45 using base_t = down_signal<estd::decay_t<estd::result_of_t<SensorFnT()> > >;
48 sensor_down_signal(SensorFnT sensor)
50 , sensor_(
std::move(sensor))
53 void recompute() final
55 this->push_down(sensor_());
65 template <
typename SensorFnT>
66 auto make_sensor_signal(SensorFnT&& fn)
67 -> std::shared_ptr<sensor_down_signal<estd::decay_t<SensorFnT> > >
69 return std::make_shared<sensor_down_signal<estd::decay_t<SensorFnT>>>(
70 std::forward<SensorFnT>(fn));
77 class state_up_down_signal :
public up_down_signal<T>
82 using up_down_signal<T>::up_down_signal;
84 void send_up(
const value_type& value)
final
86 this->push_down(value);
89 void send_up(value_type&& value) final
91 this->push_down(std::move(value));
99 auto make_state_signal(T&& value)
100 -> std::shared_ptr<state_up_down_signal<estd::decay_t<T> > >
102 return std::make_shared<state_up_down_signal<estd::decay_t<T>>>(
103 std::forward<T>(value));
This module implements the signal flow in funken.
C++ amazing templates and reusable implementations awesomeness.