1: // bit_array -- Implement a subscriptable array of bits, get and set individual bits. 3: #ifndef __bit_array__H__ 4: #define __bit_array__H__ 6: #define FALSE 0 7: #define TRUE (!FALSE) 9: class bit_array { 11: public: 12: // CONSTRUCTORS 13: bit_array(long n); // one dimensional bit_array 14: bit_array(long n, long m); // two dimensional bit_array 16: ~bit_array(); // DESTRUCTOR 18: long rows; // number of rows 19: long cols; // number of collumns 21: unsigned char* bytes; // the array of bits as bytes, 8 bits per byte 22: // (deliberately public for I/O reasons...) 24: int operator()(long i); // 1-dimensional getter 25: int operator()(long i, long j); // 2-dimensional getter 27: void set(long i, int val); // 1-dimensional setter 28: void set(long i, long j, int val); // 2-dimensional setter 30: }; 32: #endif // __bit_array__H__