*/
#include "readdistcommand.h"
+#include "readphylip.h"
+#include "readcolumn.h"
+#include "readmatrix.hpp"
ReadDistCommand::ReadDistCommand(){
try {
else if (format == "matrix") {
groupMap = new GroupMap(globaldata->getGroupFile());
groupMap->readMap();
+ //if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
globaldata->gGroupmap = groupMap;
}
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());
+ //to prevent memory leak
+ if (globaldata->gListVector != NULL) { delete globaldata->gListVector; }
+ globaldata->gListVector = read->getListVector();
+ if (globaldata->gSparseMatrix != NULL) { delete globaldata->gSparseMatrix; }
+ globaldata->gSparseMatrix = read->getMatrix();
}
return 0;
}