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

Namespaces

 detail
 
 traits
 

Classes

struct  ArchitectureInfo
 
struct  CompilerVersion
 
struct  CompilerInfo
 Consolidated compiler information structure. More...
 
struct  Version
 Library version information. More...
 
struct  PlatformReport
 Consolidated platform information structure. More...
 
struct  CppStandardInfo
 C++ standard information structure. More...
 
class  DebugUtils
 Debug utilities class with static methods. More...
 
struct  EndiannessInfo
 Comprehensive endianness information structure. More...
 
struct  FeatureSet
 Feature detection structure. More...
 
struct  PlatformInfo
 Platform information structure. More...
 
struct  TypeInfo
 
struct  AlignedType
 

Typedefs

using AssertionHandler = void(*)(const char *expression, const char *file, int line, const char *function)
 Assertion handler function pointer type. More...
 
using CacheLineAligned = AlignedType< 64 >
 
using PageAligned = AlignedType< 4096 >
 

Enumerations

enum class  CpuArchitecture : int {
  unknown = 0 , x86 , x86_64 , arm_v6 ,
  arm_v7 , arm_v8_32 , arm_v8_64 , mips ,
  mips_64 , powerpc , powerpc_64 , risc_v_32 ,
  risc_v_64 , sparc , sparc_64
}
 CPU architecture enumeration. More...
 
enum class  CompilerType : int {
  unknown = 0 , gcc , clang , msvc ,
  intel_classic , intel_llvm , mingw
}
 Compiler identification enumeration. More...
 
enum class  CppStandard : long {
  cpp_pre_17 = 0 , cpp_17 = 201703L , cpp_20 = 202002L , cpp_23 = 202302L ,
  cpp_26 = 202600L , cpp_unknown = -1
}
 C++ standard enumeration. More...
 
enum class  ByteOrder : int { unknown = 0 , little_endian , big_endian , mixed_endian }
 Byte order enumeration. More...
 
enum class  LanguageFeature : int {
  exceptions = 0 , rtti , threads , atomic_operations ,
  inline_assembly , vector_intrinsics , stack_protection , address_sanitizer ,
  thread_sanitizer , memory_sanitizer , undefined_behavior_sanitizer
}
 Language feature enumeration. More...
 
enum class  RuntimeFeature : int {
  sse = 0 , sse2 , sse3 , sse4_1 ,
  sse4_2 , avx , avx2 , avx512f ,
  neon , hardware_aes , hardware_random
}
 Runtime feature enumeration. More...
 
enum class  OperatingSystem : int {
  unknown = 0 , windows , linux_generic , ubuntu ,
  debian , redhat , macos , freebsd ,
  openbsd , netbsd , android , ios
}
 Operating system identification enumeration. More...
 
enum class  EnvironmentType : int {
  unknown = 0 , desktop , server , embedded ,
  mobile
}
 Environment type identification enumeration. More...
 

Functions

static CpuArchitecture getCpuArchitecture ()
 
static ArchitectureInfo getArchitectureInfo ()
 
static int getPointerSize ()
 
static bool hasSimdSupport ()
 
static bool hasVectorInstructions ()
 
static bool supportsCacheLineAlignment ()
 
static bool is64BitArchitecture ()
 
static bool is32BitArchitecture ()
 
static CompilerType getCompilerType ()
 Detects the current compiler type at compile time. More...
 
static CompilerVersion getCompilerVersion ()
 Gets the compiler version at compile time. More...
 
static const char * getCompilerName ()
 Gets the compiler name as a string. More...
 
static bool hasBuiltinAttribute ([[maybe_unused]] const char *attribute_name)
 Checks if compiler supports __builtin attributes. More...
 
static bool supportsInlineAssembly ()
 Checks if compiler supports inline assembly. More...
 
static bool hasColorDiagnostics ()
 Checks if compiler supports colored diagnostics. More...
 
static CompilerInfo getCompilerInfo ()
 Get consolidated compiler information. More...
 
PlatformReport getPlatformReport ()
 
void initializePlatform ()
 
bool isPlatformInitialized ()
 
std::string getBriefPlatformSummary ()
 
void printPlatformReport ()
 
static CppStandard getCppStandard ()
 Gets the current C++ standard version. More...
 
static CppStandardInfo getCppStandardInfo ()
 Gets comprehensive C++ standard information. More...
 
static long getCppVersionMacro ()
 Gets the __cplusplus macro value. More...
 
static bool hasStructuredBindings ()
 Checks if structured bindings are supported (C++17) More...
 
static bool hasIfConstexpr ()
 Checks if if constexpr is supported (C++17) More...
 
static bool hasConcepts ()
 Checks if concepts are supported (C++20) More...
 
static bool hasCoroutines ()
 Checks if coroutines are supported (C++20) More...
 
static bool hasModules ()
 Checks if modules are supported (C++20) More...
 
static bool hasRanges ()
 Checks if ranges library is supported (C++20) More...
 
static bool hasFoldExpressions ()
 Checks if fold expressions are supported (C++17) More...
 
static bool hasInlineVariables ()
 Checks if inline variables are supported (C++17) More...
 
static bool hasConsteval ()
 Checks if consteval is supported (C++20) More...
 
static bool hasConstinit ()
 Checks if constinit is supported (C++20) More...
 
static bool hasDesignatedInitializers ()
 Checks if designated initializers are supported (C++20) More...
 
static bool hasThreeWayComparison ()
 Checks if three-way comparison (spaceship operator) is supported (C++20) More...
 
static bool isCpp17OrLater ()
 Checks if the current C++ standard is at least C++17. More...
 
static bool isCpp20OrLater ()
 Checks if the current C++ standard is at least C++20. More...
 
static bool isCpp23OrLater ()
 Checks if the current C++ standard is at least C++23. More...
 
static bool isExactlyCpp17 ()
 Checks if the current C++ standard is exactly C++17. More...
 
static bool isExactlyCpp20 ()
 Checks if the current C++ standard is exactly C++20. More...
 
static bool isExactlyCpp23 ()
 Checks if the current C++ standard is exactly C++23. More...
 
void defaultAssertionHandler (const char *expression, const char *file, int line, const char *function)
 Default assertion handler implementation. More...
 
static bool isDebugBuild ()
 
static bool isReleaseBuild ()
 Check if the current build is a release build. More...
 
static bool hasDebugInfo ()
 Check if debug information is available. More...
 
static ByteOrder getByteOrder ()
 Get the system's byte order. More...
 
static EndiannessInfo getEndiannessInfo ()
 Get comprehensive endianness information. More...
 
static bool isLittleEndian ()
 Check if system is little-endian. More...
 
static bool isBigEndian ()
 Check if system is big-endian. More...
 
static uint16_t byteSwap16 (uint16_t value)
 Swap bytes in a 16-bit value. More...
 
static uint32_t byteSwap32 (uint32_t value)
 Swap bytes in a 32-bit value. More...
 
