/* -*- C++ -*- * Copyright ©2005 Hugo Mills * * This software is distributed under the terms of the GNU GPL v3 * For more information on the GPL, see the file COPYING or * visit http://www.gnu.org/ * * This software is distributed without warranty */ #ifndef DATABLOCK_H #define DATABLOCK_H #include #include #include #include "coordinate.h" #include "crossing.h" // This should be a container for the data class DataBlock { public: DataBlock(const std::string& base_name); virtual ~DataBlock(); int width(void) const { return _width; } int height(void) const { return _height; } signed short int data(const iCoordinate& c) const; Crossing next(int height); bool valid(const Crossing& e) const; void visit(const Crossing& e) { visit(e, true); } void unvisit(const Crossing& e) { visit(e, false); } bool visited(const Crossing& e) const; bool crossed(const Crossing& e, int z) const; Coordinate intercept(const Crossing& e, int z) const; void dump_local(const iCoordinate& e) const; private: FILE* datafile; int length; char* _data; int _width; int _height; int _vc; int _visitmax; int next_x, next_y, next_phase; char* _visited_nsedges; char* _visited_ewedges; char* _visited_corners; void visit(const Crossing& e, bool v); }; #endif