Biorithm  1.1
 All Classes Functions Variables Typedefs Friends
BinaryMatrix.h
00001 /**************************************************************************
00002  * Copyright (c) 2007 Clifford Conley Owens III                           *
00003  *                                                                        *
00004  * This file is part of Biorithm.                                         *
00005  *                                                                        *
00006  * Biorithm is free software: you can redistribute it and/or modify       *
00007  * it under the terms of the GNU General Public License as published by   *
00008  * the Free Software Foundation, either version 3 of the License, or      *
00009  * (at your option) any later version.                                    *
00010  *                                                                        *
00011  * Biorithm is distributed in the hope that it will be useful,            *
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00014  * GNU General Public License for more details.                           *
00015  *                                                                        *
00016  * You should have received a copy of the GNU General Public License      *
00017  * along with Biorithm.  If not, see <http://www.gnu.org/licenses/>.      *
00018  *                                                                        *
00019  **************************************************************************/
00020 
00031 #ifndef BINARYMATRIX_H
00032 #define BINARYMATRIX_H
00033 
00034 // ---------------------------- External Headers ---------------------------- //
00035 
00036 #include <fstream>
00037 #include "Itemset.h"
00038 
00039 using namespace std;
00040 
00046 class BinaryMatrix
00047 {
00048     protected:
00049         // The data stream
00050         ifstream in;
00051 
00052         // The name of the file
00053         string filename;
00054 
00055         // The row type
00056         string rowtype;
00057 
00058         // The column names
00059         vector<string> colnames;
00060 
00061         // The number of rows
00062         unsigned int rows;
00063 
00064         // The number of columns
00065         unsigned int cols;
00066 
00067         // The stream position where the data actually starts
00068         streampos start;
00069 
00070         // The current row
00071         unsigned int currow;
00072 
00073         // The error message
00074         char errmsg[512];
00075 
00076         // The frequencies
00077         vector<unsigned int> freqs;
00078 
00079     public:
00080         BinaryMatrix();
00081         BinaryMatrix(char* filename);
00082         BinaryMatrix(const BinaryMatrix& src);
00083         virtual ~BinaryMatrix();
00084         virtual BinaryMatrix& operator =(const BinaryMatrix& rhs);
00085         virtual void findRows(const vector<Itemset>& sets,
00086             vector<vector<vector<unsigned int> > >& indecies);
00087         virtual void findRows(const Itemset& is,
00088             vector<vector<unsigned int> >& indecies);
00089         virtual bool getRow(bool* row);
00090         virtual bool getRow(string& rowname, bool* row);
00091         const string& getRowType(unsigned int index) const;
00092         virtual const string& getColname(unsigned int index) const;
00093         virtual bool isOpen();
00094         virtual void rewind();
00095         virtual unsigned int getWidth();
00096         virtual unsigned int getHeight();
00097         virtual const char* setFile(const char* filename);
00098         virtual void transpose(const char* coltype);
00099         virtual const string& getFilename() const;
00100         virtual unsigned int getFreq(unsigned int col, bool one = true)
00101             const;
00102 };
00103 
00104 #endif
 All Classes Functions Variables Typedefs Friends