9 #ifndef CUBBYFLOW_ARRAY_ACCESSOR2_IMPL_H 10 #define CUBBYFLOW_ARRAY_ACCESSOR2_IMPL_H 36 Reset(width, height, data);
48 Reset(other.m_size, other.m_data);
61 Reset(
Size2(width, height), data);
67 assert(i < Width() * Height());
74 assert(i < Width() * Height());
81 return At(pt.
x, pt.
y);
87 return At(pt.
x, pt.
y);
93 assert(i < Width() && j < Height());
94 return m_data[Index(i, j)];
100 assert(i < Width() && j < Height());
101 return m_data[Index(i, j)];
104 template <
typename T>
110 template <
typename T>
113 return m_data + Width() * Height();
116 template <
typename T>
122 template <
typename T>
125 return m_data + Width() * Height();
128 template <
typename T>
134 template <
typename T>
140 template <
typename T>
146 template <
typename T>
152 template <
typename T>
155 std::swap(other.m_data, m_data);
156 std::swap(other.m_size, m_size);
159 template <
typename T>
160 template <
typename Callback>
163 for (
size_t j = 0; j < Height(); ++j)
165 for (
size_t i = 0; i < Width(); ++i)
172 template <
typename T>
173 template <
typename Callback>
176 for (
size_t j = 0; j < Height(); ++j)
178 for (
size_t i = 0; i < Width(); ++i)
185 template <
typename T>
186 template <
typename Callback>
195 template <
typename T>
196 template <
typename Callback>
202 template <
typename T>
205 assert(pt.
x < Width() && pt.
y < Height());
206 return pt.
x + Width() * pt.
y;
209 template <
typename T>
212 assert(i < Width() && j < Height());
213 return i + Width() * j;
216 template <
typename T>
222 template <
typename T>
228 template <
typename T>
231 return m_data[Index(pt.
x, pt.
y)];
234 template <
typename T>
237 return m_data[Index(pt.
x, pt.
y)];
240 template <
typename T>
243 return m_data[Index(i, j)];
246 template <
typename T>
249 return m_data[Index(i, j)];
252 template <
typename T>
259 template <
typename T>
265 template <
typename T>
272 template <
typename T>
279 template <
typename T>
282 m_size =
Size2(width, height);
286 template <
typename T>
289 m_size = other.
size();
290 m_data = other.
data();
293 template <
typename T>
296 m_size = other.m_size;
297 m_data = other.m_data;
300 template <
typename T>
303 assert(i < Width() * Height());
307 template <
typename T>
310 return m_data[Index(pt)];
313 template <
typename T>
316 assert(i < Width() && j < Height());
317 return m_data[Index(i, j)];
320 template <
typename T>
326 template <
typename T>
329 return m_data + Width() * Height();
332 template <
typename T>
338 template <
typename T>
344 template <
typename T>
350 template <
typename T>
356 template <
typename T>
357 template <
typename Callback>
360 for (
size_t j = 0; j < Height(); ++j)
362 for (
size_t i = 0; i < Width(); ++i)
369 template <
typename T>
370 template <
typename Callback>
373 for (
size_t j = 0; j < Height(); ++j)
375 for (
size_t i = 0; i < Width(); ++i)
382 template <
typename T>
383 template <
typename Callback>
389 template <
typename T>
392 assert(pt.
x < Width() && pt.
y < Height());
393 return pt.
x + Width() * pt.
y;
396 template <
typename T>
399 assert(i < Width() && j < Height());
400 return i + Width() * j;
403 template <
typename T>
409 template <
typename T>
412 return m_data[Index(pt)];
415 template <
typename T>
418 return m_data[Index(i, j)];
2-D read-only array accessor class.
Definition: ArrayAccessor2.h:261
T x
X (or the first) component of the point.
Definition: Point2.h:28
2-D point class.
Definition: Point2.h:25
2-D array accessor class.
Definition: ArrayAccessor2.h:31
Point2< size_t > Size2
Definition: Size2.h:16
T y
Y (or the second) component of the point.
Definition: Point2.h:34
Generic N-dimensional array accessor class interface.
Definition: ArrayAccessor.h:31
Definition: pybind11Utils.h:24
void ParallelFor(IndexType beginIndex, IndexType endIndex, const Function &function, ExecutionPolicy policy)
Makes a for-loop from beginIndex to endIndex in parallel.
Definition: Parallel-Impl.h:201
Generic N-dimensional read-only array accessor class interface.
Definition: ArrayAccessor.h:52
T *const data() const
Returns the raw pointer to the array data.
Definition: ArrayAccessor2-Impl.h:147
Size2 size() const
Returns the size of the array.
Definition: ArrayAccessor2-Impl.h:129
constexpr size_t ZERO_SIZE
Zero size_t.
Definition: Constants.h:18