]> git.donarmstrong.com Git - mothur.git/blobdiff - fileoutput.h
modified some calculators and other stuff - pds
[mothur.git] / fileoutput.h
index b5784210d0b734ccdf34dabf1b98259f2ec73499..3b73b148d88c7052421d48358c8ccdf0b39035ed 100644 (file)
@@ -2,7 +2,6 @@
 #define FILEOUTPUT_H
 
 #include "mothur.h"
-#include "utilities.hpp"
 #include "globaldata.hpp"
 
 using namespace std;
@@ -14,11 +13,18 @@ class FileOutput {
 public:
        FileOutput(){};
        ~FileOutput(){};
-       virtual void output(int, vector<double>) = 0;
+       
        virtual void initFile(string) = 0;
+       virtual void initFile(string, vector<string>) = 0;
+       virtual void output(int, vector<double>) = 0;
+       virtual void output(vector<double>) = 0;
        virtual void resetFile() = 0;
        virtual string getFileName() = 0;
 
+protected:
+       GlobalData* globaldata;
+       int renameOk;
+
 };     
        
 /***********************************************************************/
@@ -32,6 +38,10 @@ public:
        void output(int, vector<double>);
        void resetFile();
        string getFileName()    { return inName;        };
+       
+       void initFile(string, vector<string>){};
+       void output(vector<double>) {};
+
 private:
        string inName;
        string outName;
@@ -52,6 +62,10 @@ public:
        void initFile(string);
        void resetFile();
        string getFileName()    { return inName;        };
+       
+       void initFile(string, vector<string>) {};
+       void output(vector<double>) {};
+
 
 private:
        string outName;
@@ -72,6 +86,10 @@ public:
        void initFile(string);
        void resetFile();
        string getFileName()    { return inName;        };
+       
+       void initFile(string, vector<string>) {};
+       void output(vector<double>) {};
+
 
 private:
        string outName;
@@ -93,6 +111,11 @@ public:
        void output(int, vector<double>);
        void resetFile();
        string getFileName()    { return inName;        };
+       
+       
+       void initFile(string, vector<string>) {};
+       void output(vector<double>) {};
+
 private:
        string inName, groupLabel;
        string outName;
@@ -101,6 +124,30 @@ private:
        int counter, numGroup;
 };
 
+/***********************************************************************/
 
+class ColumnFile : public FileOutput {
+       
+public:
+       ColumnFile(string n) : FileOutput(), inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) { globaldata = GlobalData::getInstance(); };
+       ~ColumnFile();
+       
+       //to make compatible with parent class
+       void output(int, vector<double>){};
+       void initFile(string){};
+       
+       void initFile(string, vector<string>);
+       void output(vector<double>);
+       void resetFile();
+       string getFileName()    { return inName;        };
+private:
+       string inName;
+       string outName;
+       ifstream inFile;
+       ofstream outFile;
+       int counter;
+};
+
+/***********************************************************************/
 
 #endif