morph 0.1.0
Asynchronous bridge between GUI thread and business models
Loading...
Searching...
No Matches
morph::reactive::detail::TrackingFrame Class Reference

Collects the sources one tracked run reads, and restores the previous frame when it ends. More...

#include <graph.hpp>

Public Member Functions

 TrackingFrame (RuntimeCore &core, Node *observer) noexcept
 ~TrackingFrame ()
 Reinstalls the enclosing frame.
 TrackingFrame (TrackingFrame const &)=delete
TrackingFrame & operator= (TrackingFrame const &)=delete
 TrackingFrame (TrackingFrame &&)=delete
TrackingFrame & operator= (TrackingFrame &&)=delete
void add (Node &source)
 Records that the run read source; a no-op in an untracked region.
void forget (Node &node) noexcept
 Drops node, which is being destroyed, from the recorded sources. When node is this frame's observer, the frame stops recording and remembers that its observer is gone.
bool observerDestroyed () const noexcept
 Whether the observer was destroyed during the run: a body may destroy its own node (a remount inside an Effect), and the node's run must not touch it afterwards.
std::vector< Node * > takeSources () noexcept
 Hands the recorded sources to the observer.
TrackingFrame * previous () const noexcept
 The enclosing frame.

Detailed Description

Collects the sources one tracked run reads, and restores the previous frame when it ends.

A frame whose observer is null is an untracked region: reads inside it subscribe nothing.

Definition at line 367 of file graph.hpp.

Constructor & Destructor Documentation

◆ TrackingFrame()

morph::reactive::detail::TrackingFrame::TrackingFrame ( RuntimeCore & core,
Node * observer )
inlinenoexcept
Parameters
coreThe runtime core.
observerThe node whose run this is, or null for an untracked region.

Definition at line 371 of file graph.hpp.

◆ ~TrackingFrame()

morph::reactive::detail::TrackingFrame::~TrackingFrame ( )
inline

Reinstalls the enclosing frame.

Definition at line 377 of file graph.hpp.

Member Function Documentation

◆ add()

void morph::reactive::detail::TrackingFrame::add ( Node & source)
inline

Records that the run read source; a no-op in an untracked region.

Parameters
sourceThe node read.

Definition at line 385 of file graph.hpp.

◆ forget()

void morph::reactive::detail::TrackingFrame::forget ( Node & node)
inlinenoexcept

Drops node, which is being destroyed, from the recorded sources. When node is this frame's observer, the frame stops recording and remembers that its observer is gone.

Parameters
nodeThe node.

Definition at line 394 of file graph.hpp.

◆ observerDestroyed()

bool morph::reactive::detail::TrackingFrame::observerDestroyed ( ) const
inlinenodiscardnoexcept

Whether the observer was destroyed during the run: a body may destroy its own node (a remount inside an Effect), and the node's run must not touch it afterwards.

Returns
True once the observer's destructor has run.

Definition at line 405 of file graph.hpp.

◆ takeSources()

std::vector< Node * > morph::reactive::detail::TrackingFrame::takeSources ( )
inlinenodiscardnoexcept

Hands the recorded sources to the observer.

Returns
The sources, deduplicated, in first-read order.

Definition at line 409 of file graph.hpp.

◆ previous()

TrackingFrame * morph::reactive::detail::TrackingFrame::previous ( ) const
inlinenodiscardnoexcept

The enclosing frame.

Returns
The frame that was innermost when this one was opened, or null.

Definition at line 413 of file graph.hpp.


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