Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / opencl / openclconfig.hxx
blobe5fd6dd00305dd6d5ace9a9e1b46312bdb1532b9
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
10 #ifndef INCLUDED_OPENCL_OPENCLCONFIG_HXX
11 #define INCLUDED_OPENCL_OPENCLCONFIG_HXX
13 #include <ostream>
14 #include <set>
16 #include <opencl/opencldllapi.h>
17 #include <opencl/platforminfo.hxx>
18 #include <rtl/ustring.hxx>
20 struct OPENCL_DLLPUBLIC OpenCLConfig
22 struct ImplMatcher
24 OUString maOS;
25 OUString maOSVersion;
26 OUString maPlatformVendor;
27 OUString maDevice;
28 OUString maDriverVersion;
30 ImplMatcher()
34 ImplMatcher(const OUString& rOS,
35 const OUString& rOSVersion,
36 const OUString& rPlatformVendor,
37 const OUString& rDevice,
38 const OUString& rDriverVersion)
39 : maOS(rOS),
40 maOSVersion(rOSVersion),
41 maPlatformVendor(rPlatformVendor),
42 maDevice(rDevice),
43 maDriverVersion(rDriverVersion)
47 bool operator==(const ImplMatcher& r) const
49 return maOS == r.maOS &&
50 maOSVersion == r.maOSVersion &&
51 maPlatformVendor == r.maPlatformVendor &&
52 maDevice == r.maDevice &&
53 maDriverVersion == r.maDriverVersion;
55 bool operator!=(const ImplMatcher& r) const
57 return !operator==(r);
59 bool operator<(const ImplMatcher& r) const
61 return (maOS < r.maOS ||
62 (maOS == r.maOS &&
63 (maOSVersion < r.maOSVersion ||
64 (maOSVersion == r.maOSVersion &&
65 (maPlatformVendor < r.maPlatformVendor ||
66 (maPlatformVendor == r.maPlatformVendor &&
67 (maDevice < r.maDevice ||
68 (maDevice == r.maDevice &&
69 (maDriverVersion < r.maDriverVersion)))))))));
73 bool mbUseOpenCL;
75 typedef std::set<ImplMatcher> ImplMatcherSet;
77 ImplMatcherSet maBlackList;
78 ImplMatcherSet maWhiteList;
80 OpenCLConfig();
82 bool operator== (const OpenCLConfig& r) const;
83 bool operator!= (const OpenCLConfig& r) const;
85 static OpenCLConfig get();
87 void set();
89 bool checkImplementation(const OpenCLPlatformInfo& rPlatform, const OpenCLDeviceInfo& rDevice) const;
92 OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig& rConfig);
93 OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcher& rImpl);
94 OPENCL_DLLPUBLIC std::ostream& operator<<(std::ostream& rStream, const OpenCLConfig::ImplMatcherSet& rSet);
96 #endif
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */