]> git.donarmstrong.com Git - mothur.git/blobdiff - mothur.h
*** empty log message ***
[mothur.git] / mothur.h
index 36d7b28ebf45dd3f4bf1d0555c74f4e99c841fe9..2c9595ebe53c4055179f2297372bb1e691fff8ab 100644 (file)
--- a/mothur.h
+++ b/mothur.h
@@ -15,6 +15,7 @@ using namespace std;
 
 /* This file contains all the standard incudes we use in the project as well as some common utilities. */
 
+//#include <cstddef>
 
 //io libraries
 #include <iostream>
@@ -42,7 +43,15 @@ using namespace std;
 
 typedef unsigned long long ull;
 
-
+struct IntNode {
+       int lvalue;
+       int rvalue;
+       int lcoef;
+       int rcoef;
+       IntNode* left;
+       IntNode* right;
+};
+       
 /***********************************************************************/
 
 // snagged from http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.2
@@ -95,7 +104,6 @@ string toHex(const T&x){
 
     return output.str();
 }
-
 //**********************************************************************************************************************
 
 template<typename T>
@@ -203,6 +211,24 @@ inline string getSimpleName(string longName){
 
        return simpleName;
 }
+/***********************************************************************/
+
+inline int factorial(int num){
+       int total = 1;
+       
+       for (int i = 1; i <= num; i++) {
+               total *= i;
+       }
+       
+       return total;
+}
+/**************************************************************************************************
+
+double min(double x, double y)
+{
+    if(x<y){   return x;    }
+    else   {   return y;    }
+}
 
 /***********************************************************************/
 
@@ -247,6 +273,21 @@ inline int openOutputFile(string fileName, ofstream& fileHandle){
        }
 
 }
+/***********************************************************************/
+
+inline int openOutputFileAppend(string fileName, ofstream& fileHandle){
+       
+       fileHandle.open(fileName.c_str(), ios::app);
+       if(!fileHandle) {
+               cerr << "Error: Could not open " << fileName << endl;
+               return 1;
+       }
+       else {
+               return 0;
+       }
+
+}
+
 
 /***********************************************************************/