Anchors
C++ library for Incremental Computing
|
Engine is the brain of Anchors, containing the necessary functions and data to retrieve the value of an Anchor
object.
More...
#include <engine.h>
Public Member Functions | |
Engine () | |
Creates an instance of the Engine class. | |
template<typename T > | |
T | get (const AnchorPtr< T > &anchor) |
Returns the value of the given Anchor. More... | |
template<typename T > | |
void | set (AnchorPtr< T > &anchor, T val) |
Sets the value of the given Anchor. More... | |
template<typename T > | |
void | observe (AnchorPtr< T > &anchor) |
Marks an Anchor as observed. More... | |
template<typename T > | |
void | observe (std::vector< AnchorPtr< T > > &anchors) |
Marks a vector of Anchors with the same type as observed. More... | |
template<typename T > | |
void | unobserve (AnchorPtr< T > &anchor) |
Marks an Anchor as unobserved. More... | |
Engine is the brain of Anchors, containing the necessary functions and data to retrieve the value of an Anchor
object.
Note that this class is not thread-safe.
T anchors::Engine::get | ( | const AnchorPtr< T > & | anchor | ) |
Returns the value of the given Anchor.
This function is only guaranteed to return the latest value of an Anchor marked observed using observe()
.
For an unobserved Anchor, it may return a stale value—if the Anchor was created with a value or has been computed before—or an undefined value if the Anchor was created with a function e.g. using Anchors::map
, and has not been computed before.
T | - type of the Anchor value. |
anchor | - input Anchor. |
void anchors::Engine::observe | ( | AnchorPtr< T > & | anchor | ) |
void anchors::Engine::observe | ( | std::vector< AnchorPtr< T > > & | anchors | ) |
void anchors::Engine::set | ( | AnchorPtr< T > & | anchor, |
T | val | ||
) |
void anchors::Engine::unobserve | ( | AnchorPtr< T > & | anchor | ) |