]> git.donarmstrong.com Git - mothur.git/blob - clearmemorycommand.cpp
added load.logfile command. changed summary.single output for subsample=t.
[mothur.git] / clearmemorycommand.cpp
1 /*
2  *  clearmemorycommand.cpp
3  *  Mothur
4  *
5  *  Created by westcott on 7/6/11.
6  *  Copyright 2011 Schloss Lab. All rights reserved.
7  *
8  */
9
10 #include "clearmemorycommand.h"
11 #include "referencedb.h"
12
13 //**********************************************************************************************************************
14 vector<string> ClearMemoryCommand::setParameters(){     
15         try {
16                 vector<string> myArray;
17                 return myArray;
18         }
19         catch(exception& e) {
20                 m->errorOut(e, "ClearMemoryCommand", "setParameters");
21                 exit(1);
22         }
23 }
24 //**********************************************************************************************************************
25 string ClearMemoryCommand::getOutputFileNameTag(string type, string inputName=""){      
26         try {
27         string outputFileName = "";
28                 map<string, vector<string> >::iterator it;
29         
30         //is this a type this command creates
31         it = outputTypes.find(type);
32         if (it == outputTypes.end()) {  m->mothurOut("[ERROR]: this command doesn't create a " + type + " output file.\n"); }
33         else {
34             m->mothurOut("[ERROR]: No definition for type " + type + " output file tag.\n"); m->control_pressed = true; 
35         }
36         return outputFileName;
37         }
38         catch(exception& e) {
39                 m->errorOut(e, "ClearMemoryCommand", "getOutputFileNameTag");
40                 exit(1);
41         }
42 }
43 //**********************************************************************************************************************
44 string ClearMemoryCommand::getHelpString(){     
45         try {
46                 string helpString = "";
47                 helpString += "The clear.memory command removes saved reference data from memory.\n";
48                 helpString += "The clear.memory command should be in the following format: clear.memory().\n";
49                 return helpString;
50         }
51         catch(exception& e) {
52                 m->errorOut(e, "ClearMemoryCommand", "getHelpString");
53                 exit(1);
54         }
55 }
56 //**********************************************************************************************************************
57
58 ClearMemoryCommand::ClearMemoryCommand(string option)  {
59         try {
60                 abort = false; calledHelp = false;   
61                 
62                 //allow user to run help
63                 if(option == "help") { help(); abort = true; calledHelp = true; }
64                 else if(option == "citation") { citation(); abort = true; calledHelp = true;}
65         }
66         catch(exception& e) {
67                 m->errorOut(e, "ClearMemoryCommand", "ClearMemoryCommand");
68                 exit(1);
69         }
70 }
71
72 //**********************************************************************************************************************
73
74 int ClearMemoryCommand::execute(){
75         try {
76                 
77                 if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
78                 
79                 ReferenceDB* rdb = ReferenceDB::getInstance();
80                 rdb->clearMemory();
81                 
82                 return 0;
83         }
84         catch(exception& e) {
85                 m->errorOut(e, "ClearMemoryCommand", "execute");
86                 exit(1);
87         }
88 }
89 //**********************************************************************************************************************/