X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=clearmemorycommand.cpp;fp=clearmemorycommand.cpp;h=abdc5558ae1aa26ab7c2d21454f8ff0696802ad1;hb=0caf3fbabaa3ece404f8ce77f4c883dc5b1bf1dc;hp=0000000000000000000000000000000000000000;hpb=1b73ff67c83892a025e597dabd9df6fe7b58206a;p=mothur.git diff --git a/clearmemorycommand.cpp b/clearmemorycommand.cpp new file mode 100644 index 0000000..abdc555 --- /dev/null +++ b/clearmemorycommand.cpp @@ -0,0 +1,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 ClearMemoryCommand::setParameters(){ + try { + vector 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); + } +} +//**********************************************************************************************************************/