Live Cells C++
Reactive Programming for C++
Loading...
Searching...
No Matches
live_cells::mutable_cell_view_base< F, R, Os > Class Template Reference

A stateless mutable computed cell that does not cache its own value. More...

#include <mutable_cell_view.hpp>

Inheritance diagram for live_cells::mutable_cell_view_base< F, R, Os >:
Collaboration diagram for live_cells::mutable_cell_view_base< F, R, Os >:

Public Member Functions

 mutable_cell_view_base (F compute, R reverse, Os... args)
 Create a stateless mutable computed cell.
 
void value (value_type value) const
 Set the value of the cell.
 
- Public Member Functions inherited from live_cells::compute_cell_base< F, Os... >
 compute_cell_base (F compute, Ts... args)
 Create a cell with a value that is a function of the values of the cells args.
 
auto value () const
 Get the value of the cell.
 
- Public Member Functions inherited from live_cells::dependent_cell< Ts... >
 dependent_cell (Ts... args)
 Create a cell with a value dependent on the argument cells in args.
 
void add_observer (observer::ref o) const
 
void remove_observer (observer::ref o) const
 

Additional Inherited Members

- Protected Attributes inherited from live_cells::dependent_cell< Ts... >
merged_observable< Ts... > observable
 

Detailed Description

template<std::invocable F, typename R, typename... Os>
class live_cells::mutable_cell_view_base< F, R, Os >

A stateless mutable computed cell that does not cache its own value.

The value of the cell is computed whenever it is accessed and observers are added directly to the argument cells.

Warning
This is not a complete cell and hence does not satisfy the Cell concept. As such this class should not be instantiated directly. Instead the cell_view() function should be used to create stateless mutable computed cells.

Constructor & Destructor Documentation

◆ mutable_cell_view_base()

template<std::invocable F, typename R , typename... Os>
live_cells::mutable_cell_view_base< F, R, Os >::mutable_cell_view_base ( F compute,
R reverse,
Os... args )
inline

Create a stateless mutable computed cell.

Parameters
computeCompute value function.
This function, of no arguments, should compute the cell's value as a function of the cells in args.
reverseReverse 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.
argsArgument cells referenced in compute

Member Function Documentation

◆ value()

template<std::invocable F, typename R , typename... Os>
void live_cells::mutable_cell_view_base< F, R, Os >::value ( value_type value) const
inline

Set the value of the cell.

Parameters
valueThe new value

The documentation for this class was generated from the following file: