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

Namespaces

namespace  anonymous_namespace{assert.cpp}
 
namespace  app
 
namespace  async
 
namespace  container
 
namespace  details
 
namespace  ecs
 
namespace  example
 
namespace  memory
 
namespace  utils
 

Classes

struct  DefaultLogger
 Default logger type. More...
 
class  Delegate
 Type-erased callable wrapper for free and member functions. More...
 
class  Delegate< ReturnType(Args...)>
 
class  Logger
 Centralized logging system with configurable output and formatting. More...
 
struct  LoggerConfig
 Configuration for logger behavior and output. More...
 
class  RandomGenerator
 Random number utilities with a user-provided engine. More...
 
class  Timer
 High–resolution timer with configurable clock and rich elapsed API. More...
 
class  Timestep
 Represents a time step in seconds. More...
 
class  Uuid
 A class representing a universally unique identifier (UUID). More...
 
class  UuidGenerator
 A class for generating random UUIDs using a specified random number generator. More...
 

Concepts

concept  LoggerTrait
 
concept  LoggerWithConfigTrait
 
concept  RandomEngine
 Concept for random number engines compatible with std distributions.
 
concept  Distribution
 Concept for standard-like distributions.
 

Typedefs

using LoggerId = size_t
 Type alias for logger type IDs.
 
using DefaultRandomEngine = std::mt19937_64
 Default engine type used by random utilities.
 
using FastRandomEngine = std::minstd_rand
 Fast but lower-quality engine type used by random utilities.
 
using DefaultRandomGenerator = RandomGenerator< DefaultRandomEngine >
 Convenience alias for a generator using the default-quality engine.
 
using FastRandomGeneratorType = RandomGenerator< FastRandomEngine >
 Convenience alias for a generator using the fast engine.
 

Enumerations

enum class  LogLevel : uint8_t {
  kTrace = 0 , kDebug = 1 , kInfo = 2 , kWarn = 3 ,
  kError = 4 , kCritical = 5
}
 Log severity levels. More...
 

Functions

void AbortWithStacktrace (std::string_view message) noexcept
 Prints a message with stack trace and aborts the program execution.
 
template<auto Func>
requires (!std::is_member_function_pointer_v<decltype(Func)>)
constexpr auto DelegateFromFunction () noexcept
 Helper to create delegate from free function pointer.
 
template<typename Signature , Signature Func>
requires (!std::is_member_function_pointer_v<decltype(Func)>)
constexpr auto DelegateFromFunction () noexcept
 Helper to create delegate from free function pointer with explicit signature.
 
template<auto Func>
requires std::is_member_function_pointer_v<decltype(Func)>
constexpr auto DelegateFromFunction (typename details::MemberFunctionTraits< decltype(Func)>::Class &instance) noexcept
 Helper to create delegate from member function pointer.
 
template<typename Signature , Signature Func>
requires std::is_member_function_pointer_v<decltype(Func)>
constexpr auto DelegateFromFunction (typename details::MemberFunctionTraits< Signature >::Class &instance) noexcept
 Helper to create delegate from member function pointer with explicit signature.
 
template<LoggerTrait T>
constexpr LoggerId LoggerIdOf () noexcept
 
template<LoggerTrait T>
constexpr std::string_view LoggerNameOf () noexcept
 
template<LoggerTrait T>
LoggerConfig LoggerConfigOf () noexcept
 
uint64_t RandomDeviceSeed ()
 Internal helper to obtain seed from std::random_device.
 
DefaultRandomEngine MakeDefaultEngine ()
 Creates a default-quality random engine seeded with std::random_device.
 
FastRandomEngine MakeFastEngine ()
 Creates a fast linear random engine seeded with std::random_device.
 
DefaultRandomEngineDefaultEngine ()
 Thread-local default-quality engine.
 
FastRandomEngineFastEngineInstance ()
 Thread-local fast engine.
 
DefaultRandomGeneratorRandomDefault ()
 Provides access to a thread-local default-quality random generator.
 
FastRandomGeneratorTypeRandomFast ()
 Provides access to a thread-local fast random generator.
 
