Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::app Namespace Reference

Namespaces

namespace  details
 

Classes

class  AccessPolicy
 
class  App
 Application class. More...
 
struct  CleanUp
 CleanUp schedule - main cleanup. More...
 
struct  CleanUpStage
 CleanUpStage - cleanup/shutdown phase. More...
 
struct  DefaultRunnerConfig
 Configuration for the default runner. More...
 
class  DynamicModule
 
struct  DynamicModuleConfig
 Configuration for dynamic module loading. More...
 
struct  First
 First schedule - runs first in the UpdateStage. More...
 
struct  FixedTimestepRunnerConfig
 Configuration for the fixed timestep runner. More...
 
class  FrameAllocatorResource
 
struct  FrameLimitedRunnerConfig
 Configuration for the frame-limited runner. More...
 
class  FreeListAllocatorResource
 
struct  Last
 Last schedule - runs last in the UpdateStage. More...
 
struct  Main
 Main schedule - main thread execution. More...
 
struct  MainStage
 MainStage - main thread execution phase. More...
 
class  Module
 Base class for all modules. More...
 
struct  OnceRunnerConfig
 Configuration for the once runner. More...
 
class  PoolAllocatorResource
 
struct  PostCleanUp
 PostCleanUp schedule - runs after cleanup/shutdown. More...
 
struct  PostStartup
 PostStartup schedule - runs after startup initialization. More...
 
struct  PostUpdate
 PostUpdate schedule - runs after the main update. More...
 
struct  PreCleanUp
 PreCleanUp schedule - runs before cleanup/shutdown. More...
 
struct  PreStartup
 PreStartup schedule - runs before startup initialization. More...
 
struct  PreUpdate
 PreUpdate schedule - runs before the main update. More...
 
class  StackAllocatorResource
 
struct  Startup
 Startup schedule - main initialization. More...
 
struct  StartUpStage
 StartUpStage - application initialization phase. More...
 
class  SubApp
 A sub-application with its own ECS world, systems, and resources. More...
 
class  SystemConfig
 
class  SystemContext
 Per-system execution context with validated access. More...
 
class  SystemSetConfig
 
class  Time
 
struct  TimedRunnerConfig
 Configuration for the timed runner. More...
 
struct  Update
 Update schedule - main update logic. More...
 
struct  UpdateStage
 UpdateStage - main update logic phase. More...
 

Concepts

concept  ModuleTrait
 Concept to ensure a type is a valid Module.
 
concept  ModuleWithNameTrait
 Concept to check if a Module provides a GetName() method.
 
concept  ScheduleTrait
 
concept  ScheduleWithNameTrait
 
concept  ScheduleWithBeforeTrait
 Concept for schedules that provide Before() ordering constraints.
 
concept  ScheduleWithAfterTrait
 Concept for schedules that provide After() ordering constraints.
 
concept  ScheduleWithStageTrait
 Concept for schedules that declare stage membership.
 
concept  StageTrait
 Concept for schedules that represent stages.
 
concept  SubAppTrait
 Trait to identify valid sub-app types.
 
concept  SubAppWithNameTrait
 Trait to identify sub-apps with custom names.
 
concept  SubAppWithAsyncTrait
 
concept  SubAppWithMaxOverlappingUpdatesTrait
 
concept  SystemSetTrait
 Trait to identify valid system set types.
 
concept  SystemSetWithNameTrait
 Trait to identify system sets with custom names.
 

Typedefs

using CreateModuleFn = Module *(*)()
 Function signature for module creation.
 
using ModuleIdFn = ModuleTypeId(*)()
 Function signature for getting module type ID.
 
using ModuleNameFn = const char *(*)()
 Function signature for getting module name.
 
using ModuleTypeId = size_t
 
using ScheduleId = size_t
 Type alias for schedule type IDs.
 
using SubAppTypeId = size_t
 Type alias for sub-app type IDs.
 
using SystemSetId = size_t
 Type alias for system set type IDs.
 

Enumerations

enum class  AppExitCode : uint8_t { Success = 0 , Failure = 1 }
 Application exit codes. More...
 
enum class  DynamicModuleError : uint8_t {
  LibraryLoadFailed , CreateSymbolNotFound , IdSymbolNotFound , NameSymbolNotFound ,
  CreateFailed , NotLoaded , ReloadFailed , FileNotChanged
}
 Error codes for dynamic module operations. More...
 

