DataOperations< T > Class Template Reference

DataOperations: class to handle data and perform operations on them This class inherits DataHandler (interface). This construction allows to dynamicly select the temlate argument. More...

#include <DataOperations.h>

Inheritance diagram for DataOperations< T >:

DataHandler

List of all members.

Classes

class  Value
 Class for storing values It can store number or blank wich allows to display missing data. More...

Public Member Functions

 DataOperations ()
virtual void swap (string command)
virtual void parseFiles (string names)
virtual void load ()
virtual void join ()
virtual void merge ()
 This function merge all input data.
virtual void col ()
 This function makes all calculations to be made by columns in stead of by lines.
virtual void tab ()
 This function switch spaces into tabulators.
virtual void printOut ()
virtual void setCommand (string cmd)
virtual void blanks (string arg)
virtual void tol (double t)
virtual void prec (int p)
virtual void setFilter (string arg)
virtual void setOutputFiles (string names)
virtual void group (string arg)
virtual void comments (string arg)
virtual void calculate (string arg)
virtual void print (string arg)

Private Member Functions

 DataOperations (DataOperations &)
 Private copy constructor prevents from creating two same objects.
void printToStd ()
 Function to print data on standard output.
void printToFile ()
 Function to print data to one file.
void printToFiles ()
 Function to print data to many files.
size_t startFiltering ()
void mean ()
void count ()
void sum ()
void median ()
void deviation ()
void fillInBlanks ()
void commOut (ostream *out)
 This funtion inserts comments before data.
void commIn (ostream *out, int i)
 This funtion inserts comments before data of each file.
void parseComments ()
 This funtion parses comments, finds all parameters and put it in map.

Private Attributes

size_t col_cond
 variable used in filters functions to store information wich column is with condition.
bool isJoined
 if true input files are treated as one.
bool isMerged
 if true input files are merged.
bool tabulator
 if true tabulators are used to separate values
bool columns
 if true all calculations are made on columns
char c
tolerance
 stores size of tolerance used in filters functions (0 - default)
int precision
string blank
 stores string that will be put where data is missing
int commentMode
 stores information about comments mode (-1 off, 0 default, 1 one, 2 all)
vector< string > file_names
 stores names of input files
vector< string > file_out
 stores names of output files
vector< vector< vector< Value > > > all_values
 main data structure, stores all values, it's 3D vector: all_values[files][lines][columns]
vector< vector< string > > all_comments
 2D vector for storing comments
vector< map< string, double > > all_param
 vector of maps for storing parameters fuond in comments
vector< vector< Value > > tab_tmp
 temporary 2D vector for storing values
vector< Valuevall_tmp
 temporary vector for storing values
vector< double > conditions
 vector of numbers used in filters functions for comparations
vector< string > kind_of_cond
 vector of condidions used in filters functions
vector< size_t > out
 vector for storing numbers of columns that will be printed, used in filters functions
vector< vector< size_t > > dim
 2D vector for storing current dimmention of data, used in calculations functions
string command
 stores command that started the program


Detailed Description

template<typename T>
class DataOperations< T >

DataOperations: class to handle data and perform operations on them This class inherits DataHandler (interface). This construction allows to dynamicly select the temlate argument.

See also:
DataHandler
Author:
Sebastian Kłęk, Piotr Domagala and Jakub Mielczarek

Constructor & Destructor Documentation

template<typename T >
DataOperations< T >::DataOperations (  )  [inline]

This is the class constructor. It takes no arguments and it's basicly doing nothing exept setting default values to some variables.

template<typename T >
DataOperations< T >::DataOperations ( DataOperations< T > &   )  [inline, private]

Private copy constructor prevents from creating two same objects.


Member Function Documentation

template<typename T >
virtual void DataOperations< T >::blanks ( string  arg  )  [inline, virtual]

Setter for blanks.

Parameters:
arg is a string containing symbols putted where invalid value is found .

Implements DataHandler.