template<utils::ArithmeticTrait T>
RandomValue ()
 Convenience function to generate a default-distribution value using the default engine.
 
template<utils::ArithmeticTrait T, utils::ArithmeticTrait U>
auto RandomValueFromRange (T min, U max) -> std::common_type_t< T, U >
 Convenience function to generate a value in range using the default engine.
 
template<utils::ArithmeticTrait T>
RandomFastValue ()
 Convenience function to generate a default-distribution value using the fast engine.
 
template<utils::ArithmeticTrait T, utils::ArithmeticTrait U>
auto RandomFastValueFromRange (T min, U max) -> std::common_type_t< T, U >
 Convenience function to generate a value in range using the fast engine.
 

Variables

constexpr DefaultLogger kDefaultLogger {}
 Constexpr instance of the default logger for easier user interface.
 

Typedef Documentation

◆ DefaultRandomEngine

using helios::DefaultRandomEngine = typedef std::mt19937_64

Default engine type used by random utilities.

Uses a 64-bit Mersenne Twister for quality pseudorandom numbers.

Definition at line 42 of file random.hpp.

◆ DefaultRandomGenerator

Convenience alias for a generator using the default-quality engine.

Uses thread-local DefaultEngine() as the underlying engine.

Definition at line 228 of file random.hpp.

◆ FastRandomEngine

using helios::FastRandomEngine = typedef std::minstd_rand

Fast but lower-quality engine type used by random utilities.

Uses a 32-bit linear congruential engine suitable for non-cryptographic, performance-critical scenarios.

Definition at line 48 of file random.hpp.

◆ FastRandomGeneratorType

Convenience alias for a generator using the fast engine.

Uses thread-local FastEngineInstance() as the underlying engine.

Definition at line 234 of file random.hpp.

◆ LoggerId

using helios::LoggerId = typedef size_t

Type alias for logger type IDs.

Used to uniquely identify logger types at runtime.

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

Definition at line 106 of file logger.hpp.

Enumeration Type Documentation

◆ LogLevel

enum class helios::LogLevel : uint8_t
strong

Log severity levels.

Enumerator
kTrace 
kDebug 
kInfo 
kWarn 
kError 
kCritical 
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/logger.hpp.

Definition at line 34 of file logger.hpp.

Function Documentation

◆ AbortWithStacktrace()

void helios::AbortWithStacktrace ( std::string_view  message)
noexcept

Prints a message with stack trace and aborts the program execution.

Useful for placing in dead code branches or unreachable states.

Parameters
messageThe message to print before aborting

Definition at line 89 of file assert.cpp.

89 {
90#if defined(__cpp_lib_print) && (__cpp_lib_print >= 202302L)
91 // Use std::println when available (C++23)
92 std::println("\n=== FATAL ERROR ===");
93 std::println("Message: {}", message);
94
95#ifdef HELIOS_ENABLE_STACKTRACE
96 PrintStackTrace();
97#else
98 std::println("\nStack trace: <not available - build with HELIOS_ENABLE_STACKTRACE>");
99#endif
100
101 std::println("===================\n");
102 std::fflush(stdout);
103#else
104 // Fallback to fprintf to stderr when std::println is not available
105 std::fprintf(stderr, "\n=== FATAL ERROR ===\n");
106 std::fprintf(stderr, "Message: %.*s\n", static_cast<int>(message.size()), message.data());
107
108#ifdef HELIOS_ENABLE_STACKTRACE
109 PrintStackTrace();
110#else
111 std::fprintf(stderr, "\nStack trace: <not available - build with HELIOS_ENABLE_STACKTRACE>\n");
112#endif
113
114 std::fprintf(stderr, "===================\n\n");
115 std::fflush(stderr);
116#endif
117
119 std::abort();
120}
#define HELIOS_DEBUG_BREAK()
Definition core.hpp:89

◆ DefaultEngine()

DefaultRandomEngine & helios::DefaultEngine ( )
inline

Thread-local default-quality engine.

Uses Meyer's singleton pattern per thread to avoid global static initialization order issues while providing a convenient default.

