]> git.donarmstrong.com Git - mothur.git/blob - mothurout.h
added cluster.classic command
[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
18 class MothurOut {
19         
20         public:
21                 static MothurOut* getInstance();
22                 void setFileName(string);
23                 
24                 void mothurOut(string);
25                 void mothurOutEndLine();
26                 void mothurOutJustToLog(string);
27                 void errorOut(exception&, string, string);
28                 void closeLog();
29                 string getDefaultPath() { return defaultPath; }
30                 void setDefaultPath(string);
31                 string getOutputDir() { return outputDir; }
32                 void setOutputDir(string);
33                 
34                 string getReleaseDate() { return releaseDate; }
35                 void setReleaseDate(string r) { releaseDate = r; }
36                 string getVersion() { return version; }
37                 void setVersion(string r) { version = r; }
38                 
39                 //functions from mothur.h
40                 //file operations
41                 vector<unsigned long int> divideFile(string, int&);
42                 vector<unsigned long int> setFilePosEachLine(string, int&);
43                 vector<unsigned long int> setFilePosFasta(string, int&);
44                 string sortFile(string, string);
45                 void appendFiles(string, string);
46                 int renameFile(string, string); //oldname, newname
47                 string getFullPathName(string);
48                 string hasPath(string);
49                 string getExtension(string);
50                 string getPathName(string);
51                 string getSimpleName(string);
52                 string getRootName(string);
53                 bool isBlank(string);
54                 int openOutputFile(string, ofstream&);
55                 int openOutputFileAppend(string, ofstream&);
56                 int openInputFile(string, ifstream&);
57                 int openInputFile(string, ifstream&, string); //no error given 
58                 string getline(ifstream&);
59                 string getline(istringstream&);
60                 void gobble(istream&);
61                 void gobble(istringstream&);
62                 
63                 //searchs and checks
64                 bool checkReleaseVersion(ifstream&, string);
65                 bool anyLabelsToProcess(string, set<string>&, string);
66                 bool inUsersGroups(vector<string>, vector<string>);
67                 bool inUsersGroups(string, vector<string>);
68                 void getNumSeqs(ifstream&, int&);
69                 int getNumSeqs(ifstream&);
70                 int getNumNames(string);
71                 bool isTrue(string);
72         
73                 
74                 //string manipulation
75                 void splitAtEquals(string&, string&);
76                 void splitAtComma(string&, string&);    
77                 void splitAtComma(string&, vector<string>&);
78                 void splitAtDash(string&, set<int>&);
79                 void splitAtDash(string&, set<string>&);
80                 void splitAtDash(string&, vector<string>&);
81                 void splitAtChar(string&, vector<string>&, char);
82                 
83                 //math operation
84                 int factorial(int num);
85                 vector<vector<double> > binomial(int);
86                 float ceilDist(float, int);
87                 float roundDist(float, int);
88
89                 int control_pressed;
90                 bool executing;
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