tess 1.0.0
Performance-first tile and path simulation substrate
Loading...
Searching...
No Matches
tess::EventStream< T > Class Template Reference

#include <tess/sim/event_stream.h>

Public Types

using event_type = TickStampedEvent<T>

Public Member Functions

void reserve_events (std::size_t count)
auto publish (std::uint64_t tick, const T &value) -> bool
auto publish (std::uint64_t tick, T &&value) -> bool
auto events () const noexcept -> std::span< const event_type >
auto size () const noexcept -> std::size_t
bool empty () const noexcept
auto rejected_events () const noexcept -> std::uint64_t
void clear () noexcept
void consume_all () noexcept
 Retires the batch as read: every event counts completed.
void discard_all () noexcept
 Retires the batch unread: every event counts dropped.
void set_flow_accounting (diagnostics::FlowAccounting *accounting) noexcept
void observe_flow_tick (std::uint64_t tick) noexcept
 EventStream (const EventStream &other)
auto operator= (const EventStream &other) -> EventStream &
 EventStream (EventStream &&other) noexcept
auto operator= (EventStream &&other) noexcept -> EventStream &

Detailed Description

template<typename T>
class tess::EventStream< T >

Caller-owned, bounded batch of exact tick-stamped events.

Call reserve_events during setup. Publication then performs no container allocation and rejects overflow instead of silently dropping or overwriting an event; payload copy/move operations must themselves be allocation-free for the whole publication call to be allocation-free. clear starts a new batch without resetting sequence numbers, allowing consumers and diagnostics to detect gaps across ticks.

Member Function Documentation

◆ clear()

template<typename T>
void tess::EventStream< T >::clear ( )
inlinenoexcept

Starts a new batch without judging the old one.

With flow accounting attached this conservatively counts the discarded batch as dropped after admission; consumers that read the batch should prefer consume_all.

◆ observe_flow_tick()

template<typename T>
void tess::EventStream< T >::observe_flow_tick ( std::uint64_t tick)
inlinenoexcept

Observes one monotonic simulation tick for time accounting.

Ages derive from the accounting clock at publication, not from the events' payload ticks, which callers may stamp into the future.

◆ set_flow_accounting()

template<typename T>
void tess::EventStream< T >::set_flow_accounting ( diagnostics::FlowAccounting * accounting)
inlinenoexcept

Attaches caller-owned flow accounting; null detaches.

Attach or detach only on an empty batch; the accountant must outlive the attachment. Events are retained inventory: publication admits, and consume_all/discard_all/clear terminalize.


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