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 
26 namespace itk
27 {
34 // Forward declaration
35 class OpenCLContext;
36 
38 {
39 public:
40 
43 
46 
50  OpenCLProgram( OpenCLContext * context, cl_program id,
51  const std::string & fileName = std::string() );
52 
54  OpenCLProgram( const OpenCLProgram & other );
55 
59 
62 
64  bool IsNull() const { return this->m_Id == 0; }
65 
67  OpenCLContext * GetContext() const { return this->m_Context; }
68 
70  cl_program GetProgramId() const { return this->m_Id; }
71 
73  std::string GetFileName() const { return this->m_FileName; }
74 
81  bool Build( const std::string & extraBuildOptions = std::string() );
82 
93  bool Build( const std::list< OpenCLDevice > & devices,
94  const std::string & extraBuildOptions = std::string() );
95 
98  std::string GetLog() const;
99 
102  std::list< OpenCLDevice > GetDevices() const;
103 
107  OpenCLKernel CreateKernel( const std::string & name ) const;
108 
110  std::list< OpenCLKernel > CreateKernels() const;
111 
112 private:
113 
115  cl_program m_Id;
116  std::string m_FileName;
117 };
118 
122 bool ITKOpenCL_EXPORT operator==( const OpenCLProgram & lhs, const OpenCLProgram & rhs );
123 
127 bool ITKOpenCL_EXPORT operator!=( const OpenCLProgram & lhs, const OpenCLProgram & rhs );
128 
130 template< typename charT, typename traits >
131 inline
132 std::basic_ostream< charT, traits > &
133 operator<<( std::basic_ostream< charT, traits > & strm,
134  const OpenCLProgram & program )
135 {
136  if( program.IsNull() )
137  {
138  strm << "OpenCLProgram(null)";
139  return strm;
140  }
141 
142  const char indent = ' ';
143 
144  strm << "OpenCLProgram" << std::endl
145  << indent << "Id: " << program.GetProgramId() << std::endl;
146 
147  return strm;
148 }
149 
150 
151 } // end namespace itk
152 
153 #endif /* __itkOpenCLProgram_h */
itk::operator!=
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
itk::OpenCLProgram::Build
bool Build(const std::string &extraBuildOptions=std::string())
itk::OpenCLProgram::m_Id
cl_program m_Id
Definition: itkOpenCLProgram.h:115
itkOpenCLKernel.h
itk::OpenCLProgram::~OpenCLProgram
~OpenCLProgram()
ITKOpenCL_EXPORT
#define ITKOpenCL_EXPORT
Definition: itkOpenCLExport.h:31
itk::OpenCLProgram
The OpenCLProgram class represents an OpenCL program object.
Definition: itkOpenCLProgram.h:38
itk::OpenCLProgram::CreateKernel
OpenCLKernel CreateKernel(const std::string &name) const
itk::OpenCLProgram::GetContext
OpenCLContext * GetContext() const
Definition: itkOpenCLProgram.h:67
itk::OpenCLProgram::IsNull
bool IsNull() const
Definition: itkOpenCLProgram.h:64
itk::OpenCLProgram::Self
OpenCLProgram Self
Definition: itkOpenCLProgram.h:42
itk::OpenCLProgram::GetDevices
std::list< OpenCLDevice > GetDevices() const
itk::OpenCLProgram::m_Context
OpenCLContext * m_Context
Definition: itkOpenCLProgram.h:114
itk::OpenCLProgram::GetProgramId
cl_program GetProgramId() const
Definition: itkOpenCLProgram.h:70
itk::OpenCLProgram::GetLog
std::string GetLog() const
itk::operator<<
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)
Definition: itkOpenCLCommandQueue.h:116
itk::OpenCLProgram::Build
bool Build(const std::list< OpenCLDevice > &devices, const std::string &extraBuildOptions=std::string())
itk::OpenCLKernel
The OpenCLKernel class represents an executable entry point function in an OpenCL program.
Definition: itkOpenCLKernel.h:139
itk::OpenCLProgram::OpenCLProgram
OpenCLProgram(const OpenCLProgram &other)
itk::operator==
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
itk::OpenCLProgram::operator=
OpenCLProgram & operator=(const OpenCLProgram &other)
itk::OpenCLProgram::CreateKernels
std::list< OpenCLKernel > CreateKernels() const
itk::OpenCLProgram::OpenCLProgram
OpenCLProgram()
itk::OpenCLProgram::m_FileName
std::string m_FileName
Definition: itkOpenCLProgram.h:116
itk
Definition: itkAdvancedImageToImageMetric.h:40
itk::OpenCLProgram::OpenCLProgram
OpenCLProgram(OpenCLContext *context, cl_program id, const std::string &fileName=std::string())
itkOpenCLDevice.h
itk::OpenCLContext
The OpenCLContext class represents an OpenCL context.
Definition: itkOpenCLContext.h:77
itk::OpenCLProgram::GetFileName
std::string GetFileName() const
Definition: itkOpenCLProgram.h:73


Generated on OURCE_DATE_EPOCH for elastix by doxygen 1.8.18 elastix logo