Live Cells C++
Reactive Programming for C++
Loading...
Searching...
No Matches
live_cells::constant_cell< T > Class Template Reference

A cell which holds a constant value. More...

#include <constant_cell.hpp>

Public Types

typedefvalue_type
 The type of the constant value.
 

Public Member Functions

 constant_cell (const T &value)
 Construct a cell with a constant value.
 
key_ref key () const
 Get the key that identifies this cell.
 
value () const
 Get the constant value held by this cell.
 
void add_observer (observer::ref) const
 
void remove_observer (observer::ref) const
 
operator() () const
 Get the constant value held by this cell.
 

Detailed Description

template<typename T>
class live_cells::constant_cell< T >

A cell which holds a constant value.

Adding observers to this cell has no effect since its value never changes.

Constructor & Destructor Documentation

◆ constant_cell()

template<typename T >
live_cells::constant_cell< T >::constant_cell ( const T & value)
inline

Construct a cell with a constant value.

Note
Every constant_cell holding the same value is identified by the same key.
Parameters
valueThe constant value.

Member Function Documentation

◆ key()

template<typename T >
key_ref live_cells::constant_cell< T >::key ( ) const
inline

Get the key that identifies this cell.

All constant_cell's with the same value have the same key.

Returns
The key.

◆ operator()()

template<typename T >
T live_cells::constant_cell< T >::operator() ( ) const
inline

Get the constant value held by this cell.

Note
This cell is not tracked as a dependency since its value never changes.
Returns
The constant value.

◆ value()

template<typename T >
T live_cells::constant_cell< T >::value ( ) const
inline

Get the constant value held by this cell.

Returns
The constant value.

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