]> git.donarmstrong.com Git - mothur.git/blob - readtree.h
When Pat tried to compile mothur in Ubuntu linux, there were a number of minor proble...
[mothur.git] / readtree.h
1 #ifndef READTREE_H
2 #define READTREE_H
3 /*
4  *  readtree.h
5  *  Mothur
6  *
7  *  Created by Sarah Westcott on 1/22/09.
8  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
9  *
10  */
11
12 using namespace std;
13
14 #include <string>
15 #include <iostream>
16 #include "globaldata.hpp"
17 #include "tree.h"
18
19 #define MAX_LINE                513
20 #define SKIPLINE(f,c)   {while((c=f.get())!=EOF && ((c) != '\n')){}}
21
22 class Tree;
23
24 /****************************************************************************/
25
26 class ReadTree {
27         public:
28                 ReadTree(); 
29                 ~ReadTree() {};
30                 
31                 virtual void read() {};
32                 int readSpecialChar(istream&, char, string);
33                 int readNodeChar(istream& f);
34                 float readBranchLength(istream& f);
35
36                                 
37                 Tree* getTree()  { return T; }
38                 
39                 int numNodes, numLeaves;
40                 GlobalData* globaldata;
41                 
42         protected:
43                 Tree* T;
44 };
45
46 /****************************************************************************/
47
48 class ReadNewickTree : public ReadTree {
49         
50 public:
51         ReadNewickTree(string file) : treeFile(file) { openInputFile(file, filehandle); }
52         ~ReadNewickTree() {};
53         void read();
54         
55 private:
56         int readNewickInt(istream&, int&, Tree*);
57         ifstream filehandle;
58         string treeFile;
59 };
60
61 /****************************************************************************/
62
63 #endif