Returns
Reference to thread-local DefaultRandomEngine instance.

Definition at line 100 of file random.hpp.

100 {
101 thread_local auto engine = MakeDefaultEngine();
102 return engine;
103}
DefaultRandomEngine MakeDefaultEngine()
Creates a default-quality random engine seeded with std::random_device.
Definition random.hpp:80

◆ DelegateFromFunction() [1/4]

template<auto Func>
requires (!std::is_member_function_pointer_v<decltype(Func)>)
constexpr auto helios::DelegateFromFunction ( )
constexprnoexcept

Helper to create delegate from free function pointer.

Template Parameters
FuncFree function pointer
Returns
Delegate bound to the given free function

Definition at line 429 of file delegate.hpp.

429 {
430 using Traits = details::FreeFunctionTraits<decltype(Func)>;
431 using ReturnType = typename Traits::ReturnType;
432 using Args = typename Traits::Arguments;
433
434 return []<std::size_t... I>(std::index_sequence<I...>) {
435 return Delegate<ReturnType(std::tuple_element_t<I, Args>...)>::template FromFunction<Func>();
436 }(std::make_index_sequence<std::tuple_size_v<Args>>{});
437}
Type-erased callable wrapper for free and member functions.
Definition delegate.hpp:85
Traits for free function pointers.
Definition delegate.hpp:28

◆ DelegateFromFunction() [2/4]

template<typename Signature , Signature Func>
requires (!std::is_member_function_pointer_v<decltype(Func)>)
constexpr auto helios::DelegateFromFunction ( )
constexprnoexcept

Helper to create delegate from free function pointer with explicit signature.

Template Parameters
SignatureFree function pointer type
FuncFree function pointer value
Returns
Delegate bound to the given free function

Definition at line 447 of file delegate.hpp.

447 {
449 using ReturnType = typename Traits::ReturnType;
450 using Args = typename Traits::Arguments;
451
452 return []<std::size_t... I>(std::index_sequence<I...>) {
453 return Delegate<ReturnType(std::tuple_element_t<I, Args>...)>::template FromFunction<Signature, Func>();
454 }(std::make_index_sequence<std::tuple_size_v<Args>>{});
455}

◆ DelegateFromFunction() [3/4]

template<auto Func>
requires std::is_member_function_pointer_v<decltype(Func)>
constexpr auto helios::DelegateFromFunction ( typename details::MemberFunctionTraits< decltype(Func)>::Class &  instance)
constexprnoexcept

Helper to create delegate from member function pointer.

Template Parameters
FuncMember function pointer
Parameters
instanceReference to the object instance used for invocation
Returns
Delegate bound to the given member function and instance

Definition at line 465 of file delegate.hpp.

465 {
466 using Traits = details::MemberFunctionTraits<decltype(Func)>;
467 using ReturnType = typename Traits::ReturnType;
468 using Args = typename Traits::Arguments;
469
470 return []<std::size_t... I>(std::index_sequence<I...>, auto& inst) {
471 return Delegate<ReturnType(std::tuple_element_t<I, Args>...)>::template FromFunction<Func>(inst);
472 }(std::make_index_sequence<std::tuple_size_v<Args>>{}, instance);
473}
Traits for member function pointers (non-const and const).
Definition delegate.hpp:40

◆ DelegateFromFunction() [4/4]

template<typename Signature , Signature Func>
requires std::is_member_function_pointer_v<decltype(Func)>
constexpr auto helios::DelegateFromFunction ( typename details::MemberFunctionTraits< Signature >::Class &  instance)
constexprnoexcept

Helper to create delegate from member function pointer with explicit signature.

Template Parameters
SignatureMember function pointer type
FuncMember function pointer value
Parameters
instanceReference to the object instance used for invocation
Returns
Delegate bound to the given member function and instance

Definition at line 484 of file delegate.hpp.

