go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLPlatform.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef itkOpenCLPlatform_h
19#define itkOpenCLPlatform_h
20
21#include "itkOpenCL.h"
22
23#include <string>
24#include <list>
25
26namespace itk
27{
45{
46public:
49
52 : m_Id(0)
53 , m_Version(0)
54 {}
55
58 OpenCLPlatform(cl_platform_id id)
59 : m_Id(id)
60 , m_Version(0)
61 {}
62
71 {
76 IBM
77 };
78
80 bool
81 IsNull() const
82 {
83 return this->m_Id == 0;
84 }
85
87 cl_platform_id
89 {
90 return this->m_Id;
91 }
92
97
101 std::string
102 GetVersion() const;
103
106 bool
108
111 bool
113
117 std::string
118 GetProfile() const;
119
121 std::string
122 GetName() const;
123
125 std::string
126 GetVendor() const;
127
132
135 std::string
137
140 std::list<std::string>
142
149 bool
150 HasExtension(const std::string & name) const;
151
153 static std::list<OpenCLPlatform>
155
157 static OpenCLPlatform
159
160private:
161 cl_platform_id m_Id;
162 mutable int m_Version;
163};
164
169 operator==(const OpenCLPlatform & lhs, const OpenCLPlatform & rhs);
170
175 operator!=(const OpenCLPlatform & lhs, const OpenCLPlatform & rhs);
176
178template <typename charT, typename traits>
179inline std::basic_ostream<charT, traits> &
180operator<<(std::basic_ostream<charT, traits> & strm, const OpenCLPlatform & platform)
181{
182 if (platform.IsNull())
183 {
184 strm << "OpenCLPlatform(null)";
185 return strm;
186 }
187
188 const char indent = ' ';
189
190 strm << "OpenCLPlatform\n" << indent << "Id: " << platform.GetPlatformId() << std::endl;
191
192 strm << indent << "OpenCL version: ";
193 switch (platform.GetOpenCLVersion())
194 {
195 case VERSION_1_0:
196 strm << "1.0";
197 break;
198 case VERSION_1_1:
199 strm << "1.1";
200 break;
201 case VERSION_1_2:
202 strm << "1.2";
203 break;
204 case VERSION_2_0:
205 strm << "2.0";
206 break;
207 case VERSION_2_1:
208 strm << "2.1";
209 break;
210 default:
211 strm << "Unknown";
212 break;
213 }
214
215 strm << '\n'
216 << indent << "Full profile: " << (platform.IsFullProfile() ? "On" : "Off") << '\n'
217 << indent << "Embedded profile: " << (platform.IsEmbeddedProfile() ? "On" : "Off") << '\n'
218 << indent << "Profile: " << platform.GetProfile() << '\n'
219 << indent << "Version: " << platform.GetVersion() << '\n'
220 << indent << "Name: " << platform.GetName() << '\n'
221 << indent << "Vendor: " << platform.GetVendor() << '\n'
222 << indent << "Extension suffix: " << platform.GetExtensionSuffix() << std::endl;
223
224 const std::list<std::string> extensions = platform.GetExtensions();
225 const std::size_t extensionsSize = extensions.size();
226 strm << indent << "Extensions(" << extensionsSize << "): ";
227 if (extensions.empty())
228 {
229 strm << "none";
230 }
231 else
232 {
233 strm << std::endl;
234 for (std::list<std::string>::const_iterator it = extensions.begin(); it != extensions.end(); ++it)
235 {
236 strm << indent << indent << "- " << *it << std::endl;
237 }
238 }
239
240 return strm;
241}
242
243
244} // end namespace itk
245
246#endif /* itkOpenCLPlatform_h */
The OpenCLPlatform represent platform model for OpenCL.
bool IsEmbeddedProfile() const
std::string GetProfile() const
std::string GetName() const
static std::list< OpenCLPlatform > GetAllPlatforms()
OpenCLPlatform(cl_platform_id id)
OpenCLVersion GetOpenCLVersion() const
bool HasExtension(const std::string &name) const
cl_platform_id GetPlatformId() const
bool IsFullProfile() const
VendorType GetVendorType() const
std::list< std::string > GetExtensions() const
std::string GetVersion() const
std::string GetExtensionSuffix() const
static OpenCLPlatform GetPlatform(const OpenCLPlatform::VendorType vendor)
std::string GetVendor() const
#define ITKOpenCL_EXPORT
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
OpenCLVersion
Definition: itkOpenCL.h:46
@ VERSION_2_1
Definition: itkOpenCL.h:51
@ VERSION_1_2
Definition: itkOpenCL.h:49
@ VERSION_1_0
Definition: itkOpenCL.h:47
@ VERSION_1_1
Definition: itkOpenCL.h:48
@ VERSION_2_0
Definition: itkOpenCL.h:50
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo