]> git.donarmstrong.com Git - mothur.git/blobdiff - readdistcommand.cpp
This is mothur v 1.2.0 - the April ~24, 2009 release
[mothur.git] / readdistcommand.cpp
index 116e670a6e36f20df403cabf0610f7d60b4bbb5a..f19bf115d9e5f7d084b6007f1d738bcf0d33d494 100644 (file)
@@ -8,6 +8,8 @@
  */
 
 #include "readdistcommand.h"
+#include "readphylip.h"
+#include "readcolumn.h"
 
 ReadDistCommand::ReadDistCommand(){
        try {
@@ -21,6 +23,7 @@ ReadDistCommand::ReadDistCommand(){
                else if (format == "matrix") { 
                                groupMap = new GroupMap(globaldata->getGroupFile());
                                groupMap->readMap();
+                               //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap;  }
                                globaldata->gGroupmap = groupMap;
                }
                
@@ -69,11 +72,13 @@ int ReadDistCommand::execute(){
                        ifstream in;
                        openInputFile(filename, in);
                        matrix = new FullMatrix(in); //reads the matrix file
+                       //memory leak prevention
+                       //if (globaldata->gMatrix != NULL) { delete globaldata->gMatrix;  }
                        globaldata->gMatrix = matrix; //save matrix for coverage commands
                }else {
                        read->read(nameMap);
-                       globaldata->setListVector(read->getListVector());
-                       globaldata->setSparseMatrix(read->getMatrix());
+                       globaldata->gListVector = read->getListVector();
+                       globaldata->gSparseMatrix = read->getMatrix();
                }
                return 0;
        }