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:
47
50
52 OpenCLPlatform() : m_Id( 0 ), m_Version( 0 ) {}
53
56 OpenCLPlatform( cl_platform_id id ) : m_Id( id ), m_Version( 0 ) {}
57
70 IBM
71 };
72
74 bool IsNull() const { return this->m_Id == 0; }
75
77 cl_platform_id GetPlatformId() const { return this->m_Id; }
78
82
86 std::string GetVersion() const;
87
90 bool IsFullProfile() const;
91
94 bool IsEmbeddedProfile() const;
95
99 std::string GetProfile() const;
100
102 std::string GetName() const;
103
105 std::string GetVendor() const;
106
110
113 std::string GetExtensionSuffix() const;
114
117 std::list< std::string > GetExtensions() const;
118
125 bool HasExtension( const std::string & name ) const;
126
128 static std::list< OpenCLPlatform > GetAllPlatforms();
129
132
133private:
134
135 cl_platform_id m_Id;
136 mutable int m_Version;
137};
138
143
148
150template< typename charT, typename traits >
151inline
152std::basic_ostream< charT, traits > &
153operator<<( std::basic_ostream< charT, traits > & strm,
154 const OpenCLPlatform & platform )
155{
156 if( platform.IsNull() )
157 {
158 strm << "OpenCLPlatform(null)";
159 return strm;
160 }
161
162 const char indent = ' ';
163
164 strm << "OpenCLPlatform" << std::endl
165 << indent << "Id: " << platform.GetPlatformId() << std::endl;
166
167 strm << indent << "OpenCL version: ";
168 switch( platform.GetOpenCLVersion() )
169 {
170 case VERSION_1_0:
171 strm << "1.0"; break;
172 case VERSION_1_1:
173 strm << "1.1"; break;
174 case VERSION_1_2:
175 strm << "1.2"; break;
176 case VERSION_2_0:
177 strm << "2.0"; break;
178 case VERSION_2_1:
179 strm << "2.1"; break;
180 default:
181 strm << "Unknown"; break;
182 }
183
184 strm << std::endl << indent << "Full profile: " << ( platform.IsFullProfile() ? "On" : "Off" ) << std::endl
185 << indent << "Embedded profile: " << ( platform.IsEmbeddedProfile() ? "On" : "Off" ) << std::endl
186 << indent << "Profile: " << platform.GetProfile() << std::endl
187 << indent << "Version: " << platform.GetVersion() << std::endl
188 << indent << "Name: " << platform.GetName() << std::endl
189 << indent << "Vendor: " << platform.GetVendor() << std::endl
190 << indent << "Extension suffix: " << platform.GetExtensionSuffix() << std::endl;
191
192 const std::list< std::string > extensions = platform.GetExtensions();
193 const std::size_t extensionsSize = extensions.size();
194 strm << indent << "Extensions(" << extensionsSize << "): ";
195 if( extensions.empty() )
196 {
197 strm << "none";
198 }
199 else
200 {
201 strm << std::endl;
202 for( std::list< std::string >::const_iterator it = extensions.begin(); it != extensions.end(); ++it )
203 {
204 strm << indent << indent << "- " << *it << std::endl;
205 }
206 }
207
208 return strm;
209}
210
211
212} // end namespace itk
213
214#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:41
@ VERSION_2_1
Definition: itkOpenCL.h:46
@ VERSION_1_2
Definition: itkOpenCL.h:44
@ VERSION_1_0
Definition: itkOpenCL.h:42
@ VERSION_1_1
Definition: itkOpenCL.h:43
@ VERSION_2_0
Definition: itkOpenCL.h:45
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)


Generated on 1667476801 for elastix by doxygen 1.9.4 elastix logo