#ifndef id56E2396E102B4E10B20466D6B57A4C66 #define id56E2396E102B4E10B20466D6B57A4C66 #include "mapreaders/mapstreambase.hpp" #include "implem/helpers.hpp" #include #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 MapStreamRaw : public MapStreamBase { public: typedef typename MapStreamBase::coords coords; MapStreamRaw ( void ) = delete; template explicit MapStreamRaw ( Device& parDevice ); virtual ~MapStreamRaw ( void ) noexcept = default; virtual bool isReadable ( void ) const { return true; } virtual bool isWriteable ( void ) const { return false; } private: virtual std::size_t dataBlockRequested ( char* parOut, std::size_t parOutSize, const coords& parFrom, const coords& parTo ); std::istream m_istream; const bool m_deviceHasDim; }; } //namespace dk #include "implem/mapstreamraw.inl" #endif