Functions

constexpr std::string_view DynamicModuleErrorToString (DynamicModuleError error) noexcept
 Gets a human-readable description for a DynamicModuleError.
 
template<typename T >
constexpr ModuleTypeId ModuleTypeIdOf () noexcept
 
template<ModuleTrait T>
constexpr std::string_view ModuleNameOf () noexcept
 Gets the name of a module.
 
auto CheckShutdownEvent (App &app) noexcept -> std::pair< bool, ecs::ShutdownExitCode >
 Checks if a shutdown event has been received.
 
constexpr AppExitCode ToAppExitCode (ecs::ShutdownExitCode code) noexcept
 Converts shutdown exit code to app exit code.
 
AppExitCode DefaultRunner (App &app, DefaultRunnerConfig config={})
 
AppExitCode FrameLimitedRunner (App &app, FrameLimitedRunnerConfig config)
 
AppExitCode TimedRunner (App &app, TimedRunnerConfig config)
 
AppExitCode FixedTimestepRunner (App &app, FixedTimestepRunnerConfig config)
 
AppExitCode OnceRunner (App &app, OnceRunnerConfig config={})
 
template<ScheduleTrait T>
constexpr ScheduleId ScheduleIdOf () noexcept
 
template<ScheduleTrait T>
constexpr std::string_view ScheduleNameOf () noexcept
 
template<ScheduleTrait T>
constexpr auto ScheduleBeforeOf () noexcept
 Gets the Before() ordering constraints for a schedule.
 
template<ScheduleTrait T>
constexpr auto ScheduleAfterOf () noexcept
 Gets the After() ordering constraints for a schedule.
 
template<ScheduleTrait T>
constexpr bool IsStage () noexcept
 Checks if a schedule type is a stage.
 
template<ScheduleTrait T>
constexpr ScheduleId ScheduleStageOf () noexcept
 Gets the stage ID that a schedule belongs to.
 
template<SubAppTrait T>
constexpr bool SubAppAllowsOverlappingUpdates () noexcept
 Gets whether a sub-app allows overlapping updates.
 
template<SubAppTrait T>
constexpr size_t SubAppMaxOverlappingUpdates () noexcept
 Gets the maximum number of overlapping updates for a sub-app.
 
template<SubAppTrait T>
constexpr SubAppTypeId SubAppTypeIdOf () noexcept
 Type alias for module type IDs.
 
template<SubAppTrait T>
constexpr std::string_view SubAppNameOf () noexcept
 Gets the name of a sub-app type.
 
template<SystemSetTrait T>
constexpr SystemSetId SystemSetIdOf () noexcept
 Gets unique type ID for a system set type.
 
template<SystemSetTrait T>
constexpr std::string_view SystemSetNameOf () noexcept
 Gets the name of a system set type.
 

Variables

constexpr std::string_view kDefaultCreateSymbol = "helios_create_module"
 Default symbol name for the module creation function.
 
constexpr std::string_view kDefaultModuleIdSymbol = "helios_module_id"
 Default symbol name for the module ID function.
 
constexpr std::string_view kDefaultModuleNameSymbol = "helios_module_name"
 Default symbol name for the module name function.
 
constexpr Main kMain {}
 
constexpr PreStartup kPreStartup {}
 
constexpr Startup kStartup {}
 
constexpr PostStartup kPostStartup {}
 
constexpr First kFirst {}
 
constexpr PreUpdate kPreUpdate {}
 
constexpr Update kUpdate {}
 
constexpr PostUpdate kPostUpdate {}
 
constexpr Last kLast {}
 
constexpr PreCleanUp kPreCleanUp {}
 
constexpr CleanUp kCleanUp {}
 
constexpr PostCleanUp kPostCleanUp {}
 

Typedef Documentation

◆ CreateModuleFn

using helios::app::CreateModuleFn = typedef Module* (*)()

Function signature for module creation.

Dynamic modules must export a function with this signature. The function should create and return a new Module instance.

Definition at line 27 of file dynamic_module.hpp.

◆ ModuleIdFn

using helios::app::ModuleIdFn = typedef ModuleTypeId (*)()

Function signature for getting module type ID.

Dynamic modules must export a function with this signature. The function should return the unique type ID of the module.

Definition at line 34 of file dynamic_module.hpp.

◆ ModuleNameFn

using helios::app::ModuleNameFn = typedef const char* (*)()

