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

Classes

struct  FreeFunctionTraits
 Traits for free function pointers. More...
 
struct  FreeFunctionTraits< R(*)(Args...)>
 
struct  MemberFunctionTraits
 Traits for member function pointers (non-const and const). More...
 
struct  MemberFunctionTraits< R(C::*)(Args...) const >
 
struct  MemberFunctionTraits< R(C::*)(Args...)>
 
struct  TupleToFunctionSignature
 
struct  TupleToFunctionSignature< std::tuple< R, Args... > >
 

Concepts

concept  PolymorphicConvertible
 Concept to allow argument conversion with polymorphic relationships.
 
concept  ClockTrait
 Concept for clock types compatible with std::chrono clocks.
 
concept  DurationTrait
 Concept for duration types based on std::chrono::duration.
 

Typedefs

template<typename Rep , typename Period >
using NormalizedDuration = std::chrono::duration< Rep, Period >
 Helper alias to normalize a duration to its canonical std::chrono::duration form.
 
template<typename Clock , typename Rep , typename Period >
using NormalizedClockDuration = std::chrono::duration< Rep, Period >
 Helper alias to normalize a clock's duration to a specific rep/period.
 

Functions

void LogAssertionFailureViaLogger (std::string_view condition, const std::source_location &loc, std::string_view message) noexcept
 Bridge to logger-provided assertion logging.
 
void LogAssertionFailure (std::string_view condition, const std::source_location &loc, std::string_view message) noexcept
 Unified assertion logging function used by macros below.
 
void AssertionFailed (std::string_view condition, const std::source_location &loc, std::string_view message) noexcept
 Assertion handler that logs via the logger system.
 

Variables

constexpr bool kEnableAssert = false
 

Typedef Documentation

◆ NormalizedClockDuration

template<typename Clock , typename Rep , typename Period >
using helios::details::NormalizedClockDuration = typedef std::chrono::duration<Rep, Period>

Helper alias to normalize a clock's duration to a specific rep/period.

Definition at line 45 of file timer.hpp.

◆ NormalizedDuration

template<typename Rep , typename Period >
using helios::details::NormalizedDuration = typedef std::chrono::duration<Rep, Period>

Helper alias to normalize a duration to its canonical std::chrono::duration form.

Definition at line 39 of file timer.hpp.

Function Documentation

◆ AssertionFailed()

void helios::details::AssertionFailed ( std::string_view  condition,
const std::source_location &  loc,
std::string_view  message 
)
inlinenoexcept

Assertion handler that logs via the logger system.

Parameters
conditionThe failed condition as a string
locSource location of the assertion
messageAdditional message to log

Definition at line 64 of file assert.hpp.

65 {
66 // Log via logger (will use stderr fallback if logger is not linked)
67 try {
68 LogAssertionFailure(condition, loc, message);
69 } catch (...) {
70 // If logger fails, print to stderr as last resort
71#if defined(__cpp_lib_print) && (__cpp_lib_print >= 202302L)
72 if (!message.empty()) {
73 std::println(stderr, "Assertion failed: {} | {} [{}:{}]", condition, message, loc.file_name(), loc.line());
74 } else {
75 std::println(stderr, "Assertion failed: {}\nFile: {}\nLine: {}\nFunction: {}", condition, loc.file_name(),
76 loc.line(), loc.function_name());
77 }
78#else
79 if (!message.empty()) {
80 std::fprintf(stderr, "Assertion failed: %.*s | %.*s [%s:%u]\n", static_cast<int>(condition.size()),
81 condition.data(), static_cast<int>(message.size()), message.data(), loc.file_name(), loc.line());
82 } else {
83 std::fprintf(stderr, "Assertion failed: %.*s\nFile: %s\nLine: %u\nFunction: %s\n",
84 static_cast<int>(condition.size()), condition.data(), loc.file_name(), loc.line(),
85 loc.function_name());
86 }
87#endif
88 }
89}
void LogAssertionFailure(std::string_view condition, const std::source_location &loc, std::string_view message) noexcept
Unified assertion logging function used by macros below.
Definition assert.hpp:48

◆ LogAssertionFailure()

void helios::details::LogAssertionFailure ( std::string_view  condition,
const std::source_location &  loc,
std::string_view  message 
)
inlinenoexcept

Unified assertion logging function used by macros below.

Tries to forward the assertion to the logger integration function above.

If the logger isn't available (or calling it throws), this function simply returns so the caller may perform a fallback print-and-abort.

Parameters
conditionThe failed condition as a string
locSource location of the assertion
messageAdditional message to log

Definition at line 48 of file assert.hpp.

49 {
50 try {
51 // Attempt to forward to the logger integration.
52 LogAssertionFailureViaLogger(condition, loc, message);
53 } catch (...) {
54 // Ignore any exception and allow caller to fallback to printing.
55 }
56}
void LogAssertionFailureViaLogger(std::string_view condition, const std::source_location &loc, std::string_view message) noexcept
Bridge to logger-provided assertion logging.
Definition logger.hpp:649

◆ LogAssertionFailureViaLogger()

void helios::details::LogAssertionFailureViaLogger ( std::string_view  condition,
const std::source_location &  loc,
std::string_view  message 
)
inlinenoexcept

Bridge to logger-provided assertion logging.

The logger implementation provides an inline function named LogAssertionFailureViaLogger in helios::details. We forward-declare it here so assert.hpp can use logger integration when available.

If the logger is present in the build, that inline function will be used. If not, calls to LogAssertionFailure below will safely fall back to printing to stderr (via std::println) and aborting.

Parameters
conditionThe failed condition as a string
locSource location of the assertion
messageAdditional message to log
Examples
/home/runner/work/HeliosEngine/HeliosEngine/src/core/include/helios/core/logger.hpp.

Definition at line 649 of file logger.hpp.

650 {
651 Logger::GetInstance().LogAssertionFailure(condition, loc, message);
652}

Variable Documentation

◆ kEnableAssert

constexpr bool helios::details::kEnableAssert = false
inlineconstexpr

Definition at line 94 of file assert.hpp.