Live Cells C++
Reactive Programming for C++
|
A computed cell which determines its argument cells at runtime. More...
#include <dynamic_compute_cell.hpp>
Public Types | |
typedef std::invoke_result_t< F > | value_type |
Shorthand for the type of value held by this cell. | |
Public Member Functions | |
dynamic_compute_cell (F compute) | |
Create a dynamic computed cell with a given value computation function. | |
dynamic_compute_cell (key_ref key, F compute) | |
Create a dynamic computed cell with a given value computation function. | |
value_type | value () const |
value_type | operator() () const |
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 computed cell which determines its argument cells at runtime.
This is a stateful cell that caches its value when computed and maintains its own observer set.
|
inline |
Create a dynamic computed cell with a given value computation function.
The function compute is called with no arguments to compute the value of the cell when necessary. It should reference its argument cells using the function call operator so that they are registered as dependencies of this cell.
compute | Value computation function. |
|
inline |
Create a dynamic computed cell with a given value computation function.
The function compute is called with no arguments to compute the value of the cell when necessary. It should reference its argument cells using the function call operator so that they are registered as dependencies of this cell.
key | Key identifying cell. |
compute | Value computation function. |