]> git.donarmstrong.com Git - mothur.git/blob - mothurout.h
added pipeline commands which involved change to command factory and command 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                 string getOutputDir() { return outputDir; }
31                 void setOutputDir(string);
32                 
33                 string getReleaseDate() { return releaseDate; }
34                 void setReleaseDate(string r) { releaseDate = r; }
35                 string getVersion() { return version; }
36                 void setVersion(string r) { version = r; }
37                 
38                 //functions from mothur.h
39                 //file operations
40                 vector<unsigned long int> divideFile(string, int&);
41                 vector<unsigned long int> setFilePosEachLine(string, int&);
42                 vector<unsigned long int> setFilePosFasta(string, int&);
43                 string sortFile(string, string);
44                 void appendFiles(string, string);
45                 int renameFile(string, string); //oldname, newname
46                 string getFullPathName(string);
47                 string hasPath(string);
48                 string getExtension(string);
49                 string getPathName(string);
50                 string getSimpleName(string);
51                 string getRootName(string);
52                 bool isBlank(string);
53                 int openOutputFile(string, ofstream&);
54                 int openOutputFileAppend(string, ofstream&);
55                 int openInputFile(string, ifstream&);
56                 int openInputFile(string, ifstream&, string); //no error given 
57                 string getline(ifstream&);
58                 string getline(istringstream&);
59                 void gobble(istream&);
60                 void gobble(istringstream&);
61                 
62                 //searchs and checks
63                 bool checkReleaseVersion(ifstream&, string);
64                 bool anyLabelsToProcess(string, set<string>&, string);
65                 bool inUsersGroups(vector<string>, vector<string>);
66                 bool inUsersGroups(string, vector<string>);
67                 void getNumSeqs(ifstream&, int&);
68                 int getNumSeqs(ifstream&);
69                 int getNumNames(string);
70                 bool isTrue(string);
71         
72                 
73                 //string manipulation
74                 void splitAtEquals(string&, string&);
75                 void splitAtComma(string&, string&);    
76                 void splitAtComma(string&, vector<string>&);
77                 void splitAtDash(string&, set<int>&);
78                 void splitAtDash(string&, set<string>&);
79                 void splitAtDash(string&, vector<string>&);
80                 void splitAtChar(string&, vector<string>&, char);
81                 
82                 //math operation
83                 int factorial(int num);
84                 vector<vector<double> > binomial(int);
85                 float ceilDist(float, int);
86                 float roundDist(float, int);
87
88                 int control_pressed;
89                 bool executing;
90                 
91
92         private:
93                 static MothurOut* _uniqueInstance;
94                 MothurOut( const MothurOut& ); // Disable copy constructor
95                 void operator=( const MothurOut& ); // Disable assignment operator
96                 MothurOut() { control_pressed = false; defaultPath=""; };
97                 ~MothurOut();
98
99                 string logFileName;
100                 string defaultPath, outputDir;
101                 string releaseDate, version;
102                 
103                 ofstream out;
104                 
105                 int mem_usage(double&, double&);
106
107 };
108 /***********************************************/
109
110 #endif
111