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 //option definitions should go here...
66 /*******************************************************/
68 /******************************************************/
69 void GlobalData::clear() {
70 //option definitions should go here...
71 phylipfile = ""; //do we need this?
72 columnfile = ""; //do we need this?
76 namefile = ""; //do we need this?
77 groupfile = ""; //do we need this?
79 // fastafile = ""; //do we need this?
85 /*******************************************************/
87 /******************************************************/
88 void GlobalData::newRead() {
90 //remove old file names
94 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
96 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
98 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
100 if (ginput != NULL) { delete ginput; ginput = NULL;}
102 if (gorder != NULL) { delete gorder; gorder = NULL; }
104 if (glist != NULL) { delete glist; glist = NULL;}
106 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
108 if (sabund != NULL) { delete sabund; sabund = NULL;}
110 if (rabund != NULL) { delete rabund; rabund = NULL; }
112 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
114 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
116 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
118 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
123 labels.clear(); Groups.clear();
127 catch(exception& e) {
128 errorOut(e, "GlobalData", "newRead");
133 //******************************************************/
135 /******************************************************/
136 GlobalData::~GlobalData() {
139 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
140 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
141 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
142 if (ginput != NULL) { delete ginput; ginput = NULL;}
143 if (gorder != NULL) { delete gorder; gorder = NULL; }
144 if (glist != NULL) { delete glist; glist = NULL;}
145 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
146 if (sabund != NULL) { delete sabund; sabund = NULL;}
147 if (rabund != NULL) { delete rabund; rabund = NULL; }
148 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
149 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
150 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
151 if (nameMap != NULL) { delete nameMap; nameMap = NULL; }
153 catch(exception& e) {
154 errorOut(e, "GlobalData", "~GlobalData");
158 /*******************************************************/
160 /*******************************************************/