go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkOpenCLEventList.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 __itkOpenCLEventList_h
19 #define __itkOpenCLEventList_h
20 
21 #include "itkOpenCLEvent.h"
22 #include <vector>
23 
24 namespace itk
25 {
33 {
34 public:
35 
38 
39  typedef std::vector< cl_event > OpenCLEventListArrayType;
40 
43 
47  OpenCLEventList( const OpenCLEvent & event );
48 
51  OpenCLEventList( const OpenCLEventList & other );
52 
54  ~OpenCLEventList();
55 
57  OpenCLEventList & operator=( const OpenCLEventList & other );
58 
61  bool IsEmpty() const { return this->m_Events.empty(); }
62 
65  std::size_t GetSize() const { return this->m_Events.size(); }
66 
70  void Append( const OpenCLEvent & event );
71 
73  void Append( const OpenCLEventList & other );
74 
77  void Remove( const OpenCLEvent & event );
78 
82  OpenCLEvent Get( const std::size_t index ) const;
83 
86  bool Contains( const OpenCLEvent & event ) const;
87 
93  const cl_event * GetEventData() const;
94 
97  const OpenCLEventListArrayType & GetEventArray() const;
98 
101  OpenCLEventList & operator+=( const OpenCLEvent & event );
102 
105  OpenCLEventList & operator+=( const OpenCLEventList & other );
106 
109  OpenCLEventList & operator<<( const OpenCLEvent & event );
110 
113  OpenCLEventList & operator<<( const OpenCLEventList & other );
114 
119  cl_int WaitForFinished();
120 
121 private:
122 
123  OpenCLEventListArrayType m_Events;
124 };
125 
129 bool ITKOpenCL_EXPORT operator==( const OpenCLEventList & lhs, const OpenCLEventList & rhs );
130 
134 bool ITKOpenCL_EXPORT operator!=( const OpenCLEventList & lhs, const OpenCLEventList & rhs );
135 
137 template< typename charT, typename traits >
138 inline
139 std::basic_ostream< charT, traits > &
140 operator<<( std::basic_ostream< charT, traits > & strm,
141  const OpenCLEventList & eventlist )
142 {
143  if( !eventlist.GetSize() )
144  {
145  strm << "OpenCLEventList()";
146  return strm;
147  }
148 
149  OpenCLEventList::OpenCLEventListArrayType::const_iterator it;
150  const OpenCLEventList::OpenCLEventListArrayType & eventsArray = eventlist.GetEventArray();
151 
152  std::size_t id = 0;
153  strm << "OpenCLEventList contains:" << std::endl;
154  for( it = eventsArray.begin(); it < eventsArray.end(); ++it )
155  {
156  // const OpenCLEvent &event = *it;
157  // strm << "array id: " << id << " " << event << std::endl;
158 
159  // Let's print only address, printing the OpenCLEvent
160  // could halt execution of the program
161  strm << "array id: " << id << " " << *it << std::endl;
162  ++id;
163  }
164 
165  return strm;
166 }
167 
168 
169 } // end namespace itk
170 
171 #endif /* __itkOpenCLEventList_h */
std::vector< cl_event > OpenCLEventListArrayType
OpenCLEventList class represents a list of OpenCLEvent objects.
const OpenCLEventListArrayType & GetEventArray() const
std::vcl_size_t GetSize() const
bool ITKOpenCL_EXPORT operator==(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
bool ITKOpenCL_EXPORT operator!=(const OpenCLCommandQueue &lhs, const OpenCLCommandQueue &rhs)
__host__ __device__ void operator+=(int2 &a, int2 b)
#define ITKOpenCL_EXPORT
std::basic_ostream< charT, traits > & operator<<(std::basic_ostream< charT, traits > &strm, const OpenCLCommandQueue &queue)
OpenCLEventListArrayType m_Events
OpenCLEvent class represents an OpenCL event object.


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