Class Updater

Class Documentation

class Updater

Declaration: final

Retains the last complete text while replacing it asynchronously.

Construct on platform during initialization, then use from the simulation owner. Calls require serialization; destruction after quiescence may run on platform. CPU work uses a Context-tracked worker group; uploads use its dispatcher. No job borrows this updater or the game. Destruction never waits for jobs.

Public Functions

explicit Updater(CE::Runtime::Context &engine)

Construct on the platform owner with no current generation.

Capture the current default Font, a Context-tracked worker group and its platform submission endpoint. First request()/update() publishes asynchronously; construction/allocation failures propagate.

Updater(CE::Runtime::Context &engine, Request initial)

Synchronously prepare/upload the initial request on the graphics owner/current context.

An empty font uses the captured engine default. Initial errors propagate from construction; later asynchronous errors are retained by failure().

See also

Retained updates

~Updater()

Destroy after serialized callers quiesce; platform teardown is allowed after simulation joins.

Destruction never waits for jobs: submitted work owns its request and borrows neither updater nor game. Retained current generations remain independent; native use still needs their backend domain.

Updater(const Updater&) = delete
Updater &operator=(const Updater&) = delete
void request(Request next)

Own the newest desired request.

Equal content/options and font/material snapshot identities do not resubmit or retry. A distinct request clears the previous failure; empty font selects the captured default. Revision exhaustion throws failed_operation. No preparation/upload is started until update().

bool update()

Advance without waiting, adopting a ready complete generation and starting the newest desired work when idle.

At most one active replacement plus one newest desired request is retained; an older active success is adopted before its successor starts. Submission/preparation/upload failures preserve current() and are observed through failure().

Returns:

Whether current() changed during this call.

void retry()

Requeue an unchanged failed request explicitly, clearing its failure.

No effect while pending or after success; revision exhaustion throws. Call update() to start the retry; there is no automatic busy retry.

bool pending() const noexcept

Declaration: [[nodiscard]]

Return whether preparation/upload or an unsettled desired revision exists.

This is a serialized observation, not permission for concurrent calls.

std::shared_ptr<const Generation> current() const noexcept

Declaration: [[nodiscard]]

Return a retained immutable complete generation, initially null for the empty constructor.

Failure never replaces it; retaining the handle does not retain a live graphics context.

std::optional<Failure> failure() const noexcept

Declaration: [[nodiscard]]

Copy the last failure since a distinct request/retry.

A newer already-queued success need not clear it; use revision to identify the event. No failure is reported for synchronous construction errors, which propagate.