Live Cells C++
Reactive Programming for C++
|
A mutable computed cell with the argument cells determined dynamically. More...
#include <dynamic_mutable_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 | |
template<typename T , typename U > | |
dynamic_mutable_compute_cell (key_ref k, T &&compute, U &&reverse) | |
Create a dynamic mutable computed cell. | |
template<typename T , typename U > | |
dynamic_mutable_compute_cell (T &&compute, U &&reverse) | |
Create a dynamic mutable computed cell. | |
value_type | value () const |
void | value (value_type value) const |
Set the value of the cell. | |
value_type | operator= (const value_type &value) |
Set the value of the cell to value. | |
value_type | operator= (const value_type &value) const |
Set the value of the cell. | |
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 mutable computed cell with the argument cells determined dynamically.
|
inline |
Create a dynamic mutable computed cell.
k | Key identifying cell |
compute | Compute value function. This function should compute the cell's value as a function of the cells in args. |
reverse | Reverse computation function. This function should set the values of the cells in args, such that compute returns the same value as the value that was assigned to the cell, which is passed to this function. |
|
inline |
Create a dynamic mutable computed cell.
compute | Compute value function. This function should compute the cell's value as a function of the cells in args. |
reverse | Reverse computation function. This function should set the values of the cells in args, such that compute returns the same value as the value that was assigned to the cell, which is passed to this function. |
|
inline |
Set the value of the cell to value.
C::value(value)
.This method triggers the reverse computation function of the cell.
value | The new value of the cell |
|
inline |
Set the value of the cell.
This is equivalent to \prop value(value).
This method triggers the reverse computation function of the cell.
const
version is provided to allow setting the value of a mutable cell within a lambda provided for the reverse computation function of a mutable computed cell.value | The new value |
|
inline |
Set the value of the cell.
This method calls the reverse computation function of the cell.