File: clearmemorycommand.cpp

package info (click to toggle)
mothur 1.33.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 11,248 kB
  • ctags: 12,231
  • sloc: cpp: 152,046; fortran: 665; makefile: 74; sh: 34
file content (70 lines) | stat: -rw-r--r-- 2,072 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
 *  clearmemorycommand.cpp
 *  Mothur
 *
 *  Created by westcott on 7/6/11.
 *  Copyright 2011 Schloss Lab. All rights reserved.
 *
 */

#include "clearmemorycommand.h"
#include "referencedb.h"

//**********************************************************************************************************************
vector<string> ClearMemoryCommand::setParameters(){	
	try {
		vector<string> myArray;
		return myArray;
	}
	catch(exception& e) {
		m->errorOut(e, "ClearMemoryCommand", "setParameters");
		exit(1);
	}
}
//**********************************************************************************************************************
string ClearMemoryCommand::getHelpString(){	
	try {
		string helpString = "";
		helpString += "The clear.memory command removes saved reference data from memory.\n";
		helpString += "The clear.memory command should be in the following format: clear.memory().\n";
		return helpString;
	}
	catch(exception& e) {
		m->errorOut(e, "ClearMemoryCommand", "getHelpString");
		exit(1);
	}
}
//**********************************************************************************************************************

ClearMemoryCommand::ClearMemoryCommand(string option)  {
	try {
		abort = false; calledHelp = false;   
		
		//allow user to run help
		if(option == "help") { help(); abort = true; calledHelp = true; }
		else if(option == "citation") { citation(); abort = true; calledHelp = true;}
	}
	catch(exception& e) {
		m->errorOut(e, "ClearMemoryCommand", "ClearMemoryCommand");
		exit(1);
	}
}

//**********************************************************************************************************************

int ClearMemoryCommand::execute(){
	try {
		
		if (abort == true) { if (calledHelp) { return 0; }  return 2;	}
		
		ReferenceDB* rdb = ReferenceDB::getInstance();
		rdb->clearMemory();
		
		return 0;
	}
	catch(exception& e) {
		m->errorOut(e, "ClearMemoryCommand", "execute");
		exit(1);
	}
}
//**********************************************************************************************************************/