ObjFW
OFSystemInfo.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 #import "OFString.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
26 OF_SUBCLASSING_RESTRICTED
28 #ifdef OF_HAVE_CLASS_PROPERTIES
29 @property (class, readonly, nonatomic) size_t pageSize;
30 @property (class, readonly, nonatomic) size_t numberOfCPUs;
31 @property (class, readonly, nonatomic) OFString *ObjFWVersion;
32 @property (class, readonly, nonatomic) unsigned int ObjFWVersionMajor;
33 @property (class, readonly, nonatomic) unsigned int ObjFWVersionMinor;
34 @property (class, readonly, nullable, nonatomic) OFString *operatingSystemName;
35 @property (class, readonly, nullable, nonatomic)
37 # ifdef OF_HAVE_FILES
38 @property (class, readonly, nullable, nonatomic) OFString *userDataPath;
39 @property (class, readonly, nullable, nonatomic) OFString *userConfigPath;
40 # endif
41 @property (class, readonly, nullable, nonatomic) OFString *CPUVendor;
42 @property (class, readonly, nullable, nonatomic) OFString *CPUModel;
43 # if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN)
44 @property (class, readonly, nonatomic) bool supportsMMX;
45 @property (class, readonly, nonatomic) bool supportsSSE;
46 @property (class, readonly, nonatomic) bool supportsSSE2;
47 @property (class, readonly, nonatomic) bool supportsSSE3;
48 @property (class, readonly, nonatomic) bool supportsSSSE3;
49 @property (class, readonly, nonatomic) bool supportsSSE41;
50 @property (class, readonly, nonatomic) bool supportsSSE42;
51 @property (class, readonly, nonatomic) bool supportsAVX;
52 @property (class, readonly, nonatomic) bool supportsAVX2;
53 @property (class, readonly, nonatomic) bool supportsAESNI;
54 @property (class, readonly, nonatomic) bool supportsSHAExtensions;
55 # endif
56 # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
57 @property (class, readonly, nonatomic) bool supportsAltiVec;
58 # endif
59 # ifdef OF_WINDOWS
60 @property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
61 # endif
62 #endif
63 
69 + (size_t)pageSize;
70 
78 + (size_t)numberOfCPUs;
79 
86 
92 + (unsigned int)ObjFWVersionMajor;
93 
99 + (unsigned int)ObjFWVersionMinor;
100 
107 + (nullable OFString *)operatingSystemName;
108 
115 + (nullable OFString *)operatingSystemVersion;
116 
117 #ifdef OF_HAVE_FILES
128 + (nullable OFString *)userDataPath;
129 
142 + (nullable OFString *)userConfigPath;
143 #endif
144 
152 + (nullable OFString *)CPUVendor;
153 
161 + (nullable OFString *)CPUModel;
162 
163 #if defined(OF_X86_64) || defined(OF_X86) || defined(DOXYGEN)
171 + (bool)supportsMMX;
172 
182 + (bool)supportsSSE;
183 
193 + (bool)supportsSSE2;
194 
204 + (bool)supportsSSE3;
205 
215 + (bool)supportsSSSE3;
216 
226 + (bool)supportsSSE41;
227 
237 + (bool)supportsSSE42;
238 
248 + (bool)supportsAVX;
249 
259 + (bool)supportsAVX2;
260 
268 + (bool)supportsAESNI;
269 
277 + (bool)supportsSHAExtensions;
278 #endif
279 
280 #if defined(OF_POWERPC) || defined(OF_POWERPC64)
288 + (bool)supportsAltiVec;
289 #endif
290 
291 #ifdef OF_WINDOWS
299 + (bool)isWindowsNT;
300 #endif
301 
302 + (instancetype)alloc OF_UNAVAILABLE;
303 - (instancetype)init OF_UNAVAILABLE;
304 @end
305 
306 OF_ASSUME_NONNULL_END
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:547
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object.
Definition: OFObject.m:392
A class for handling strings.
Definition: OFString.h:132
A class for querying information about the system.
Definition: OFSystemInfo.h:28
nullable OFString * CPUVendor()
Returns the vendor of the CPU.
Definition: OFSystemInfo.m:530
bool supportsAVX()
Returns whether the CPU supports AVX.
size_t pageSize()
Returns the size of a page.
Definition: OFSystemInfo.m:309
nullable OFString * userConfigPath()
Returns the path where user configuration for the application can be stored.
Definition: OFSystemInfo.m:444
bool supportsSSE3()
Returns whether the CPU supports SSE3.
nullable OFString * userDataPath()
Returns the path where user data for the application can be stored.
Definition: OFSystemInfo.m:351
unsigned int ObjFWVersionMajor()
The major version of ObjFW.
Definition: OFSystemInfo.m:324
nullable OFString * operatingSystemName()
Returns the name of the operating system the application is running on.
Definition: OFSystemInfo.m:334
OFString * ObjFWVersion()
The version of ObjFW.
Definition: OFSystemInfo.m:319
nullable OFString * operatingSystemVersion()
Returns the version of the operating system the application is running on.
Definition: OFSystemInfo.m:342
size_t numberOfCPUs()
Returns the number of CPUs installed in the system.
Definition: OFSystemInfo.m:314
nullable OFString * CPUModel()
Returns the model of the CPU.
Definition: OFSystemInfo.m:551
bool supportsSSE41()
Returns whether the CPU supports SSE4.1.
bool supportsSSSE3()
Returns whether the CPU supports SSSE3.
bool supportsSSE42()
Returns whether the CPU supports SSE4.2.
bool supportsAVX2()
Returns whether the CPU supports AVX2.
unsigned int ObjFWVersionMinor()
The minor version of ObjFW.
Definition: OFSystemInfo.m:329
bool supportsAESNI()
Returns whether the CPU supports AES-NI.
bool supportsSSE()
Returns whether the CPU supports SSE.
bool supportsSHAExtensions()
Returns whether the CPU supports Intel SHA Extensions.
bool supportsSSE2()
Returns whether the CPU supports SSE2.
bool supportsMMX()
Returns whether the CPU supports MMX.