static uint64_t byteSwap64 (uint64_t value)
 Swap bytes in a 64-bit value. More...
 
template<typename Type >
static Type byteSwap (Type value)
 Generic byte swap function for integral types. More...
 
template<typename Type >
static Type hostToNetwork (Type value)
 Convert from host byte order to network byte order (big-endian) More...
 
template<typename Type >
static Type networkToHost (Type value)
 Convert from network byte order (big-endian) to host byte order. More...
 
static uint16_t hostToNetworkShort (uint16_t hostshort)
 Convert 16-bit value from host to network byte order. More...
 
static uint32_t hostToNetworkLong (uint32_t hostlong)
 Convert 32-bit value from host to network byte order. More...
 
static uint16_t networkToHostShort (uint16_t netshort)
 Convert 16-bit value from network to host byte order. More...
 
static uint32_t networkToHostLong (uint32_t netlong)
 Convert 32-bit value from network to host byte order. More...
 
static bool areByteOrdersCompatible (ByteOrder order1, ByteOrder order2)
 Check if two byte orders are compatible (no swapping needed) More...
 
static ByteOrder getOppositeByteOrder (ByteOrder order)
 Get the opposite byte order. More...
 
template<typename Type >
static Type convertByteOrder (Type value, ByteOrder from_order, ByteOrder to_order)
 Convert value between specified byte orders. More...
 
static bool hasExceptions ()
 Detects if C++ exceptions are enabled. More...
 
static bool hasRtti ()
 Detects if RTTI (Runtime Type Information) is enabled. More...
 
static bool hasThreads ()
 Detects if threading support is available. More...
 
static bool hasAtomicOperations ()
 Detects if atomic operations are supported. More...
 
static bool hasInlineAssembly ()
 Detects if inline assembly is supported. More...
 
static bool hasVectorIntrinsics ()
 Detects if vector intrinsics are available. More...
 
static bool hasStackProtection ()
 Detects if stack protection is enabled. More...
 
static bool hasAddressSanitizer ()
 Detects if AddressSanitizer is enabled. More...
 
static bool hasThreadSanitizer ()
 Detects if ThreadSanitizer is enabled. More...
 
static bool hasMemorySanitizer ()
 Detects if MemorySanitizer is enabled. More...
 
static bool hasUndefinedBehaviorSanitizer ()
 Detects if UndefinedBehaviorSanitizer is enabled. More...
 
bool hasSseSupport ()
 Detects SSE support at runtime. More...
 
bool hasSse2Support ()
 Detects SSE2 support at runtime. More...
 
bool hasSse3Support ()
 Detects SSE3 support at runtime. More...
 
bool hasSse41Support ()
 Detects SSE4.1 support at runtime. More...
 
bool hasSse42Support ()
 Detects SSE4.2 support at runtime. More...
 
bool hasAvxSupport ()
 Detects AVX support at runtime. More...
 
bool hasAvx2Support ()
 Detects AVX2 support at runtime. More...
 
bool hasAvx512fSupport ()
 Detects AVX-512F support at runtime. More...
 
bool hasNeonSupport ()
 Detects ARM NEON support. More...
 
bool hasHardwareAes ()
 Detects hardware AES support. More...
 
bool hasHardwareRandom ()
 Detects hardware random number generation support. More...
 
static FeatureSet getFeatureSet ()
 Gets a complete feature set with all detected features. More...
 
static bool hasLanguageFeature (LanguageFeature feature)
 Checks if a specific language feature is available. More...
 
bool hasRuntimeFeature (RuntimeFeature feature)
 Checks if a specific runtime feature is available. More...
 
template<LanguageFeature TFeature>
static bool hasFeature ()
 Generic template function for feature testing. More...
 
static bool supportsNodecard ()
 Check if compiler supports nodiscard attribute. More...
 
static bool supportsDeprecated ()
 Check if compiler supports deprecated attribute. More...
 
static bool supportsFallthrough ()
 Check if compiler supports fallthrough attribute. More...
 
static bool hasAttributeSupport (const char *)
 Check if compiler supports a specific C++ attribute. More...
 
static OperatingSystem getOperatingSystem ()
 Detects the current operating system at compile time. More...
 
static EnvironmentType getEnvironmentType ()
 Detects the current environment type at compile time. More...
 
static PlatformInfo getPlatformInfo ()
 Gets comprehensive platform information. More...
 
static bool hasPosixApi ()
 Checks if the platform supports POSIX APIs. More...
 
static bool hasWin32Api ()
 Checks if the platform supports Win32 APIs. More...
 
static bool supportsCaseSensitiveFilesystem ()
 Checks if the platform supports case-sensitive filesystems. More...
 
template<>
static bool hasFeature< LanguageFeature::exceptions > ()
 Template specializations for specific language features Provides optimized compile-time constants for individual features. More...
 
template<>
static bool hasFeature< LanguageFeature::rtti > ()
 Specialization for RTTI - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::threads > ()
 Specialization for threads - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::atomic_operations > ()
 Specialization for atomic operations - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::inline_assembly > ()
 Specialization for inline assembly - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::vector_intrinsics > ()
 Specialization for vector intrinsics - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::stack_protection > ()
 Specialization for stack protection - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::address_sanitizer > ()
 Specialization for AddressSanitizer - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::thread_sanitizer > ()
 Specialization for ThreadSanitizer - Direct function call for better optimization. More...
 
template<>
static bool hasFeature< LanguageFeature::memory_sanitizer > ()
 Specialization for MemorySanitizer - Direct function call for better optimization. More...
 
template<RuntimeFeature TFeature>
bool hasRuntimeFeature ()
 Template function for runtime feature testing. More...
 
template<>
bool hasRuntimeFeature< RuntimeFeature::sse > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::sse2 > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::sse3 > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::sse4_1 > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::sse4_2 > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::avx > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::avx2 > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::avx512f > ()
 
template<>
bool hasRuntimeFeature< RuntimeFeature::neon > ()
 
template<typename Type >
static size_t getTypeSize ()
 
template<typename Type >
static size_t getTypeAlignment ()
 
static size_t getCacheLineSize ()
 Get the cache line size for the current platform. More...
 
static size_t getPageSize ()
 Get the page size for the current platform. More...
 
template<typename Type >
static size_t calculatePadding ()
 
template<typename Type >
static bool hasInternalPadding ()
 
template<typename Type , size_t TExpectedSize>
static bool verifyTypeSize ()
 
template<typename Type , size_t TExpectedAlignment>
static bool verifyTypeAlignment ()
 
template<typename Type >
static bool isCacheLineAligned ()
 Verify that a type is suitably aligned for cache line optimization. More...
 
template<typename Type >
static bool isPageAligned ()
 Verify that a type is suitably aligned for page boundaries. More...
 
static size_t alignedSize (size_t size, size_t alignment)
 Calculate the aligned size for a given alignment. More...
 
