50 using Tick = bool (*)(
void* context,
float dt);
61 bool wanted()
const {
return wanted_; }
83 bool on_frame(
float dt);
122 void stop() { binding_.stop(); }
128 bool has_source()
const {
return static_cast<bool>(source_); }
134 static bool tick(
void* context,
float dt);
135 void update_wanted() { binding_.
set_wanted(source_ && active_); }
137 FrameClockBinding binding_;
138 std::shared_ptr<MeterSource> source_;
160 void stop() { binding_.stop(); }
164 float value()
const {
return value_; }
166 bool has_source()
const {
return static_cast<bool>(source_); }
171 static bool tick(
void* context,
float dt);
172 void update_wanted() { binding_.
set_wanted(source_ && active_); }
174 FrameClockBinding binding_;
175 std::shared_ptr<ScalarSource> source_;
friend class View
Definition value_source_binding.hpp:79
FrameClockBinding(View &owner, Tick tick, void *context)
void refresh()
(Re)point the subscription at the owner's currently reachable clock, unsubscribing when wanted() is f...
bool wanted() const
Definition value_source_binding.hpp:61
bool subscribed() const
Definition value_source_binding.hpp:74
FrameClockBinding(const FrameClockBinding &)=delete
bool(*)(void *context, float dt) Tick
Per-frame callback.
Definition value_source_binding.hpp:50
FrameClock * subscribed_clock() const
Definition value_source_binding.hpp:75
View & owner() const
Definition value_source_binding.hpp:76
void set_wanted(bool wanted)
Declare whether the owner currently has anything to read.
Definition value_source_binding.hpp:60
FrameClockBinding & operator=(const FrameClockBinding &)=delete
void stop()
Unsubscribe from the cached clock, if subscribed.
Definition frame_clock.hpp:14
void stop()
Definition value_source_binding.hpp:122
FrameClock * subscribed_clock() const
Definition value_source_binding.hpp:131
bool active() const
Definition value_source_binding.hpp:118
bool subscribed() const
Definition value_source_binding.hpp:130
void set_source(std::shared_ptr< MeterSource > source, int channel)
Bind a source (or nullptr to unbind, which drops the subscription so the view stops holding the edito...
bool has_source() const
Definition value_source_binding.hpp:128
void refresh()
Re-evaluate the subscription against the owner's reachable clock.
Definition value_source_binding.hpp:121
MeterSourceBinding(View &owner)
Definition value_source_binding.hpp:104
const MeterFrame & frame() const
The most recent frame snapshotted on the clock.
Definition value_source_binding.hpp:126
int channel() const
Definition value_source_binding.hpp:129
void set_active(bool active)
Owner-level gate, ANDed with having a source: false parks the binding (unsubscribed,...
void set_source(std::shared_ptr< ScalarSource > source)
Drops the cached value along with the old source — see MeterSourceBinding::set_source.
void stop()
Definition value_source_binding.hpp:160
bool subscribed() const
Definition value_source_binding.hpp:167
FrameClock * subscribed_clock() const
Definition value_source_binding.hpp:168
float value() const
The most recent value snapshotted on the clock.
Definition value_source_binding.hpp:164
ScalarSourceBinding(View &owner)
Definition value_source_binding.hpp:148
bool active() const
Definition value_source_binding.hpp:157
void set_active(bool active)
See MeterSourceBinding::set_active.
void refresh()
Definition value_source_binding.hpp:159
bool has_source() const
Definition value_source_binding.hpp:166
Hover-cursor tracking for platform window hosts.
Definition fwd.hpp:27
A single multi-channel meter reading.
Definition value_source.hpp:39
Source-compatible spelling of <pulp/dataplane/value_source.hpp>.