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::getFormat() { return format; }
34 void GlobalData::setListFile(string file) { listfile = file; inputFileName = file; }
35 void GlobalData::setTreeFile(string file) { treefile = file; inputFileName = file; }
36 void GlobalData::setRabundFile(string file) { rabundfile = file; inputFileName = file; }
37 void GlobalData::setSabundFile(string file) { sabundfile = file; inputFileName = file; }
38 void GlobalData::setPhylipFile(string file) { phylipfile = file; inputFileName = file; }
39 void GlobalData::setColumnFile(string file) { columnfile = file; inputFileName = file; }
40 void GlobalData::setGroupFile(string file) { groupfile = file; }
41 void GlobalData::setSharedFile(string file) { sharedfile = file; inputFileName = file; }
42 void GlobalData::setNameFile(string file) { namefile = file; }
43 void GlobalData::setOrderFile(string file) { orderfile = file; }
44 void GlobalData::setOrderGroupFile(string file) { ordergroup = file; }
45 void GlobalData::setFormat(string Format) { format = Format; }
48 /*******************************************************/
50 /******************************************************/
51 GlobalData::GlobalData() {
52 m = MothurOut::getInstance();
53 //option definitions should go here...
69 /*******************************************************/
71 /******************************************************/
72 void GlobalData::clear() {
73 //option definitions should go here...
74 phylipfile = ""; //do we need this?
75 columnfile = ""; //do we need this?
79 namefile = ""; //do we need this?
80 groupfile = ""; //do we need this?
83 // fastafile = ""; //do we need this?
90 /*******************************************************/
92 /******************************************************/
93 void GlobalData::newRead() {
95 //remove old file names
99 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
101 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
103 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
105 if (ginput != NULL) { delete ginput; ginput = NULL;}
107 if (gorder != NULL) { delete gorder; gorder = NULL; }
109 if (glist != NULL) { delete glist; glist = NULL;}
111 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
113 if (sabund != NULL) { delete sabund; sabund = NULL;}
115 if (rabund != NULL) { delete rabund; rabund = NULL; }
117 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
119 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
121 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
123 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
128 labels.clear(); Groups.clear();
133 catch(exception& e) {
134 m->errorOut(e, "GlobalData", "newRead");
139 //******************************************************/
141 /******************************************************/
142 GlobalData::~GlobalData() {
145 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
146 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
147 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
148 if (ginput != NULL) { delete ginput; ginput = NULL;}
149 if (gorder != NULL) { delete gorder; gorder = NULL; }
150 if (glist != NULL) { delete glist; glist = NULL;}
151 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
152 if (sabund != NULL) { delete sabund; sabund = NULL;}
153 if (rabund != NULL) { delete rabund; rabund = NULL; }
154 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
155 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
156 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
157 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
159 catch(exception& e) {
160 m->errorOut(e, "GlobalData", "~GlobalData");
164 /*******************************************************/
166 /*******************************************************/