template<typename T >
void DataOperations< T >::calculate ( string  arg  )  [inline, virtual]

This function parses the calculate option and accordingly to it performs selected operations.

Parameters:
arg is a command line argument of -c (--calculate) option.

Implements DataHandler.

template<typename T >
virtual void DataOperations< T >::col (  )  [inline, virtual]

This function makes all calculations to be made by columns in stead of by lines.

Implements DataHandler.

template<typename T >
void DataOperations< T >::comments ( string  arg  )  [inline, virtual]

This function parses the comments option and accordingly to it sets level of coping comments from input to output.

Parameters:
arg is a command line argument of --comments option.

Implements DataHandler.

template<typename T >
void DataOperations< T >::commIn ( ostream *  out,
int  i 
) [inline, private]

This funtion inserts comments before data of each file.

template<typename T >
void DataOperations< T >::commOut ( ostream *  out  )  [inline, private]

This funtion inserts comments before data.

template<typename T >
void DataOperations< T >::count (  )  [inline, private]

Funtion to count values. It can works on columns or rows.

template<typename T >
void DataOperations< T >::deviation (  )  [inline, private]

Funtion to calculate standard deviation. It can works on columns or rows.

template<typename T >
void DataOperations< T >::fillInBlanks (  )  [inline, private]

Funtion to search for missing data and fill in blanks when needed. This is made because the same number of columns in every line in needed.

template<typename T >
void DataOperations< T >::group ( string  arg  )  [inline, virtual]

This function parses the group option and accordingly to it groups data.

Parameters:
arg is a command line argument of -g (--group) option.

Implements DataHandler.

template<typename T >
virtual void DataOperations< T >::join (  )  [inline, virtual]

This function joins all input to one output. Actually it works only when two or more files were specified on the input

Implements DataHandler.

template<typename T >
void DataOperations< T >::load (  )  [inline, virtual]

This function loads data to memory. If input files have been set, this function will open each of them and read content. Otherwise it will start reading standard input. The EOF symbol ends reading.

Implements DataHandler.

template<typename T >
void DataOperations< T >::mean (  )  [inline, private]

Funtion to calculate mean. It can works on columns or rows.

template<typename T >
void DataOperations< T >::median (  )  [inline, private]

Funtion to calculate median. It can works on columns or rows.

template<typename T >
void DataOperations< T >::merge (  )  [inline, virtual]

This function merge all input data.

Implements DataHandler.

template<typename T >
void DataOperations< T >::parseComments (  )  [inline, private]

This funtion parses comments, finds all parameters and put it in map.

template<typename T >
void DataOperations< T >::parseFiles ( string  names  )  [inline, virtual]

Function to collect input file names.

Parameters:
names is a list of files separated by ','

Implements DataHandler.

template<typename T >
virtual void DataOperations< T >::prec ( int  p  )  [inline, virtual]

Setter for printing precision.

Parameters:
p precision (number of digits after '.').

Implements DataHandler.

template<typename T >
void DataOperations< T >::print ( string  arg  )  [inline, virtual]

This function parses the print option and accordingly to it prints only selected data.

Parameters:
arg is a command line argument of -p (--print) option.

Implements DataHandler.

template<typename T >
void DataOperations< T >::printOut (  )  [inline, virtual]

This function is called on the end, when we want to print all. Function will decide where to save the data one file, many files or print to standard output.

Implements DataHandler.

template<typename T >
void DataOperations< T >::printToFile (  )  [inline, private]

Function to print data to one file.

template<typename T >
void DataOperations< T >::printToFiles (  )  [inline, private]

Function to print data to many files.

template<typename T >
void DataOperations< T >::printToStd (  )  [inline, private]

Function to print data on standard output.

template<typename T >
virtual void DataOperations< T >::setCommand ( string  cmd  )  [inline, virtual]

Setter for command that started the program.

Parameters:
cmd is a string containing command that started the program.

Implements DataHandler.

template<typename T >
void DataOperations< T >::setFilter ( string  arg  )  [inline, virtual]

