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

A cell with a value that is a function of one or more argument cells. More...

#include <compute_cell.hpp>

Inheritance diagram for live_cells::compute_cell_base< F, Ts >:
Collaboration diagram for live_cells::compute_cell_base< F, Ts >:

Public Member Functions

 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, Cell... Ts>
class live_cells::compute_cell_base< F, Ts >

A cell with a value that is a function of one or more argument cells.

The value computation function is provided to this class on construction.

Note
This class is not intended to be instantiated directly by users of the library. Instead create a computed cell with the function computed.
This is not a complete cell type and is such it does not satisfy the Cell concept.

Constructor & Destructor Documentation

◆ compute_cell_base()

template<std::invocable F, Cell... Ts>
live_cells::compute_cell_base< F, Ts >::compute_cell_base ( F compute,
Ts... args )
inline

Create a cell with a value that is a function of the values of the cells args.

Parameters
computeA function of no arguments, that is called to compute the cell's value when necessary.
argsArgument cells referenced by compute

Member Function Documentation

◆ value()

template<std::invocable F, Cell... Ts>
auto live_cells::compute_cell_base< F, Ts >::value ( ) const
inline

Get the value of the cell.

Note
The value of the cell is recomputed whenever it this method is called.
Returns
The cell's value

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