#ifndef id8F5106DFABC14263ADF235C56E434207 #define id8F5106DFABC14263ADF235C56E434207 #include "primitivetypes.hpp" #include "implem/compatibility.h" #include "implem/vector.hpp" #include "implem/helpers.hpp" #include #include #include namespace dk { namespace implem { template class HasMapDimensions { class yes { char m; }; class nope { yes m[2]; }; static yes deduce ( int a, int b = T::MapDimensions ); static nope deduce ( ... ); public: enum { result = (sizeof(yes) == sizeof(deduce(1))) }; }; template typename std::enable_if::type err_mismatching_dimension ( const Device* ) noexcept a_pure; template typename std::enable_if::result == false, std::size_t>::type err_mismatching_dimension ( const Device* ) noexcept a_pure; template typename std::enable_if>::type retrieve_map_size_from_device ( Device* parDevice ); template typename std::enable_if::result == false, Vector>::type retrieve_map_size_from_device ( Device* parDevice ); } //namespace implem //Customization point - specialize to enable map size retrieval for Device template typename Device::coords get_map_size_from_device ( const Device* parDevice ); template class TileMapData { public: typedef Vector coords; TileMapData ( void ) = delete; template explicit TileMapData ( Device& parDevice ); //TODO: add an overload to initialize a TileMapData from a universal reference to std::istream ~TileMapData ( void ) noexcept = default; bool streamHasDimensionInfo ( void ) const { return m_deviceHasDim; } void fetch ( std::vector& parOut, const coords& parFrom, const coords& parTo ); const coords& mapSize ( void ) const; private: std::istream m_stream; const coords m_mapSize; const bool m_deviceHasDim; }; } //namespace dk #include "implem/tilemapdata.inl" #endif