18#ifndef LIVE_CELLS_STORE_CELL_HPP
19#define LIVE_CELLS_STORE_CELL_HPP
22#include "compute_state.hpp"
23#include "stateful_cell.hpp"
24#include "changes_only_state.hpp"
140 template <Cell C,
typename State = store_cell_state<C>>
173 return this->
state->value();
static argument_tracker & global()
Definition tracker.hpp:99
Dynamically typed Cell container.
Definition observable.hpp:133
Mixin that modifies a compute_cell_state subclass to only notify its observers if the new value of th...
Definition changes_only_state.hpp:24
Cell state for a cell which computes a value as a function of one or more argument cells.
Definition compute_state.hpp:50
void pause() override
Definition compute_state.hpp:122
C compute
Compute value function.
Definition compute_state.hpp:95
value_type value()
Retrieve the latest cached value.
Definition compute_state.hpp:76
std::shared_ptr< observer > observer_ptr()
Get an observer::ref for this, that can be passed to add_observer and remove_observer of Cell.
Definition compute_state.hpp:101
void init() override
Definition compute_state.hpp:117
A computed cell which determines its argument cells at runtime.
Definition dynamic_compute_cell.hpp:153
Dynamically type key container.
Definition keys.hpp:76
Defines the interface for a key which uniquely identifies a cell.
Definition keys.hpp:33
std::shared_ptr< observer > ref
Shared pointer to an observer.
Definition types.hpp:37
Base class for a cell with a state.
Definition stateful_cell.hpp:42
std::shared_ptr< S > state
Reference to the cell's state.
Definition stateful_cell.hpp:105
void remove_observer(observer::ref o) const
Remove an observer from the cell.
Definition stateful_cell.hpp:92
Defines the computation function of a store_cell.
Definition store_cell.hpp:44
store_cell_compute_state(C arg)
Definition store_cell.hpp:58
C::value_type operator()(observer::ref)
Compute the value of the argument cell.
Definition store_cell.hpp:68
Maintains the state of a store_cell.
Definition store_cell.hpp:77
void pause() override
Called after the last observer is removed.
Definition store_cell.hpp:109
C::value_type value_type
Definition store_cell.hpp:93
store_cell_state(key_ref k, C arg)
Create a store_cell state.
Definition store_cell.hpp:88
void init() override
Called before the first observer is added.
Definition store_cell.hpp:95
A Cell that caches the value of another Cell.
Definition store_cell.hpp:141
value_type value() const
Get the value of the cell.
Definition store_cell.hpp:172
store_cell(C cell)
Create a store cell that caches the value of cell.
Definition store_cell.hpp:164
value_type operator()() const
Get the value of the cell and track it as a dependency.
Definition store_cell.hpp:182
C::value_type value_type
The type of value held by this cell.
Definition store_cell.hpp:156
A store_cell_state that only notifies the observers of the cell if the new value of the cell is not e...
Definition store_cell.hpp:122
Base class for a key distinguished from other keys by one or more values.
Definition keys.hpp:147
Defines the cell protocol.
Definition types.hpp:128
constexpr auto store
Operator for caching the value of another cell.
Definition store_cell.hpp:251
constexpr auto cache
Operator for creating a cell that caches the value of another cell and only notifies its observers wh...
Definition store_cell.hpp:267
Definition boolean.hpp:26
auto store(const C &arg)
Create a Cell that caches the value of another Cell.
Definition store_cell.hpp:206
Cell option specifying that the cell, to which it is applied, should only notify its observers when i...
Definition changes_only_state.hpp:94
Key identifying a store_cell.
Definition store_cell.hpp:33