3 #include "globaldata.hpp"
4 #include "sharedlistvector.h"
6 #include "fullmatrix.h"
8 /*******************************************************/
10 /******************************************************/
11 GlobalData* GlobalData::getInstance() {
12 if( _uniqueInstance == 0) {
13 _uniqueInstance = new GlobalData();
15 return _uniqueInstance;
17 /*******************************************************/
19 /******************************************************/
20 // These functions give you the option parameters of the commands
21 string GlobalData::getPhylipFile() { return phylipfile; }
22 string GlobalData::getColumnFile() { return columnfile; }
23 string GlobalData::getListFile() { return listfile; }
24 string GlobalData::getRabundFile() { return rabundfile; }
25 string GlobalData::getSabundFile() { return sabundfile; }
26 string GlobalData::getNameFile() { return namefile; }
27 string GlobalData::getGroupFile() { return groupfile; }
28 string GlobalData::getOrderFile() { return orderfile; }
29 string GlobalData::getTreeFile() { return treefile; }
30 string GlobalData::getSharedFile() { return sharedfile; }
31 string GlobalData::getFormat() { return format; }
33 void GlobalData::setListFile(string file) { listfile = file; inputFileName = file; }
34 void GlobalData::setTreeFile(string file) { treefile = file; inputFileName = file; }
35 void GlobalData::setRabundFile(string file) { rabundfile = file; inputFileName = file; }
36 void GlobalData::setSabundFile(string file) { sabundfile = file; inputFileName = file; }
37 void GlobalData::setPhylipFile(string file) { phylipfile = file; inputFileName = file; }
38 void GlobalData::setColumnFile(string file) { columnfile = file; inputFileName = file; }
39 void GlobalData::setGroupFile(string file) { groupfile = file; }
40 void GlobalData::setSharedFile(string file) { sharedfile = file; inputFileName = file; }
41 void GlobalData::setNameFile(string file) { namefile = file; }
42 void GlobalData::setOrderFile(string file) { orderfile = file; }
43 void GlobalData::setFormat(string Format) { format = Format; }
46 /*******************************************************/
48 /******************************************************/
49 GlobalData::GlobalData() {
50 m = MothurOut::getInstance();
51 //option definitions should go here...
67 /*******************************************************/
69 /******************************************************/
70 void GlobalData::clear() {
71 //option definitions should go here...
72 phylipfile = ""; //do we need this?
73 columnfile = ""; //do we need this?
77 namefile = ""; //do we need this?
78 groupfile = ""; //do we need this?
80 // fastafile = ""; //do we need this?
87 /*******************************************************/
89 /******************************************************/
90 void GlobalData::newRead() {
92 //remove old file names
96 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
98 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
100 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
102 if (ginput != NULL) { delete ginput; ginput = NULL;}
104 if (gorder != NULL) { delete gorder; gorder = NULL; }
106 if (glist != NULL) { delete glist; glist = NULL;}
108 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
110 if (sabund != NULL) { delete sabund; sabund = NULL;}
112 if (rabund != NULL) { delete rabund; rabund = NULL; }
114 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
116 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
118 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
120 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
125 labels.clear(); Groups.clear();
130 catch(exception& e) {
131 m->errorOut(e, "GlobalData", "newRead");
136 //******************************************************/
138 /******************************************************/
139 GlobalData::~GlobalData() {
142 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
143 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
144 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
145 if (ginput != NULL) { delete ginput; ginput = NULL;}
146 if (gorder != NULL) { delete gorder; gorder = NULL; }
147 if (glist != NULL) { delete glist; glist = NULL;}
148 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
149 if (sabund != NULL) { delete sabund; sabund = NULL;}
150 if (rabund != NULL) { delete rabund; rabund = NULL; }
151 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
152 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
153 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
154 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
156 catch(exception& e) {
157 m->errorOut(e, "GlobalData", "~GlobalData");
161 /*******************************************************/
163 /*******************************************************/