484 {
486 using ReturnType = typename Traits::ReturnType;
487 using Args = typename Traits::Arguments;
488
489 return []<std::size_t... I>(std::index_sequence<I...>, auto& inst) {
490 return Delegate<ReturnType(std::tuple_element_t<I, Args>...)>::template FromFunction<Signature, Func>(inst);
491 }(std::make_index_sequence<std::tuple_size_v<Args>>{}, instance);
492}

◆ FastEngineInstance()

FastRandomEngine & helios::FastEngineInstance ( )
inline

Thread-local fast engine.

Uses Meyer's singleton pattern per thread to avoid global static initialization order issues while providing a fast default.

Returns
Reference to thread-local FastRandomEngine instance.

Definition at line 111 of file random.hpp.

111 {
112 thread_local auto engine = MakeFastEngine();
113 return engine;
114}
FastRandomEngine MakeFastEngine()
Creates a fast linear random engine seeded with std::random_device.
Definition random.hpp:90

◆ LoggerConfigOf()

template<LoggerTrait T>
LoggerConfig helios::LoggerConfigOf ( )
inlinenoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/logger.hpp.

Definition at line 200 of file logger.hpp.

200 {
201 if constexpr (LoggerWithConfigTrait<T>) {
202 return T::Config();
203 } else {
204 return LoggerConfig::Default();
205 }
206}

◆ LoggerIdOf()

template<LoggerTrait T>
constexpr LoggerId helios::LoggerIdOf ( )
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/logger.hpp.

Definition at line 160 of file logger.hpp.

160 {
161 return ctti::type_index_of<T>().hash();
162}

◆ LoggerNameOf()

template<LoggerTrait T>
constexpr std::string_view helios::LoggerNameOf ( )
constexprnoexcept
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/logger.hpp.

Definition at line 179 of file logger.hpp.

179 {
180 return T::Name();
181}

◆ MakeDefaultEngine()

DefaultRandomEngine helios::MakeDefaultEngine ( )
inline

Creates a default-quality random engine seeded with std::random_device.

Useful when the caller wants an engine instance but does not care a specific engine type beyond the default choice.

Returns
DefaultRandomEngine instance seeded with random_device.

Definition at line 80 of file random.hpp.

80 {
81 return DefaultRandomEngine{static_cast<DefaultRandomEngine::result_type>(RandomDeviceSeed())};
82}
std::mt19937_64 DefaultRandomEngine
Default engine type used by random utilities.
Definition random.hpp:42
uint64_t RandomDeviceSeed()
Internal helper to obtain seed from std::random_device.
Definition random.hpp:55

◆ MakeFastEngine()

FastRandomEngine helios::MakeFastEngine ( )
inline

Creates a fast linear random engine seeded with std::random_device.

Intended for performance-critical code where statistical quality is less important. Not suitable for cryptographic purposes.

Returns
FastRandomEngine instance seeded with random_device.

Definition at line 90 of file random.hpp.

90 {
91 return FastRandomEngine{static_cast<FastRandomEngine::result_type>(RandomDeviceSeed())};
92}
std::minstd_rand FastRandomEngine
Fast but lower-quality engine type used by random utilities.
Definition random.hpp:48

◆ RandomDefault()

DefaultRandomGenerator & helios::RandomDefault ( )
inline

Provides access to a thread-local default-quality random generator.

Uses Meyer's singleton pattern per thread and avoids any static engine objects other than thread-local instances that are lazily initialized on first use.

Returns
Reference to DefaultRandomGenerator bound to DefaultEngine().

Definition at line 242 of file random.hpp.

242 {
243 thread_local DefaultRandomGenerator generator{DefaultEngine()};
244 return generator;
245}
Random number utilities with a user-provided engine.
Definition random.hpp:123
DefaultRandomEngine & DefaultEngine()
Thread-local default-quality engine.
Definition random.hpp:100

◆ RandomDeviceSeed()

uint64_t helios::RandomDeviceSeed ( )
inline

Internal helper to obtain seed from std::random_device.

This function is intentionally small and header-only to avoid static initialization of engines in user code.

Returns
64-bit seed value from random_device.

Definition at line 55 of file random.hpp.

