One UI owner for scheduler, tree, routing and a single terminal run. All calls/destruction except requestStop require the creating thread. Scene owns typed nodes and bindings; release them before this object. Terminal I/O never runs inside layout/paint. No automatic recovery follows uncertain output. Run is single-use, including failed/closed sessions.
More...
#include <application.hpp>
|
|
| ~Application () |
| | Finish an active session, then release routing/tree before the scheduler. Destroy on the UI owner thread. An active session's borrowed scene, observer and terminal must remain alive through this call; a completed session retains no borrowed scene callbacks.
|
|
| Application (const Application &)=delete |
|
Application & | operator= (const Application &)=delete |
| Scheduler & | scheduler () noexcept |
| WidgetTree & | tree () noexcept |
| EventRouter & | router () noexcept |
| Node< Widget > | root () const noexcept |
| SchedulerTime | now () const noexcept |
| WidthPolicy | widthPolicy () const noexcept |
| BackgroundExecutor * | background () noexcept |
|
void | requestStop () noexcept |
| | Worker-safe while this owner lives; wakes scheduler and cancels terminal waits.
|
| std::expected< void, ApplicationError > | start (ApplicationScene &scene, ApplicationReadyTerminal &terminal, std::stop_token stop={}) |
| | Start the single permitted ready-only session, without waiting or running a frame.
|
| std::expected< ApplicationStep, ApplicationError > | step () |
| | Service one bounded input/dispatch/render/output cycle without waiting. Uses existing input/scheduler/preparation budgets and at most one frame and one flush. User callbacks and ready transport operations must themselves return in bounded time. EOF preserves run's cutoff: it drains admitted input/output, without waiting for a frame deadline.
|
| ApplicationStats | stats () const noexcept |
| std::expected< ApplicationStats, ApplicationError > | run (ApplicationScene &scene, std::stop_token stop={}) |
| | Open standard input/output and restore them before returning. Requires the default steady clock; an injected clock returns INVALID_OPTIONS before opening. EOF finishes decoding, delivers admitted CONTROL and flushes submitted output. It does not wait for future frame deadlines or promise a final repaint of accepted changes.
|
| std::expected< ApplicationStats, ApplicationError > | run (ApplicationScene &scene, ApplicationTerminal &terminal, std::stop_token stop={}) |
| | Run against a borrowed custom terminal; always close before returning once accepted. EOF has the same cutoff as the native overload: no final repaint or frame-cap exception. Finite replay must leave time before EOF when it needs a final visible frame.
|
One UI owner for scheduler, tree, routing and a single terminal run. All calls/destruction except requestStop require the creating thread. Scene owns typed nodes and bindings; release them before this object. Terminal I/O never runs inside layout/paint. No automatic recovery follows uncertain output. Run is single-use, including failed/closed sessions.
◆ background()
- Returns
- Borrowed executor for this session, or null when no background service was requested. UI-only. Never own or join the returned executor in a scene or callback. A borrowed host executor outlives cleanup; a default executor is available only during a synchronous run.
◆ create()
- Parameters
-
| options | Positive finite policies, copied into the owner. |
| clock | Borrowed monotonic millisecond service; null reader uses steady_clock. |
- Returns
- UI owner or explicit options/component/allocation error. Caller argument allocations are outside this boundary; arbitrary noexcept user constructors cannot be made recoverable.
◆ now()
- Returns
- Current monotonic logical milliseconds; injected clock must not move backwards.
◆ root()
| Node< Widget > portals::Application::root |
( |
| ) |
const |
|
noexcept |
- Returns
- Checked root observer valid until the tree closes.
◆ router()
- Returns
- Borrowed UI event router.
◆ run() [1/2]
Run against a borrowed custom terminal; always close before returning once accepted. EOF has the same cutoff as the native overload: no final repaint or frame-cap exception. Finite replay must leave time before EOF when it needs a final visible frame.
- Parameters
-
| scene | Borrowed scene which must outlive this call. |
| terminal | Exclusive transport borrowed through cleanup; no ownership transfer. |
| stop | Optional caller cancellation signal. |
- Returns
- Owning totals or detailed first failure and separate restoration error. The caller has already opened this terminal: default background startup occurs before scene callbacks, not before that external open. Final owned join follows the terminal close attempt.
◆ run() [2/2]
Open standard input/output and restore them before returning. Requires the default steady clock; an injected clock returns INVALID_OPTIONS before opening. EOF finishes decoding, delivers admitted CONTROL and flushes submitted output. It does not wait for future frame deadlines or promise a final repaint of accepted changes.
- Parameters
-
| scene | Borrowed scene which must outlive this call. |
| stop | Optional caller cancellation signal. |
- Returns
- Owning totals or detailed first failure and separate restoration error. Opt-in background workers start before native terminal open. After stop, coroutine retirement and terminal close attempt, a final explicit join may wait for cooperative user work.
◆ scheduler()
| Scheduler & portals::Application::scheduler |
( |
| ) |
|
|
noexcept |
- Returns
- Borrowed UI scheduler; publishers may retain its closed channel state.
◆ start()
Start the single permitted ready-only session, without waiting or running a frame.
- Parameters
-
| scene | Borrowed scene which must outlive session cleanup, including destructor cleanup. |
| terminal | Exclusive bounded transport borrowed through cleanup; no ownership transfer. |
| stop | Caller cancellation signal sampled at start and each step; retained safely until cleanup. |
- Returns
- Success, or the first start failure after cleanup once start was accepted. Wrong-thread, reentrant and repeated starts reject without changing the active session.
◆ stats()
- Returns
- Owning cumulative totals; call only on the UI owner thread outside concurrent operations.
◆ step()
Service one bounded input/dispatch/render/output cycle without waiting. Uses existing input/scheduler/preparation budgets and at most one frame and one flush. User callbacks and ready transport operations must themselves return in bounded time. EOF preserves run's cutoff: it drains admitted input/output, without waiting for a frame deadline.
- Returns
- Owning cumulative progress and completion, or the retained first failure after cleanup. NOT_STARTED, WRONG_THREAD and REENTRANT_OPERATION reject without stopping a session.
◆ tree()
- Returns
- Borrowed UI tree; observing handles do not extend its lifetime.
◆ widthPolicy()
| WidthPolicy portals::Application::widthPolicy |
( |
| ) |
const |
|
noexcept |
- Returns
- Shared width policy for text created by the scene.
The documentation for this class was generated from the following file: