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::getFastaFile() { return fastafile; }
32 string GlobalData::getFormat() { return format; }
34 void GlobalData::setListFile(string file) { listfile = file; inputFileName = file; }
35 //void GlobalData::setFastaFile(string file) { fastafile = 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::setNameFile(string file) { namefile = file; }
44 void GlobalData::setOrderFile(string file) { orderfile = file; }
45 void GlobalData::setFormat(string Format) { format = Format; }
48 /*******************************************************/
50 /******************************************************/
51 GlobalData::GlobalData() {
52 //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?
86 /*******************************************************/
88 /******************************************************/
89 void GlobalData::newRead() {
91 //remove old file names
95 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
96 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
97 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
98 if (ginput != NULL) { delete ginput; ginput = NULL;}
99 if (gorder != NULL) { delete gorder; gorder = NULL; }
100 if (glist != NULL) { delete glist; glist = NULL;}
101 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
102 if (sabund != NULL) { delete sabund; sabund = NULL;}
103 if (rabund != NULL) { delete rabund; rabund = NULL; }
104 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
105 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
106 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
110 labels.clear(); lines.clear(); Groups.clear();
114 catch(exception& e) {
115 errorOut(e, "GlobalData", "newRead");
120 //******************************************************/
122 /******************************************************/
123 GlobalData::~GlobalData() {
126 if (gGroupmap != NULL) { delete gGroupmap; gGroupmap = NULL; }
127 if (gListVector != NULL) { delete gListVector; gListVector = NULL;}
128 if (gSparseMatrix != NULL) { delete gSparseMatrix; gSparseMatrix = NULL; }
129 if (ginput != NULL) { delete ginput; ginput = NULL;}
130 if (gorder != NULL) { delete gorder; gorder = NULL; }
131 if (glist != NULL) { delete glist; glist = NULL;}
132 if (gSharedList != NULL) { delete gSharedList; gSharedList = NULL; }
133 if (sabund != NULL) { delete sabund; sabund = NULL;}
134 if (rabund != NULL) { delete rabund; rabund = NULL; }
135 if (gMatrix != NULL) { delete gMatrix; gMatrix = NULL;}
136 if (gTreemap != NULL) { delete gTreemap; gTreemap = NULL; }
137 if (gSequenceDB != NULL) { delete gSequenceDB; gSequenceDB = NULL;}
139 catch(exception& e) {
140 errorOut(e, "GlobalData", "~GlobalData");
144 /*******************************************************/
146 /*******************************************************/