go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLVector.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 itkOpenCLVector_h
19#define itkOpenCLVector_h
20
21#include "itkOpenCLVectorBase.h"
22#include "itkOpenCLBuffer.h"
23#include "itkMacro.h"
24
25namespace itk
26{
51template <typename T>
52class ITK_TEMPLATE_EXPORT OpenCLVector : public OpenCLVectorBase
53{
54public:
57
61
67
71
76 operator=(const OpenCLVector<T> & other);
77
79 bool
80 IsNull() const;
81
85 void
87
89 bool
90 IsEmpty() const
91 {
92 return this->m_Size == 0;
93 }
94
96 std::size_t
97 GetSize() const
98 {
99 return this->m_Size;
100 }
101
104 T & operator[](const std::size_t index);
105
109 const T & operator[](const std::size_t index) const;
110
114 void
115 Read(T * data, const std::size_t count, const std::size_t offset = 0);
116
119 void
120 Write(const T * data, const std::size_t count, const std::size_t offset = 0);
121
123 void
124 Write(const Vector<T> & data, const std::size_t offset = 0);
125
128 GetContext() const;
129
132 GetBuffer() const;
133
134private:
137 OpenCLVector(OpenCLContext * context, const OpenCLMemoryObject::Access access, const std::size_t size);
138
140 friend class OpenCLContext;
141};
142
143//------------------------------------------------------------------------------
145template <typename charT, typename traits, typename dataType>
146inline std::basic_ostream<charT, traits> &
147operator<<(std::basic_ostream<charT, traits> & strm, const OpenCLVector<dataType> & vector)
148{
149 if (vector.IsNull())
150 {
151 strm << "OpenCLVector(null)";
152 return strm;
153 }
154
155 const char indent = ' ';
156
157 strm << "OpenCLVector\n" << indent << "Size: " << vector.GetSize() << std::endl;
158
159 strm << std::endl;
160
161 return strm;
162}
163
164
165} // end namespace itk
166
167#ifndef ITK_MANUAL_INSTANTIATION
168# include "itkOpenCLVector.hxx"
169#endif
170
171#endif /* itkOpenCLVector_h */
The OpenCLBuffer class represents an OpenCL buffer object.
The OpenCLContext class represents an OpenCL context.
The base class for the OpenCLVector implementation.
The OpenCLVector class represents a templated OpenCL buffer object.
OpenCLContext * GetContext() const
OpenCLVector(const OpenCLVector< T > &other)
T & operator[](const std::vcl_size_t index)
const T & operator[](const std::vcl_size_t index) const
std::vcl_size_t GetSize() const
OpenCLVector< T > & operator=(const OpenCLVector< T > &other)
void Write(const T *data, const std::vcl_size_t count, const std::vcl_size_t offset=0)
void Write(const Vector< T > &data, const std::vcl_size_t offset=0)
bool IsEmpty() const
bool IsNull() const
OpenCLVector(OpenCLContext *context, const OpenCLMemoryObject::Access access, const std::vcl_size_t size)
void Read(T *data, const std::vcl_size_t count, const std::vcl_size_t offset=0)
OpenCLBuffer GetBuffer() const
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