]> git.donarmstrong.com Git - mothur.git/blob - fileoutput.h
sffinfo bug with flow grams right index when clipQualRight=0
[mothur.git] / fileoutput.h
1 #ifndef FILEOUTPUT_H
2 #define FILEOUTPUT_H
3
4 #include "mothur.h"
5 #include "mothurout.h"
6
7 /***********************************************************************/
8
9 class FileOutput {
10         
11 public:
12         FileOutput(){ m = MothurOut::getInstance(); }
13         virtual ~FileOutput(){};
14         
15         virtual void initFile(string) = 0;
16         virtual void initFile(string, vector<string>) = 0;
17         virtual void output(int, vector<double>) = 0;
18         virtual void output(vector<double>) = 0;
19         virtual void resetFile() = 0;
20         virtual string getFileName() = 0;
21
22 protected:
23         int renameOk;
24         MothurOut* m;
25
26 };      
27         
28 /***********************************************************************/
29
30 class ThreeColumnFile : public FileOutput {
31         
32 public:
33         ThreeColumnFile(string n) : FileOutput(), inName(n), counter(0), outName(n + ".temp") { };
34         ~ThreeColumnFile();
35         void initFile(string);
36         void output(int, vector<double>);
37         void resetFile();
38         string getFileName()    { return inName;        };
39         
40         void initFile(string, vector<string>){};
41         void output(vector<double>) {};
42
43 private:
44         string inName;
45         string outName;
46         ifstream inFile;
47         ofstream outFile;
48         int counter;
49 };
50
51
52 /***********************************************************************/
53 class OneColumnFile : public FileOutput {
54         
55         
56 public:
57         OneColumnFile(string n) : inName(n), counter(0), outName(n + ".temp") {};
58         ~OneColumnFile();
59         void output(int, vector<double>);
60         void initFile(string);
61         void resetFile();
62         string getFileName()    { return inName;        };
63         
64         void initFile(string, vector<string>) {};
65         void output(vector<double>) {};
66
67
68 private:
69         string outName;
70         ifstream inFile;
71         string inName;
72         ofstream outFile;
73         int counter;
74 };
75
76 /***********************************************************************/
77 class SharedOneColumnFile : public FileOutput {
78         
79         
80 public:
81         SharedOneColumnFile(string n) : inName(n), counter(0), outName(n + ".temp") {};
82         ~SharedOneColumnFile();
83         void output(int, vector<double>);
84         void initFile(string);
85         void resetFile();
86         string getFileName()    { return inName;        };
87         
88         void initFile(string, vector<string>) {};
89         void output(vector<double>) {};
90
91
92 private:
93         string outName;
94         ifstream inFile;
95         string inName;
96         ofstream outFile;
97         int counter;
98                 
99 };
100
101 /***********************************************************************/
102
103 class SharedThreeColumnFile : public FileOutput {
104         
105 public:
106         SharedThreeColumnFile(string n, string groups) : FileOutput(), groupLabel(groups), inName(n), counter(0), numGroup(1), outName(n + ".temp") {   };
107         ~SharedThreeColumnFile();
108         void initFile(string);
109         void output(int, vector<double>);
110         void resetFile();
111         string getFileName()    { return inName;        };
112         
113         
114         void initFile(string, vector<string>) {};
115         void output(vector<double>) {};
116
117 private:
118         string inName, groupLabel;
119         string outName;
120         ifstream inFile;
121         ofstream outFile;
122         int counter, numGroup;
123 };
124
125 /***********************************************************************/
126 //used by parsimony, unifrac.weighted and unifrac.unweighted
127 class ColumnFile : public FileOutput {
128         
129 public:
130         ColumnFile(string n, string i) : FileOutput(), iters(i), inName(n), counter(0), outName(n + ".temp") {};
131         ~ColumnFile();
132         
133         //to make compatible with parent class
134         void output(int, vector<double>){};
135         void initFile(string){};
136         
137         void initFile(string, vector<string>);
138         void output(vector<double>);
139         void resetFile();
140         string getFileName()    { return inName;        };
141 private:
142         string inName;
143         string outName;
144         ifstream inFile;
145         ofstream outFile;
146         int counter;
147         string iters;
148 };
149
150
151
152 #endif