Live Cells C++
Reactive Programming for C++
|
A mutable computed cell with arguments determined at compile-time. More...
#include <static_mutable_compute_cell.hpp>
Public Types | |
typedef std::invoke_result_t< F > | value_type |
The type of value held by this cell. | |
Public Member Functions | |
template<typename T , typename U , typename... Args> | |
static_mutable_compute_cell (key_ref k, T &&compute, U &&reverse, Args &&... args) | |
Create a static mutable computed cell. | |
template<typename T , typename U , typename... Args> | |
static_mutable_compute_cell (T &&compute, U &&reverse, Args &&... args) | |
Create a static mutable computed cell. | |
value_type | value () const |
Get the value of the cell. | |
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 |
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 mutable computed cell with arguments determined at compile-time.
|
inline |
Create a static mutable computed cell.
k | Key identifying cell |
compute | Compute value function. This function is called with no arguments to compute the value of the cell. |
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. |
args | Arguments to compute |
|
inline |
Create a static mutable computed cell.
compute | Compute value function. This function is called with no arguments to compute the value of the cell. |
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. |
args | Arguments to compute |
|
inline |
Get the value of the cell and track it as a dependency.
|
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 |
Get the value of the cell.
|
inline |
Set the value of the cell.
This method triggers the reverse computation function of the cell.
value | The new value |