static uintptr_t alignedAddress (uintptr_t addr, size_t alignment)
 Calculate the aligned address for a given alignment. More...
 
static bool isAligned (uintptr_t addr, size_t alignment)
 Check if an address is aligned to the specified boundary. More...
 
bool isAligned (const void *ptr, size_t alignment)
 Check if a pointer is aligned to the specified boundary. More...
 

Typedef Documentation

◆ AssertionHandler

using trlc::platform::AssertionHandler = typedef void (*)(const char* expression, const char* file, int line, const char* function)

Assertion handler function pointer type.

This function type is used for custom assertion handlers. When an assertion fails, the registered handler is called with detailed information about the assertion failure.

Parameters
expressionThe stringified expression that failed
fileThe source file where the assertion failed
lineThe line number where the assertion failed
functionThe function name where the assertion failed
Note
The handler should not return - it should either abort the program or throw an exception (if exceptions are enabled)
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/debug.hpp.

Definition at line 54 of file debug.hpp.

◆ CacheLineAligned

◆ PageAligned

Enumeration Type Documentation

◆ ByteOrder

enum trlc::platform::ByteOrder : int
strong

Byte order enumeration.

Represents different byte ordering schemes used by CPU architectures.

Enumerator
unknown 

Unknown byte order.

little_endian 

Little-endian (LSB first)

big_endian 

Big-endian (MSB first)

mixed_endian 

Mixed endianness (rare architectures)

Definition at line 33 of file endianness.hpp.

◆ CompilerType

enum trlc::platform::CompilerType : int
strong

Compiler identification enumeration.

Represents the detected compiler type at compile time. This enumeration covers all major C++ compilers used in modern development, enabling compiler-specific optimizations and feature detection.

Compiler Detection Strategy

Detection uses compiler-specific predefined macros in order of specificity:

  1. Intel compilers (checked first due to macro conflicts)
  2. Clang (checked before GCC as it often defines GCC macros)
  3. GCC (including GCC-compatible compilers)
  4. MSVC (Microsoft Visual C++)
  5. MinGW (GCC-based compiler for Windows)

Compiler Characteristics

GNU Compiler Collection (GCC)

  • Platforms: Linux, Windows (MinGW), macOS, embedded systems
  • Standards: Excellent C++11/14/17/20/23 support
  • Optimization: Strong optimization capabilities
  • Extensions: GNU-specific language extensions

Clang/LLVM

  • Platforms: Linux, macOS, Windows, embedded systems
  • Standards: Leading C++ standard compliance
  • Diagnostics: Superior error messages and warnings
  • Tooling: Excellent static analysis and tooling support

Microsoft Visual C++ (MSVC)

  • Platforms: Windows (primary), some cross-platform support
  • Standards: Good C++11/14/17/20 support, improving C++23
  • Integration: Tight Visual Studio integration
  • Optimization: Excellent Windows-specific optimizations

Intel Compilers

  • Intel Classic: Legacy Intel C++ Compiler (being phased out)
  • Intel LLVM: New Intel compiler based on LLVM infrastructure
  • Optimization: Excellent performance on Intel hardware
  • Vectorization: Superior auto-vectorization capabilities
Note
Compiler detection is performed using predefined macros and is evaluated at compile time for zero runtime overhead.
See also
getCompilerType() for detection function
getCompilerVersion() for version information
CompilerInfo for comprehensive compiler details
Since
1.0.0
Enumerator
unknown 

Unknown or unsupported compiler.

gcc 

GNU Compiler Collection - Cross-platform, open-source.

clang 

Clang/LLVM compiler - Modern, standards-compliant.

msvc 

Microsoft Visual C++ compiler - Windows-focused.

intel_classic 

Legacy Intel C++ Compiler - Performance-optimized.

intel_llvm 

Intel C++ Compiler based on LLVM - Modern Intel toolchain.

mingw 

MinGW compiler (GCC-based for Windows) - Windows cross-compilation.

Definition at line 120 of file compiler.hpp.

◆ CppStandard

enum trlc::platform::CppStandard : long
strong

C++ standard enumeration.

Represents different C++ standard versions with their corresponding __cplusplus macro values for precise version detection.

Enumerator
cpp_pre_17 

Pre-C++17 standards (C++98/03/11/14)

cpp_17 

C++17 standard.

cpp_20 

C++20 standard.

cpp_23 

C++23 standard.

cpp_26 

C++26 standard (tentative)

cpp_unknown 

Unknown or unsupported standard.

Definition at line 24 of file cpp_standard.hpp.

◆ CpuArchitecture

CPU architecture enumeration.

Represents different CPU architectures that can be detected at compile time. This enumeration covers all major CPU architecture families used in modern computing from embedded systems to high-performance servers.

Architecture Families

x86 Family

  • x86: Legacy 32-bit Intel/AMD processors
  • x86_64: Modern 64-bit Intel/AMD processors (also known as AMD64)

ARM Family

  • arm_v6: ARM Architecture v6 (older embedded systems)
  • arm_v7: ARM Architecture v7 (common in mobile devices)
  • arm_v8_32: AArch32 mode of ARM v8 (32-bit execution)
  • arm_v8_64: AArch64 mode of ARM v8 (64-bit execution, ARM64)

Other Architectures

  • MIPS: Popular in embedded systems and older workstations
  • PowerPC: Used in older Apple computers and embedded systems
  • RISC-V: Open-source architecture gaining popularity
  • SPARC: Oracle/Sun workstations and servers
Note
The architecture detection is performed at compile time using compiler predefined macros, ensuring zero runtime overhead.
See also
getCpuArchitecture() for detection function
ArchitectureInfo for comprehensive architecture information
Since
1.0.0
Enumerator
unknown 

Unknown or unsupported architecture.

x86 

Intel/AMD x86 (32-bit) - Legacy desktop/server processors.

x86_64 

Intel/AMD x86-64 (64-bit) - Modern desktop/server processors.

arm_v6 

ARM Architecture v6 - Older embedded systems (e.g., Raspberry Pi 1)

arm_v7 

ARM Architecture v7 - Mobile devices, embedded systems.

arm_v8_32 

AArch32 (ARM v8 32-bit mode) - Modern ARM in 32-bit mode.

arm_v8_64 

AArch64 (ARM v8 64-bit mode / ARM64) - Modern mobile, Apple Silicon.

mips 

MIPS (32-bit) - Embedded systems, older workstations.

mips_64 

MIPS64 (64-bit) - High-performance MIPS systems.

powerpc 

PowerPC (32-bit) - Legacy Apple computers, embedded systems.

powerpc_64 

PowerPC64 (64-bit) - High-performance PowerPC systems.

risc_v_32 

RISC-V (32-bit) - Open-source architecture, embedded systems.

risc_v_64 

RISC-V (64-bit) - Open-source architecture, future systems.

sparc 

SPARC (32-bit) - Legacy Sun/Oracle workstations.

sparc_64 

