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 >
53{
54public:
55
58
62
68
72
77
79 bool IsNull() const;
80
84 void Release();
85
87 bool IsEmpty() const { return this->m_Size == 0; }
88
90 std::size_t GetSize() const { return this->m_Size; }
91
94 T & operator[]( const std::size_t index );
95
99 const T & operator[]( const std::size_t index ) const;
100
104 void Read( T * data, const std::size_t count, const std::size_t offset = 0 );
105
108 void Write( const T * data, const std::size_t count, const std::size_t offset = 0 );
109
111 void Write( const Vector< T > & data, const std::size_t offset = 0 );
112
115
118
119private:
120
124 const OpenCLMemoryObject::Access access, const std::size_t size );
125
127 friend class OpenCLContext;
128};
129
130//------------------------------------------------------------------------------
132template< typename charT, typename traits, typename dataType >
133inline
134std::basic_ostream< charT, traits > &
135operator<<( std::basic_ostream< charT, traits > & strm,
136 const OpenCLVector< dataType > & vector )
137{
138 if( vector.IsNull() )
139 {
140 strm << "OpenCLVector(null)";
141 return strm;
142 }
143
144 const char indent = ' ';
145
146 strm << "OpenCLVector" << std::endl
147 << indent << "Size: " << vector.GetSize() << std::endl;
148
149 strm << std::endl;
150
151 return strm;
152}
153
154
155} // end namespace itk
156
157#ifndef ITK_MANUAL_INSTANTIATION
158#include "itkOpenCLVector.hxx"
159#endif
160
161#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
OpenCLVector Self
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 1667476801 for elastix by doxygen 1.9.4 elastix logo