Aria
2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Toggle main menu visibility
Loading...
Searching...
No Matches
reactive.hpp
Go to the documentation of this file.
1
#pragma once
2
3
// ============================================================================
4
// reactive/reactive.hpp
5
// ----------------------------------------------------------------------------
6
// Single-include umbrella for the Aria reactive subsystem.
7
//
8
// End users should prefer this header over the individual files: the
9
// sub-headers are carefully ordered here so that forward declarations and
10
// out-of-line template definitions are all satisfied in one shot.
11
//
12
// Public surface provided by this header:
13
// * reactive::Property<T> -- observable source
14
// * reactive::Computed<T> -- derived value (auto-tracked)
15
// * reactive::Effect -- side-effect reaction (auto-tracked)
16
// * aria::Subscription -- RAII handle returned by observe
17
// * reactive::batch / BatchScope -- coalesce multiple writes
18
// * reactive::untracked / UntrackedScope -- opt out of tracking
19
// * reactive::dep(x) -- explicit dependency declaration
20
// * reactive::CircularDependencyError
21
//
22
// Design rationale: every piece of state that participates in reactivity
23
// is a Node in a single process-wide DAG. Writes propagate in two
24
// phases (push coloring, pull evaluation) so that computations are
25
// evaluated after their upstreams. Reentrant writes can schedule later
26
// flush rounds; cycle detection bounds non-converging dependencies.
27
// ============================================================================
28
29
// Include order matters -- see the notes above each sub-header. In short:
30
// graph / node first (they are the protocol), then the three user types,
31
// with effect.hpp last because it supplies the out-of-line definitions
32
// of Computed's observer methods.
33
#include "
aria/reactive/node.hpp
"
34
#include "
aria/reactive/graph.hpp
"
35
#include "
aria/reactive/graph.inl
"
// inline implementations of Graph / Node
36
#include "
aria/reactive/property.hpp
"
37
#include "
aria/reactive/computed.hpp
"
38
#include "
aria/reactive/effect.hpp
"
39
#include "
aria/reactive/inspector.hpp
"
// diagnostics: to_dot / to_json / flush tracer
40
41
// ============================================================================
42
// Public-API promotion
43
// ----------------------------------------------------------------------------
44
// The implementation lives in `aria::reactive` (an internal namespace),
45
// but every user-visible type is promoted into `aria::` via the using
46
// declarations below. Per `docs/api-style.md` S-1/S-2, public code MUST
47
// use the unqualified `aria::` form -- the `aria::reactive::` qualified
48
// names exist only as an implementation locator (e.g. for users who
49
// reach into `Graph::assert_on_graph_thread()` for low-level diagnostics).
50
// ============================================================================
51
namespace
aria
{
52
53
using
reactive::Property
;
54
using
reactive::Computed
;
55
using
reactive::Effect
;
56
using
reactive::BatchScope
;
57
using
reactive::UntrackedScope
;
58
using
reactive::CircularDependencyError
;
59
using
reactive::GraphInspector
;
60
61
using
reactive::batch
;
62
using
reactive::untracked
;
63
using
reactive::dep
;
64
65
}
// namespace aria
aria::reactive::BatchScope
RAII batch guard: { BatchScope b; ...; } or use batch([&]{...}).
Definition
graph.hpp:346
aria::reactive::CircularDependencyError
Thrown when flush detects a dependency cycle.
Definition
graph.hpp:63
aria::reactive::Computed
Definition
computed.hpp:86
aria::reactive::Effect
Definition
effect.hpp:127
aria::reactive::GraphInspector
Lightweight diagnostics entry point.
Definition
inspector.hpp:54
aria::reactive::Property
Definition
property.hpp:103
aria::reactive::UntrackedScope
RAII: within the scope, every dep() behaves like a plain get().
Definition
graph.hpp:318
effect.hpp
graph.hpp
graph.inl
inspector.hpp
aria::reactive::batch
auto batch(Fn &&fn) -> decltype(fn())
Sugar: batch([&]{ firstName = "..."; lastName = "..."; }).
Definition
graph.hpp:369
aria::reactive::untracked
auto untracked(Fn &&fn) -> decltype(fn())
Sugar: untracked([&]{ ... }).
Definition
graph.hpp:329
aria::reactive::dep
requires ::aria::ReactiveNode< Reactive > void dep(Reactive &r)
Definition
computed.hpp:76
aria
Definition
signal.hpp:12
node.hpp
computed.hpp
property.hpp
modules
core
include
aria
reactive
reactive.hpp
Generated by
1.18.0