DoorKeeper/include/doorkeeper/implem/tileiterator.inl

61 lines
1.8 KiB
Text
Raw Normal View History

namespace dk {
template <typename T, uint32_t D, typename T1>
2015-08-16 18:33:44 +00:00
TileIterator<T, D, T1>::TileIterator (qualif_vector_type* parData, const coords& parArea) :
m_tile_range(parArea),
m_data(parData)
{
DK_ASSERT(parData);
}
template <typename T, uint32_t D, typename T1>
2015-08-16 18:33:44 +00:00
TileIterator<T, D, T1>::TileIterator (qualif_vector_type* parData, const coords& parStart, const coords& parArea) :
m_tile_range(parStart, parArea),
m_data(parData)
{
2014-12-12 19:04:48 +00:00
DK_ASSERT(parData);
}
template <typename T, uint32_t D, typename T1>
void TileIterator<T, D, T1>::increment() {
2015-08-16 18:33:44 +00:00
++m_tile_range;
}
template <typename T, uint32_t D, typename T1>
void TileIterator<T, D, T1>::decrement() {
2015-08-16 18:33:44 +00:00
--m_tile_range;
}
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*/) {
//TODO: implement
}
template <typename T, uint32_t D, typename T1>
ptrdiff_t TileIterator<T, D, T1>::distance_to (const TileIterator& parOther) {
2015-08-16 18:33:44 +00:00
return std::distance(to_index(m_tile_range), to_index(parOther.m_tile_range));
}
template <typename T, uint32_t D, typename T1>
bool TileIterator<T, D, T1>::equal (const TileIterator& parOther) const {
2015-08-16 18:33:44 +00:00
return m_data == parOther.m_data and m_tile_range == parOther.m_tile_range and m_tile_range == parOther.m_tile_range;
}
template <typename T, uint32_t D, typename T1>
T& TileIterator<T, D, T1>::dereference() const {
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);
DK_ASSERT(index < m_data->size());
return (*m_data)[index];
}
2015-08-16 18:33:44 +00:00
template <typename T, uint32_t D, typename T1>
auto TileIterator<T, D, T1>::raw_coords() const -> const TileCoordsType& {
return m_tile_range;
}
template <typename T, uint32_t D, typename T1>
auto TileIterator<T, D, T1>::position() const -> const coords& {
return m_tile_range.position();
}
} //namespace dk