Live Cells C++
Reactive Programming for C++
|
A Cell
that caches the value of another Cell
.
More...
#include <store_cell.hpp>
Public Types | |
typedef C::value_type | value_type |
The type of value held by this cell. | |
Public Member Functions | |
store_cell (C cell) | |
Create a store cell that caches the value of cell. | |
value_type | value () const |
Get the value of the cell. | |
value_type | operator() () const |
Get the value of the cell and track it as a dependency. | |
Public Member Functions inherited from live_cells::stateful_cell< S > | |
template<typename... Args> | |
stateful_cell (key_ref k, Args... args) | |
Create a stateful cell and associate it with a state. | |
key_ref | key () const |
Get the key identifying the cell. | |
void | add_observer (observer::ref o) const |
Add an observer to the cell. | |
void | remove_observer (observer::ref o) const |
Remove an observer from the cell. | |
Additional Inherited Members | |
Protected Attributes inherited from live_cells::stateful_cell< S > | |
const key_ref | key_ |
Key identifying the cell. | |
std::shared_ptr< S > | state |
Reference to the cell's state. | |
A Cell
that caches the value of another Cell
.
This cell reads the value of another cell and caches it until it changes.
This is useful to cache the computed value of a lightweight computed cell, which would otherwise be recomputed every time it is accessed.
|
inline |
Create a store cell that caches the value of cell.
cell | The argument cell. |
|
inline |
Get the value of the cell and track it as a dependency.
|
inline |
Get the value of the cell.