Class System

Inheritance Relationships

Derived Type

Class Documentation

class System

Platform-thread adapter.

State is always available; supported Events/Text channels are independently requested through scoped capture handles. Backends latch capture before pumping and publish the complete poll once. The initialized window is borrowed and must survive callback detachment. Bindings, device queries and polling belong to the platform owner; capture/ focus requests and acquired immutable handles may cross threads.

Subclassed by CE::Platform::GLFW::InputSystem

Public Functions

virtual ~System()

Destroy only after input users/borrowed window callbacks quiesce.

Concrete adapters detach native callbacks before window destruction; retained capture/focus requests own request state only.

virtual void initialize(CE::Platform::Window &window) = 0

Attach a borrowed compatible native window on the platform owner.

Concrete adapter validation/native failures can throw; window must survive detachment.

virtual void poll() = 0

Complete one platform-owned native pump and publish its semantic/capture state.

Concrete adapters establish capture/focus before observations; callers do not poll from simulation.

virtual void deinitialize() = 0

Detach platform callbacks/resources while the borrowed window is still alive, preserving already delivered immutable state.

Concrete adapters define failure cleanup; do not race polling or destruction.

virtual Actions::Bindings &bindings() = 0

Declaration: [[nodiscard]]

Borrow the mutable mapper on the platform owner only; do not retain past adapter teardown or mutate from simulation.

inline Actions::ContextSubmission action_contexts()

Declaration: [[nodiscard]]

Acquire the retained context submission endpoint on platform.

Later attach calls may run from simulation/other producers without re-querying this adapter.

inline virtual std::shared_ptr<const Actions::Snapshot> action_snapshot()

Declaration: [[nodiscard]]

Retain the current immutable semantic snapshot through bindings().

Acquire through the adapter on its permitted owner; acquired handles can cross threads.

virtual DeviceId keyboard_id() const = 0

Declaration: [[nodiscard]]

Return adapter-owned keyboard identity on platform; cache during initialization for later value-only mapping requests.

virtual DeviceId mouse_id() const = 0

Declaration: [[nodiscard]]

Return adapter-owned mouse identity on platform; does not expose live native mouse state.

virtual DeviceId gamepad_id() const = 0

Declaration: [[nodiscard]]

Return the adapter’s single convenience gamepad identity on platform.

This interface does not enumerate all native pads.

inline virtual bool supports(Capture::Channel mode) const

Declaration: [[nodiscard]]

Report capture capability; the base supports State only.

Committed Text support does not promise IME composition.

inline virtual bool supports_focus() const

Declaration: [[nodiscard]]

Report routed keyboard-focus capability; base adapters return false.

Capture::Lease capture(Capture::Channel mode)

Declaration: [[nodiscard]]

Retain a scoped request for a supported channel; unsupported channels throw failed_operation.

Requests may cross threads after capability/adapter lifetime requirements are respected; leases do not retain the window or consume private queues.

Routing::Manager &routing()

Declaration: [[nodiscard]]

Borrow the synchronized focus manager.

Unsupported routing throws failed_operation; do not retain the reference beyond the adapter, but acquired leases retain safe request state.

virtual std::shared_ptr<const PollSnapshot> poll_snapshot()

Declaration: [[nodiscard]]

Retrieve on platform after publication.

A capture-capable adapter must publish State+records together or this throws. State-only adapters may synthesize empty records around their latest state. Returned handle is independent immutable ownership.

void publish_events_to(CE::Events::EventBus::Publisher publisher) noexcept

Select optional notification routing on the platform owner before polling.

The weak handle may outlive its bus. Runtime supplies its Context’s handle; standalone adapters can opt in explicitly. Never closes the selected bus.

GamepadAvailability gamepad_availability() const

Declaration: [[nodiscard]]

Copy current slot state under its lock.

Register a listener then read this seed on the platform owner; no poll can interleave those owner operations. Other threads may read copies, but must post subscription/seed setup to that owner.

Protected Functions

void begin_input_poll()

Adapter hook before pumping: latch one focus/capture snapshot, gate keyboard gameplay State and open the action-context poll boundary.

Mid-pump requests wait for the next poll.

inline Capture::Collector &capture_buffer()

Declaration: [[nodiscard]]

Borrow platform-owned ordered capture staging for backend callbacks; never expose it as a simulation reader queue.

std::shared_ptr<const PollSnapshot> publish_input(ObservationClock::time_point observed_at = ObservationClock::now())

Declaration: [[nodiscard]]

Complete semantic State and pending records, then atomically publish a complete retained poll.

Call once after pumping with nondecreasing observation time; allocation/evaluation errors propagate and no incomplete poll handle is returned.

void discard_captured_input()

Detach cleanup: drop pending records/focus/latest complete-poll ownership while preserving previously delivered handles and live capture request counts.

Mapper clear/release publication is a separate adapter responsibility.

void open_gamepad_availability()
void stage_gamepad_availability(DeviceId device, bool available) noexcept
void close_gamepad_availability(bool notify = true) noexcept