Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::reactive::Graph Class Reference

Process-wide singleton reactive graph (accessed via Node::graph()). More...

#include <graph.hpp>

Public Member Functions

 Graph () noexcept
 ~Graph () noexcept=default
 Graph (const Graph &)=delete
Graphoperator= (const Graph &)=delete
void assert_on_graph_thread () const noexcept
void begin_batch () noexcept
 Open a new batch. Nesting is legal; the outermost close flushes.
void end_batch ()
 Close the current batch; triggers a flush once the outermost batch closes (unless we are already inside a flush).
bool in_batch () const noexcept
void on_source_changed (Node &src)
 Called after a Source has committed a new value: bumps its version and colors the downstream MaybeDirty.
void enqueue_dirty (Node &n)
 Enqueue a node into the current flush round's "pending" set.
void flush ()
 Evaluate every dirty node in topological order.
bool pull (Node &n)
 Force-evaluate a single node if it is Dirty / MaybeDirty.
TrackingContextcurrent_tracker () noexcept
void push_tracker (TrackingContext *ctx)
 Push / pop a tracker (used by RAII TrackerScope).
void pop_tracker (TrackingContext *ctx)
void enter_untracked ()
 Enter / leave an untracked scope.
void leave_untracked ()

Friends

class Node

Detailed Description

Process-wide singleton reactive graph (accessed via Node::graph()).

Constructor & Destructor Documentation

◆ Graph() [1/2]

aria::reactive::Graph::Graph ( )
inlinedefaultnoexcept

◆ ~Graph()

aria::reactive::Graph::~Graph ( )
defaultnoexcept

◆ Graph() [2/2]

aria::reactive::Graph::Graph ( const Graph & )
delete

Member Function Documentation

◆ operator=()

Graph & aria::reactive::Graph::operator= ( const Graph & )
delete

◆ assert_on_graph_thread()

void aria::reactive::Graph::assert_on_graph_thread ( ) const
inlinenoexcept

◆ begin_batch()

void aria::reactive::Graph::begin_batch ( )
inlinenoexcept

Open a new batch. Nesting is legal; the outermost close flushes.

◆ end_batch()

void aria::reactive::Graph::end_batch ( )
inline

Close the current batch; triggers a flush once the outermost batch closes (unless we are already inside a flush).

◆ in_batch()

bool aria::reactive::Graph::in_batch ( ) const
inlinenodiscardnoexcept

◆ on_source_changed()

void aria::reactive::Graph::on_source_changed ( Node & src)
inline

Called after a Source has committed a new value: bumps its version and colors the downstream MaybeDirty.

  • Inside a batch: only colors, no flush.
  • Outside a batch: a single-shot flush runs immediately.

◆ enqueue_dirty()

void aria::reactive::Graph::enqueue_dirty ( Node & n)
inline

Enqueue a node into the current flush round's "pending" set.

Typical use: a Reaction node has no value but must still run on flush.

◆ flush()

void aria::reactive::Graph::flush ( )
inline

Evaluate every dirty node in topological order.

Nodes whose recompute() changes the cached value seed a new round by re-coloring their downstream. The loop runs at most kMaxFlushRounds rounds before declaring a cycle.

◆ pull()

bool aria::reactive::Graph::pull ( Node & n)
inline

Force-evaluate a single node if it is Dirty / MaybeDirty.

Returns true iff the node's version was advanced by this call.

◆ current_tracker()

TrackingContext * aria::reactive::Graph::current_tracker ( )
inlinenodiscardnoexcept

◆ push_tracker()

void aria::reactive::Graph::push_tracker ( TrackingContext * ctx)
inline

Push / pop a tracker (used by RAII TrackerScope).

◆ pop_tracker()

void aria::reactive::Graph::pop_tracker ( TrackingContext * ctx)
inline

◆ enter_untracked()

void aria::reactive::Graph::enter_untracked ( )
inline

Enter / leave an untracked scope.

Implemented as pushing a nullptr tracker so current_tracker() returns null inside, which makes dep() behave like a plain read.

◆ leave_untracked()

void aria::reactive::Graph::leave_untracked ( )
inline

◆ Node

friend class Node
friend

The documentation for this class was generated from the following files:
  • modules/core/include/aria/reactive/graph.hpp
  • modules/core/include/aria/reactive/graph.inl