This function parses the filtr option.

Parameters:
arg is a command line argument of -f (--filtr) option.

Implements DataHandler.

template<typename T >
void DataOperations< T >::setOutputFiles ( string  names  )  [inline, virtual]

Sets the output file names.

Parameters:
names is a list of output files specified by -o (--output-files) option and separated by ','.

Implements DataHandler.

template<typename T >
size_t DataOperations< T >::startFiltering (  )  [inline, private]

This function starts filtering data with condidions given in setFilter

See also:
setFilter

template<typename T >
void DataOperations< T >::sum (  )  [inline, private]

Funtion to calculate sum of values. It can works on columns or rows.

template<typename T >
void DataOperations< T >::swap ( string  command  )  [inline, virtual]

This function swaps two columns in selected file.

Parameters:
command is a command line argument of -s (--swap) option

Implements DataHandler.

template<typename T >
virtual void DataOperations< T >::tab (  )  [inline, virtual]

This function switch spaces into tabulators.

Implements DataHandler.

template<typename T >
virtual void DataOperations< T >::tol ( double  t  )  [inline, virtual]

Setter for tolerance used in comparations made by filter function.

Parameters:
t value of tolerance.

Implements DataHandler.


Member Data Documentation

template<typename T >
vector< vector<string> > DataOperations< T >::all_comments [private]

2D vector for storing comments

template<typename T >
vector< map<string, double> > DataOperations< T >::all_param [private]

vector of maps for storing parameters fuond in comments

template<typename T >
vector< vector< vector<Value> > > DataOperations< T >::all_values [private]

main data structure, stores all values, it's 3D vector: all_values[files][lines][columns]

template<typename T >
string DataOperations< T >::blank [private]

stores string that will be put where data is missing

template<typename T >
char DataOperations< T >::c [private]

variable used in filters functions to store information about condidions (0 - means only one condition, a - means and, o - means or).

template<typename T >
size_t DataOperations< T >::col_cond [private]

variable used in filters functions to store information wich column is with condition.

template<typename T >
bool DataOperations< T >::columns [private]

if true all calculations are made on columns

template<typename T >
string DataOperations< T >::command [private]

stores command that started the program

template<typename T >
int DataOperations< T >::commentMode [private]

stores information about comments mode (-1 off, 0 default, 1 one, 2 all)

template<typename T >
vector<double> DataOperations< T >::conditions [private]

vector of numbers used in filters functions for comparations

template<typename T >
vector< vector <size_t> > DataOperations< T >::dim [private]

2D vector for storing current dimmention of data, used in calculations functions

template<typename T >
vector<string> DataOperations< T >::file_names [private]

stores names of input files

template<typename T >
vector<string> DataOperations< T >::file_out [private]

stores names of output files

template<typename T >
bool DataOperations< T >::isJoined [private]

if true input files are treated as one.

template<typename T >
bool DataOperations< T >::isMerged [private]

if true input files are merged.

template<typename T >
vector<string> DataOperations< T >::kind_of_cond [private]

vector of condidions used in filters functions

template<typename T >
vector<size_t> DataOperations< T >::out [private]

vector for storing numbers of columns that will be printed, used in filters functions

template<typename T >
int DataOperations< T >::precision [private]

stores number of digits to display after comma (0 - default: means there wasn't --prec option in command, 6 digits are used)

template<typename T >
vector< vector<Value> > DataOperations< T >::tab_tmp [private]

temporary 2D vector for storing values

template<typename T >
bool DataOperations< T >::tabulator [private]

if true tabulators are used to separate values

template<typename T >
T DataOperations< T >::tolerance [private]

stores size of tolerance used in filters functions (0 - default)

template<typename T >
vector<Value> DataOperations< T >::vall_tmp [private]

temporary vector for storing values


The documentation for this class was generated from the following file:

Generated on Mon Aug 10 20:58:08 2009 for Filtertool by  doxygen 1.5.9