SPARC64 (64-bit) - Oracle/Sun servers and workstations.

Definition at line 105 of file architecture.hpp.

◆ EnvironmentType

Environment type identification enumeration.

Represents the target environment type for the application.

Enumerator
unknown 

Unknown environment type.

desktop 

Desktop/workstation environment.

server 

Server environment.

embedded 

Embedded system environment.

mobile 

Mobile device environment.

Definition at line 41 of file platform.hpp.

◆ LanguageFeature

Language feature enumeration.

Represents compile-time detectable language and compiler features. These features are determined at compile time based on compiler capabilities and build settings.

Enumerator
exceptions 

C++ exception handling support.

rtti 

Runtime Type Information support.

threads 

Threading support (std::thread)

atomic_operations 

Atomic operations support.

inline_assembly 

Inline assembly support.

vector_intrinsics 

Vector/SIMD intrinsics support.

stack_protection 

Stack protection features.

address_sanitizer 

AddressSanitizer support.

thread_sanitizer 

ThreadSanitizer support.

memory_sanitizer 

MemorySanitizer support.

undefined_behavior_sanitizer 

UndefinedBehaviorSanitizer support.

Definition at line 49 of file features.hpp.

◆ OperatingSystem

Operating system identification enumeration.

Represents the detected operating system type at compile time.

Enumerator
unknown 

Unknown or unsupported operating system.

windows 

Microsoft Windows (all versions)

linux_generic 

Generic Linux distribution.

ubuntu 

Ubuntu Linux distribution.

debian 

Debian Linux distribution.

redhat 

Red Hat Enterprise Linux / CentOS / Fedora.

macos 

Apple macOS / Mac OS X.

freebsd 

FreeBSD operating system.

openbsd 

OpenBSD operating system.

netbsd 

NetBSD operating system.

android 

Android operating system.

ios 

Apple iOS operating system.

Definition at line 21 of file platform.hpp.

◆ RuntimeFeature

enum trlc::platform::RuntimeFeature : int
strong

Runtime feature enumeration.

Represents CPU features that may require runtime detection. These features depend on the actual hardware capabilities and may not be detectable at compile time.

Enumerator
sse 

SSE (Streaming SIMD Extensions)

sse2 

SSE2 extensions.

sse3 

SSE3 extensions.

sse4_1 

SSE4.1 extensions.

sse4_2 

SSE4.2 extensions.

avx 

AVX (Advanced Vector Extensions)

avx2 

AVX2 extensions.

avx512f 

AVX-512 Foundation.

neon 

ARM NEON SIMD extensions.

hardware_aes 

Hardware AES acceleration.

hardware_random 

Hardware random number generation.

Definition at line 70 of file features.hpp.

Function Documentation

◆ alignedAddress()

static uintptr_t trlc::platform::alignedAddress ( uintptr_t  addr,
size_t  alignment 
)
static

Calculate the aligned address for a given alignment.

Rounds up an address to the next boundary that satisfies the alignment requirement.

Parameters
addrThe original address
alignmentThe required alignment (must be power of 2)
Returns
The aligned address
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 432 of file typeinfo.hpp.

◆ alignedSize()

static size_t trlc::platform::alignedSize ( size_t  size,
size_t  alignment 
)
static

Calculate the aligned size for a given alignment.

Rounds up a size to the next boundary that satisfies the alignment requirement.

Parameters
sizeThe original size
alignmentThe required alignment (must be power of 2)
Returns
The aligned size
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 419 of file typeinfo.hpp.

◆ areByteOrdersCompatible()

static bool trlc::platform::areByteOrdersCompatible ( ByteOrder  order1,
ByteOrder  order2 
)
static

Check if two byte orders are compatible (no swapping needed)

Parameters
order1First byte order
order2Second byte order
Returns
true if byte orders are compatible

Definition at line 464 of file endianness.hpp.

◆ byteSwap()

template<typename Type >
static Type trlc::platform::byteSwap ( Type  value)
static

Generic byte swap function for integral types.

Automatically selects the appropriate byte swap implementation based on the size of the type. Supports signed and unsigned integral types.

Template Parameters
TypeIntegral type to byte swap
Parameters
valueValue to byte swap
Returns
Byte-swapped value

Definition at line 321 of file endianness.hpp.

◆ byteSwap16()

static uint16_t trlc::platform::byteSwap16 ( uint16_t  value)
static

Swap bytes in a 16-bit value.

Parameters
value16-bit value to byte swap
Returns
Byte-swapped value

Definition at line 286 of file endianness.hpp.

◆ byteSwap32()

static uint32_t trlc::platform::byteSwap32 ( uint32_t  value)
static

Swap bytes in a 32-bit value.

Parameters
value32-bit value to byte swap
Returns
Byte-swapped value

Definition at line 296 of file endianness.hpp.

◆ byteSwap64()

static uint64_t trlc::platform::byteSwap64 ( uint64_t  value)
static

Swap bytes in a 64-bit value.

Parameters
value64-bit value to byte swap
Returns
Byte-swapped value

Definition at line 306 of file endianness.hpp.

◆ calculatePadding()

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

◆ convertByteOrder()

template<typename Type >
static Type trlc::platform::convertByteOrder ( Type  value,
ByteOrder  from_order,
ByteOrder  to_order 
)
static

Convert value between specified byte orders.

Template Parameters
TypeIntegral type to convert
Parameters
valueValue to convert
from_orderSource byte order
to_orderTarget byte order
Returns
Converted value

Definition at line 499 of file endianness.hpp.

◆ defaultAssertionHandler()

void trlc::platform::defaultAssertionHandler ( const char *  expression,
const char *  file,
int  line,
const char *  function 
)
inline

Default assertion handler implementation.

This is the default handler for assertion failures. It prints detailed information about the assertion failure to stderr and then terminates the program.

Parameters
expressionThe stringified expression that failed
fileThe source file where the assertion failed
lineThe line number where the assertion failed
functionThe function name where the assertion failed
Note
This function never returns - it always terminates the program
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/debug.hpp.

Definition at line 461 of file debug.hpp.

◆ getArchitectureInfo()

static ArchitectureInfo trlc::platform::getArchitectureInfo ( )
static

◆ getBriefPlatformSummary()

std::string trlc::platform::getBriefPlatformSummary ( )
inline

◆ getByteOrder()

static ByteOrder trlc::platform::getByteOrder ( )
static

Get the system's byte order.

Returns the byte order of the current system. Uses compile-time detection when possible, falls back to runtime detection for unknown cases.

Returns
ByteOrder enum value representing the system's byte order

Definition at line 159 of file endianness.hpp.

◆ getCacheLineSize()

static size_t trlc::platform::getCacheLineSize ( )
static

Get the cache line size for the current platform.

Returns the cache line size in bytes. This is used for optimizing memory access patterns and avoiding false sharing in concurrent code.

