go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLProgram.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 itkOpenCLProgram_h
19#define itkOpenCLProgram_h
20
21#include "itkOpenCLDevice.h"
22#include "itkOpenCLKernel.h"
23
24#include <string>
25
26namespace itk
27{
34// Forward declaration
35class OpenCLContext;
36
38{
39public:
42
45
49 OpenCLProgram(OpenCLContext * context, cl_program id, const std::string & fileName = std::string());
50
53
57
60 operator=(const OpenCLProgram & other);
61
63 bool
64 IsNull() const
65 {
66 return this->m_Id == 0;
67 }
68
71 GetContext() const
72 {
73 return this->m_Context;
74 }
75
77 cl_program
79 {
80 return this->m_Id;
81 }
82
84 std::string
86 {
87 return this->m_FileName;
88 }
89
96 bool
97 Build(const std::string & extraBuildOptions = std::string());
98
109 bool
110 Build(const std::list<OpenCLDevice> & devices, const std::string & extraBuildOptions = std::string());
111
114 std::string
115 GetLog() const;
116
119 std::list<OpenCLDevice>
120 GetDevices() const;
121
126 CreateKernel(const std::string & name) const;
127
129 std::list<OpenCLKernel>
131
132private:
134 cl_program m_Id;
135 std::string m_FileName;
136};
137
142 operator==(const OpenCLProgram & lhs, const OpenCLProgram & rhs);
143
148 operator!=(const OpenCLProgram & lhs, const OpenCLProgram & rhs);
149
151template <typename charT, typename traits>
152inline std::basic_ostream<charT, traits> &
153operator<<(std::basic_ostream<charT, traits> & strm, const OpenCLProgram & program)
154{
155 if (program.IsNull())
156 {
157 strm << "OpenCLProgram(null)";
158 return strm;
159 }
160
161 const char indent = ' ';
162
163 strm << "OpenCLProgram\n" << indent << "Id: " << program.GetProgramId() << std::endl;
164
165 return strm;
166}
167
168
169} // end namespace itk
170
171#endif /* itkOpenCLProgram_h */
The OpenCLContext class represents an OpenCL context.
The OpenCLKernel class represents an executable entry point function in an OpenCL program.
The OpenCLProgram class represents an OpenCL program object.
OpenCLKernel CreateKernel(const std::string &name) const
OpenCLContext * m_Context
std::string GetLog() const
std::string GetFileName() const
OpenCLProgram(const OpenCLProgram &other)
OpenCLContext * GetContext() const
OpenCLProgram(OpenCLContext *context, cl_program id, const std::string &fileName=std::string())
bool Build(const std::list< OpenCLDevice > &devices, const std::string &extraBuildOptions=std::string())
bool Build(const std::string &extraBuildOptions=std::string())
std::list< OpenCLKernel > CreateKernels() const
OpenCLProgram & operator=(const OpenCLProgram &other)
cl_program GetProgramId() const
std::list< OpenCLDevice > GetDevices() const
#define ITKOpenCL_EXPORT
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
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