Biorithm
1.1
|
This class wraps an ifstream and handles reading data from a truth matrix. More...
#include <BinaryMatrix.h>
Public Member Functions | |
BinaryMatrix () | |
BinaryMatrix (char *filename) | |
BinaryMatrix (const BinaryMatrix &src) | |
virtual | ~BinaryMatrix () |
virtual BinaryMatrix & | operator= (const BinaryMatrix &rhs) |
virtual void | findRows (const vector< Itemset > &sets, vector< vector< vector< unsigned int > > > &indecies) |
virtual void | findRows (const Itemset &is, vector< vector< unsigned int > > &indecies) |
virtual bool | getRow (bool *row) |
virtual bool | getRow (string &rowname, bool *row) |
const string & | getRowType (unsigned int index) const |
virtual const string & | getColname (unsigned int index) const |
virtual bool | isOpen () |
virtual void | rewind () |
virtual unsigned int | getWidth () |
virtual unsigned int | getHeight () |
virtual const char * | setFile (const char *filename) |
virtual void | transpose (const char *coltype) |
virtual const string & | getFilename () const |
virtual unsigned int | getFreq (unsigned int col, bool one=true) const |
Protected Attributes | |
ifstream | in |
string | filename |
string | rowtype |
vector< string > | colnames |
unsigned int | rows |
unsigned int | cols |
streampos | start |
unsigned int | currow |
char | errmsg [512] |
vector< unsigned int > | freqs |
This class wraps an ifstream and handles reading data from a truth matrix.
The BinaryMatrix
BinaryMatrix::BinaryMatrix | ( | char * | filename | ) |
Constructor that takes a filename
------------------------------- Parameters ------------------------------- char* filename The name of the file
BinaryMatrix::BinaryMatrix | ( | const BinaryMatrix & | src | ) |
Copy constructor.
------------------------------- Parameters ------------------------------- const BinaryMatrix& src The source matrix
BinaryMatrix::~BinaryMatrix | ( | ) | [virtual] |
Destructor
const string & BinaryMatrix::getColname | ( | unsigned int | index | ) | const [virtual] |
Gets the column name
------------------------------- Parameters ------------------------------- unsigned int index The column id
--------------------------------- Return --------------------------------- The name of that column
const string & BinaryMatrix::getFilename | ( | ) | const [virtual] |
Gets the filename for the matrix.
--------------------------------- Return --------------------------------- The filename of the matrix
unsigned int BinaryMatrix::getHeight | ( | ) | [virtual] |
Returns the height of the matrix. Does not count column names.
--------------------------------- Return --------------------------------- The height of the matrix
bool BinaryMatrix::getRow | ( | bool * | row | ) | [virtual] |
Gets a row
------------------------------- Parameters ------------------------------- const BinaryMatrix& rhs The right hand side
--------------------------------- Return --------------------------------- true There is another row left false There are no more rows left
bool BinaryMatrix::getRow | ( | string & | rowname, |
bool * | row | ||
) | [virtual] |
Reads in a row from the matrix
------------------------------- Parameters ------------------------------- string& rowname The name of row bool* row This is where we put the row data
--------------------------------- Return --------------------------------- false if there are no more rows left
const string & BinaryMatrix::getRowType | ( | unsigned int | index | ) | const |
Returns the row type (The field in the upper left of the file)
--------------------------------- Return --------------------------------- The row type
unsigned int BinaryMatrix::getWidth | ( | ) | [virtual] |
Returns the width of the matrix. Does not count row names.
--------------------------------- Return --------------------------------- The width of the matrix
bool BinaryMatrix::isOpen | ( | ) | [virtual] |
Makes sure our stream is open.
--------------------------------- Return --------------------------------- Whether or not the stream is open.
BinaryMatrix & BinaryMatrix::operator= | ( | const BinaryMatrix & | rhs | ) | [virtual] |
The = operator
------------------------------- Parameters ------------------------------- const BinaryMatrix& rhs The right hand side
--------------------------------- Return --------------------------------- A referenc to the new matrix
void BinaryMatrix::rewind | ( | ) | [virtual] |
Rewinds the file
const char * BinaryMatrix::setFile | ( | const char * | filename | ) | [virtual] |
Reads in the column names and sets variables needed for grabbing rows in the future
------------------------------- Parameters ------------------------------- const char* filename The name of the file
--------------------------------- Return --------------------------------- NULL The file is valid The error message
void BinaryMatrix::transpose | ( | const char * | coltype | ) | [virtual] |
Transposes the matrix if coltype is not null
------------------------------- Parameters ------------------------------- const char* coltype The name for the new column type. Ie: if it was bills before, it should now be senators