DoorKeeper/include/doorkeeper/components/basemapsource.hpp
King_DuckZ fd8a1cbabc Add a hash mechanism to BaseMapSource.
This is needed to recognize what type of tiles a layer contains.
Client code has to fill in a map of hash => add_layer<T>() pointers.
As a layer is loaded, the correct add_layer<T>() is called based
on the hash saved with the layer itself.
2015-06-07 03:57:18 +02:00

46 lines
1.4 KiB
C++

#ifndef id372857FBD20C4DD2A9EDDB3A167682AA
#define id372857FBD20C4DD2A9EDDB3A167682AA
#include "doorkeeper/implem/maptypes.hpp"
#include "doorkeeper/primitivetypes.hpp"
#include "doorkeeper/helpers/hashing.hpp"
#include "doorkeeper/implem/coords_utils.hpp"
#include <cstdint>
#include <vector>
#include <string>
#include <type_traits>
#include <cstddef>
namespace dk {
namespace implem {
template <typename T, uint32_t D, bool POD=std::is_pod<T>::value>
class data_fetcher;
} //namespace implem
template <uint32_t D>
class BaseMapSource {
template <typename T, uint32_t, bool POD>
friend class implem::data_fetcher;
public:
typedef dk::Vector<D> coords;
BaseMapSource ( void ) = default;
virtual ~BaseMapSource ( void ) noexcept = default;
template <typename T>
void fetch ( std::vector<T>& parOut, const coords& parFrom, const coords& parTo );
virtual const coords& mapSize ( void ) const = 0;
virtual const coords& tileSize ( void ) const = 0;
virtual MapTypes mapType ( void ) const = 0;
virtual int layersCount ( void ) const = 0;
virtual void chainedMaps ( std::vector<std::string>& parOut ) const = 0;
virtual HashType layerTypeHash ( int parIndex ) const = 0;
protected:
virtual void fetch_raw ( char* parOut, const coords& parFrom, const coords& parTo, std::size_t parSize ) = 0;
};
} //namespace dk
#include "doorkeeper/implem/basemapsource.inl"
#endif