DoorKeeper/include/mapreaders/mapstreambase.hpp
King_DuckZ 436d738620 Refactoring in map reading code - part 1/2
Fixed a bug when iterating over a view that was smaller than the map size
Added a class to abstract map readers
2015-01-05 18:01:28 +01:00

32 lines
931 B
C++

#ifndef id3CAE7A32F0C3428EA125F91D261C0029
#define id3CAE7A32F0C3428EA125F91D261C0029
#include "primitivetypes.hpp"
#include "implem/vector.hpp"
#include <cstddef>
namespace dk {
template <std::size_t D>
class MapStreamBase {
public:
typedef Vector<CoordinateScalarType, D> coords;
MapStreamBase ( void ) = delete;
explicit MapStreamBase ( const coords& parMapSize );
virtual ~MapStreamBase ( void ) noexcept = default;
virtual bool isReadable ( void ) const = 0;
virtual bool isWriteable ( void ) const = 0;
const coords& mapSize ( void ) const noexcept { return m_mapSize; }
void read ( char* parOut, std::size_t parOutSize, const coords& parFrom, const coords& parTo );
private:
virtual std::size_t dataBlockRequested ( char* parOut, std::size_t parOutSize, const coords& parFrom, const coords& parTo ) = 0;
const coords m_mapSize;
};
} //namespace dk
#include "implem/mapstreambase.inl"
#endif