Returns
Cache line size in bytes (typically 64 bytes)
Note
This function attempts to detect the actual cache line size but falls back to common defaults if detection is not possible
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 119 of file typeinfo.hpp.

◆ getCompilerInfo()

static CompilerInfo trlc::platform::getCompilerInfo ( )
static

Get consolidated compiler information.

Returns a CompilerInfo structure containing all detected compiler information in a single convenient package.

Returns
CompilerInfo structure with all detected information
Note
This function is constexpr and can be evaluated at compile time
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 517 of file compiler.hpp.

◆ getCompilerName()

static const char* trlc::platform::getCompilerName ( )
static

Gets the compiler name as a string.

Returns a human-readable string representation of the compiler name.

Returns
Compiler name as a C-style string
Note
Returns "unknown" for unrecognized compilers

Definition at line 398 of file compiler.hpp.

◆ getCompilerType()

static CompilerType trlc::platform::getCompilerType ( )
static

Detects the current compiler type at compile time.

Uses compiler-specific predefined macros to identify the compiler. Detection is performed entirely at compile time with zero runtime cost.

Returns
CompilerType enum value representing the detected compiler
Note
Returns CompilerType::unknown for unrecognized compilers
Examples
Version-dependent.

Definition at line 323 of file compiler.hpp.

◆ getCompilerVersion()

static CompilerVersion trlc::platform::getCompilerVersion ( )
static

Gets the compiler version at compile time.

Extracts version information from compiler-specific macros.

Returns
CompilerVersion structure with major, minor, and patch versions
Note
Returns version (0, 0, 0) for unknown compilers
Examples
Version, and Version-dependent.

Definition at line 357 of file compiler.hpp.

◆ getCppStandard()

static CppStandard trlc::platform::getCppStandard ( )
static

Gets the current C++ standard version.

Returns
CppStandard enum value representing the detected standard

Definition at line 171 of file cpp_standard.hpp.

◆ getCppStandardInfo()

static CppStandardInfo trlc::platform::getCppStandardInfo ( )
static

Gets comprehensive C++ standard information.

Returns
CppStandardInfo structure with all detected information
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 179 of file cpp_standard.hpp.

◆ getCppVersionMacro()

static long trlc::platform::getCppVersionMacro ( )
static

Gets the __cplusplus macro value.

Returns
Value of __cplusplus macro

Definition at line 189 of file cpp_standard.hpp.

◆ getCpuArchitecture()

static CpuArchitecture trlc::platform::getCpuArchitecture ( )
static
Examples
Basic.

Definition at line 537 of file architecture.hpp.

◆ getEndiannessInfo()

static EndiannessInfo trlc::platform::getEndiannessInfo ( )
static

Get comprehensive endianness information.

Returns a complete EndiannessInfo structure with byte order and convenient boolean flags.

Returns
EndiannessInfo structure with complete endianness data
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 178 of file endianness.hpp.

◆ getEnvironmentType()

static EnvironmentType trlc::platform::getEnvironmentType ( )
static

Detects the current environment type at compile time.

Determines the target environment based on platform characteristics and available compile-time information.

Returns
EnvironmentType enum value representing the detected environment
Note
Detection is based on platform type and common patterns

Definition at line 138 of file platform.hpp.

◆ getFeatureSet()

static FeatureSet trlc::platform::getFeatureSet ( )
static

Gets a complete feature set with all detected features.

Returns
FeatureSet containing all available features
Note
Language features are compile-time, runtime features require detection
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 553 of file features.hpp.

◆ getOperatingSystem()

static OperatingSystem trlc::platform::getOperatingSystem ( )
static

Detects the current operating system at compile time.

Uses platform-specific predefined macros to identify the operating system. Detection is performed entirely at compile time with zero runtime cost.

Returns
OperatingSystem enum value representing the detected OS
Note
Returns OperatingSystem::unknown for unrecognized platforms

Definition at line 98 of file platform.hpp.

◆ getOppositeByteOrder()

static ByteOrder trlc::platform::getOppositeByteOrder ( ByteOrder  order)
static

Get the opposite byte order.

Parameters
orderInput byte order
Returns
Opposite byte order, or unknown if input is unknown/mixed

Definition at line 478 of file endianness.hpp.

◆ getPageSize()

static size_t trlc::platform::getPageSize ( )
static

Get the page size for the current platform.

Returns the memory page size in bytes. This is useful for memory allocation optimizations and system-level memory management.

Returns
Page size in bytes (typically 4096 bytes)
Note
This function attempts to detect the actual page size but falls back to common defaults if detection is not possible
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 143 of file typeinfo.hpp.

◆ getPlatformInfo()

static PlatformInfo trlc::platform::getPlatformInfo ( )
static

Gets comprehensive platform information.

Returns a complete PlatformInfo structure with operating system, environment type, human-readable names, and kernel family.

Returns
PlatformInfo structure with all detected platform details
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 172 of file platform.hpp.

◆ getPlatformReport()

PlatformReport trlc::platform::getPlatformReport ( )
inline

◆ getPointerSize()

static int trlc::platform::getPointerSize ( )
static
Examples
Pointer.

Definition at line 636 of file architecture.hpp.

◆ getTypeAlignment()

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

◆ getTypeSize()

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

◆ hasAddressSanitizer()

static bool trlc::platform::hasAddressSanitizer ( )
static

Detects if AddressSanitizer is enabled.

Returns
true if ASan is active

Definition at line 298 of file features.hpp.

◆ hasAtomicOperations()

static bool trlc::platform::hasAtomicOperations ( )
static

Detects if atomic operations are supported.

Returns
true if std::atomic and atomic operations are available

Definition at line 244 of file features.hpp.

◆ hasAttributeSupport()

static bool trlc::platform::hasAttributeSupport ( const char *  )
static

Check if compiler supports a specific C++ attribute.

Parameters
attribute_nameName of the attribute to check
Returns
true if attribute is supported, false otherwise
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/macros.hpp.

Definition at line 73 of file macros.hpp.

◆ hasAvx2Support()

bool trlc::platform::hasAvx2Support ( )
inline

Detects AVX2 support at runtime.

Returns
true if AVX2 is supported by the CPU

Definition at line 480 of file features.hpp.

◆ hasAvx512fSupport()

bool trlc::platform::hasAvx512fSupport ( )
inline

Detects AVX-512F support at runtime.

Returns
true if AVX-512F is supported by the CPU

Definition at line 492 of file features.hpp.

◆ hasAvxSupport()

bool trlc::platform::hasAvxSupport ( )
inline

Detects AVX support at runtime.

Returns
true if AVX is supported by the CPU

Definition at line 468 of file features.hpp.

◆ hasBuiltinAttribute()

static bool trlc::platform::hasBuiltinAttribute ( [[maybe_unused] ] const char *  attribute_name)
static

Checks if compiler supports __builtin attributes.

Determines if the current compiler supports GCC-style __builtin functions for the specified attribute.

