]> git.donarmstrong.com Git - mothur.git/blobdiff - readtree.h
fixed phylo.diversity
[mothur.git] / readtree.h
index 1abef8a179478b9db980ee6c21e6e6b9855a024b..0c368337a85954a94750fdba504103cccbe9057f 100644 (file)
@@ -9,10 +9,7 @@
  *
  */
 
-using namespace std;
-
-#include <string>
-#include <iostream>
+#include "mothur.h"
 #include "globaldata.hpp"
 #include "tree.h"
 
@@ -26,21 +23,19 @@ class Tree;
 class ReadTree {
        public:
                ReadTree(); 
-               ~ReadTree() {};
+               virtual ~ReadTree() {};
                
-               virtual void read() {};
+               virtual int read() = 0;
                int readSpecialChar(istream&, char, string);
                int readNodeChar(istream& f);
                float readBranchLength(istream& f);
-
-                               
-               Tree* getTree()  { return T; }
                
-               int numNodes, numLeaves;
+       protected:
                GlobalData* globaldata;
+               int numNodes, numLeaves;
+               MothurOut* m;
+               
                
-       protected:
-               Tree* T;
 };
 
 /****************************************************************************/
@@ -48,14 +43,20 @@ class ReadTree {
 class ReadNewickTree : public ReadTree {
        
 public:
-       ReadNewickTree(string file) : treeFile(file) { openInputFile(file, filehandle); }
+       ReadNewickTree(string file) : treeFile(file) { m->openInputFile(file, filehandle); readOk = 0; } 
        ~ReadNewickTree() {};
-       void read();
+       int read();
        
 private:
+       Tree* T;
        int readNewickInt(istream&, int&, Tree*);
+       int readTreeString();
+       void nexusTranslation();
        ifstream filehandle;
        string treeFile;
+       string holder;
+       int readOk;  // readOk = 0 means success, readOk = 1 means errors.
+       
 };
 
 /****************************************************************************/