Class Collector

Class Documentation

class Collector

Declaration: final

Platform-owned record collector; capture requests may come from any thread.

begin_poll() latches activation for the next pump. Collection/publication stay on the platform thread and do not invoke consumers there.

Public Functions

Collector() = default

Create empty capture staging with independent shared request counts.

Allocation may throw; recording/publication stays on the platform owner.

Collector(const Collector&) = delete
Collector &operator=(const Collector&) = delete
Lease request(Channel mode)

Declaration: [[nodiscard]]

Request Events/Text concurrently with other producers.

State is always collected and its lease is a no-op request; invalid modes throw invalid_args. Returned state can outlive this collector without retaining its adapter.

void begin_poll(CE::Input::Routing::Focus focus = {})

Latch current request counts and copied focus for the next platform pump.

Requests/focus changes during that pump affect a later latch; existing pending records are not cleared.

void record(CE::Input::DeviceId device, CE::Input::DeviceKind kind, CE::Input::Events::Payload data, CE::Input::ObservationClock::time_point observed_at = CE::Input::ObservationClock::now())

Append an owned active-channel payload in collector order.

Inactive channels ignore records; active Text must be a Unicode scalar. Keyboard/Text routing uses latched target/epoch; PassThrough admits gameplay too. Observation time/other payloads are not normalized. Invalid Text/allocation failure throws; staging is not transactional.

std::vector<CE::Input::Events::Record> complete()

Declaration: [[nodiscard]]

Transfer the whole pending vector in collector order and leave it empty; channel request counts and sequence history remain.

void discard_pending()

Drop staged records and clear the current activation/focus latch without revoking leases.

The next begin_poll() relatches live request counts.

See also

Ordered capture