Function signature for getting module name.

Dynamic modules must export a function with this signature. The function should return the name of the module as a null-terminated string.

Definition at line 41 of file dynamic_module.hpp.

◆ ModuleTypeId

◆ ScheduleId

using helios::app::ScheduleId = typedef size_t

Type alias for schedule type IDs.

Used to uniquely identify schedule types at runtime.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp, and /home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedules.hpp.

Definition at line 20 of file schedule.hpp.

◆ SubAppTypeId

◆ SystemSetId

using helios::app::SystemSetId = typedef size_t

Type alias for system set type IDs.

Used to uniquely identify system set types at runtime.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/system_set_config.hpp.

Definition at line 19 of file system_set.hpp.

Enumeration Type Documentation

◆ AppExitCode

enum class helios::app::AppExitCode : uint8_t
strong

Application exit codes.

Enumerator
Success 

Successful execution.

Failure 

General failure.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/app.hpp, and /home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 87 of file app.hpp.

87 : uint8_t {
88 Success = 0, ///< Successful execution
89 Failure = 1, ///< General failure
90};
@ Success
Successful execution.
@ Failure
General failure.

◆ DynamicModuleError

enum class helios::app::DynamicModuleError : uint8_t
strong

Error codes for dynamic module operations.

Enumerator
LibraryLoadFailed 

Failed to load the dynamic library.

CreateSymbolNotFound 

Module creation function not found.

IdSymbolNotFound 

Module ID function not found.

NameSymbolNotFound 

Module name function not found.

CreateFailed 

Module creation function returned nullptr.

NotLoaded 

Module is not loaded.

ReloadFailed 

Failed to reload module.

FileNotChanged 

File has not been modified.

Definition at line 61 of file dynamic_module.hpp.

61 : uint8_t {
62 LibraryLoadFailed, ///< Failed to load the dynamic library
63 CreateSymbolNotFound, ///< Module creation function not found
64 IdSymbolNotFound, ///< Module ID function not found
65 NameSymbolNotFound, ///< Module name function not found
66 CreateFailed, ///< Module creation function returned nullptr
67 NotLoaded, ///< Module is not loaded
68 ReloadFailed, ///< Failed to reload module
69 FileNotChanged, ///< File has not been modified
70};
@ CreateFailed
Module creation function returned nullptr.
@ FileNotChanged
File has not been modified.
@ IdSymbolNotFound
Module ID function not found.
@ ReloadFailed
Failed to reload module.
@ CreateSymbolNotFound
Module creation function not found.
@ NotLoaded
Module is not loaded.
@ LibraryLoadFailed
Failed to load the dynamic library.
@ NameSymbolNotFound
Module name function not found.

Function Documentation

◆ CheckShutdownEvent()

auto helios::app::CheckShutdownEvent ( App app) -> std::pair<bool, ecs::ShutdownExitCode>
inlinenoexcept

Checks if a shutdown event has been received.

Parameters
appApplication to check
Returns
Pair of (should_shutdown, exit_code)
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 24 of file runners.hpp.

24 {
25 const auto& world = app.GetMainWorld();
26
27 if (!world.HasEvent<ecs::ShutdownEvent>()) {
28 return {false, ecs::ShutdownExitCode::Success};
29 }
30
31 const auto reader = world.ReadEvents<ecs::ShutdownEvent>();
32 if (reader.Empty()) {
33 return {false, ecs::ShutdownExitCode::Success};
34 }
35
36 // Return the first shutdown event's exit code
37 const auto events = reader.Read();
38 return {true, events.front().exit_code};
39}
const ecs::World & GetMainWorld() const noexcept
Gets the main world.
Definition app.hpp:510
auto ReadEvents() const noexcept -> EventReader< T >
Gets an event reader for type T.
Definition world.hpp:985

◆ DefaultRunner()

AppExitCode helios::app::DefaultRunner ( App app,
DefaultRunnerConfig  config = {} 
)
inline
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 80 of file runners.hpp.

