74 lines
2.8 KiB
C++
74 lines
2.8 KiB
C++
/* Copyright 2015, Michele Santullo
|
|
* This file is part of DoorKeeper.
|
|
*
|
|
* DoorKeeper is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* DoorKeeper is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with DoorKeeper. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef idA52FEA0859494D3FBDF8ED5565091C59
|
|
#define idA52FEA0859494D3FBDF8ED5565091C59
|
|
|
|
#include "doorkeeper/components/tyler.hpp"
|
|
#include "doorkeeper/components/basemapsource.hpp"
|
|
#include "doorkeeper/helpers/typename.hpp"
|
|
#include "doorkeeper/components/exception.hpp"
|
|
#include <utility>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <map>
|
|
#include <stack>
|
|
#include <ciso646>
|
|
|
|
namespace dkh {
|
|
template <typename PixConv>
|
|
using PushLayerMapType = std::map<dk::HashType, void(dk::Tyler<PixConv>::*)(dk::BaseMapSource<PixConv::dimensions>*,int)>;
|
|
|
|
template <typename PixConv, typename C>
|
|
struct MapLoaderPool {
|
|
enum { dimensions = PixConv::dimensions };
|
|
typedef std::unique_ptr<dk::BaseMapSource<dimensions>> BaseMapSourceUPtr;
|
|
typedef std::map<std::string, BaseMapSourceUPtr> PoolMapType;
|
|
typedef PixConv PixelConvType;
|
|
|
|
typedef C opener_type;
|
|
|
|
PoolMapType pool;
|
|
C opener;
|
|
|
|
dk::BaseMapSource<dimensions>* operator() ( const std::string& parName );
|
|
};
|
|
|
|
class UnknownLayerTemplateException : public dk::DoorKeeperException {
|
|
};
|
|
|
|
template <typename M>
|
|
dk::Tyler<typename M::PixelConvType> call_map_load ( M& parFileOpener, const std::string& parOpen, const PushLayerMapType<typename M::PixelConvType>& parPusher );
|
|
|
|
template <typename M>
|
|
dk::Tyler<typename M::PixelConvType> call_map_load ( dk::Tyler<typename M::PixelConvType>& parTyler, M& parFileOpener, const std::string& parOpen, const PushLayerMapType<typename M::PixelConvType>& parPusher );
|
|
|
|
template <typename PixConv, typename C>
|
|
dk::Tyler<PixConv> map_load ( C& parFileOpener, const std::string& parOpen, const PushLayerMapType<PixConv>& parPusher );
|
|
|
|
template <typename PixConv, typename C>
|
|
dk::Tyler<PixConv>& map_load ( dk::Tyler<PixConv>& parTyler, C& parFileOpener, const std::string& parOpen, const PushLayerMapType<PixConv>& parPusher );
|
|
|
|
namespace implem {
|
|
template <typename PixConv>
|
|
void call_push_layer ( dk::Tyler<PixConv>& parTyler, const PushLayerMapType<PixConv>& parPusher, dk::BaseMapSource<PixConv::dimensions>* parReader, int parIndex );
|
|
} //namespace implem
|
|
} //namespace dkh
|
|
|
|
#include "doorkeeper/implem/maploader.inl"
|
|
|
|
#endif
|