Parameters
attribute_nameName of the attribute to check (unused in constexpr context)
Returns
true if compiler supports builtin attributes
Note
This is a simplified check based on compiler type

Definition at line 428 of file compiler.hpp.

◆ hasColorDiagnostics()

static bool trlc::platform::hasColorDiagnostics ( )
static

Checks if compiler supports colored diagnostics.

Determines if the compiler can output colored error/warning messages.

Returns
true if colored diagnostics are supported

Definition at line 456 of file compiler.hpp.

◆ hasConcepts()

static bool trlc::platform::hasConcepts ( )
static

Checks if concepts are supported (C++20)

Returns
true if concepts are available
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 223 of file cpp_standard.hpp.

◆ hasConsteval()

static bool trlc::platform::hasConsteval ( )
static

Checks if consteval is supported (C++20)

Returns
true if consteval is available

Definition at line 298 of file cpp_standard.hpp.

◆ hasConstinit()

static bool trlc::platform::hasConstinit ( )
static

Checks if constinit is supported (C++20)

Returns
true if constinit is available

Definition at line 310 of file cpp_standard.hpp.

◆ hasCoroutines()

static bool trlc::platform::hasCoroutines ( )
static

Checks if coroutines are supported (C++20)

Returns
true if coroutines are available
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 235 of file cpp_standard.hpp.

◆ hasDebugInfo()

static bool trlc::platform::hasDebugInfo ( )
static

Check if debug information is available.

Determines whether debug information (symbols, line numbers, etc.) is likely to be available in the current build. This is an approximation based on compiler flags and build configuration.

Returns
True if debug information is likely available
Note
This is a best-effort detection and may not be 100% accurate across all compilers and build configurations
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp, and /home/tranglc/sources/trlc-platform/include/trlc/platform/debug.hpp.

Definition at line 121 of file debug.hpp.

◆ hasDesignatedInitializers()

static bool trlc::platform::hasDesignatedInitializers ( )
static

Checks if designated initializers are supported (C++20)

Returns
true if designated initializers are available

Definition at line 322 of file cpp_standard.hpp.

◆ hasExceptions()

static bool trlc::platform::hasExceptions ( )
static

Detects if C++ exceptions are enabled.

Returns
true if exceptions are available

Definition at line 196 of file features.hpp.

◆ hasFeature()

template<LanguageFeature TFeature>
static bool trlc::platform::hasFeature ( )
static

Generic template function for feature testing.

Template Parameters
TFeatureMust be LanguageFeature enum value
Returns
true if the specified language feature is available
Note
Only works with LanguageFeature enum, not RuntimeFeature

Definition at line 659 of file features.hpp.

◆ hasFeature< LanguageFeature::address_sanitizer >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::address_sanitizer > ( )
static

Specialization for AddressSanitizer - Direct function call for better optimization.

Definition at line 77 of file traits.hpp.

◆ hasFeature< LanguageFeature::atomic_operations >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::atomic_operations > ( )
static

Specialization for atomic operations - Direct function call for better optimization.

Definition at line 53 of file traits.hpp.

◆ hasFeature< LanguageFeature::exceptions >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::exceptions > ( )
static

Template specializations for specific language features Provides optimized compile-time constants for individual features.

Specialization for exceptions - Direct function call for better optimization

Definition at line 35 of file traits.hpp.

◆ hasFeature< LanguageFeature::inline_assembly >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::inline_assembly > ( )
static

Specialization for inline assembly - Direct function call for better optimization.

Definition at line 59 of file traits.hpp.

◆ hasFeature< LanguageFeature::memory_sanitizer >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::memory_sanitizer > ( )
static

Specialization for MemorySanitizer - Direct function call for better optimization.

Definition at line 89 of file traits.hpp.

◆ hasFeature< LanguageFeature::rtti >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::rtti > ( )
static

Specialization for RTTI - Direct function call for better optimization.

Definition at line 41 of file traits.hpp.

◆ hasFeature< LanguageFeature::stack_protection >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::stack_protection > ( )
static

Specialization for stack protection - Direct function call for better optimization.

Definition at line 71 of file traits.hpp.

◆ hasFeature< LanguageFeature::thread_sanitizer >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::thread_sanitizer > ( )
static

Specialization for ThreadSanitizer - Direct function call for better optimization.

Definition at line 83 of file traits.hpp.

◆ hasFeature< LanguageFeature::threads >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::threads > ( )
static

Specialization for threads - Direct function call for better optimization.

Definition at line 47 of file traits.hpp.

◆ hasFeature< LanguageFeature::vector_intrinsics >()

template<>
static bool trlc::platform::hasFeature< LanguageFeature::vector_intrinsics > ( )
static

Specialization for vector intrinsics - Direct function call for better optimization.

Definition at line 65 of file traits.hpp.

◆ hasFoldExpressions()

static bool trlc::platform::hasFoldExpressions ( )
static

Checks if fold expressions are supported (C++17)

Returns
true if fold expressions are available

Definition at line 274 of file cpp_standard.hpp.

◆ hasHardwareAes()

bool trlc::platform::hasHardwareAes ( )
inline

Detects hardware AES support.

Returns
true if hardware AES acceleration is available

Definition at line 522 of file features.hpp.

◆ hasHardwareRandom()

bool trlc::platform::hasHardwareRandom ( )
inline

Detects hardware random number generation support.

Returns
true if hardware RNG is available

Definition at line 536 of file features.hpp.

◆ hasIfConstexpr()

static bool trlc::platform::hasIfConstexpr ( )
static

Checks if if constexpr is supported (C++17)

Returns
true if if constexpr is available
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 211 of file cpp_standard.hpp.

◆ hasInlineAssembly()

static bool trlc::platform::hasInlineAssembly ( )
static

Detects if inline assembly is supported.

Returns
true if inline assembly can be used

Definition at line 260 of file features.hpp.

◆ hasInlineVariables()

static bool trlc::platform::hasInlineVariables ( )
static

Checks if inline variables are supported (C++17)

Returns
true if inline variables are available

Definition at line 286 of file cpp_standard.hpp.

◆ hasInternalPadding()

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

◆ hasLanguageFeature()

static bool trlc::platform::hasLanguageFeature ( LanguageFeature  feature)
static

Checks if a specific language feature is available.

Parameters
featureLanguage feature to check
Returns
true if feature is available at compile time

Definition at line 588 of file features.hpp.

◆ hasMemorySanitizer()

static bool trlc::platform::hasMemorySanitizer ( )
static

Detects if MemorySanitizer is enabled.

Returns
true if MSan is active

Definition at line 332 of file features.hpp.

◆ hasModules()

static bool trlc::platform::hasModules ( )
static

Checks if modules are supported (C++20)

Returns
true if modules are available
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 249 of file cpp_standard.hpp.

◆ hasNeonSupport()

bool trlc::platform::hasNeonSupport ( )
inline

Detects ARM NEON support.

Returns
true if NEON is supported

Definition at line 504 of file features.hpp.

