OpenMS
Loading...
Searching...
No Matches
OpenMSOSInfo Class Reference

Snapshot of the runtime operating system: name, version, and pointer-width architecture. More...

#include <OpenMS/SYSTEM/BuildInfo.h>

Collaboration diagram for OpenMSOSInfo:
[legend]

Public Member Functions

 OpenMSOSInfo ()
 Construct an empty instance with all fields set to "unknown". Use getOSInfo to probe the runtime platform.
 
std::string getOSAsString () const
 Return the running operating system name ("Windows", "MacOS", "Linux", or "unknown").
 
std::string getArchAsString () const
 Return the running architecture ("32 bit", "64 bit", or "unknown") as detected by getOSInfo from the pointer width.
 
std::string getOSVersionAsString () const
 Return the OS version captured by getOSInfo (e.g. "10.15" on macOS or "10.0.19045" on Windows); "unknown" if the platform query failed.
 

Static Public Member Functions

static std::string getBinaryArchitecture ()
 Return the pointer width of this binary, derived from sizeof(size_t).
 
static std::string getActiveSIMDExtensions ()
 Return a comma-separated list of SIMD instruction sets compiled into this binary.
 
static OpenMSOSInfo getOSInfo ()
 Probe the running platform and return a populated OpenMSOSInfo.
 

Private Attributes

OpenMS_OS os_
 
std::string os_version_
 
OpenMS_Architecture arch_
 

Detailed Description

Snapshot of the runtime operating system: name, version, and pointer-width architecture.

Populated via the static factory getOSInfo, which probes the running platform with preprocessor defines (WIN32, __MACH__ && __APPLE__, __unix__). All accessors return string labels suitable for logging or display; the underlying enum values are kept private and only exposed via the *AsString accessors.

Distinct from the build-time view of the binary: getBinaryArchitecture and getActiveSIMDExtensions return what the compiler emitted, not what the running kernel reports.

Constructor & Destructor Documentation

◆ OpenMSOSInfo()

OpenMSOSInfo ( )
inline

Construct an empty instance with all fields set to "unknown". Use getOSInfo to probe the runtime platform.

References OpenMS::Internal::ARCH_UNKNOWN, and OpenMS::Internal::OS_UNKNOWN.

Member Function Documentation

◆ getActiveSIMDExtensions()

static std::string getActiveSIMDExtensions ( )
static

Return a comma-separated list of SIMD instruction sets compiled into this binary.

Reflects the SIMDe preprocessor probes that were defined at build time: any of neon, SSE, SSE2, SSE3, SSE4.1, SSE4.2, AVX, AVX2, FMA. Returns an empty string if none of those is set.

◆ getArchAsString()

std::string getArchAsString ( ) const
inline

Return the running architecture ("32 bit", "64 bit", or "unknown") as detected by getOSInfo from the pointer width.

References OpenMS::Internal::OpenMS_ArchNames.

◆ getBinaryArchitecture()

static std::string getBinaryArchitecture ( )
inlinestatic

Return the pointer width of this binary, derived from sizeof(size_t).

"32 bit" if sizeof(size_t) is 4, "64 bit" if 8, otherwise "unknown". This reflects how the binary was compiled, independent of the running OS.

References OpenMS::Internal::OpenMS_ArchNames.

◆ getOSAsString()

std::string getOSAsString ( ) const
inline

Return the running operating system name ("Windows", "MacOS", "Linux", or "unknown").

References OpenMS::Internal::OpenMS_OSNames.

◆ getOSInfo()

static OpenMSOSInfo getOSInfo ( )
inlinestatic

Probe the running platform and return a populated OpenMSOSInfo.

Sets os_ from compile-time platform macros (WIN32 / __MACH__ && __APPLE__ / __unix__), os_version_ via getOSVersionString_, and arch_ from sizeof(void*) (4 → 32-bit, otherwise 64-bit). Fields stay at their OS_UNKNOWN / ARCH_UNKNOWN defaults if the running platform isn't recognised.

References OpenMSOSInfo::arch_, OpenMS::Internal::getOSVersionString_(), OpenMSOSInfo::os_, and OpenMSOSInfo::os_version_.

◆ getOSVersionAsString()

std::string getOSVersionAsString ( ) const
inline

Return the OS version captured by getOSInfo (e.g. "10.15" on macOS or "10.0.19045" on Windows); "unknown" if the platform query failed.

Member Data Documentation

◆ arch_

OpenMS_Architecture arch_
private

Referenced by OpenMSOSInfo::getOSInfo().

◆ os_

OpenMS_OS os_
private

Referenced by OpenMSOSInfo::getOSInfo().

◆ os_version_

std::string os_version_
private

Referenced by OpenMSOSInfo::getOSInfo().