80 {}) {
81 try {
82 while (app.IsRunning()) {
83 if (config.update_time_resource) [[likely]] {
84 app.TickTime();
85 }
86
87 app.Update();
88
89 // Check for shutdown event
90 const auto [should_shutdown, exit_code] = CheckShutdownEvent(app);
91 if (should_shutdown) [[unlikely]] {
92 return ToAppExitCode(exit_code);
93 }
94 }
95 } catch (const std::exception& exception) {
96 HELIOS_CRITICAL("Application encountered an unhandled exception and will exit: {}!", exception.what());
97 return AppExitCode::Failure;
98 }
99
100 return AppExitCode::Success;
101}
bool IsRunning() const noexcept
Checks if the app is currently running.
Definition app.hpp:430
void TickTime() noexcept
Updates the Time resource for the current frame.
Definition app.cpp:206
void Update()
Updates the application and its subsystems.
Definition app.cpp:84
#define HELIOS_CRITICAL(...)
Definition logger.hpp:691
bool update_time_resource
Whether to automatically update the Time resource.
Definition runners.hpp:57

◆ DynamicModuleErrorToString()

constexpr std::string_view helios::app::DynamicModuleErrorToString ( DynamicModuleError  error)
constexprnoexcept

Gets a human-readable description for a DynamicModuleError.

Parameters
errorThe error code
Returns
String description of the error

Definition at line 77 of file dynamic_module.hpp.

77 {
78 switch (error) {
79 case DynamicModuleError::LibraryLoadFailed:
80 return "Failed to load dynamic library";
81 case DynamicModuleError::CreateSymbolNotFound:
82 return "Module creation function not found";
83 case DynamicModuleError::IdSymbolNotFound:
84 return "Module ID function not found";
85 case DynamicModuleError::NameSymbolNotFound:
86 return "Module name function not found";
87 case DynamicModuleError::CreateFailed:
88 return "Module creation function returned nullptr";
89 case DynamicModuleError::NotLoaded:
90 return "Module is not loaded";
91 case DynamicModuleError::ReloadFailed:
92 return "Failed to reload module";
93 case DynamicModuleError::FileNotChanged:
94 return "File has not been modified";
95 default:
96 return "Unknown error";
97 }
98}

◆ FixedTimestepRunner()

AppExitCode helios::app::FixedTimestepRunner ( App app,
FixedTimestepRunnerConfig  config 
)
inline
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 244 of file runners.hpp.

244 {
245 try {
246 using Duration = std::chrono::duration<float>;
247
248 const Duration fixed_delta{config.fixed_delta_seconds};
249 Duration accumulator{0.0F};
250
251 Timer frame_timer;
252 while (app.IsRunning()) {
253 // Calculate frame time using Timer
254 const auto frame_time = frame_timer.ElapsedDuration<Duration>();
255 frame_timer.Reset();
256
257 accumulator += frame_time;
258
259 // Limit the number of substeps to prevent spiral of death
260 uint32_t substeps = 0;
261 while (accumulator >= fixed_delta && substeps < config.max_substeps) {
262 if (config.update_time_resource) [[likely]] {
263 app.TickTime();
264 }
265
266 app.Update();
267 accumulator -= fixed_delta;
268 ++substeps;
269
270 // Check for shutdown event
271 const auto [should_shutdown, exit_code] = CheckShutdownEvent(app);
272 if (should_shutdown) [[unlikely]] {
273 return ToAppExitCode(exit_code);
274 }
275 }
276
277 // If we hit max substeps, clamp accumulator to prevent runaway
278 if (substeps >= config.max_substeps && accumulator >= fixed_delta) {
279 HELIOS_WARN("Fixed timestep runner hit max substeps ({}), clamping accumulator", config.max_substeps);
280 accumulator = Duration{0.0F};
281 }
282 }
283 } catch (const std::exception& exception) {
284 HELIOS_CRITICAL("Application encountered an unhandled exception and will exit: {}!", exception.what());
285 return AppExitCode::Failure;
286 }
287
288 return AppExitCode::Success;
289}
#define HELIOS_WARN(...)
Definition logger.hpp:687
auto CheckShutdownEvent(App &app) noexcept -> std::pair< bool, ecs::ShutdownExitCode >
Checks if a shutdown event has been received.
Definition runners.hpp:24
constexpr AppExitCode ToAppExitCode(ecs::ShutdownExitCode code) noexcept
Converts shutdown exit code to app exit code.
Definition runners.hpp:44
float fixed_delta_seconds
Fixed timestep in seconds (default: 60 FPS)
Definition runners.hpp:218
bool update_time_resource
Whether to automatically update the Time resource.
Definition runners.hpp:220
uint32_t max_substeps
Maximum physics substeps per frame to prevent spiral of death.
Definition runners.hpp:219

