5 * Created by Sarah Westcott on 1/23/09.
6 * Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10 #include "readtreecommand.h"
12 //**********************************************************************************************************************
13 ReadTreeCommand::ReadTreeCommand(){
15 globaldata = GlobalData::getInstance();
16 filename = globaldata->inputFileName;
18 //read in group map info.
19 treeMap = new TreeMap(globaldata->getGroupFile());
22 //memory leak prevention
23 //if (globaldata->gTreemap != NULL) { delete globaldata->gTreemap; }
24 globaldata->gTreemap = treeMap;
26 read = new ReadNewickTree(filename);
30 cout << "Standard Error: " << e.what() << " has occurred in the ReadTreeCommand class Function ReadTreeCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
34 cout << "An unknown error has occurred in the ReadTreeCommand class function ReadTreeCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
39 //**********************************************************************************************************************
41 ReadTreeCommand::~ReadTreeCommand(){
45 //**********************************************************************************************************************
47 int ReadTreeCommand::execute(){
51 readOk = read->read();
53 if (readOk != 0) { cout << "Read Terminated." << endl; globaldata->gTree.clear(); delete globaldata->gTreemap; return 0; }
55 vector<Tree*> T = globaldata->gTree;
57 //assemble users trees
58 for (int i = 0; i < T.size(); i++) {
65 cout << "Standard Error: " << e.what() << " has occurred in the ReadTreeCommand class Function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
69 cout << "An unknown error has occurred in the ReadTreeCommand class function execute. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
74 //**********************************************************************************************************************