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::getOrderGroupFile() { return ordergroup; }
30 string GlobalData::getTreeFile() { return treefile; }
31 string GlobalData::getSharedFile() { return sharedfile; }
32 string GlobalData::getRelAbundFile() { return relAbundfile; }
33 string GlobalData::getFormat() { return format; }
35 void GlobalData::setListFile(string file) { listfile = file; inputFileName = file; }
36 void GlobalData::setTreeFile(string file) { treefile = file; inputFileName = file; }
37 void GlobalData::setRabundFile(string file) { rabundfile = file; inputFileName = file; }
38 void GlobalData::setSabundFile(string file) { sabundfile = file; inputFileName = file; }
39 void GlobalData::setPhylipFile(string file) { phylipfile = file; inputFileName = file; }
40 void GlobalData::setColumnFile(string file) { columnfile = file; inputFileName = file; }
41 void GlobalData::setGroupFile(string file) { groupfile = file; }
42 void GlobalData::setSharedFile(string file) { sharedfile = file; inputFileName = file; }
43 void GlobalData::setRelAbundFile(string file) { relAbundfile = file; inputFileName = file; }
44 void GlobalData::setNameFile(string file) { namefile = file; }
45 void GlobalData::setOrderFile(string file) { orderfile = file; }
46 void GlobalData::setOrderGroupFile(string file) { ordergroup = file; }
47 void GlobalData::setFormat(string Format) { format = Format; }
50 /*******************************************************/
52 /******************************************************/
53 GlobalData::GlobalData() {
54 m = MothurOut::getInstance();
55 //option definitions should go here...
72 /*******************************************************/
74 /******************************************************/
75 void GlobalData::clear() {
76 //option definitions should go here...
77 phylipfile = ""; //do we need this?
78 columnfile = ""; //do we need this?
82 namefile = ""; //do we need this?
83 groupfile = ""; //do we need this?
86 // fastafile = ""; //do we need this?
95 /*******************************************************/
97 /******************************************************/
98 void GlobalData::newRead() {
100 //remove old file names
104 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
106 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
108 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
110 if (ginput != NULL) { delete ginput; ginput = NULL;}
112 if (gorder != NULL) { delete gorder; gorder = NULL; }
114 if (glist != NULL) { delete glist; glist = NULL;}
116 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
118 if (sabund != NULL) { delete sabund; sabund = NULL;}
120 if (rabund != NULL) { delete rabund; rabund = NULL; }
122 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
124 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
126 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
128 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
133 labels.clear(); Groups.clear();
138 catch(exception& e) {
139 m->errorOut(e, "GlobalData", "newRead");
144 //******************************************************/
146 /******************************************************/
147 GlobalData::~GlobalData() {
150 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
151 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
152 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
153 if (ginput != NULL) { delete ginput; ginput = NULL;}
154 if (gorder != NULL) { delete gorder; gorder = NULL; }
155 if (glist != NULL) { delete glist; glist = NULL;}
156 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
157 if (sabund != NULL) { delete sabund; sabund = NULL;}
158 if (rabund != NULL) { delete rabund; rabund = NULL; }
159 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
160 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
161 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
162 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
164 catch(exception& e) {
165 m->errorOut(e, "GlobalData", "~GlobalData");
169 /*******************************************************/
171 /*******************************************************/