go home Home | Main Page | Topics | 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 &
105 operator[](const std::size_t index);
106
110 void
111 Read(T * data, const std::size_t count, const std::size_t offset = 0);
112
115 void
116 Write(const T * data, const std::size_t count, const std::size_t offset = 0);
117
119 void
120 Write(const Vector<T> & data, const std::size_t offset = 0);
121
124 GetContext() const;
125
128 GetBuffer() const;
129
130private:
133 OpenCLVector(OpenCLContext * context, const OpenCLMemoryObject::Access access, const std::size_t size);
134
136 friend class OpenCLContext;
137};
138
139//------------------------------------------------------------------------------
141template <typename charT, typename traits, typename dataType>
142inline std::basic_ostream<charT, traits> &
143operator<<(std::basic_ostream<charT, traits> & strm, const OpenCLVector<dataType> & vector)
144{
145 if (vector.IsNull())
146 {
147 strm << "OpenCLVector(null)";
148 return strm;
149 }
150
151 const char indent = ' ';
152
153 strm << "OpenCLVector\n" << indent << "Size: " << vector.GetSize() << std::endl;
154
155 strm << std::endl;
156
157 return strm;
158}
159
160
161} // end namespace itk
162
163#ifndef ITK_MANUAL_INSTANTIATION
164# include "itkOpenCLVector.hxx"
165#endif
166
167#endif /* itkOpenCLVector_h */
The OpenCLBuffer class represents an OpenCL buffer object.
OpenCLVectorBase(const std::vcl_size_t elemSize)
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)
friend class OpenCLContext
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 26-02-2026 for elastix by doxygen 1.16.1 (669aeeefca743c148e2d935b3d3c69535c7491e6) elastix logo