globaldata = GlobalData::getInstance();
//read in group map info.
- groupMap = new GroupMap(globaldata->getGroupFile());
- groupMap->readMap();
+ groupMap = globaldata->gGroupmap;
-
//fill filehandles with neccessary ofstreams
int i;
ofstream* temp;
int ParseListCommand::execute(){
try{
- globaldata = GlobalData::getInstance();
int count = 1;
//read in listfile
//if the users enters label "0.06" and there is no "0.06" in their file use the next lowest label.
set<string> processedLabels;
set<string> userLabels = globaldata->labels;
-
- //read in group map info.
- groupMap = new GroupMap(globaldata->getGroupFile());
- groupMap->readMap();
+ set<int> userLines = globaldata->lines;
//create new list vectors to fill with parsed data
for (int i=0; i<groupMap->getNumGroups(); i++) {
//parses and sets each groups listvector
//as long as you are not at the end of the file or done wih the lines you want
- while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0))) {
+ while((list != NULL) && ((globaldata->allLines == 1) || (userLabels.size() != 0) || (userLines.size() != 0))) {
if(globaldata->allLines == 1 || globaldata->lines.count(count) == 1 || globaldata->labels.count(list->getLabel()) == 1){
cout << list->getLabel() << '\t' << count << endl;
processedLabels.insert(list->getLabel());
userLabels.erase(list->getLabel());
+ userLines.erase(count);
}
if ((anyLabelsToProcess(list->getLabel(), userLabels, "") == true) && (processedLabels.count(lastList->getLabel()) != 1)) {
if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap; }
globaldata->gGroupmap = groupMap;
+ //close files
+ for (it3 = filehandles.begin(); it3 != filehandles.end(); it3++) {
+ ofstream* temp = it3->second;
+ (*temp).close();
+ delete it3->second;
+ }
+
+ //delete list vectors to fill with parsed data
+ for (it2 = groupOfLists.begin(); it2 != groupOfLists.end(); it2++) {
+ delete it2->second;
+ }
+
return 0;
}
catch(exception& e) {