|
Live Cells C++
Reactive Programming for C++
|
Dynamically typed Cell container.
More...
#include <observable.hpp>
Public Member Functions | |
| template<Cell O> | |
| cell (O o) | |
Create a container holding the Cell o. | |
| template<typename T > | |
| cell (typed_cell< T > 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. | |
| template<typename T > | |
| T | value () const |
Get the value held by the underlying Cell. | |
| template<typename T > | |
| void | value (T value) |
Set the value of the underlying Cell. | |
| template<typename T > | |
| T | operator() () const |
Get the value held by the underlying Cell and track it as a dependency. | |
Protected Attributes | |
| std::shared_ptr< internal::ref_base > | obs_ref |
| Pointer to the container holding the underlying cell. | |
Friends | |
| template<typename T > | |
| class | typed_cell |
Related Symbols | |
(Note that these are not member symbols.) | |
| bool | operator== (const cell &a, const cell &b) |
Compare two cell's by their keys. | |
| bool | operator!= (const cell &a, const cell &b) |
Compare two cell's by their keys. | |
Dynamically typed Cell container.
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.
|
inline |
Create a container holding the Cell o.
| o | The cell to hold in the container |
|
inline |
Create a container holding the Cell held in c.
| c | A typed_cell 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 |
|
inline |
Remove an observer from the underlying Cell.
| obs | The observer to remove from the cell. |
|
inline |
Set the value of the underlying Cell.
This method attempts to cast the underlying cell to a cell holding a value of type T. If the underlying cell does not hold a value of type T, or is not a MutableCell, an std::bad_cast exception is thrown.
| value | The value to set the underlying cell to. |
Compare two 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. Compare two 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.