MayaFlux 0.1.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
MayaFlux::Vruta::Event Class Reference

Coroutine type for event-driven suspension. More...

#include <Event.hpp>

+ Collaboration diagram for MayaFlux::Vruta::Event:

Public Types

using promise_type = MayaFlux::Vruta::event_promise
 

Public Member Functions

 Event (std::coroutine_handle< promise_type > h)
 Constructs a Event from a coroutine handle.
 
 Event (const Event &other)
 Copy constructor.
 
Eventoperator= (const Event &other)
 Copy assignment operator.
 
 Event (Event &&other) noexcept
 Move constructor.
 
Eventoperator= (Event &&other) noexcept
 Move assignment operator.
 
virtual ~Event ()
 Destructor.
 
virtual ProcessingToken get_processing_token () const
 Get the processing token that determines how this routine should be scheduled.
 
virtual bool is_active () const
 Checks if the coroutine is still active.
 
void resume ()
 
bool done () const
 
std::coroutine_handle< promise_typeget_handle () const
 
virtual bool get_should_terminate () const
 Get should_terminate flag from promise.
 
virtual void set_should_terminate (bool should_terminate)
 Set should_terminate flag in promise.
 
template<typename... Args>
void update_params (Args... args)
 Updates multiple named parameters in the coroutine's state.
 
template<typename T >
void set_state (const std::string &key, T value)
 Sets a named state value in the coroutine.
 
template<typename T >
T * get_state (const std::string &key)
 Gets a named state value from the coroutine.
 

Protected Member Functions

virtual void set_state_impl (const std::string &key, std::any value)
 
virtual void * get_state_impl_raw (const std::string &key)
 
template<typename T >
T * get_state_impl (const std::string &key)
 Implementation helper for get_state.
 
virtual void update_params_impl ()
 brief Implementation helper for update_params
 
template<typename T , typename... Args>
void update_params_impl (const std::string &key, T value, Args... args)
 Implementation helper for update_params.
 

Private Attributes

std::coroutine_handle< promise_typem_handle
 

Detailed Description

Coroutine type for event-driven suspension.

Events suspend on EventAwaiter (window events, custom signals, etc.) and are resumed directly by EventSource when events occur.

Unlike AudioRoutine/GraphicsRoutine, there is no periodic processing. Events are "fire-and-forget" - they run until completion or explicit cancellation.

Usage: auto handler = [](Window* w) -> Event { while (true) { auto event = co_await w->get_event_source().next_event(); // Handle event } };

Definition at line 26 of file Event.hpp.


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