]> git.donarmstrong.com Git - mothur.git/blob - mothurout.h
moved utilities out of mothur.h and into mothurOut class.
[mothur.git] / mothurout.h
1 #ifndef MOTHUROUT_H
2 #define MOTHUROUT_H
3
4 /*
5  *  mothurOut.h
6  *  Mothur
7  *
8  *  Created by westcott on 2/25/10.
9  *  Copyright 2010 Schloss Lab. All rights reserved.
10  *
11  */
12
13 #include "mothur.h"
14
15 /***********************************************/
16
17 class MothurOut {
18         
19         public:
20                 static MothurOut* getInstance();
21                 void setFileName(string);
22                 
23                 void mothurOut(string);
24                 void mothurOutEndLine();
25                 void mothurOutJustToLog(string);
26                 void errorOut(exception&, string, string);
27                 void closeLog();
28                 string getDefaultPath() { return defaultPath; }
29                 void setDefaultPath(string);
30                 
31                 string getReleaseDate() { return releaseDate; }
32                 void setReleaseDate(string r) { releaseDate = r; }
33                 string getVersion() { return version; }
34                 void setVersion(string r) { version = r; }
35                 
36                 //functions from mothur.h
37                 //file operations
38                 vector<unsigned long int> divideFile(string, int&);
39                 vector<unsigned long int> setFilePosEachLine(string, int&);
40                 vector<unsigned long int> setFilePosFasta(string, int&);
41                 string sortFile(string, string);
42                 void appendFiles(string, string);
43                 int renameFile(string, string); //oldname, newname
44                 string getFullPathName(string);
45                 string hasPath(string);
46                 string getExtension(string);
47                 string getPathName(string);
48                 string getSimpleName(string);
49                 string getRootName(string);
50                 bool isBlank(string);
51                 int openOutputFile(string, ofstream&);
52                 int openOutputFileAppend(string, ofstream&);
53                 int openInputFile(string, ifstream&);
54                 int openInputFile(string, ifstream&, string); //no error given 
55                 string getline(ifstream&);
56                 string getline(istringstream&);
57                 void gobble(istream&);
58                 void gobble(istringstream&);
59                 
60                 //searchs and checks
61                 bool checkReleaseVersion(ifstream&, string);
62                 bool anyLabelsToProcess(string, set<string>&, string);
63                 bool inUsersGroups(vector<string>, vector<string>);
64                 bool inUsersGroups(string, vector<string>);
65                 void getNumSeqs(ifstream&, int&);
66                 int getNumSeqs(ifstream&);
67                 int getNumNames(string);
68                 bool isTrue(string);
69         
70                 
71                 //string manipulation
72                 void splitAtEquals(string&, string&);
73                 void splitAtComma(string&, string&);    
74                 void splitAtComma(string&, vector<string>&);
75                 void splitAtDash(string&, set<int>&);
76                 void splitAtDash(string&, set<string>&);
77                 void splitAtDash(string&, vector<string>&);
78                 void splitAtChar(string&, vector<string>&, char);
79                 
80                 //math operation
81                 int factorial(int num);
82                 vector<vector<double> > binomial(int);
83                 float ceilDist(float, int);
84                 float roundDist(float, int);
85
86                 int control_pressed;
87                 bool executing;
88                 
89
90         private:
91                 static MothurOut* _uniqueInstance;
92                 MothurOut( const MothurOut& ); // Disable copy constructor
93                 void operator=( const MothurOut& ); // Disable assignment operator
94                 MothurOut() { control_pressed = false; defaultPath=""; };
95                 ~MothurOut();
96
97                 string logFileName;
98                 string defaultPath;
99                 string releaseDate, version;
100                 
101                 ofstream out;
102                 
103                 int mem_usage(double&, double&);
104
105 };
106 /***********************************************/
107
108 #endif
109