◆ FrameLimitedRunner()

AppExitCode helios::app::FrameLimitedRunner ( App app,
FrameLimitedRunnerConfig  config 
)
inline
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 131 of file runners.hpp.

131 {
132 try {
133 uint64_t frame = 0;
134 while (app.IsRunning() && frame < config.max_frames) {
135 if (config.update_time_resource) [[likely]] {
136 app.TickTime();
137 }
138
139 app.Update();
140 ++frame;
141
142 // Check for shutdown event
143 const auto [should_shutdown, exit_code] = CheckShutdownEvent(app);
144 if (should_shutdown) [[unlikely]] {
145 return ToAppExitCode(exit_code);
146 }
147 }
148 } catch (const std::exception& exception) {
149 HELIOS_CRITICAL("Application encountered an unhandled exception and will exit: {}!", exception.what());
150 return AppExitCode::Failure;
151 }
152
153 return AppExitCode::Success;
154}
uint64_t max_frames
Maximum number of frames to run.
Definition runners.hpp:107
bool update_time_resource
Whether to automatically update the Time resource.
Definition runners.hpp:108

◆ IsStage()

template<ScheduleTrait T>
constexpr bool helios::app::IsStage ( )
constexprnoexcept

Checks if a schedule type is a stage.

Template Parameters
TSchedule type
Returns
True if the schedule is a stage, false otherwise
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp.

Definition at line 185 of file schedule.hpp.

185 {
186 if constexpr (StageTrait<T>) {
187 return T::IsStage();
188 } else {
189 return false;
190 }
191}
Concept for schedules that represent stages.
Definition schedule.hpp:175

◆ ModuleNameOf()

template<ModuleTrait T>
constexpr std::string_view helios::app::ModuleNameOf ( )
constexprnoexcept

Gets the name of a module.

Returns provided name or type name as fallback.

Template Parameters
TModule type
Returns
Module name

Definition at line 98 of file module.hpp.

98 {
99 if constexpr (ModuleWithNameTrait<T>) {
100 return T::GetName();
101 } else {
102 return ctti::name_of<T>();
103 }
104}
Concept to check if a Module provides a GetName() method.
Definition module.hpp:80

◆ ModuleTypeIdOf()

template<typename T >
constexpr ModuleTypeId helios::app::ModuleTypeIdOf ( )
constexprnoexcept

Definition at line 87 of file module.hpp.

87 {
88 return ctti::type_index_of<T>().hash();
89}

◆ OnceRunner()

AppExitCode helios::app::OnceRunner ( App app,
OnceRunnerConfig  config = {} 
)
inline
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 315 of file runners.hpp.

315 {}) {
316 try {
317 if (app.IsRunning()) {
318 if (config.update_time_resource) [[likely]] {
319 app.TickTime();
320 }
321
322 app.Update();
323 }
324 } catch (const std::exception& exception) {
325 HELIOS_CRITICAL("Application encountered an unhandled exception and will exit: {}!", exception.what());
326 return AppExitCode::Failure;
327 }
328
329 return AppExitCode::Success;
330}
bool update_time_resource
Whether to update the Time resource.
Definition runners.hpp:295

◆ ScheduleAfterOf()

template<ScheduleTrait T>
constexpr auto helios::app::ScheduleAfterOf ( )
constexprnoexcept

Gets the After() ordering constraints for a schedule.

Returns schedules that must run after this schedule. If the schedule doesn't provide After(), returns empty array.

Template Parameters
TSchedule type
Returns
Array of schedule IDs that must run after T
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp.

Definition at line 142 of file schedule.hpp.

142 {
143 if constexpr (ScheduleWithAfterTrait<T>) {
144 return T::After();
145 } else {
146 return std::array<ScheduleId, 0>{};
147 }
148}
Concept for schedules that provide After() ordering constraints.
Definition schedule.hpp:114

◆ ScheduleBeforeOf()

template<ScheduleTrait T>
constexpr auto helios::app::ScheduleBeforeOf ( )
constexprnoexcept

Gets the Before() ordering constraints for a schedule.

Returns schedules that must run before this schedule. If the schedule doesn't provide Before(), returns empty array.

Template Parameters
TSchedule type
Returns
Array of schedule IDs that must run before T
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp.

Definition at line 126 of file schedule.hpp.

