ObjFW
OFSystemInfo.h
1 /*
2  * Copyright (c) 2008-2024 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 
21 @class OFDictionary OF_GENERIC(KeyType, ObjectType);
22 @class OFIRI;
23 
29 OF_SUBCLASSING_RESTRICTED
31 #ifdef OF_HAVE_CLASS_PROPERTIES
32 @property (class, readonly, nonatomic) size_t pageSize;
33 @property (class, readonly, nonatomic) size_t numberOfCPUs;
34 @property (class, readonly, nonatomic) OFString *ObjFWVersion;
35 @property (class, readonly, nonatomic) unsigned short ObjFWVersionMajor;
36 @property (class, readonly, nonatomic) unsigned short ObjFWVersionMinor;
37 @property (class, readonly, nullable, nonatomic) OFString *operatingSystemName;
38 @property (class, readonly, nullable, nonatomic)
40 @property (class, readonly, nullable, nonatomic) OFIRI *userDataIRI;
41 @property (class, readonly, nullable, nonatomic) OFIRI *userConfigIRI;
42 @property (class, readonly, nullable, nonatomic) OFIRI *temporaryDirectoryIRI;
43 @property (class, readonly, nullable, nonatomic) OFString *CPUVendor;
44 @property (class, readonly, nullable, nonatomic) OFString *CPUModel;
45 # if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN)
46 @property (class, readonly, nonatomic) bool supportsMMX;
47 @property (class, readonly, nonatomic) bool supports3DNow;
48 @property (class, readonly, nonatomic) bool supportsEnhanced3DNow;
49 @property (class, readonly, nonatomic) bool supportsSSE;
50 @property (class, readonly, nonatomic) bool supportsSSE2;
51 @property (class, readonly, nonatomic) bool supportsSSE3;
52 @property (class, readonly, nonatomic) bool supportsSSSE3;
53 @property (class, readonly, nonatomic) bool supportsSSE41;
54 @property (class, readonly, nonatomic) bool supportsSSE42;
55 @property (class, readonly, nonatomic) bool supportsAVX;
56 @property (class, readonly, nonatomic) bool supportsAVX2;
57 @property (class, readonly, nonatomic) bool supportsAESNI;
58 @property (class, readonly, nonatomic) bool supportsSHAExtensions;
59 # endif
60 # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
61 @property (class, readonly, nonatomic) bool supportsAltiVec;
62 # endif
63 # if defined(OF_WINDOWS) || defined(DOXYGEN)
64 @property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT;
65 # endif
66 #endif
67 
73 + (size_t)pageSize;
74 
82 + (size_t)numberOfCPUs;
83 
90 
96 + (unsigned short)ObjFWVersionMajor;
97 
103 + (unsigned short)ObjFWVersionMinor;
104 
111 + (nullable OFString *)operatingSystemName;
112 
119 + (nullable OFString *)operatingSystemVersion;
120 
132 + (nullable OFIRI *)userDataIRI;
133 
147 + (nullable OFIRI *)userConfigIRI;
148 
165 + (nullable OFIRI *)temporaryDirectoryIRI;
166 
174 + (nullable OFString *)CPUVendor;
175 
183 + (nullable OFString *)CPUModel;
184 
185 #if defined(OF_AMD64) || defined(OF_X86) || defined(DOXYGEN)
186 
193 + (bool)supportsMMX;
194 
202 + (bool)supports3DNow;
203 
211 + (bool)supportsEnhanced3DNow;
212 
222 + (bool)supportsSSE;
223 
233 + (bool)supportsSSE2;
234 
244 + (bool)supportsSSE3;
245 
255 + (bool)supportsSSSE3;
256 
266 + (bool)supportsSSE41;
267 
277 + (bool)supportsSSE42;
278 
288 + (bool)supportsAVX;
289 
299 + (bool)supportsAVX2;
300 
308 + (bool)supportsAESNI;
309 
317 + (bool)supportsSHAExtensions;
318 #endif
319 
320 #if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN)
321 
328 + (bool)supportsAltiVec;
329 #endif
330 
331 #if defined(OF_WINDOWS) || defined(DOXYGEN)
332 
339 + (bool)isWindowsNT;
340 #endif
341 
342 + (instancetype)alloc OF_UNAVAILABLE;
343 - (instancetype)init OF_UNAVAILABLE;
344 @end
345 
346 OF_ASSUME_NONNULL_END
347 
348 #ifdef OF_HAVE_SOCKETS
349 # import "OFSystemInfo+NetworkInterfaces.h"
350 #endif
bool supportsAESNI()
Returns whether the CPU supports AES-NI.
bool supportsMMX()
Returns whether the CPU supports MMX.
A class for querying information about the system.
Definition: OFSystemInfo.h:30
size_t pageSize()
Returns the size of a page.
Definition: OFSystemInfo.m:351
bool supportsSSE41()
Returns whether the CPU supports SSE4.1.
bool supportsSSE42()
Returns whether the CPU supports SSE4.2.
nullable OFIRI * userDataIRI()
Returns the path where user data for the application can be stored.
Definition: OFSystemInfo.m:392
The root class for all other classes inside ObjFW.
Definition: OFObject.h:686
bool supportsSSSE3()
Returns whether the CPU supports SSSE3.
bool supportsAVX2()
Returns whether the CPU supports AVX2.
bool supportsSHAExtensions()
Returns whether the CPU supports Intel SHA Extensions.
A class for handling strings.
Definition: OFString.h:134
bool supportsSSE2()
Returns whether the CPU supports SSE2.
An abstract class for storing objects in a dictionary.
Definition: OFDictionary.h:78
OFString * ObjFWVersion()
The version of ObjFW.
Definition: OFSystemInfo.m:361
nullable OFIRI * temporaryDirectoryIRI()
Returns a path where temporary files for can be stored.
Definition: OFSystemInfo.m:568
instancetype init()
Initializes an already allocated object.
Definition: OFObject.m:586
unsigned short ObjFWVersionMajor()
The major version of ObjFW.
Definition: OFSystemInfo.m:366
instancetype alloc()
Allocates memory for an instance of the class and sets up the memory pool for the object...
Definition: OFObject.m:438
bool supportsAVX()
Returns whether the CPU supports AVX.
bool supportsEnhanced3DNow()
Returns whether the CPU supports enhanced 3DNow!.
A class for representing IRIs, URIs, URLs and URNs, for parsing them as well as accessing parts of th...
Definition: OFIRI.h:35
bool isWindowsNT()
Returns whether the application is running on Windows NT.
nullable OFString * operatingSystemName()
Returns the name of the operating system the application is running on.
Definition: OFSystemInfo.m:376
nullable OFString * CPUModel()
Returns the model of the CPU.
Definition: OFSystemInfo.m:673
size_t numberOfCPUs()
Returns the number of CPUs installed in the system.
Definition: OFSystemInfo.m:356
nullable OFString * CPUVendor()
Returns the vendor of the CPU.
Definition: OFSystemInfo.m:650
bool supportsSSE()
Returns whether the CPU supports SSE.
nullable OFString * operatingSystemVersion()
Returns the version of the operating system the application is running on.
Definition: OFSystemInfo.m:384
nullable OFIRI * userConfigIRI()
Returns the path where user configuration for the application can be stored.
Definition: OFSystemInfo.m:484
bool supportsSSE3()
Returns whether the CPU supports SSE3.
unsigned short ObjFWVersionMinor()
The minor version of ObjFW.
Definition: OFSystemInfo.m:371
bool supports3DNow()
Returns whether the CPU supports 3DNow!.
bool supportsAltiVec()
Returns whether the CPU and OS support AltiVec.