◆ hasPosixApi()

static bool trlc::platform::hasPosixApi ( )
static

Checks if the platform supports POSIX APIs.

Determines if the current platform provides POSIX-compliant APIs based on platform detection and standard macros.

Returns
true if POSIX APIs are available

Definition at line 243 of file platform.hpp.

◆ hasRanges()

static bool trlc::platform::hasRanges ( )
static

Checks if ranges library is supported (C++20)

Returns
true if ranges are available
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 262 of file cpp_standard.hpp.

◆ hasRtti()

static bool trlc::platform::hasRtti ( )
static

Detects if RTTI (Runtime Type Information) is enabled.

Returns
true if RTTI is available

Definition at line 210 of file features.hpp.

◆ hasRuntimeFeature() [1/2]

template<RuntimeFeature TFeature>
bool trlc::platform::hasRuntimeFeature ( )

Template function for runtime feature testing.

Template Parameters
TFeatureMust be RuntimeFeature enum value
Returns
true if the specified runtime feature is available

Definition at line 103 of file traits.hpp.

◆ hasRuntimeFeature() [2/2]

bool trlc::platform::hasRuntimeFeature ( RuntimeFeature  feature)
inline

Checks if a specific runtime feature is available.

Parameters
featureRuntime feature to check
Returns
true if feature is available (requires runtime detection)
Note
This function is not constexpr as it may require CPU feature detection

Definition at line 623 of file features.hpp.

◆ hasRuntimeFeature< RuntimeFeature::avx >()

Definition at line 134 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::avx2 >()

Definition at line 139 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::avx512f >()

Definition at line 144 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::neon >()

Definition at line 149 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::sse >()

Definition at line 109 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::sse2 >()

Definition at line 114 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::sse3 >()

Definition at line 119 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::sse4_1 >()

Definition at line 124 of file traits.hpp.

◆ hasRuntimeFeature< RuntimeFeature::sse4_2 >()

Definition at line 129 of file traits.hpp.

◆ hasSimdSupport()

static bool trlc::platform::hasSimdSupport ( )
static

◆ hasSse2Support()

bool trlc::platform::hasSse2Support ( )
inline

Detects SSE2 support at runtime.

Returns
true if SSE2 is supported by the CPU

Definition at line 420 of file features.hpp.

◆ hasSse3Support()

bool trlc::platform::hasSse3Support ( )
inline

Detects SSE3 support at runtime.

Returns
true if SSE3 is supported by the CPU

Definition at line 432 of file features.hpp.

◆ hasSse41Support()

bool trlc::platform::hasSse41Support ( )
inline

Detects SSE4.1 support at runtime.

Returns
true if SSE4.1 is supported by the CPU

Definition at line 444 of file features.hpp.

◆ hasSse42Support()

bool trlc::platform::hasSse42Support ( )
inline

Detects SSE4.2 support at runtime.

Returns
true if SSE4.2 is supported by the CPU

Definition at line 456 of file features.hpp.

◆ hasSseSupport()

bool trlc::platform::hasSseSupport ( )
inline

Detects SSE support at runtime.

Returns
true if SSE is supported by the CPU

Definition at line 408 of file features.hpp.

◆ hasStackProtection()

static bool trlc::platform::hasStackProtection ( )
static

Detects if stack protection is enabled.

Returns
true if stack protection features are active

Definition at line 282 of file features.hpp.

◆ hasStructuredBindings()

static bool trlc::platform::hasStructuredBindings ( )
static

Checks if structured bindings are supported (C++17)

Returns
true if structured bindings are available
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 199 of file cpp_standard.hpp.

◆ hasThreads()

static bool trlc::platform::hasThreads ( )
static

Detects if threading support is available.

Returns
true if std::thread and threading primitives are available

Definition at line 230 of file features.hpp.

◆ hasThreadSanitizer()

static bool trlc::platform::hasThreadSanitizer ( )
static

Detects if ThreadSanitizer is enabled.

Returns
true if TSan is active

Definition at line 315 of file features.hpp.

◆ hasThreeWayComparison()

static bool trlc::platform::hasThreeWayComparison ( )
static

Checks if three-way comparison (spaceship operator) is supported (C++20)

Returns
true if three-way comparison is available

Definition at line 334 of file cpp_standard.hpp.

◆ hasUndefinedBehaviorSanitizer()

static bool trlc::platform::hasUndefinedBehaviorSanitizer ( )
static

Detects if UndefinedBehaviorSanitizer is enabled.

Returns
true if UBSan is active

Definition at line 349 of file features.hpp.

◆ hasVectorInstructions()

static bool trlc::platform::hasVectorInstructions ( )
static
Examples
Vector-aware.

Definition at line 728 of file architecture.hpp.

◆ hasVectorIntrinsics()

static bool trlc::platform::hasVectorIntrinsics ( )
static

Detects if vector intrinsics are available.

Returns
true if SIMD intrinsics can be used

Definition at line 274 of file features.hpp.

◆ hasWin32Api()

static bool trlc::platform::hasWin32Api ( )
static

Checks if the platform supports Win32 APIs.

Determines if the current platform provides Win32 APIs based on Windows-specific macros.

Returns
true if Win32 APIs are available

Definition at line 272 of file platform.hpp.

◆ hostToNetwork()

template<typename Type >
static Type trlc::platform::hostToNetwork ( Type  value)
static

Convert from host byte order to network byte order (big-endian)

Network byte order is defined as big-endian. This function converts values from the host's native byte order to network byte order.

Template Parameters
TypeIntegral type to convert
Parameters
valueValue in host byte order
Returns
Value in network byte order (big-endian)

Definition at line 366 of file endianness.hpp.

◆ hostToNetworkLong()

static uint32_t trlc::platform::hostToNetworkLong ( uint32_t  hostlong)
static

Convert 32-bit value from host to network byte order.

Equivalent to the POSIX htonl() function.

Parameters
hostlong32-bit value in host byte order
Returns
32-bit value in network byte order

Definition at line 425 of file endianness.hpp.

◆ hostToNetworkShort()

static uint16_t trlc::platform::hostToNetworkShort ( uint16_t  hostshort)
static

Convert 16-bit value from host to network byte order.

Equivalent to the POSIX htons() function.

Parameters
hostshort16-bit value in host byte order
Returns
16-bit value in network byte order

Definition at line 413 of file endianness.hpp.

◆ initializePlatform()

void trlc::platform::initializePlatform ( )
inline

◆ is32BitArchitecture()

static bool trlc::platform::is32BitArchitecture ( )
static
Examples
32-bit.

Definition at line 849 of file architecture.hpp.

◆ is64BitArchitecture()

static bool trlc::platform::is64BitArchitecture ( )
static
Examples
64-bit, and Basic.

Definition at line 813 of file architecture.hpp.

◆ isAligned() [1/2]

bool trlc::platform::isAligned ( const void *  ptr,
size_t  alignment 
)
inline

