00001 # ifndef OptIm15_h
00002 # define OptIm15_h OptIm15_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 # include <vector>
00021 # include "Root.h"
00022 # include "PixelLine15.h"
00023
00024 namespace Conjecture {
00025 class Image;
00026 class ImageArgs;
00027
00028
00069
00070
00071 class OptIm15 : public Root {
00072 public:
00073
00074 OptIm15(const Image* image, const ImageArgs& config);
00075 OptIm15(const std::vector<unsigned int>& rows, unsigned char width = 15);
00076
00077
00078
00079 inline const uint8_t & width() const { return this->_width; }
00080 inline const std::vector<PixelLine15> & cols() const { return this->_cols; }
00081 inline const std::vector<PixelLine15> & rows() const { return this->_rows; }
00082
00083
00084
00085
00086
00087
00088
00089 void init(const std::vector<unsigned int>& rows, unsigned char width);
00090
00092 int rblack(unsigned char i) const { return this->rows()[i].black(); }
00094 int rholes(unsigned char i) const { return this->rows()[i].holes(); }
00096 int cblack(unsigned char i) const { return this->cols()[i].black(); }
00098 int choles(unsigned char i) const { return this->cols()[i].holes(); }
00099
00103 std::string str(char on = '#', char off = '.') const;
00104
00105 static void test(int argc = 0, const char* argv[] = NULL);
00106
00107 protected:
00108
00109
00110 inline void widthIs(const uint8_t & width) { this->_width = width; }
00111 inline void colsIs(const std::vector<PixelLine15> & cols) { this->_cols = cols; }
00112 inline void rowsIs(const std::vector<PixelLine15> & rows) { this->_rows = rows; }
00113
00114
00115
00116 std::string rawstr(const std::vector<PixelLine15>& vec, char on = '1', char off = '0', unsigned char size = 15) const;
00117
00118 private:
00119
00120
00121 inline uint8_t& widthRef() { return this->_width; }
00122 inline std::vector<PixelLine15>& colsRef() { return this->_cols; }
00123 inline std::vector<PixelLine15>& rowsRef() { return this->_rows; }
00124
00125
00126
00127
00128
00129
00130 uint8_t _width;
00131 std::vector<PixelLine15> _cols;
00132 std::vector<PixelLine15> _rows;
00133 };
00134 }
00135
00136 # endif // OptIm15_h
00137