Class Accumulator

Class Documentation

class Accumulator

Declaration: final

Owns the last consumption boundary and persistent State baseline.

consume() summarizes a whole polling batch; it never schedules simulation. One owner supplies synchronization and a valid nonnull baseline/start. Consumption validates sample/interval order before changing its baseline; returned Tick owns handles and copied records independent of later calls.

Public Functions

inline Accumulator(std::shared_ptr<const Actions::Snapshot> baseline, ObservationClock::time_point start)

Retain a baseline and initial consumption boundary on one synchronized owner.

The constructor stores inputs; consume operations validate nonnull baseline and monotonic intervals.

inline Tick consume(ObservationClock::time_point until, std::vector<std::shared_ptr<const Actions::Snapshot>> polls)

Declaration: [[nodiscard]]

Summarize State-only polls into an owned Tick over the previous boundary..until interval.

Validate newer IDs/nondecreasing observation times before advancing the baseline/boundary; failure preserves them. Empty polls preserve current levels while hold durations advance.

Tick consume_polls(ObservationClock::time_point until, std::vector<std::shared_ptr<const PollSnapshot>> polls)

Declaration: [[nodiscard]]

Summarize complete polls and copy their records in publication order without consuming another reader’s stream.

Null polls/state, invalid order/intervals and allocation failures throw before changing the baseline. Return independent Tick storage and retained samples.

See also

Tick input