Player12
An open source football management simulator
Loading...
Searching...
No Matches
MatchEventCursor Class Reference

#include <match_audio.h>

Public Member Functions

void collect (std::span< const MatchEvent > events, std::vector< const MatchEvent * > &fresh)
 
void skipAll (std::span< const MatchEvent > events)
 

Private Member Functions

bool isBefore (const MatchEvent &event) const
 
bool isNew (const MatchEvent &event, std::uint64_t fingerprint) const
 
void mark (const MatchEvent &event, std::uint64_t fingerprint)
 

Private Attributes

int period = 0
 
float minute = -1.0f
 
std::array< std::uint64_t, SAME_TIME_CAPACITY > sameTime {}
 
std::size_t sameTimeCount = 0
 

Static Private Attributes

static constexpr std::size_t SAME_TIME_CAPACITY = 16
 

Detailed Description

Remembers which match events were already heard. Events carry no id and the engine's log drops its oldest entries once full, so an event is known by its place in match time (period, clock) plus a fingerprint of its content. That identity survives log eviction, a replayed or re-created engine and seeking: an event is reported once, and never again.

Member Function Documentation

◆ collect()

void MatchEventCursor::collect ( std::span< const MatchEvent >  events,
std::vector< const MatchEvent * > &  fresh 
)

Appends events not heard yet (in log order) and marks them heard.

◆ isBefore()

bool MatchEventCursor::isBefore ( const MatchEvent &  event) const
private

Strictly earlier in match time than the last heard event.

◆ isNew()

bool MatchEventCursor::isNew ( const MatchEvent &  event,
std::uint64_t  fingerprint 
) const
private

◆ mark()

void MatchEventCursor::mark ( const MatchEvent &  event,
std::uint64_t  fingerprint 
)
private

◆ skipAll()

void MatchEventCursor::skipAll ( std::span< const MatchEvent >  events)

Marks every event in events heard without reporting it.

Member Data Documentation

◆ minute

float MatchEventCursor::minute = -1.0f
private

◆ period

int MatchEventCursor::period = 0
private

◆ SAME_TIME_CAPACITY

constexpr std::size_t MatchEventCursor::SAME_TIME_CAPACITY = 16
staticconstexprprivate

◆ sameTime

std::array<std::uint64_t, SAME_TIME_CAPACITY> MatchEventCursor::sameTime {}
private

Fingerprints of heard events at exactly (period, minute).

◆ sameTimeCount

std::size_t MatchEventCursor::sameTimeCount = 0
private

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