1#ifndef LIVE_CELLS_OBSERVER_CELL_STATE_HPP
2#define LIVE_CELLS_OBSERVER_CELL_STATE_HPP
88 const std::invocable
auto ¬ify_will_update) {
90 assert(changed_dependencies == 0 &&
"Number of changed dependencies == 0 at start of update cycle.");
96 changed_dependencies = 0;
101 changed_dependencies++;
153 const std::invocable
auto &did_change,
154 const std::invocable<bool>
auto ¬ify_update,
155 const std::invocable
auto &post_update) {
157 assert(changed_dependencies > 0 &&
"Calls to update() are not more than calls to will_update().");
159 has_changed = has_changed ||
changed;
161 if (--changed_dependencies == 0) {
164 notify_update(has_changed && did_change());
179 int changed_dependencies = 0;
184 int has_changed =
false;
A computed cell which determines its argument cells at runtime.
Definition dynamic_compute_cell.hpp:153
Provides functionality for observing a cell from a cell_state.
Definition observer_cell_state.hpp:21
bool updating
Are the argument cells in the process of updating their values?
Definition observer_cell_state.hpp:32
void init_observer_state()
Initialize the cell observation state.
Definition observer_cell_state.hpp:40
void handle_will_update(const std::invocable auto ¬ify_will_update)
Handle a observer::will_update call.
Definition observer_cell_state.hpp:66
void pause_observer_state()
Pause the cell observation state.
Definition observer_cell_state.hpp:50
bool stale
Does the value have to be recomputed?
Definition observer_cell_state.hpp:26
void handle_update(bool changed, const std::invocable auto &did_change, const std::invocable< bool > auto ¬ify_update, const std::invocable auto &post_update)
Handle an observer::update call.
Definition observer_cell_state.hpp:152
void handle_update(bool changed, const std::invocable< bool > auto ¬ify_update)
Handle an observer::update call.
Definition observer_cell_state.hpp:120
void handle_will_update(const std::invocable auto &pre_update, const std::invocable auto ¬ify_will_update)
Handle a observer::will_update call.
Definition observer_cell_state.hpp:87
Definition boolean.hpp:26