MPIO v1.6.0
Multi-platform common IO library
Loading...
Searching...
No Matches
OS Class Reference

Common operating system functions. (MT-Safe). More...

#include <os.hpp>

Static Public Member Functions

static double getCurrentClock ()
 Returns high resolution time stamp in seconds. (MT-Safe).
static int getLogicalCpuCount ()
 Returns system logical CPU count. (MT-Safe).
static int getPhysicalCpuCount ()
 Returns system physical CPU count. (MT-Safe).
static int getPerformanceCpuCount ()
 Returns system performance CPU count. (MT-Safe).
static int64_t getTotalRamSize ()
 Returns system total physical RAM size. (MT-Safe).
static int64_t getFreeRamSize ()
 Returns system free physical RAM size. (MT-Safe).
static string getCpuName ()
 Returns system CPU name string. (MT-Safe).
static int executeFile (const char *filePath, char **args) noexcept
 Executes specified file with arguments. (MT-Safe).
static int executeFile (const char *filePath, va_list args) noexcept
 Executes specified file with arguments. (MT-Safe).
static int executeFile (const char *filePath,...) noexcept
 Executes specified file with arguments. (MT-Safe).
static bool openFileManager (const string &path)
 Opens file using preferred application. (Explorer, Finder, Browser, etc.).
static void showError (const string &title, const string &message)
 Shows system error message. (Window or popup).

Detailed Description

Common operating system functions. (MT-Safe).

See the os.h

Member Function Documentation

◆ getCurrentClock()

double getCurrentClock ( )
inlinestatic

Returns high resolution time stamp in seconds. (MT-Safe).

See the getCurrentClock().

◆ getLogicalCpuCount()

int getLogicalCpuCount ( )
inlinestatic

Returns system logical CPU count. (MT-Safe).

See the getLogicalCpuCount().

Exceptions
Errorif failed to get logical CPU count.

◆ getPhysicalCpuCount()

int getPhysicalCpuCount ( )
inlinestatic

Returns system physical CPU count. (MT-Safe).

See the getPhysicalCpuCount().

Exceptions
Errorif failed to get physical CPU count.

◆ getPerformanceCpuCount()

int getPerformanceCpuCount ( )
inlinestatic

Returns system performance CPU count. (MT-Safe).

See the getPerformanceCpuCount().

Exceptions
Errorif failed to get performance CPU count.

◆ getTotalRamSize()

int64_t getTotalRamSize ( )
inlinestatic

Returns system total physical RAM size. (MT-Safe).

See the getTotalRamSize().

Exceptions
Errorif failed to get total RAM size.

◆ getFreeRamSize()

int64_t getFreeRamSize ( )
inlinestatic

Returns system free physical RAM size. (MT-Safe).

See the getFreeRamSize().

Exceptions
Errorif failed to get free RAM size.

◆ getCpuName()

string getCpuName ( )
inlinestatic

Returns system CPU name string. (MT-Safe).

See the getCpuName().

Exceptions
Errorif failed to get CPU name.

◆ executeFile() [1/3]

int executeFile ( const char * filePath,
char ** args )
inlinestaticnoexcept

Executes specified file with arguments. (MT-Safe).

See the executeFileA().

Parameters
[in]filePathfile path string
argsprogram arguments
Returns
Program exit code or -1 if process stopped or crashed.

◆ executeFile() [2/3]

int executeFile ( const char * filePath,
va_list args )
inlinestaticnoexcept

Executes specified file with arguments. (MT-Safe).

See the executeFileVA().

Parameters
[in]filePathfile path string
argsprogram arguments
Returns
Program exit code or -1 if process stopped or crashed.

◆ executeFile() [3/3]

int executeFile ( const char * filePath,
... )
inlinestaticnoexcept

Executes specified file with arguments. (MT-Safe).

See the executeFileVA().

Warning
Always pass NULL as the last argument in the list!!!
Parameters
[in]filePathfile path string
argsprogram arguments
Returns
Program exit code or -1 if process stopped or crashed.

◆ openFileManager()

bool openFileManager ( const string & path)
inlinestatic

Opens file using preferred application. (Explorer, Finder, Browser, etc.).

See the executeFileVA().

Parameters
[in]pathdirectory or file path string
Returns
True on success, otherwise false.

◆ showError()

void showError ( const string & title,
const string & message )
inlinestatic

Shows system error message. (Window or popup).

See the showError().

Parameters
[in]titlemessage title string
[in]messageerror message string