126 {
127 if constexpr (ScheduleWithBeforeTrait<T>) {
128 return T::Before();
129 } else {
130 return std::array<ScheduleId, 0>{};
131 }
132}
Concept for schedules that provide Before() ordering constraints.
Definition schedule.hpp:104

◆ ScheduleIdOf()

template<ScheduleTrait T>
constexpr ScheduleId helios::app::ScheduleIdOf ( )
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp.

Definition at line 71 of file schedule.hpp.

71 {
72 return ctti::type_index_of<T>().hash();
73}

◆ ScheduleNameOf()

template<ScheduleTrait T>
constexpr std::string_view helios::app::ScheduleNameOf ( )
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp.

Definition at line 90 of file schedule.hpp.

90 {
91 if constexpr (ScheduleWithNameTrait<T>) {
92 return T::GetName();
93 } else {
94 return ctti::name_of<T>();
95 }
96}

◆ ScheduleStageOf()

template<ScheduleTrait T>
constexpr ScheduleId helios::app::ScheduleStageOf ( )
constexprnoexcept

Gets the stage ID that a schedule belongs to.

If the schedule declares a stage via GetStage(), returns that stage ID. If the schedule is itself a stage, returns its own ID. Otherwise, returns 0 to indicate it's not associated with any stage.

Template Parameters
TSchedule type
Returns
Stage ID that this schedule belongs to, or 0 if not in a stage
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/schedule.hpp.

Definition at line 203 of file schedule.hpp.

203 {
204 if constexpr (ScheduleWithStageTrait<T>) {
205 return T::GetStage();
206 } else if constexpr (IsStage<T>()) {
207 return ScheduleIdOf<T>();
208 } else {
209 return 0;
210 }
211}
Concept for schedules that declare stage membership.
Definition schedule.hpp:160

◆ SubAppAllowsOverlappingUpdates()

template<SubAppTrait T>
constexpr bool helios::app::SubAppAllowsOverlappingUpdates ( )
constexprnoexcept

Gets whether a sub-app allows overlapping updates.

Template Parameters
TSub-app type
Returns
True if overlapping updates are allowed, false otherwise
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/sub_app.hpp.

Definition at line 103 of file sub_app.hpp.

103 {
104 if constexpr (SubAppWithAsyncTrait<T>) {
105 return T::AllowOverlappingUpdates();
106 } else {
107 return false; // Default: no overlapping updates
108 }
109}

◆ SubAppMaxOverlappingUpdates()

template<SubAppTrait T>
constexpr size_t helios::app::SubAppMaxOverlappingUpdates ( )
constexprnoexcept

Gets the maximum number of overlapping updates for a sub-app.

Template Parameters
TSub-app type
Returns
Maximum overlapping updates, or 0 if not specified
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/sub_app.hpp.

Definition at line 117 of file sub_app.hpp.

117 {
119 return T::GetMaxOverlappingUpdates();
120 } else {
121 return 0; // Default: no limit
122 }
123}

◆ SubAppNameOf()

template<SubAppTrait T>
constexpr std::string_view helios::app::SubAppNameOf ( )
constexprnoexcept

Gets the name of a sub-app type.

Template Parameters
TSub-app type
Returns
Name of the sub-app
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/sub_app.hpp.

Definition at line 146 of file sub_app.hpp.

146 {
147 if constexpr (SubAppWithNameTrait<T>) {
148 return T::GetName();
149 } else {
150 return ctti::name_of<T>();
151 }
152}
Trait to identify sub-apps with custom names.
Definition sub_app.hpp:51

◆ SubAppTypeIdOf()

template<SubAppTrait T>
constexpr SubAppTypeId helios::app::SubAppTypeIdOf ( )
constexprnoexcept

Type alias for module type IDs.

Template Parameters
TModule type
Returns
Unique type ID for the module
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/sub_app.hpp.

Definition at line 136 of file sub_app.hpp.

136 {
137 return ctti::type_index_of<T>().hash();
138}

◆ SystemSetIdOf()

template<SystemSetTrait T>
constexpr SystemSetId helios::app::SystemSetIdOf ( )
constexprnoexcept

Gets unique type ID for a system set type.

Uses CTTI to generate a unique hash for the system set type. The ID is consistent across compilation units.

Template Parameters
TSystem set type
Returns
Unique type ID for the system set

Definition at line 49 of file system_set.hpp.

49 {
50 return ctti::type_index_of<T>().hash();
51}

◆ SystemSetNameOf()

