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 "readtreecommand.h"
13 #include "readotucommand.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"
27 #include "parsimonycommand.h"
28 #include "unifracunweightedcommand.h"
29 #include "unifracweightedcommand.h"
33 /***********************************************************/
35 /***********************************************************/
36 CommandFactory::CommandFactory(){
37 command = new NoCommand();
40 /***********************************************************/
42 /***********************************************************/
43 CommandFactory::~CommandFactory(){
47 /***********************************************************/
49 /***********************************************************/
50 //This function calls the appropriate command fucntions based on user input.
51 Command* CommandFactory::getCommand(string commandName){
53 delete command; //delete the old command
55 if(commandName == "read.dist") { command = new ReadDistCommand(); }
56 else if(commandName == "read.otu") { command = new ReadOtuCommand(); }
57 else if(commandName == "read.tree") { command = new ReadTreeCommand(); }
58 else if(commandName == "cluster") { command = new ClusterCommand(); }
59 else if(commandName == "deconvolute") { command = new DeconvoluteCommand(); }
60 else if(commandName == "parsimony") { command = new ParsimonyCommand(); }
61 else if(commandName == "help") { command = new HelpCommand(); }
62 else if(commandName == "quit") { command = new QuitCommand(); }
63 else if(commandName == "collect.single") { command = new CollectCommand(); }
64 else if(commandName == "collect.shared") { command = new CollectSharedCommand(); }
65 else if(commandName == "rarefaction.single") { command = new RareFactCommand(); }
66 else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(); }
67 else if(commandName == "summary.single") { command = new SummaryCommand(); }
68 else if(commandName == "summary.shared") { command = new SummarySharedCommand(); }
69 else if(commandName == "unifrac.weighted") { command = new UnifracWeightedCommand(); }
70 else if(commandName == "unifrac.unweighted") { command = new UnifracUnweightedCommand(); }
71 else { command = new NoCommand(); }
76 cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
80 cout << "An unknown error has occurred in the CommandFactory class function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
85 /***********************************************************/