Live Cells C++
Reactive Programming for C++
|
Provides functionality for observing a cell from a cell_state
.
More...
#include <observer_cell_state.hpp>
Protected Member Functions | |
void | init_observer_state () |
Initialize the cell observation state. | |
void | pause_observer_state () |
Pause the cell observation state. | |
void | handle_will_update (const std::invocable auto ¬ify_will_update) |
Handle a observer::will_update call. | |
void | handle_will_update (const std::invocable auto &pre_update, const std::invocable auto ¬ify_will_update) |
Handle a observer::will_update call. | |
void | handle_update (bool changed, const std::invocable< bool > auto ¬ify_update) |
Handle an observer::update call. | |
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. | |
Protected Attributes | |
bool | stale = true |
Does the value have to be recomputed? | |
bool | updating = false |
Are the argument cells in the process of updating their values? | |
Provides functionality for observing a cell from a cell_state
.
This class provides implementations of observer::will_update
and observer::update
, namely handle_will_update
and handle_update
, which determine when the cell's value should be recomputed, and notify the observers of the cell.
Subclasses should check the state
member variable. If it is true, the cell's value should be recomputed.
|
inlineprotected |
Handle an observer::update
call.
This method notifies the observers of this cell, by calling notify_update
.
observer::update
.changed | Has the value of the dependency cell changed? |
did_change | Function called with no arguments, to determine whether the value of the cell has changed. This function should return true if the value of the cell may have changed, false if it is know that the cell value has not changed. |
notify_will_update | Function that notifies the observers of the cell. The argument passed to this cell is true if the cell's value may have changed or false if it has not changed. |
post_update | A function of no arguments that is called after the update cycle ends. This function is only called if this method is being called for the last dependency cell during this update cycle and the value of this cell has changed. |
|
inlineprotected |
Handle an observer::update
call.
This method notifies the observers of this cell, by calling notify_update
.
observer::update
.changed | Has the value of the dependency cell changed? |
notify_will_update | Function that notifies the observers of the cell. The argument passed to this cell is true if the cell's value may have changed or false if it has not changed. |
|
inlineprotected |
Handle a observer::will_update
call.
This method notifies the observers of this cell, by calling notify_will_update
.
observer::will_update
.notify_will_update | Function that notifies the observers of the cell. |
|
inlineprotected |
Handle a observer::will_update
call.
This method notifies the observers of this cell, by calling notify_will_update
.
observer::will_update
.pre_update | A function of no arguments that is called before the update cycle begins. This function is only called if this method is being called for the first time during the current update cycle. |
notify_will_update | Function that notifies the observers of the cell. |
|
inlineprotected |
Initialize the cell observation state.
cell_state::init()
.
|
inlineprotected |
Pause the cell observation state.
cell_state::pause()
.