Container for static methods to access various system and execution environment valuses. More...
#include <mi32/misystem.h>
Classes | |
| class | DISABLE_SUSPEND |
| Sentry class to enable/disable system suspend during long non-interactive operations. More... | |
Public Types | |
| enum | EXECUTEFLAGS { EXECUTEFLAG_None = 0x0000, EXECUTEFLAG_WaitUntilFinished = 0x0001, EXECUTEFLAG_ShowConsole = 0x0002, EXECUTEFLAG_NoWaitForInit = 0x0004 } |
| enum | PLATFORM { PLATFORM_Unknown = 0, PLATFORM_Win32_PreNT = 0x000100, PLATFORM_Win95 = (PLATFORM_Win32_PreNT | 0x01), PLATFORM_Win98 = (PLATFORM_Win32_PreNT | 0x02), PLATFORM_WinME = (PLATFORM_Win32_PreNT | 0x03), PLATFORM_Win32_NT = 0x001000, PLATFORM_WinNT = (PLATFORM_Win32_NT | 0x01), PLATFORM_Win2000 = (PLATFORM_Win32_NT | 0x02), PLATFORM_WinXP = (PLATFORM_Win32_NT | 0x03), PLATFORM_WinServer2003 = (PLATFORM_Win32_NT | 0x04), PLATFORM_WinVista = (PLATFORM_Win32_NT | 0x05), PLATFORM_WinServer2008 = (PLATFORM_Win32_NT | 0x06), PLATFORM_Win7 = (PLATFORM_Win32_NT | 0x07), PLATFORM_WinServer2008_R2 = (PLATFORM_Win32_NT | 0x08), PLATFORM_Unix = 0x002000, PLATFORM_MacOSX = (PLATFORM_Unix | 0x01), PLATFORM_LinuxX86 = (PLATFORM_Unix | 0x02), PLATFORM_UnixSun = (PLATFORM_Unix | 0x03), PLATFORM_UnixSGI = (PLATFORM_Unix | 0x04), PLATFORM_UnixIBM = (PLATFORM_Unix | 0x05) } |
| enum | PROCESSRESULT { PROCESSRESULT_Finished = 0, PROCESSRESULT_ExitError, PROCESSRESULT_ExternalStop, PROCESSRESULT_DiedCoreDump, PROCESSRESULT_DiedNoCoreDump } |
| enum | RUNMODE { RUNMODE_User, RUNMODE_Job } |
| typedef UINT64 | THREAD_ID |
Static Public Member Functions | |
| static void | DisableCrashWindow () |
| static ERRVALUE | ExecuteProcess (const MISTRING &Process, EXECUTEFLAGS ExeFlags=EXECUTEFLAG_None, FastDelegate< void(PTRUINT, PROCESSRESULT)> DelegateOnProcessEnd=0, PTRUINT *ProcessID=0) |
| static const MISTRINGLIST & | GetCurrentLanguageSet () |
| static THREAD_ID | GetCurrentThreadID () |
| static MISTRING | GetCurrentUserName () |
| static MISTRING | GetEnvironmentValue (const char *name) |
| static MISTRING | GetHostDetails () |
| static MISTRING | GetHostName () |
| static int | GetNumLogicalProcessors () |
| static int | GetNumPhysicalProcessors () |
| static INT64 | GetPhysicalMemoryAvailable () |
| static INT64 | GetPhysicalMemoryTotal () |
| static PLATFORM | GetPlatform () |
| static UINT32 | GetProcessID () |
| static RUNMODE | GetRunMode () |
| static CHAR_ENCODING | GetSystemEncoding () |
| static const char * | GetSystemLanguage () |
| static UINT32 | GetTickCount () |
| static UINT32 | GetTicksPerSecond () |
| static double | GetTimerValue () |
| static int | GetUserThreadLimit (bool IncludeLogicalCores) |
| static INT64 | GetVirtualMemoryAvailable () |
| static INT64 | GetVirtualMemoryTotal () |
| static void | Initialize () |
| static bool | IsMainThread () |
| static void | KillProcess (int ProcessID) |
| static const char * | LookupISO639_1Code (const char *iso639_2code) |
| static const char * | LookupISO639_2Code (const char *iso639_1code) |
| static void | SetAsMainThread () |
| static void | SetCurrentLanguageSet (const MISTRINGLIST &iso639) |
| static ERRVALUE | SetCurrentWorkingDirectory (const FILEPATH &filepath) |
| static void | SetEnvironmentValue (const char *name, const char *value) |
| static void | SetRunMode (RUNMODE runmode) |
| static void | SetSuspendDisabled (bool disable) |
| static void | SetUserThreadLimit (int MaxThreads) |
| static void | Sleep (double delay) |
| static bool | Supports64BitFileSystem () |
| static ERRVALUE | TranslateSystemError (ERRVALUE DftErrCode, INT32 &SystemError) |
| static void | Uninitialize () |
Container for static methods to access various system and execution environment valuses.
| typedef UINT64 MISYSTEM::THREAD_ID |
| enum MISYSTEM::PLATFORM |
| enum MISYSTEM::RUNMODE |
| static void MISYSTEM::DisableCrashWindow | ( | ) | [static] |
Disable dialog that may be displayed when process crashes.
Use with care, as process will simply terminate on crash.
| static ERRVALUE MISYSTEM::ExecuteProcess | ( | const MISTRING & | Process, | |
| EXECUTEFLAGS | ExeFlags = EXECUTEFLAG_None, |
|||
| FastDelegate< void(PTRUINT, PROCESSRESULT)> | DelegateOnProcessEnd = 0, |
|||
| PTRUINT * | ProcessID = 0 | |||
| ) | [static] |
Execute a process with possible additional parameters.
Double quotes are required for the process string and any parameters that have spaces. If called on UNIX systems with EXECUTEFLAG_WaitUntilFinished specified, only one delegate per thread can be assigned. If another delegate is assigned for the same thread, the other is dropped. Windows systems do not have this limitation.
| Process | Process to execute plus any parameters. If process is not an absolute path, OS process location rules apply. | |
| DelegateOnProcessEnd | Called when the process is finished | |
| ProcessID | Process ID of the child created RETURNED, if not NULL and EXECUTEFLAG_WaitUntilFinished is not specified and DelegateOnProcessEnd is assigned |
| static const MISTRINGLIST& MISYSTEM::GetCurrentLanguageSet | ( | ) | [static] |
Get the current language set for the calling thread.
Depending on the situation, there may be more than one language selected in the order of first language prefered. The default language set order is: 1. The code stored in the user's tntproc.ini file, if the entry exists. 2. The code returned by GetSystemLanguage(). 2. English code "enu".
| static THREAD_ID MISYSTEM::GetCurrentThreadID | ( | ) | [static] |
Get current thread ID.
| static MISTRING MISYSTEM::GetCurrentUserName | ( | ) | [static] |
Get current user name.
| static MISTRING MISYSTEM::GetEnvironmentValue | ( | const char * | name | ) | [static] |
Get value of named environment variable.
| name | Environment variable name |
| static MISTRING MISYSTEM::GetHostDetails | ( | ) | [static] |
Get host computer details.
Returns multi-line string which may include OS name, version, service pack, processor, total physical and virtual memory, and other non-user-specific information.
| static MISTRING MISYSTEM::GetHostName | ( | ) | [static] |
Get host computer name.
| static int MISYSTEM::GetNumLogicalProcessors | ( | ) | [static] |
Get the number of logical processors.
| static int MISYSTEM::GetNumPhysicalProcessors | ( | ) | [static] |
Get the number of physical processors.
| static INT64 MISYSTEM::GetPhysicalMemoryAvailable | ( | ) | [static] |
Get amount of available physical memory.
| static INT64 MISYSTEM::GetPhysicalMemoryTotal | ( | ) | [static] |
Get amount of total physical memory.
| static PLATFORM MISYSTEM::GetPlatform | ( | ) | [static] |
Get platform.
| static UINT32 MISYSTEM::GetProcessID | ( | ) | [static] |
Get the numeric ID of the current process.
| static RUNMODE MISYSTEM::GetRunMode | ( | ) | [static] |
Get process run mode.
| static CHAR_ENCODING MISYSTEM::GetSystemEncoding | ( | ) | [static] |
Get the system encoding that is used in filenames and other system strings For Windows and MAC, they are static, for LINUX and SUN, it depends on the current locale setting.
| static const char* MISYSTEM::GetSystemLanguage | ( | ) | [static] |
Get the language setup for the system (set via the current user).
| static UINT32 MISYSTEM::GetTickCount | ( | ) | [static] |
Returns a simple clock tick of unknown starting time.
| static UINT32 MISYSTEM::GetTicksPerSecond | ( | ) | [static] |
Get number of clock ticks per second.
| static double MISYSTEM::GetTimerValue | ( | ) | [static] |
Return 'timer' value.
Precision of timer is system-dependent, ranging from 1ms and 100ns.
| static int MISYSTEM::GetUserThreadLimit | ( | bool | IncludeLogicalCores | ) | [static] |
Get user preference for thread limit.
If no thread limit set, return value is based on number of processor cores, otherwise will return smalller of user limit and number of cores.
| IncludeLogicalCores | Include logical (hyperthreading) cores if any |
| static INT64 MISYSTEM::GetVirtualMemoryAvailable | ( | ) | [static] |
Get amount of available virtual memory.
The return value may change if the OS supports dynamic page/swap file allocation.
| static INT64 MISYSTEM::GetVirtualMemoryTotal | ( | ) | [static] |
Get total amount of virtual memory.
The return value may change if the OS supports dynamic page/swap file allocation.
| static void MISYSTEM::Initialize | ( | ) | [static] |
Initialize system.
| static bool MISYSTEM::IsMainThread | ( | ) | [static] |
Determine if current thread is set as "main" thread.
Typically the "user interface" is run in the main thread.
| static void MISYSTEM::KillProcess | ( | int | ProcessID | ) | [static] |
Kill process by pid.
| static const char* MISYSTEM::LookupISO639_1Code | ( | const char * | iso639_2code | ) | [static] |
Given an ISO639-2 three character language code, return the equivalent ISO639-1 two character language code.
| iso639_2code | ISO639-2 three character language code |
| static const char* MISYSTEM::LookupISO639_2Code | ( | const char * | iso639_1code | ) | [static] |
Given an ISO639-1 two character language code, return the equivalent ISO639-2 three character language code The returned ISO639-2 code may have two sets of codes separated by a '/'.
| iso639_1code | ISO639-1 two character language code |
| static void MISYSTEM::SetAsMainThread | ( | ) | [static] |
Set current thread as "main thread".
| static void MISYSTEM::SetCurrentLanguageSet | ( | const MISTRINGLIST & | iso639 | ) | [static] |
Set the current language set for the calling thread.
If there is more than one language listed, then the order is of first language prefered.
| iso639 | ISO 639-2 three character language code or ISO 639-1 two character language code with a possible ISO 3166 country code list |
Set the current working directory.
Note, to get the current working directory, construct a FILEPATH with FILEPATH::PATHTYPE_Current.
| static void MISYSTEM::SetEnvironmentValue | ( | const char * | name, | |
| const char * | value | |||
| ) | [static] |
Set value of named environment variable (char* value).
| name | Environment variable name | |
| value | Value to set |
| static void MISYSTEM::SetRunMode | ( | RUNMODE | runmode | ) | [static] |
Set process "run" mode.
| runmode | Run mode |
| static void MISYSTEM::SetSuspendDisabled | ( | bool | disable | ) | [static] |
Enable or prevent system processor from entering suspended / sleeping state.
Keeps counter so each time is disabled must be matched by call to enable. Initial state is to enable suspend. May not be supported on all platforms.
| disable | True to disable suspend, false to enable |
| static void MISYSTEM::SetUserThreadLimit | ( | int | MaxThreads | ) | [static] |
Set user preference for thread limit.
Intended to allow user to limit number of threads below default for evaluating performance.
| MaxThreads | Maximum threads to return from GetUserThreadLimit |
| static void MISYSTEM::Sleep | ( | double | delay | ) | [static] |
Delay for specified time.
| delay | Time to delay in seconds |
| static bool MISYSTEM::Supports64BitFileSystem | ( | ) | [static] |
Determine if system supports 64-bit filesystems.
| static ERRVALUE MISYSTEM::TranslateSystemError | ( | ERRVALUE | DftErrCode, | |
| INT32 & | SystemError | |||
| ) | [static] |
Translate OS error code to MicroImages error code Does NOT do a SetErrPosn() on the error code, that is up to the caller.
| DftErrCode | Default error code to use if system error not specifically handled | |
| SystemError | Operating sytem error RETURNED |
| static void MISYSTEM::Uninitialize | ( | ) | [static] |
Uninitialize system.
1.6.1