X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=readtree.h;h=0c368337a85954a94750fdba504103cccbe9057f;hb=3247d888e7aafc4a65ec9062a94dfd166c2c5b1d;hp=41d03058d6478cb371737dbc385c8bb5d0a1c999;hpb=4761e165b4a196fefa57755d3176d9ced19df6b1;p=mothur.git diff --git a/readtree.h b/readtree.h index 41d0305..0c36833 100644 --- a/readtree.h +++ b/readtree.h @@ -9,22 +9,56 @@ * */ -using namespace std; +#include "mothur.h" +#include "globaldata.hpp" +#include "tree.h" -#include -#include +#define MAX_LINE 513 +#define SKIPLINE(f,c) {while((c=f.get())!=EOF && ((c) != '\n')){}} +class Tree; + +/****************************************************************************/ class ReadTree { public: - ReadTree(); - ~ReadTree(); + ReadTree(); + virtual ~ReadTree() {}; + + virtual int read() = 0; + int readSpecialChar(istream&, char, string); + int readNodeChar(istream& f); + float readBranchLength(istream& f); + + protected: + GlobalData* globaldata; + int numNodes, numLeaves; + MothurOut* m; + +}; + +/****************************************************************************/ + +class ReadNewickTree : public ReadTree { - private: +public: + ReadNewickTree(string file) : treeFile(file) { m->openInputFile(file, filehandle); readOk = 0; } + ~ReadNewickTree() {}; + 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. - }; +/****************************************************************************/ -#endif \ No newline at end of file +#endif