55 {
56 std::random_device rd{};
57 using result_type = std::random_device::result_type;
58 constexpr auto result_bits = sizeof(result_type) * 8U;
59 constexpr auto target_bits = sizeof(uint64_t) * 8U;
60
61 if constexpr (result_bits >= target_bits) {
62 return static_cast<uint64_t>(rd());
63 } else {
64 uint64_t value = 0;
65 auto shift = 0U;
66 while (shift < target_bits) {
67 value |= static_cast<uint64_t>(rd()) << shift;
68 shift += result_bits;
69 }
70 return value;
71 }
72}

◆ RandomFast()

FastRandomGeneratorType & helios::RandomFast ( )
inline

Provides access to a thread-local fast random generator.

Uses Meyer's singleton pattern per thread and avoids any static engine objects other than thread-local instances that are lazily initialized on first use.

Returns
Reference to FastRandomGeneratorType bound to FastEngineInstance().

Definition at line 253 of file random.hpp.

253 {
254 thread_local FastRandomGeneratorType generator{FastEngineInstance()};
255 return generator;
256}
FastRandomEngine & FastEngineInstance()
Thread-local fast engine.
Definition random.hpp:111

◆ RandomFastValue()

template<utils::ArithmeticTrait T>
T helios::RandomFastValue ( )
inline

Convenience function to generate a default-distribution value using the fast engine.

Equivalent to RandomFast().Value<T>(), but shorter to call.

Template Parameters
TArithmetic type to generate.
Returns
Randomly generated value of type T using the fast engine.

Definition at line 290 of file random.hpp.

290 {
291 return RandomFast().Value<T>();
292}
T Value()
Generates a random arithmetic value using a reasonable default distribution.
Definition random.hpp:190
FastRandomGeneratorType & RandomFast()
Provides access to a thread-local fast random generator.
Definition random.hpp:253

◆ RandomFastValueFromRange()

template<utils::ArithmeticTrait T, utils::ArithmeticTrait U>
auto helios::RandomFastValueFromRange ( min,
max 
) -> std::common_type_t<T, U>
inline

Convenience function to generate a value in range using the fast engine.

Equivalent to RandomFast().ValueFromRange(min, max).

Template Parameters
TArithmetic type.
UArithmetic type.
Parameters
minLower bound of the range.
maxUpper bound of the range.
Returns
Random value of common_type_t<T, U> in [min, max] or [min, max).

Definition at line 304 of file random.hpp.

304 {
305 return RandomFast().ValueFromRange(min, max);
306}
auto ValueFromRange(T min, U max) -> std::common_type_t< T, U >
Generates a random arithmetic value within the specified range.
Definition random.hpp:208

◆ RandomValue()

template<utils::ArithmeticTrait T>
T helios::RandomValue ( )
inline

Convenience function to generate a default-distribution value using the default engine.

Equivalent to RandomDefault().Value<T>(), but shorter to call.

Template Parameters
TArithmetic type to generate.
Returns
Randomly generated value of type T.

Definition at line 265 of file random.hpp.

265 {
266 return RandomDefault().Value<T>();
267}
DefaultRandomGenerator & RandomDefault()
Provides access to a thread-local default-quality random generator.
Definition random.hpp:242

◆ RandomValueFromRange()

template<utils::ArithmeticTrait T, utils::ArithmeticTrait U>
auto helios::RandomValueFromRange ( min,
max 
) -> std::common_type_t<T, U>
inline

Convenience function to generate a value in range using the default engine.

Equivalent to RandomDefault().ValueFromRange(min, max).

Template Parameters
TArithmetic type.
UArithmetic type.
Parameters
minLower bound of the range.
maxUpper bound of the range.
Returns
Random value of common_type_t<T, U> in [min, max] or [min, max).

Definition at line 279 of file random.hpp.

279 {
280 return RandomDefault().ValueFromRange(min, max);
281}

Variable Documentation

◆ kDefaultLogger

constexpr DefaultLogger helios::kDefaultLogger {}
inlineconstexpr

Constexpr instance of the default logger for easier user interface.

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

Definition at line 225 of file logger.hpp.

225{};