go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLSampler.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 __itkOpenCLSampler_h
19 #define __itkOpenCLSampler_h
20 
21 #include "itkOpenCL.h"
22 #include <ostream>
23 
24 namespace itk
25 {
68 // Forward declaration
69 class OpenCLContext;
70 
72 {
73 public:
74 
77 
79  OpenCLSampler() : m_Context( 0 ), m_Id( 0 ) {}
80 
84  OpenCLSampler( OpenCLContext * context, cl_sampler id ) :
85  m_Context( context ), m_Id( id ) {}
86 
89  OpenCLSampler( const OpenCLSampler & other );
90 
92  ~OpenCLSampler();
93 
97  OpenCLSampler & operator=( const OpenCLSampler & other );
98 
108  None = 0x1130, // CL_ADDRESS_NONE
109  ClampToEdge = 0x1131, // CL_ADDRESS_CLAMP_TO_EDGE
110  Clamp = 0x1132, // CL_ADDRESS_CLAMP
111  Repeat = 0x1133, // CL_ADDRESS_REPEAT
112  MirroredRepeat = 0x1134 // CL_ADDRESS_MIRRORED_REPEAT
113  };
114 
121  enum FilterMode {
122  Nearest = 0x1140, // CL_FILTER_NEAREST
123  Linear = 0x1141 // CL_FILTER_LINEAR
124  };
125 
127  bool IsNull() const { return this->m_Id == 0; }
128 
131  bool GetNormalizedCoordinates() const;
132 
136  OpenCLSampler::AddressingMode GetAddressingMode() const;
137 
140  OpenCLSampler::FilterMode GetFilterMode() const;
141 
144  cl_sampler GetSamplerId() const { return this->m_Id; }
145 
148  OpenCLContext * GetContext() const { return this->m_Context; }
149 
150 private:
151 
153  cl_sampler m_Id;
154 };
155 
159 bool ITKOpenCL_EXPORT operator==( const OpenCLSampler & lhs, const OpenCLSampler & rhs );
160 
164 bool ITKOpenCL_EXPORT operator!=( const OpenCLSampler & lhs, const OpenCLSampler & rhs );
165 
167 template< typename charT, typename traits >
168 inline
169 std::basic_ostream< charT, traits > &
170 operator<<( std::basic_ostream< charT, traits > & strm,
171  const OpenCLSampler & sampler )
172 {
173  if( sampler.IsNull() )
174  {
175  strm << "OpenCLSampler(null)";
176  return strm;
177  }
178 
179  const char indent = ' ';
180 
181  strm << "OpenCLSampler" << std::endl
182  << indent << "Id: " << sampler.GetSamplerId() << std::endl;
183 
184  return strm;
185 }
186 
187 
188 } // end namespace itk
189 
190 #endif /* __itkOpenCLSampler_h */
cl_sampler GetSamplerId() const
bool IsNull() const
OpenCLContext * m_Context
OpenCLSampler Self
The OpenCLContext class represents an OpenCL context.
OpenCLSampler(OpenCLContext *context, cl_sampler id)
OpenCLContext * GetContext() const
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
The OpenCLSampler class represents an OpenCL sampler object.
#define ITKOpenCL_EXPORT


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