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 
45  OpenCLProgram();
46 
50  OpenCLProgram( OpenCLContext * context, cl_program id,
51  const std::string & fileName = std::string() );
52 
54  OpenCLProgram( const OpenCLProgram & other );
55 
58  ~OpenCLProgram();
59 
61  OpenCLProgram & operator=( const OpenCLProgram & other );
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 */
OpenCLProgram Self
std::string GetFileName() const
The OpenCLContext class represents an OpenCL context.
OpenCLContext * m_Context
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
cl_program GetProgramId() const
bool IsNull() const
The OpenCLKernel class represents an executable entry point function in an OpenCL program...
#define ITKOpenCL_EXPORT
The OpenCLProgram class represents an OpenCL program object.
OpenCLContext * GetContext() const


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo