]> git.donarmstrong.com Git - mothur.git/blob - clearmemorycommand.cpp
changes while testing
[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::getHelpString(){     
26         try {
27                 string helpString = "";
28                 helpString += "The clear.memory command removes saved reference data from memory.\n";
29                 helpString += "The clear.memory command should be in the following format: clear.memory().\n";
30                 return helpString;
31         }
32         catch(exception& e) {
33                 m->errorOut(e, "ClearMemoryCommand", "getHelpString");
34                 exit(1);
35         }
36 }
37 //**********************************************************************************************************************
38
39 ClearMemoryCommand::ClearMemoryCommand(string option)  {
40         try {
41                 abort = false; calledHelp = false;   
42                 
43                 //allow user to run help
44                 if(option == "help") { help(); abort = true; calledHelp = true; }
45                 else if(option == "citation") { citation(); abort = true; calledHelp = true;}
46         }
47         catch(exception& e) {
48                 m->errorOut(e, "ClearMemoryCommand", "ClearMemoryCommand");
49                 exit(1);
50         }
51 }
52
53 //**********************************************************************************************************************
54
55 int ClearMemoryCommand::execute(){
56         try {
57                 
58                 if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
59                 
60                 ReferenceDB* rdb = ReferenceDB::getInstance();
61                 rdb->clearMemory();
62                 
63                 return 0;
64         }
65         catch(exception& e) {
66                 m->errorOut(e, "ClearMemoryCommand", "execute");
67                 exit(1);
68         }
69 }
70 //**********************************************************************************************************************/