MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Kriya::EventAwaiter Class Reference

Awaiter for suspending on window events with optional filtering. More...

#include <EventAwaiter.hpp>

+ Collaboration diagram for MayaFlux::Kriya::EventAwaiter:

Public Member Functions

 EventAwaiter (Vruta::EventSource &source, Vruta::EventFilter filter={})
 
 ~EventAwaiter ()
 
 EventAwaiter (const EventAwaiter &)=delete
 
EventAwaiteroperator= (const EventAwaiter &)=delete
 
 EventAwaiter (EventAwaiter &&) noexcept=default
 
EventAwaiteroperator= (EventAwaiter &&) noexcept=delete
 
bool await_ready ()
 Check if event already available.
 
void await_suspend (std::coroutine_handle<> handle)
 Suspend coroutine, register for event notification.
 
Core::WindowEvent await_resume ()
 Resume with event data.
 
void try_resume ()
 Called by EventSource when event arrives.
 

Private Attributes

Vruta::EventSourcem_source
 
Vruta::EventFilter m_filter
 
Core::WindowEvent m_result
 
std::coroutine_handle m_handle
 
bool m_is_suspended = false
 

Friends

class Vruta::EventSource
 

Detailed Description

Awaiter for suspending on window events with optional filtering.

Allows coroutines to suspend until specific window events arrive. Events are filtered by type and/or input key/button, with support for both awaiting any event or specific event types.

Note
EventAwaiter takes EventFilter by value, so temporary filters created in next_event() and await_event() are safe.

Usage Examples:

// Wait for any event
auto event = co_await event_source.next_event();
// Wait for specific event type
auto event = co_await event_source.await_event(WindowEventType::KEY_PRESSED);
// Wait for specific key press (via EventFilter)
auto event = co_await EventAwaiter(source, filter);
// Manual filter construction for complex queries
filter.event_type = WindowEventType::KEY_PRESSED;
auto event = co_await EventAwaiter(source, filter);
Awaiter for suspending on window events with optional filtering.
std::optional< IO::Keys > key_code
std::optional< Core::WindowEventType > event_type
Filter criteria for window events.
See also
EventSource for creating awaiters
EventFilter for filter construction
IO::Keys for key enumeration

Definition at line 44 of file EventAwaiter.hpp.


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