Live Cells C++
Reactive Programming for C++
Loading...
Searching...
No Matches
live_cells::ops Namespace Reference

Concepts

concept  Operator
 Concept defining an operator on a cell.
 

Functions

auto select (const Cell auto &if_true)
 Create an Operator for conditionally selecting the value of another cell based on the value of the operand cell.
 
auto select (const Cell auto &if_true, const Cell auto &if_false)
 Create an Operator for conditionally selecting the value of another cell based on the value of the operand cell.
 
auto on_error (const Cell auto &error_value)
 Create an Operator for handling exceptions thrown by the operand Cell.
 
template<typename E >
auto on_error (const Cell auto &error_value)
 Create an Operator for handling exceptions of type E thrown by the operand Cell.
 
template<Cell C, Operator< C > O>
auto operator| (const C &arg, const O &op)
 Apply an Operator op on a Cell arg.
 

Variables

constexpr auto peek
 Operator for reading the value of a cell without reacting to changes.
 
constexpr auto previous
 Operator for creating a cell that evaluates to the previous value of another cell.
 
constexpr auto store
 Operator for caching the value of another cell.
 
constexpr auto cache
 Operator for creating a cell that caches the value of another cell and only notifies its observers when its value has actually changed.
 

Detailed Description

Provides functions which can be applied on Cell's using the | operator.

Function Documentation

◆ on_error() [1/2]

auto live_cells::ops::on_error ( const Cell auto & error_value)

Create an Operator for handling exceptions thrown by the operand Cell.

See also
live_cells::on_error
Parameters
error_valueThe cell holding the value to use when an exception is thrown by the operand cell.
Returns
The error handling Operator.

◆ on_error() [2/2]

template<typename E >
auto live_cells::ops::on_error ( const Cell auto & error_value)

Create an Operator for handling exceptions of type E thrown by the operand Cell.

See also
live_cells::on_error
Parameters
error_valueThe cell holding the value to use when an exception is thrown by the operand cell.
Returns
The error handling Operator.

◆ operator|()

template<Cell C, Operator< C > O>
auto live_cells::ops::operator| ( const C & arg,
const O & op )
inline

Apply an Operator op on a Cell arg.

Parameters
argOperand cell on which to apply the Operator op
opThe Operator to apply on arg
Returns
The Cell resulting from applying op on arg

◆ select() [1/2]

auto live_cells::ops::select ( const Cell auto & if_true)

Create an Operator for conditionally selecting the value of another cell based on the value of the operand cell.

See also
live_cells::select
Parameters
if_trueCell selected when the value of the operand cell is true.
Returns
The selection operator.

◆ select() [2/2]

auto live_cells::ops::select ( const Cell auto & if_true,
const Cell auto & if_false )

Create an Operator for conditionally selecting the value of another cell based on the value of the operand cell.

See also
live_cells::select
Parameters
if_trueCell selected when the value of the operand cell is true.
if_falseCell selected when the value of the operand cell is false.
Returns
The selection operator.

Variable Documentation

◆ cache

constexpr auto live_cells::ops::cache
constexpr
Initial value:
= [] (const Cell auto & cell) {
return live_cells::store(changes_only, cell);
}
Defines the cell protocol.
Definition types.hpp:128
auto store(const C &arg)
Create a Cell that caches the value of another Cell.
Definition store_cell.hpp:206

Operator for creating a cell that caches the value of another cell and only notifies its observers when its value has actually changed.

See also
live_cells::store
Parameters
cellThe operand Cell
Returns
A Cell that has the same value as cell but caches it in memory until it changes.

◆ peek

constexpr auto live_cells::ops::peek
constexpr
Initial value:
= [] (const Cell auto &cell) {
return live_cells::peek(cell);
}
auto peek(const C &cell)
Create a Cell that reads the value of cell but does not notify its observers when the value has chang...
Definition peek_cell.hpp:130

Operator for reading the value of a cell without reacting to changes.

See also
live_cells::peek
Parameters
cellThe operand Cell
Returns
A Cell that has the same value as cell but does not notify its observers when the value changes.

◆ previous

constexpr auto live_cells::ops::previous
constexpr
Initial value:
= [] (const Cell auto &cell) {
return live_cells::previous(cell);
}
auto previous(const C &cell)
Create a Cell that evaluates to the previous value of cell.
Definition previous_value_cell.hpp:232

Operator for creating a cell that evaluates to the previous value of another cell.

See also
live_cells::previous
Parameters
cellcell The argument cell.
Returns
A cell that evaluates to the previous value of cell.

◆ store

constexpr auto live_cells::ops::store
constexpr
Initial value:
= [] (const Cell auto &cell) {
return live_cells::store(cell);
}

Operator for caching the value of another cell.

See also
live_cells::store
Parameters
cellThe operand Cell
Returns
A Cell that has the same value as cell but caches it in memory until it changes.