Check if a pointer is aligned to the specified boundary.

Parameters
ptrThe pointer to check
alignmentThe alignment boundary
Returns
True if the pointer is properly aligned
Note
This function is not constexpr due to reinterpret_cast limitations

Definition at line 456 of file typeinfo.hpp.

◆ isAligned() [2/2]

static bool trlc::platform::isAligned ( uintptr_t  addr,
size_t  alignment 
)
static

Check if an address is aligned to the specified boundary.

Parameters
addrThe address to check
alignmentThe alignment boundary
Returns
True if the address is properly aligned
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 443 of file typeinfo.hpp.

◆ isBigEndian()

static bool trlc::platform::isBigEndian ( )
static

Check if system is big-endian.

Returns
true if system uses big-endian byte order

Definition at line 197 of file endianness.hpp.

◆ isCacheLineAligned()

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

Verify that a type is suitably aligned for cache line optimization.

Checks whether a type's alignment is sufficient for cache line optimization.

Template Parameters
TypeThe type to verify
Returns
True if the type is cache line aligned
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 389 of file typeinfo.hpp.

◆ isCpp17OrLater()

static bool trlc::platform::isCpp17OrLater ( )
static

Checks if the current C++ standard is at least C++17.

Returns
true if C++17 or later

Definition at line 346 of file cpp_standard.hpp.

◆ isCpp20OrLater()

static bool trlc::platform::isCpp20OrLater ( )
static

Checks if the current C++ standard is at least C++20.

Returns
true if C++20 or later

Definition at line 354 of file cpp_standard.hpp.

◆ isCpp23OrLater()

static bool trlc::platform::isCpp23OrLater ( )
static

Checks if the current C++ standard is at least C++23.

Returns
true if C++23 or later

Definition at line 362 of file cpp_standard.hpp.

◆ isDebugBuild()

static bool trlc::platform::isDebugBuild ( )
static

◆ isExactlyCpp17()

static bool trlc::platform::isExactlyCpp17 ( )
static

Checks if the current C++ standard is exactly C++17.

Returns
true if exactly C++17

Definition at line 370 of file cpp_standard.hpp.

◆ isExactlyCpp20()

static bool trlc::platform::isExactlyCpp20 ( )
static

Checks if the current C++ standard is exactly C++20.

Returns
true if exactly C++20

Definition at line 378 of file cpp_standard.hpp.

◆ isExactlyCpp23()

static bool trlc::platform::isExactlyCpp23 ( )
static

Checks if the current C++ standard is exactly C++23.

Returns
true if exactly C++23

Definition at line 386 of file cpp_standard.hpp.

◆ isLittleEndian()

static bool trlc::platform::isLittleEndian ( )
static

Check if system is little-endian.

Returns
true if system uses little-endian byte order

Definition at line 188 of file endianness.hpp.

◆ isPageAligned()

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

Verify that a type is suitably aligned for page boundaries.

Checks whether a type's alignment is sufficient for page boundary alignment.

Template Parameters
TypeThe type to verify
Returns
True if the type is page aligned
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/typeinfo.hpp.

Definition at line 402 of file typeinfo.hpp.

◆ isPlatformInitialized()

bool trlc::platform::isPlatformInitialized ( )
inline

◆ isReleaseBuild()

static bool trlc::platform::isReleaseBuild ( )
static

Check if the current build is a release build.

Determines whether the code was compiled with release settings enabled. This is the logical inverse of isDebugBuild().

Returns
True if this is a release build, false otherwise
Note
This function is constexpr and evaluated at compile time
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp, and /home/tranglc/sources/trlc-platform/include/trlc/platform/debug.hpp.

Definition at line 105 of file debug.hpp.

◆ networkToHost()

template<typename Type >
static Type trlc::platform::networkToHost ( Type  value)
static

Convert from network byte order (big-endian) to host byte order.

Network byte order is defined as big-endian. This function converts values from network byte order to the host's native byte order.

Template Parameters
TypeIntegral type to convert
Parameters
valueValue in network byte order (big-endian)
Returns
Value in host byte order

Definition at line 389 of file endianness.hpp.

◆ networkToHostLong()

static uint32_t trlc::platform::networkToHostLong ( uint32_t  netlong)
static

Convert 32-bit value from network to host byte order.

Equivalent to the POSIX ntohl() function.

Parameters
netlong32-bit value in network byte order
Returns
32-bit value in host byte order

Definition at line 449 of file endianness.hpp.

◆ networkToHostShort()

static uint16_t trlc::platform::networkToHostShort ( uint16_t  netshort)
static

Convert 16-bit value from network to host byte order.

Equivalent to the POSIX ntohs() function.

Parameters
netshort16-bit value in network byte order
Returns
16-bit value in host byte order

Definition at line 437 of file endianness.hpp.

◆ printPlatformReport()

void trlc::platform::printPlatformReport ( )
inline

◆ supportsCacheLineAlignment()

static bool trlc::platform::supportsCacheLineAlignment ( )
static
Examples
Cache-aligned.

Definition at line 774 of file architecture.hpp.

◆ supportsCaseSensitiveFilesystem()

static bool trlc::platform::supportsCaseSensitiveFilesystem ( )
static

Checks if the platform supports case-sensitive filesystems.

Determines if the filesystem is case-sensitive based on platform characteristics and common filesystem behavior.

Returns
true if filesystem is typically case-sensitive
Note
This is a compile-time approximation; actual filesystem behavior may vary
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/core.hpp.

Definition at line 291 of file platform.hpp.

◆ supportsDeprecated()

static bool trlc::platform::supportsDeprecated ( )
static

Check if compiler supports deprecated attribute.

Returns
true if deprecated is supported, false otherwise
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/macros.hpp.

Definition at line 44 of file macros.hpp.

◆ supportsFallthrough()

static bool trlc::platform::supportsFallthrough ( )
static

Check if compiler supports fallthrough attribute.

Returns
true if fallthrough is supported, false otherwise
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/macros.hpp.

Definition at line 58 of file macros.hpp.

◆ supportsInlineAssembly()

static bool trlc::platform::supportsInlineAssembly ( )
static

Checks if compiler supports inline assembly.

Determines if the current compiler supports inline assembly syntax.

Returns
true if inline assembly is supported

Definition at line 441 of file compiler.hpp.

◆ supportsNodecard()

static bool trlc::platform::supportsNodecard ( )
static

Check if compiler supports nodiscard attribute.

Returns
true if nodiscard is supported, false otherwise
Examples
/home/tranglc/sources/trlc-platform/include/trlc/platform/macros.hpp.

Definition at line 30 of file macros.hpp.

◆ verifyTypeAlignment()

template<typename Type , size_t TExpectedAlignment>
static bool trlc::platform::verifyTypeAlignment ( )
static

◆ verifyTypeSize()

template<typename Type , size_t TExpectedSize>
static bool trlc::platform::verifyTypeSize ( )
static