00001 //=========================================================================== 00002 // SINTEF LSMG library - version 1.1 00003 // 00004 // Copyright (C) 2000-2005 SINTEF ICT, Applied Mathematics, Norway. 00005 // 00006 // This program is free software; you can redistribute it and/or 00007 // modify it under the terms of the GNU General Public License 00008 // as published by the Free Software Foundation version 2 of the License. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 00018 // 59 Temple Place - Suite 330, 00019 // Boston, MA 02111-1307, USA. 00020 // 00021 // Contact information: e-mail: tor.dokken@sintef.no 00022 // SINTEF ICT, Department of Applied Mathematics, 00023 // P.O. Box 124 Blindern, 00024 // 0314 Oslo, Norway. 00025 // 00026 // Other licenses are also available for this software, notably licenses 00027 // for: 00028 // - Building commercial software. 00029 // - Building software whose source code you wish to keep private. 00030 //=========================================================================== 00031 #ifndef _BITMATRIX_H_ 00032 #define _BITMATRIX_H_ 00033 00034 00035 // Found the basics at Björn Arne Herwig's homepage: 00036 // "Mein wahrscheinlich erstes C++-Programm" 00037 class BitMatrix { 00038 00039 unsigned int sizex_, sizey_; 00040 unsigned char* matrix_; 00041 public: 00042 BitMatrix(unsigned int sizx, unsigned int sizy); 00043 BitMatrix(); 00044 ~BitMatrix(); 00045 00046 void set(const unsigned int& x, const unsigned int& y, int val); 00047 int get(const unsigned int& x, const unsigned int& y) const; 00048 00049 void size(int& nox, int& noy) const {nox=sizex_; noy=sizey_;} 00050 00051 //void raw() const; 00052 void zero(); 00053 void show() const; 00054 unsigned long count(int val) const; 00055 }; 00056 00057 #endif