]> git.donarmstrong.com Git - mothur.git/blob - fileoutput.h
rarefaction.shared() fixed bug
[mothur.git] / fileoutput.h
1 #ifndef FILEOUTPUT_H
2 #define FILEOUTPUT_H
3
4 #include <iostream>
5 #include <fstream>
6 #include <iomanip>
7 #include <vector>
8 #include "utilities.hpp"
9 #include "globaldata.hpp"
10
11 using namespace std;
12
13 /***********************************************************************/
14
15 class FileOutput {
16         
17 public:
18         FileOutput(){};
19         ~FileOutput(){};
20         virtual void output(int, vector<double>) = 0;
21         virtual void initFile(string) = 0;
22         virtual void resetFile() = 0;
23         virtual string getFileName() = 0;
24
25 };      
26         
27 /***********************************************************************/
28
29 class ThreeColumnFile : public FileOutput {
30         
31 public:
32         ThreeColumnFile(string n) : FileOutput(), inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) { };
33         ~ThreeColumnFile();
34         void initFile(string);
35         void output(int, vector<double>);
36         void resetFile();
37         string getFileName()    { return inName;        };
38 private:
39         string inName;
40         string outName;
41         ifstream inFile;
42         ofstream outFile;
43         int counter;
44 };
45
46
47 /***********************************************************************/
48 class OneColumnFile : public FileOutput {
49         
50         
51 public:
52         OneColumnFile(string n) : inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) {};
53         ~OneColumnFile();
54         void output(int, vector<double>);
55         void initFile(string);
56         void resetFile();
57         string getFileName()    { return inName;        };
58
59 private:
60         string outName;
61         ifstream inFile;
62         string inName;
63         ofstream outFile;
64         int counter;
65 };
66
67 /***********************************************************************/
68 class SharedOneColumnFile : public FileOutput {
69         
70         
71 public:
72         SharedOneColumnFile(string n) : inName(n), counter(0), outName(getPathName(n) + ".temp." + getSimpleName(n)) {};
73         ~SharedOneColumnFile();
74         void output(int, vector<double>);
75         void initFile(string);
76         void resetFile();
77         string getFileName()    { return inName;        };
78
79 private:
80         string outName;
81         ifstream inFile;
82         string inName;
83         ofstream outFile;
84         int counter;
85                 
86 };
87
88 /***********************************************************************/
89
90 class SharedThreeColumnFile : public FileOutput {
91         
92 public:
93         SharedThreeColumnFile(string n, string groups) : FileOutput(), groupLabel(groups), inName(n), counter(0), numGroup(1), outName(getPathName(n) + ".temp." + getSimpleName(n)) {  };
94         ~SharedThreeColumnFile();
95         void initFile(string);
96         void output(int, vector<double>);
97         void resetFile();
98         string getFileName()    { return inName;        };
99 private:
100         string inName, groupLabel;
101         string outName;
102         ifstream inFile;
103         ofstream outFile;
104         int counter, numGroup;
105 };
106
107
108
109 #endif
110