|
| | Node (std::shared_ptr< RuntimeCore > core, std::size_t depth=0) |
| | Constructs a node. Off the owner this is reported (site::kOffOwner) and the node is not counted towards the core's live nodes, whose counter belongs to the owner.
|
| virtual | ~Node () |
| | Unlinks this node from its sources and observers, drops every reference the core holds to it, and tells a pull running on it that it is gone.
|
|
| Node (Node const &)=delete |
|
Node & | operator= (Node const &)=delete |
|
| Node (Node &&)=delete |
|
Node & | operator= (Node &&)=delete |
| void | markStale (Colour colour) |
| | Push phase: raises this node to colour and marks its observers Check.
|
| bool | updateIfNecessary () |
| | Pull phase: brings this node up to date, recomputing only if a source really changed.
|
| std::size_t | countRun (std::uint64_t epoch) noexcept |
| | Counts one run of this Effect in the flush numbered epoch.
|
| std::size_t | depth () const noexcept |
| | How deeply the scope owning this node is nested; the flush runs shallower Effects first.
|
| bool | runsAfter (Node const &other) const noexcept |
| | Whether this node runs after other when both are queued: it is deeper, or as deep and newer.
|
| std::uint64_t | creationOrder () const noexcept |
| | Where this node stands in its runtime's creation order; among Effects of one depth, the flush runs older ones first.
|
| void | settle () noexcept |
| | Marks this node Clean without running it (a dropped queue entry).
|
|
| RuntimeCore & | core () const noexcept |
| | The runtime core.
|
| bool | bornOnOwner () const noexcept |
| | Whether this node was constructed on the owner; one that was not is refused its work.
|
| void | trackRead () const |
| | Registers this node as a source of the innermost tracked run, if any.
|
| void | forceDirty () noexcept |
| | Marks this node Dirty, so the next pull recomputes it.
|
| bool | isPulling () const noexcept |
| | Whether a pull is bringing this node up to date right now. A read of the node from inside that pull can only come from its own run or from a source's run that reads it: a cycle.
|
| void | markObserversStale (Colour colour) |
| | Marks every observer of this node colour.
|
| void | adoptSources (std::vector< Node * > fresh) |
| | Replaces this node's sources with fresh, unlinking the ones no longer read.
|
| void | mergeSources (std::vector< Node * > fresh) |
| | Adds fresh to this node's sources without dropping any: what a failed run keeps.
|
A graph node: a source (Signal), an observer (Effect), or both (Computed).
Non-copyable and non-movable: other nodes hold raw pointers to it, and its destructor unlinks it in both directions. A derived node supplies recompute() and isEffect() as private overrides; only Node calls them.
A node may be destroyed while it is being brought up to date (an Effect body that remounts the view owning it). The destructor tells the running pull and the running tracking frame, and neither touches the node again.
Definition at line 432 of file graph.hpp.
| virtual morph::reactive::detail::Node::~Node |
( |
| ) |
|
|
inlinevirtual |
Unlinks this node from its sources and observers, drops every reference the core holds to it, and tells a pull running on it that it is gone.
Destroying a node off the owner is a misuse. It is reported (site::kOffOwner) but cannot be refused: the destructor still edits the owner's graph, queue and counters, and what that does beyond the report is undefined.
Definition at line 451 of file graph.hpp.
| void morph::reactive::detail::Node::markStale |
( |
Colour | colour | ) |
|
|
inline |
Push phase: raises this node to colour and marks its observers Check.
An Effect is queued when it leaves Clean. A node already at least as stale stops the walk, because its observers were marked when it turned stale, unless an observer has since ended Clean above it (exposeStaleSources()); then the walk passes through it once.
- Parameters
-
| colour | Dirty for a direct observer of a change, Check for a transitive one. |
Definition at line 480 of file graph.hpp.
| void morph::reactive::detail::Node::adoptSources |
( |
std::vector< Node * > | fresh | ) |
|
|
inlineprotected |
Replaces this node's sources with fresh, unlinking the ones no longer read.
Strong guarantee: linking the new sources is the only step that allocates, and it runs first; if it throws, the links it made are undone, so no source keeps a link this node does not list.
- Parameters
-
| fresh | The sources the latest run read. |
Definition at line 618 of file graph.hpp.