5 * Created by Pat Schloss on 10/25/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
10 #include "command.hpp"
11 #include "readdistcommand.h"
12 #include "readotucommand.h"
13 #include "readlistcommand.h"
14 #include "clustercommand.h"
15 #include "parselistcommand.h"
16 #include "collectcommand.h"
17 #include "collectsharedcommand.h"
18 #include "rarefactcommand.h"
19 #include "summarycommand.h"
20 #include "summarysharedcommand.h"
21 #include "rarefactsharedcommand.h"
22 #include "nocommand.h"
23 #include "quitcommand.h"
24 #include "helpcommand.h"
25 #include "commandfactory.hpp"
26 #include "deconvolutecommand.h"
30 /***********************************************************/
32 /***********************************************************/
33 CommandFactory::CommandFactory(){
34 command = new NoCommand();
37 /***********************************************************/
39 /***********************************************************/
40 CommandFactory::~CommandFactory(){
44 /***********************************************************/
46 /***********************************************************/
47 //This function calls the appropriate command fucntions based on user input.
48 Command* CommandFactory::getCommand(string commandName){
50 delete command; //delete the old command
52 if(commandName == "read.dist") { command = new ReadDistCommand(); }
53 else if(commandName == "read.otu") { command = new ReadOtuCommand(); }
54 else if(commandName == "read.list") { command = new ReadListFileCommand(); }
55 else if(commandName == "cluster") { command = new ClusterCommand(); }
56 else if(commandName == "deconvolute") { command = new DeconvoluteCommand(); }
57 else if(commandName == "help") { command = new HelpCommand(); }
58 else if(commandName == "quit") { command = new QuitCommand(); }
59 else if(commandName == "collect.single") { command = new CollectCommand(); }
60 else if(commandName == "collect.shared") { command = new CollectSharedCommand(); }
61 else if(commandName == "rarefaction.single") { command = new RareFactCommand(); }
62 else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(); }
63 else if(commandName == "summary.single") { command = new SummaryCommand(); }
64 else if(commandName == "summary.shared") { command = new SummarySharedCommand(); }
65 else { command = new NoCommand(); }
70 cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
74 cout << "An unknown error has occurred in the CommandFactory class function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
79 /***********************************************************/
81 /***********************************************************/