Class Startup

Class Documentation

class Startup

Declaration: final

Registers command-line options and performs one synchronous initialization.

The object is not synchronized or movable. Initialize on the platform owner; returned contexts retain their backend’s lifetime and thread requirements. Owns a nested process logging guard. Keep Startup alive through the returned context/game, or retain an outer Logging::ProcessLifetime until they finish.

Public Functions

explicit Startup(StartupBackend backend, std::string description = "Cheryl application", StartupOptions configuration = {})

Register common/backend options without constructing native context state.

See also

Detailed guide

Parameters:
  • backend – Owned callbacks with required create factory.

  • description – Owned description used in CLI help.

  • configuration – Initial execution/runtime settings, overridden by registered arguments.

Throws:

CE::Exceptions::invalid_args – For a missing factory. Registration/allocation callback failures propagate. Startup owns a nested ProcessLifetime; keep it or an outer guard alive until all returned context/game work finishes. Callback-bound values must remain alive through initialize().

Startup(const Startup&) = delete

Copy/move is disabled because registered callbacks bind this object’s stable configuration address.

See also

Detailed guide

Startup &operator=(const Startup&) = delete

Copy/move is disabled because registered callbacks bind this object’s stable configuration address.

See also

Detailed guide

Startup(Startup&&) = delete

Copy/move is disabled because registered callbacks bind this object’s stable configuration address.

See also

Detailed guide

Startup &operator=(Startup&&) = delete

Copy/move is disabled because registered callbacks bind this object’s stable configuration address.

See also

Detailed guide

void add_application_options(const OptionDefinitions &definitions)

Invoke an application registrar immediately before initialization.

See also

Detailed guide

Parameters:

definitions – Nonempty callback borrowing the application CLI option group.

Throws:
StartupResult initialize(int argc, const char *const *argv)

Declaration: [[nodiscard]]

Parse, validate and construct a context once on the platform owner.

See also

Detailed guide

Parameters:
  • argc – Positive count including the executable name.

  • argv – Non-null array of argc non-null argument strings, borrowed for parsing.

Throws:
  • CE::Exceptions::failed_operation – For reuse or a factory returning nullptr.

  • CE::Exceptions::invalid_args – For malformed argument arrays before parsing. CLI parse errors and configuration invalid_args return before context creation. Other backend/allocation failures propagate. Once valid arrays begin parsing the object is consumed even if initialization returns help/error or throws; it is not synchronized.

Returns:

Owned context/runtime policy, or empty context plus help/validation exit_code.