*
*/
-using namespace std;
+#include "mothur.h"
+#include "globaldata.hpp"
+#include "tree.h"
-#include <string>
-#include <iostream>
+#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();
+ string 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