TRLC Platform Library  1.0.0
Header-only C++ library for compile-time platform detection and abstraction
trlc::platform::detail Namespace Reference

Functions

static CpuArchitecture detectCpuArchitecture ()
 Detects CPU architecture using compiler predefined macros. More...
 
static int detectPointerSize ()
 Determines pointer size based on architecture. More...
 
static size_t detectCacheLineSize ()
 Determines typical cache line size for architecture. More...
 
static const char * getArchitectureName ()
 Gets human-readable architecture name. More...
 
static CppStandard detectCppStandard ()
 Detects C++ standard using __cplusplus macro. More...
 
static long getCppVersionMacroValue ()
 Gets the __cplusplus macro value. More...
 
static const char * getCppStandardName ()
 Gets human-readable standard name. More...
 
static ByteOrder detectByteOrderCompileTime ()
 Compile-time endianness detection using preprocessor macros. More...
 
ByteOrder detectByteOrderRuntime ()
 Runtime endianness detection using union method. More...
 
static uint16_t byteSwap16Impl (uint16_t value)
 16-bit byte swap implementation More...
 
static uint32_t byteSwap32Impl (uint32_t value)
 32-bit byte swap implementation More...
 
static uint64_t byteSwap64Impl (uint64_t value)
 64-bit byte swap implementation More...
 
static size_t detectPageSize ()
 Detect page size (implementation detail) More...
 
template<typename Type >
static size_t calculateTypePadding ()
 Calculate padding for a type (implementation detail) More...
 
template<typename Type >
static bool hasTypePadding ()
 Check if a type has padding (implementation detail) More...
 

Variables

std::atomic< bool > g_platform_initialized {false}
 Internal initialization state tracking (inline to avoid ODR violations) More...
 
std::atomic< bool > g_initialization_in_progress {false}
 

Function Documentation

◆ byteSwap16Impl()

static uint16_t trlc::platform::detail::byteSwap16Impl ( uint16_t  value)
static

16-bit byte swap implementation

Uses compiler intrinsics when available, falls back to manual implementation.

Definition at line 212 of file endianness.hpp.

◆ byteSwap32Impl()

static uint32_t trlc::platform::detail::byteSwap32Impl ( uint32_t  value)
static

32-bit byte swap implementation

Definition at line 233 of file endianness.hpp.

◆ byteSwap64Impl()

static uint64_t trlc::platform::detail::byteSwap64Impl ( uint64_t  value)
static

64-bit byte swap implementation

Definition at line 254 of file endianness.hpp.

◆ calculateTypePadding()

template<typename Type >
static size_t trlc::platform::detail::calculateTypePadding ( )
static

Calculate padding for a type (implementation detail)

This is a simplified implementation that works for fundamental types and some simple cases. For complex types, the calculation may be approximate due to the difficulty of determining exact member layouts at compile time without reflection.

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 475 of file typeinfo.hpp.

◆ detectByteOrderCompileTime()

static ByteOrder trlc::platform::detail::detectByteOrderCompileTime ( )
static

Compile-time endianness detection using preprocessor macros.

This function attempts to determine byte order at compile time using standard preprocessor macros. Falls back to runtime detection if needed.

Definition at line 79 of file endianness.hpp.

◆ detectByteOrderRuntime()

ByteOrder trlc::platform::detail::detectByteOrderRuntime ( )
inline

Runtime endianness detection using union method.

This function performs runtime byte order detection when compile-time detection is not possible or returns unknown.

Definition at line 134 of file endianness.hpp.

◆ detectCacheLineSize()

static size_t trlc::platform::detail::detectCacheLineSize ( )
static

Determines typical cache line size for architecture.

Returns
Cache line size in bytes

Definition at line 422 of file architecture.hpp.

◆ detectCppStandard()

static CppStandard trlc::platform::detail::detectCppStandard ( )
static

Detects C++ standard using __cplusplus macro.

Returns
CppStandard enum value

Definition at line 104 of file cpp_standard.hpp.

◆ detectCpuArchitecture()

static CpuArchitecture trlc::platform::detail::detectCpuArchitecture ( )
static

Detects CPU architecture using compiler predefined macros.

Returns
CpuArchitecture enum value

Definition at line 321 of file architecture.hpp.

◆ detectPageSize()

static size_t trlc::platform::detail::detectPageSize ( )
static

Detect page size (implementation detail)

Attempts to detect the actual page size using platform-specific methods. Falls back to common defaults.

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 510 of file typeinfo.hpp.

◆ detectPointerSize()

static int trlc::platform::detail::detectPointerSize ( )
static

Determines pointer size based on architecture.

Returns
Pointer size in bits (32 or 64)

Definition at line 392 of file architecture.hpp.

◆ getArchitectureName()

static const char* trlc::platform::detail::getArchitectureName ( )
static

Gets human-readable architecture name.

Returns
Architecture name string

Definition at line 458 of file architecture.hpp.

◆ getCppStandardName()

static const char* trlc::platform::detail::getCppStandardName ( )
static

Gets human-readable standard name.

Returns
Standard name string

Definition at line 147 of file cpp_standard.hpp.

◆ getCppVersionMacroValue()

static long trlc::platform::detail::getCppVersionMacroValue ( )
static

Gets the __cplusplus macro value.

Returns
Value of __cplusplus macro (or _MSVC_LANG for MSVC)

Definition at line 133 of file cpp_standard.hpp.

◆ hasTypePadding()

template<typename Type >
static bool trlc::platform::detail::hasTypePadding ( )
static

Check if a type has padding (implementation detail)

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 498 of file typeinfo.hpp.

Variable Documentation

◆ g_initialization_in_progress

std::atomic<bool> trlc::platform::detail::g_initialization_in_progress {false}
inline

◆ g_platform_initialized

std::atomic<bool> trlc::platform::detail::g_platform_initialized {false}
inline

Internal initialization state tracking (inline to avoid ODR violations)

Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 354 of file core.hpp.