Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::runtime::IDispatcher Class Referenceabstract

Abstract main-thread dispatcher. More...

#include <dispatcher.hpp>

Inheritance diagram for aria::runtime::IDispatcher:
[legend]

Public Member Functions

 ~IDispatcher () override=default
virtual void post (std::function< void()> fn)=0
 Schedule the callable to run on the main thread (asynchronously).
virtual void post_delayed (std::chrono::milliseconds delay, std::function< void()> fn)=0
 Like post(), but with a delay.
bool is_main_thread () const noexcept override=0
 Returns true if currently executing on the main thread.
void post_after (std::chrono::milliseconds delay, std::function< void()> fn) override
 IDelayedScheduler adapter — routes to post_delayed.
::aria::SchedulerCaps caps () const noexcept override
 Capability bitmask.
void schedule (std::function< void()> fn) override
 Submit fn for execution "soon". Defines Caps::Post.
void schedule_after (std::chrono::milliseconds delay, std::function< void()> fn) override
 Submit fn for execution after delay.
Public Member Functions inherited from aria::IDelayedScheduler
 ~IDelayedScheduler () override
Public Member Functions inherited from aria::IScheduler
virtual ~IScheduler ()=default

Detailed Description

Abstract main-thread dispatcher.

Posts callables to be executed on the platform's main / UI thread. Concrete implementations exist for each platform (AppKit/UIKit/JNI/Qt/Emscripten), plus a generic in-process implementation for testing and console apps.

Inherits from IDelayedScheduler (and therefore from aria::IScheduler) so it can be used directly by debounce / throttle / retry_with_backoff / unified IScheduler consumers without an adapter.

Capability bitmask is Post | Delay | MainThread | Pumpable. Concrete platform dispatchers may widen it (e.g. by adding GraphSafe/WorkerSafe in caps() overrides) — by default we conservatively claim the four universal capabilities.

Constructor & Destructor Documentation

◆ ~IDispatcher()

aria::runtime::IDispatcher::~IDispatcher ( )
overridedefault

Member Function Documentation

◆ post()

virtual void aria::runtime::IDispatcher::post ( std::function< void()> fn)
pure virtual

Schedule the callable to run on the main thread (asynchronously).

Implemented in aria::adapters::qt6::QtDispatcher, and aria::runtime::SimpleDispatcher.

◆ post_delayed()

virtual void aria::runtime::IDispatcher::post_delayed ( std::chrono::milliseconds delay,
std::function< void()> fn )
pure virtual

Like post(), but with a delay.

Implemented in aria::adapters::qt6::QtDispatcher, and aria::runtime::SimpleDispatcher.

◆ is_main_thread()

bool aria::runtime::IDispatcher::is_main_thread ( ) const
nodiscardoverridepure virtualnoexcept

Returns true if currently executing on the main thread.

Reimplemented from aria::IScheduler.

Implemented in aria::adapters::qt6::QtDispatcher, and aria::runtime::SimpleDispatcher.

◆ post_after()

void aria::runtime::IDispatcher::post_after ( std::chrono::milliseconds delay,
std::function< void()> fn )
inlineoverridevirtual

IDelayedScheduler adapter — routes to post_delayed.

Implements aria::IDelayedScheduler.

◆ caps()

::aria::SchedulerCaps aria::runtime::IDispatcher::caps ( ) const
inlinenodiscardoverridevirtualnoexcept

Capability bitmask.

Implementations should return a constant value (or at least a value stable across the object's lifetime).

Reimplemented from aria::IDelayedScheduler.

Reimplemented in aria::adapters::qt6::QtDispatcher.

◆ schedule()

void aria::runtime::IDispatcher::schedule ( std::function< void()> fn)
inlineoverridevirtual

Submit fn for execution "soon". Defines Caps::Post.

Reimplemented from aria::IDelayedScheduler.

◆ schedule_after()

void aria::runtime::IDispatcher::schedule_after ( std::chrono::milliseconds delay,
std::function< void()> fn )
inlineoverridevirtual

Submit fn for execution after delay.

Default implementation throws unsupported_capability; implementations that advertise Caps::Delay MUST override.

Reimplemented from aria::IDelayedScheduler.


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