Live Cells C++
Reactive Programming for C++
|
Dynamically typed Cell
container with a static value type.
More...
#include <observable.hpp>
Public Member Functions | |
template<TypedCell< T > C> | |
typed_cell (C cell) | |
Create a container holding the Cell cell. | |
typed_cell (cell c) | |
Create a container holding the Cell held in c. | |
void | add_observer (observer::ref obs) |
Add an observer to the underlying Cell . | |
void | remove_observer (observer::ref obs) |
Remove an observer from the underlying Cell . | |
key_ref | key () const |
Get the key that uniquely identifies the underlying Cell . | |
T | value () const |
Get the value held by the underlying Cell . | |
void | value (T value) |
Set the value of the underlying Cell . | |
T | operator() () const |
Get the value held by the underlying Cell and track it as a dependency. | |
Friends | |
class | cell |
Related Symbols | |
(Note that these are not member symbols.) | |
template<typename T1 , typename T2 > | |
bool | operator== (const typed_cell< T1 > &a, const typed_cell< T2 > &b) |
Compare two typed_cell's by their keys. | |
template<typename T1 , typename T2 > | |
bool | operator!= (const typed_cell< T1 > &a, const typed_cell< T2 > &b) |
Compare two typed_cell's by their keys. | |
Dynamically typed Cell
container with a static value type.
Like cell
, this class erases the types of Cell's
, so that a cell can be used and stored in containers when its exact type is not known at compile-time. However, this class enforces that the value type of the underlying Cell
is convertible to T.
|
inline |
Create a container holding the Cell
cell.
cell | The cell to hold in the container |
|
inline |
Create a container holding the Cell
held in c.
c | A typeless cell container. |
bad_typed_cell_cast | When the value type of the Cell held in c is not compatible with the value type T of this container. |
|
inline |
Add an observer to the underlying Cell
.
obs | The observer to add to the cell. |
|
inline |
Get the key that uniquely identifies the underlying Cell
.
|
inline |
Get the value held by the underlying Cell
and track it as a dependency.
|
inline |
Remove an observer from the underlying Cell
.
obs | The observer to remove from the cell. |
|
inline |
Get the value held by the underlying Cell
.
|
inline |
Set the value of the underlying Cell
.
If the underlying cell does is not a MutableCell
, an std::bad_cast
exception is thrown.
value | The value to set the underlying cell to. |
|
related |
Compare two typed_cell's
by their keys.
a | A dynamically typed cell |
b | A dynamically typed cell |
true
if the key of a is not equal to the key of b.
|
related |
Compare two typed_cell's
by their keys.
a | A dynamically typed cell |
b | A dynamically typed cell |
true
if the key of a is equal to the key of b.