template<SystemSetTrait T>
constexpr std::string_view helios::app::SystemSetNameOf ( )
constexprnoexcept

Gets the name of a system set type.

Returns the custom name if GetName() is provided, otherwise returns the CTTI-generated type name.

Template Parameters
TSystem set type
Returns
Name of the system set

Definition at line 61 of file system_set.hpp.

61 {
62 if constexpr (SystemSetWithNameTrait<T>) {
63 return T::GetName();
64 } else {
65 return ctti::name_of<T>();
66 }
67}
Trait to identify system sets with custom names.

◆ TimedRunner()

AppExitCode helios::app::TimedRunner ( App app,
TimedRunnerConfig  config 
)
inline
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 184 of file runners.hpp.

184 {
185 try {
186 const auto duration_seconds = static_cast<double>(config.duration_seconds);
187
188 Timer timer;
189 while (app.IsRunning()) {
190 if (timer.ElapsedSec() >= duration_seconds) {
191 break;
192 }
193
194 if (config.update_time_resource) [[likely]] {
195 app.TickTime();
196 }
197
198 app.Update();
199
200 // Check for shutdown event
201 const auto [should_shutdown, exit_code] = CheckShutdownEvent(app);
202 if (should_shutdown) [[unlikely]] {
203 return ToAppExitCode(exit_code);
204 }
205 }
206 } catch (const std::exception& exception) {
207 HELIOS_CRITICAL("Application encountered an unhandled exception and will exit: {}!", exception.what());
208 return AppExitCode::Failure;
209 }
210
211 return AppExitCode::Success;
212}
High–resolution timer with configurable clock and rich elapsed API.
Definition timer.hpp:64
constexpr double ElapsedSec() const
Elapsed time in seconds as double.
Definition timer.hpp:111
float duration_seconds
Duration to run in seconds.
Definition runners.hpp:160
bool update_time_resource
Whether to automatically update the Time resource.
Definition runners.hpp:161

◆ ToAppExitCode()

constexpr AppExitCode helios::app::ToAppExitCode ( ecs::ShutdownExitCode  code)
constexprnoexcept

Converts shutdown exit code to app exit code.

Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/app/runners.hpp.

Definition at line 44 of file runners.hpp.

44 {
45 switch (code) {
46 case ecs::ShutdownExitCode::Success:
47 return AppExitCode::Success;
48 default:
49 return AppExitCode::Failure;
50 }
51}

Variable Documentation

◆ kCleanUp

constexpr CleanUp helios::app::kCleanUp {}
inlineconstexpr

◆ kDefaultCreateSymbol

constexpr std::string_view helios::app::kDefaultCreateSymbol = "helios_create_module"
inlineconstexpr

Default symbol name for the module creation function.

Definition at line 46 of file dynamic_module.hpp.

◆ kDefaultModuleIdSymbol

constexpr std::string_view helios::app::kDefaultModuleIdSymbol = "helios_module_id"
inlineconstexpr

Default symbol name for the module ID function.

Definition at line 51 of file dynamic_module.hpp.

◆ kDefaultModuleNameSymbol

constexpr std::string_view helios::app::kDefaultModuleNameSymbol = "helios_module_name"
inlineconstexpr

Default symbol name for the module name function.

Definition at line 56 of file dynamic_module.hpp.

◆ kFirst

constexpr First helios::app::kFirst {}
inlineconstexpr

◆ kLast

constexpr Last helios::app::kLast {}
inlineconstexpr

◆ kMain

constexpr Main helios::app::kMain {}
inlineconstexpr

◆ kPostCleanUp

constexpr PostCleanUp helios::app::kPostCleanUp {}
inlineconstexpr

◆ kPostStartup

constexpr PostStartup helios::app::kPostStartup {}
inlineconstexpr

◆ kPostUpdate

constexpr PostUpdate helios::app::kPostUpdate {}
inlineconstexpr

◆ kPreCleanUp

constexpr PreCleanUp helios::app::kPreCleanUp {}
inlineconstexpr

◆ kPreStartup

constexpr PreStartup helios::app::kPreStartup {}
inlineconstexpr

◆ kPreUpdate

constexpr PreUpdate helios::app::kPreUpdate {}
inlineconstexpr

◆ kStartup

constexpr Startup helios::app::kStartup {}
inlineconstexpr

◆ kUpdate

constexpr Update helios::app::kUpdate {}
inlineconstexpr