1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPlatformDefines.h"
6#include "String/BsString.h"
7#include "Prerequisites/BsTypes.h"
8#include "Utility/BsUUID.h"
9
10namespace bs
11{
12 /** @addtogroup General
13 * @{
14 */
15
16 struct MACAddress;
17
18 /** Contains information about available GPUs on the system. */
19 struct GPUInfo
20 {
21 String names[5];
22 UINT32 numGPUs;
23 };
24
25 /** Contains information about the system hardware and operating system. */
26 struct SystemInfo
27 {
28 String cpuManufacturer;
29 String cpuModel;
30 UINT32 cpuClockSpeedMhz;
31 UINT32 cpuNumCores;
32 UINT32 memoryAmountMb;
33 String osName;
34 bool osIs64Bit;
35
36 GPUInfo gpuInfo;
37 };
38
39 /** Provides access to various operating system specific utility functions. */
40 class BS_UTILITY_EXPORT PlatformUtility
41 {
42 public:
43 /**
44 * Terminates the current process.
45 *
46 * @param[in] force True if the process should be forcefully terminated with no cleanup.
47 */
48 [[noreturn]] static void terminate(bool force = false);
49
50 /** Returns information about the underlying hardware. */
51 static SystemInfo getSystemInfo();
52
53 /** Creates a new universally unique identifier (UUID/GUID). */
54 static UUID generateUUID();
55
56 /**
57 * Converts a UTF8 encoded string into uppercase or lowercase.
58 *
59 * @param[in] input String to convert.
60 * @param[in] toUpper If true, converts the character to uppercase. Otherwise convert to lowercase.
61 * @return Converted string.
62 */
63 static String convertCaseUTF8(const String& input, bool toUpper);
64
65 /** @name Internal
66 * @{
67 */
68
69 /**
70 * Assigns information about GPU hardware. This data will be returned by getSystemInfo() when requested. This is
71 * expeced to be called by the render API backend when initialized.
72 */
73 static void _setGPUInfo(GPUInfo gpuInfo) { sGPUInfo = gpuInfo; }
74
75 /** @} */
76
77 private:
78 static GPUInfo sGPUInfo;
79 };
80
81 /** @} */
82}
83