2015-07-29 23:18:19 +00:00
|
|
|
#ifndef id753CAC41D3AE48A1A1D1EC399FD3DADF
|
|
|
|
#define id753CAC41D3AE48A1A1D1EC399FD3DADF
|
|
|
|
|
|
|
|
#include "doorkeeper/primitivetypes.hpp"
|
|
|
|
#include "doorkeeper/implem/vector.hpp"
|
|
|
|
#include <cstdint>
|
2015-08-14 10:31:13 +00:00
|
|
|
#include <cstddef>
|
2015-08-14 16:18:43 +00:00
|
|
|
#include <algorithm>
|
2015-07-29 23:18:19 +00:00
|
|
|
|
|
|
|
namespace dk {
|
|
|
|
template <uint32_t D>
|
|
|
|
class TileCoords {
|
2015-08-14 10:31:13 +00:00
|
|
|
static_assert(D >= 1, "Invalid dimension");
|
|
|
|
static_assert(D <= static_cast<std::size_t>(-1), "Dimension is too large");
|
2015-07-29 23:18:19 +00:00
|
|
|
public:
|
|
|
|
typedef Vector<D> coords;
|
|
|
|
|
|
|
|
TileCoords ( void ) = default;
|
|
|
|
TileCoords ( const TileCoords& ) = default;
|
|
|
|
explicit TileCoords ( const coords& parSize );
|
|
|
|
TileCoords ( const coords& parValue, const coords& parSize );
|
|
|
|
|
|
|
|
TileCoords& operator++ ( void ); //pre
|
|
|
|
TileCoords operator++ ( int ); //post
|
|
|
|
TileCoords& operator-- ( void ); //pre
|
|
|
|
TileCoords operator-- ( int ); //post
|
|
|
|
const TileCoords& operator+= ( CoordinateScalarType parValue );
|
|
|
|
const TileCoords& operator-= ( CoordinateScalarType parValue );
|
|
|
|
bool operator== ( const TileCoords& parOther ) const;
|
|
|
|
bool operator!= ( const TileCoords& parOther ) const;
|
|
|
|
TileCoords& operator= ( const TileCoords& ) = default;
|
2015-08-14 16:18:43 +00:00
|
|
|
const CoordinateScalarType& operator[] ( int parIndex ) const;
|
|
|
|
CoordinateScalarType& operator[] ( int parIndex );
|
2015-07-29 23:18:19 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
coords m_pos;
|
|
|
|
coords m_size;
|
|
|
|
};
|
2015-08-14 16:18:43 +00:00
|
|
|
|
|
|
|
namespace implem {
|
|
|
|
CoordinateScalarType sum_mod ( CoordinateScalarType parA, CoordinateScalarType parB, CoordinateScalarType parDiv ) a_pure;
|
|
|
|
CoordinateScalarType sum_div ( CoordinateScalarType parA, CoordinateScalarType parB, CoordinateScalarType parDiv ) a_pure;
|
|
|
|
} //namespace implem
|
2015-07-29 23:18:19 +00:00
|
|
|
} //namespace dk
|
|
|
|
|
|
|
|
#include "doorkeeper/implem/tilecoords.inl"
|
|
|
|
|
|
|
|
#endif
|