]> git.donarmstrong.com Git - mothur.git/blobdiff - fileoutput.h
This is mothur v 1.2.0 - the April ~24, 2009 release
[mothur.git] / fileoutput.h
index 6eb5e8d708eca6f102c7a562507ac92e1553e336..3b73b148d88c7052421d48358c8ccdf0b39035ed 100644 (file)
@@ -1,11 +1,7 @@
 #ifndef FILEOUTPUT_H
 #define FILEOUTPUT_H
 
-#include <iostream>
-#include <fstream>
-#include <iomanip>
-#include <vector>
-#include "utilities.hpp"
+#include "mothur.h"
 #include "globaldata.hpp"
 
 using namespace std;
@@ -17,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;
+
 };     
        
 /***********************************************************************/
@@ -35,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;
@@ -55,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;
@@ -69,12 +80,16 @@ class SharedOneColumnFile : public FileOutput {
        
        
 public:
-       SharedOneColumnFile(string n, vector<string> g) : inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) {};
+       SharedOneColumnFile(string n) : inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) {};
        ~SharedOneColumnFile();
        void output(int, vector<double>);
        void initFile(string);
        void resetFile();
        string getFileName()    { return inName;        };
+       
+       void initFile(string, vector<string>) {};
+       void output(vector<double>) {};
+
 
 private:
        string outName;
@@ -96,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;
@@ -104,7 +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
-