DoorKeeper/include/components/tilestreamer.hpp

45 lines
1.2 KiB
C++
Raw Normal View History

#ifndef id9B1C02049E474F6997D367932C4C2D21
#define id9B1C02049E474F6997D367932C4C2D21
#include "primitivetypes.hpp"
#include <iostream>
#include <vector>
#include <algorithm>
#include <memory>
2014-12-13 03:50:23 +00:00
#include <iterator>
//This code might need to be removed, but for now it's handy to read a simple
//ascii file into a vector without worrying too much about details.
//TODO: remove along with the code in the constructor
#include "implem/asciimap_parser.hpp"
#include <iomanip>
#include <stdexcept>
namespace dk {
template <typename T, size_t D>
class TileStreamer {
public:
typedef Vector<CoordinateScalarType, D> coords;
typedef std::unique_ptr<std::istream> StreamPtr;
explicit TileStreamer ( StreamPtr&& parStream );
TileStreamer ( const TileStreamer& ) = delete;
TileStreamer ( TileStreamer&& ) = default;
~TileStreamer ( void ) noexcept = default;
TileStreamer& operator= ( const TileStreamer& ) = delete;
void copy ( std::vector<T>& parDest, const coords& parFrom, const coords& parTo );
2014-12-13 03:50:23 +00:00
const coords& tilesCount ( void ) const { return m_count; }
private:
StreamPtr m_stream;
2014-12-13 03:50:23 +00:00
coords m_count;
std::vector<T> m_wholedata;
};
} //namespace dk
#include "implem/tilestreamer.inl"
#endif