Portals0.7.0 · dev (544a5c68c72e · 2026-11-28 UTC)
Loading...
Searching...
No Matches
portals::UiEndpoint< T > Class Template Reference

Copyable worker-safe endpoint for short, always deferred UI commands. The callback and its captures stay exclusively in the UI-owned Scheduler registration. Uses the existing shared CONTROL queue with REJECT; commands are never coalesced. Queue defaults and budgets come from SchedulerOptions (32 entries/32 per dispatch). May outlive its node, scene and scheduler; later publication returns CLOSED. More...

#include <ui_delivery.hpp>

Public Member Functions

 UiEndpoint ()=default
 Construct an empty closed endpoint.
std::expected< void, SchedulerError > post (std::shared_ptr< const T > payload) const
 Enqueue without observing execution; never invokes the UI callback inline.
std::expected< UiAcknowledgement, SchedulerError > postAcknowledged (std::shared_ptr< const T > payload) const
 Enqueue with a separate nonblocking execution receipt.

Friends

template<class>
class ui::Ref

Detailed Description

template<class T>
class portals::UiEndpoint< T >

Copyable worker-safe endpoint for short, always deferred UI commands. The callback and its captures stay exclusively in the UI-owned Scheduler registration. Uses the existing shared CONTROL queue with REJECT; commands are never coalesced. Queue defaults and budgets come from SchedulerOptions (32 entries/32 per dispatch). May outlive its node, scene and scheduler; later publication returns CLOSED.

Template Parameters
TTransitively immutable payload owning all referenced data. Final destruction may occur on UI or a producer; payload deleters must support either and can affect UI dispatch latency.

Member Function Documentation

◆ post()

template<class T>
std::expected< void, SchedulerError > portals::UiEndpoint< T >::post ( std::shared_ptr< const T > payload) const
inline

Enqueue without observing execution; never invokes the UI callback inline.

Parameters
payloadImmutable owning value; null is INVALID_ARGUMENT. One envelope is allocated.
Returns
Enqueue acceptance only, or CLOSED, WOULD_BLOCK, NO_MEMORY or INVALID_ARGUMENT. Rejection does not change accepted commands or retry automatically.

◆ postAcknowledged()

template<class T>
std::expected< UiAcknowledgement, SchedulerError > portals::UiEndpoint< T >::postAcknowledged ( std::shared_ptr< const T > payload) const
inline

Enqueue with a separate nonblocking execution receipt.

Parameters
payloadImmutable owning value; null is INVALID_ARGUMENT. Allocates envelope and receipt.
Returns
Receipt on acceptance, or exact enqueue error; acceptance never promises execution.

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