addSystem method
- String name,
- LoopPhase phase,
- LoopSystem system, {
- SystemSettings settings = const SystemSettings(),
Adds system to phase under name, unique in the loop, ordered
against the phase's other systems by settings' after/before.
settings' reads and writes name the state the system touches; both
default to empty, which declares nothing and is never checked. What a
later minor lets a system say arrives as a field of SystemSettings,
never as a parameter here.
Declared so an unordered pair can be named. A replay is bit for bit
only while two systems that touch one state run in one order on every
machine; where the constraints leave a choice, registration order
decides, and an install order that differs between the run and its
replay is a different picture. The engine's loop names every pair of
systems in one step phase where one writes what the other reads or
writes and neither is ordered against the other, through after and
before or a chain of them.
Throws a NameTakenException for a name already used, and an ArgumentError for a phase that does not exist.
Implementation
@override
Registration addSystem(
String name,
LoopPhase phase,
LoopSystem system, {
SystemSettings settings = const SystemSettings(),
}) {
_named(name, 'the system', _store.systems.keys);
final entry = TestSystem(
name: name,
phase: phase,
system: system,
after: settings.after,
before: settings.before,
reads: settings.reads,
writes: settings.writes,
owner: _owner,
);
_store.systems[name] = entry;
return _track(
Registration(() {
if (identical(_store.systems[name], entry)) _store.systems.remove(name);
}),
);
}