Biorithm  1.1
Public Member Functions | Protected Attributes
TruthMatrix Class Reference

This class wraps an ifstream and handles reading data from a truth matrix. More...

#include <TruthMatrix.h>

List of all members.

Public Member Functions

 TruthMatrix ()
 TruthMatrix (char *filename)
 TruthMatrix (const TruthMatrix &src)
virtual ~TruthMatrix ()
virtual TruthMatrixoperator= (const TruthMatrix &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 width ()
virtual unsigned int height ()
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

Detailed Description

This class wraps an ifstream and handles reading data from a truth matrix.


Constructor & Destructor Documentation

The TruthMatrix

Author:
Conley Owens ibcliffo@vt.edu
Date:
2007-06-04 The constructor
TruthMatrix::TruthMatrix ( char *  filename)

Constructor that takes a filename

------------------------------- Parameters ------------------------------- char* filename The name of the file

Copy constructor.

------------------------------- Parameters ------------------------------- const TruthMatrix& src The source matrix

Destructor


Member Function Documentation

const string & TruthMatrix::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 & TruthMatrix::getFilename ( ) const [virtual]

Gets the filename for the matrix.

--------------------------------- Return --------------------------------- The filename of the matrix

bool TruthMatrix::getRow ( bool *  row) [virtual]

Gets a row

------------------------------- Parameters ------------------------------- const TruthMatrix& rhs The right hand side

--------------------------------- Return --------------------------------- true There is another row left false There are no more rows left

bool TruthMatrix::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 & TruthMatrix::getRowType ( unsigned int  index) const

Returns the row type (The field in the upper left of the file)

--------------------------------- Return --------------------------------- The row type

unsigned int TruthMatrix::height ( ) [virtual]

Returns the height of the matrix. Does not count column names.

--------------------------------- Return --------------------------------- The height of the matrix

bool TruthMatrix::isOpen ( ) [virtual]

Makes sure our stream is open.

--------------------------------- Return --------------------------------- Whether or not the stream is open.

TruthMatrix & TruthMatrix::operator= ( const TruthMatrix rhs) [virtual]

The = operator

------------------------------- Parameters ------------------------------- const TruthMatrix& rhs The right hand side

--------------------------------- Return --------------------------------- A referenc to the new matrix

void TruthMatrix::rewind ( ) [virtual]

Rewinds the file

const char * TruthMatrix::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 TruthMatrix::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

unsigned int TruthMatrix::width ( ) [virtual]

Returns the width of the matrix. Does not count row names.

--------------------------------- Return --------------------------------- The width of the matrix


The documentation for this class was generated from the following files:
 All Classes Functions Variables Typedefs Friends