2014-12-09 21:30:06 +00:00
|
|
|
namespace dk {
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2015-08-17 22:03:27 +00:00
|
|
|
TileIterator<T, D, T1>::TileIterator (qualif_vector_type* parData, const PixelConv<D>& parPixConv, const coords& parArea) :
|
2015-08-16 18:33:44 +00:00
|
|
|
m_tile_range(parArea),
|
2015-08-17 22:03:27 +00:00
|
|
|
m_data(parData),
|
|
|
|
m_pixel_conv(parPixConv)
|
2015-01-06 15:00:24 +00:00
|
|
|
{
|
|
|
|
DK_ASSERT(parData);
|
2015-08-17 22:03:27 +00:00
|
|
|
DK_ASSERT(&m_pixel_conv != nullptr);
|
2015-01-06 15:00:24 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2015-08-17 22:03:27 +00:00
|
|
|
TileIterator<T, D, T1>::TileIterator (qualif_vector_type* parData, const PixelConv<D>& parPixConv, const coords& parStart, const coords& parArea) :
|
2015-08-16 18:33:44 +00:00
|
|
|
m_tile_range(parStart, parArea),
|
2015-08-17 22:03:27 +00:00
|
|
|
m_data(parData),
|
|
|
|
m_pixel_conv(parPixConv)
|
2014-12-09 21:30:06 +00:00
|
|
|
{
|
2014-12-12 19:04:48 +00:00
|
|
|
DK_ASSERT(parData);
|
2015-08-17 22:03:27 +00:00
|
|
|
DK_ASSERT(&m_pixel_conv != nullptr);
|
2014-12-09 21:30:06 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2014-12-30 16:53:15 +00:00
|
|
|
void TileIterator<T, D, T1>::increment() {
|
2015-08-16 18:33:44 +00:00
|
|
|
++m_tile_range;
|
2014-12-09 21:30:06 +00:00
|
|
|
}
|
2014-12-11 22:58:52 +00:00
|
|
|
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2014-12-30 16:53:15 +00:00
|
|
|
void TileIterator<T, D, T1>::decrement() {
|
2015-08-16 18:33:44 +00:00
|
|
|
--m_tile_range;
|
2014-12-11 22:58:52 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2015-05-27 22:25:06 +00:00
|
|
|
void TileIterator<T, D, T1>::advance (size_t /*parAdvance*/) {
|
2014-12-11 22:58:52 +00:00
|
|
|
//TODO: implement
|
|
|
|
}
|
|
|
|
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2015-08-18 22:15:31 +00:00
|
|
|
auto TileIterator<T, D, T1>::distance_to (const TileIterator& parOther) -> difference_type {
|
2015-08-16 18:33:44 +00:00
|
|
|
return std::distance(to_index(m_tile_range), to_index(parOther.m_tile_range));
|
2014-12-11 22:58:52 +00:00
|
|
|
}
|
|
|
|
|
2015-01-08 11:20:17 +00:00
|
|
|
template <typename T, uint32_t D, typename T1>
|
2014-12-30 16:53:15 +00:00
|
|
|
bool TileIterator<T, D, T1>::equal (const TileIterator& parOther) const {
|
2015-08-16 22:41:21 +00:00
|
|
|
return m_data == parOther.m_data and m_tile_range.position() == parOther.m_tile_range.position();
|
2014-12-11 22:58:52 +00:00
|
|
|
}
|
2015-05-24 15:18:46 +00:00
|
|
|
|
|
|
|
template <typename T, uint32_t D, typename T1>
|
2015-08-18 22:15:31 +00:00
|
|
|
auto TileIterator<T, D, T1>::dereference() const -> reference {
|
2015-08-16 18:33:44 +00:00
|
|
|
const auto index = to_index(m_tile_range);
|
2015-08-14 10:30:27 +00:00
|
|
|
DK_ASSERT(m_data);
|
2015-08-17 08:45:20 +00:00
|
|
|
DK_ASSERT(index >= 0);
|
|
|
|
DK_ASSERT(static_cast<typename std::make_unsigned<decltype(index)>::type>(index) < m_data->size());
|
2015-08-18 22:15:31 +00:00
|
|
|
return Tile<T, D>(&(*m_data)[index], m_tile_range, coords(0), &m_pixel_conv);
|
2015-08-17 22:03:27 +00:00
|
|
|
}
|
|
|
|
|
2015-08-16 22:41:21 +00:00
|
|
|
template <uint32_t D>
|
|
|
|
inline Vector<D> make_past_end_coords (const Vector<D>& parTo) {
|
|
|
|
Vector<D> retval(0);
|
|
|
|
//for (CoordinateDistType d = 0; d < D - 1; ++d) {
|
|
|
|
//retval[d] = parFrom[d];
|
|
|
|
//}
|
|
|
|
retval[D - 1] = parTo[D - 1] + 1;
|
|
|
|
return retval;
|
|
|
|
}
|
2014-12-09 21:30:06 +00:00
|
|
|
} //namespace dk
|