]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.h
updated pats contact and mothur header info
[mothur.git] / mothur.h
index 2efdda8bda209ec303dd7e6bc1b8650b5eb65949..c5afe86a79a9e92c789735ea3b1be3d33accf66a 100644 (file)
--- a/mothur.h
+++ b/mothur.h
 #include <ctime>
 #include <limits>
 
-using namespace std;
 
-#ifdef _WIN32
-       #define exp(x) (exp((double) x))
-       #define sqrt(x) (sqrt((double) x))
-       #define log10(x) (log10((double) x))
-       #define log2(x) (log10(x)/log10(2))
-       #define isnan(x) ((x) != (x))
-       #define isinf(x) (fabs(x) == std::numeric_limits<double>::infinity())
-#else
+#if defined (__APPLE__) || (__MACH__) || (linux) || (__linux)
        #include <sys/wait.h>
        #include <unistd.h>
 #endif
 
+using namespace std;
+
+#define exp(x) (exp((double) x))
+#define sqrt(x) (sqrt((double) x))
+#define log10(x) (log10((double) x))
+#define log2(x) (log10(x)/log10(2))
+#define isnan(x) ((x) != (x))
+#define isinf(x) (fabs(x) == std::numeric_limits<double>::infinity())
+
 
 typedef unsigned long ull;
 
@@ -96,6 +97,7 @@ inline void convert(const string& s, T& x, bool failIfLeftoverChars = true){
        if (!(i >> x) || (failIfLeftoverChars && i.get(c)))
                throw BadConversion(s);
 }
+
 //**********************************************************************************************************************
 
 template<typename T>
@@ -167,6 +169,30 @@ inline int openOutputFileAppend(string fileName, ofstream& fileHandle){
        }
 
 }
+/***********************************************************************/
+
+inline string getline(ifstream& fileHandle) {
+       try {
+       
+               string line = "";
+               
+               while (!fileHandle.eof())       {
+                       //get next character
+                       char c = fileHandle.get(); 
+                       
+                       //are you at the end of the line
+                       if ((c == '\n') || (c == '\r') || (c == '\f')){   break;        }       
+                       else {          line += c;              }
+               }
+               
+               return line;
+               
+       }
+       catch(exception& e) {
+               cout << "Error in mothur function getline" << endl;
+               exit(1);
+       }
+}
 
 /**************************************************************************************************/
 
@@ -231,7 +257,7 @@ inline void errorOut(exception& e, string object, string function) {
        
                mothurOut("Error: ");
                mothurOut(toString(e.what()));
-               mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at pschloss@microbio.umass.edu, and be sure to include the mothur.logFile with your inquiry.");
+               mothurOut(" has occurred in the " + object + " class function " + function + ". Please contact Pat Schloss at pschloss@umich.edu, and be sure to include the mothur.logFile with your inquiry.");
                mothurOutEndLine();
        
 }