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 "readsharedcommand.h"
14 #include "readotucommand.h"
15 #include "clustercommand.h"
16 #include "parselistcommand.h"
17 #include "collectcommand.h"
18 #include "collectsharedcommand.h"
19 #include "rarefactcommand.h"
20 #include "summarycommand.h"
21 #include "summarysharedcommand.h"
22 #include "rarefactsharedcommand.h"
23 #include "nocommand.h"
24 #include "quitcommand.h"
25 #include "helpcommand.h"
26 #include "commandfactory.hpp"
27 #include "deconvolutecommand.h"
28 #include "parsimonycommand.h"
29 #include "unifracunweightedcommand.h"
30 #include "unifracweightedcommand.h"
34 /***********************************************************/
36 /***********************************************************/
37 CommandFactory::CommandFactory(){
38 command = new NoCommand();
41 /***********************************************************/
43 /***********************************************************/
44 CommandFactory::~CommandFactory(){
48 /***********************************************************/
50 /***********************************************************/
51 //This function calls the appropriate command fucntions based on user input.
52 Command* CommandFactory::getCommand(string commandName){
54 delete command; //delete the old command
56 if(commandName == "read.dist") { command = new ReadDistCommand(); }
57 else if(commandName == "read.otu") { command = new ReadOtuCommand(); }
58 else if(commandName == "read.tree") { command = new ReadTreeCommand(); }
59 else if(commandName == "read.shared") { command = new ReadSharedCommand(); }
60 else if(commandName == "cluster") { command = new ClusterCommand(); }
61 else if(commandName == "deconvolute") { command = new DeconvoluteCommand(); }
62 else if(commandName == "parsimony") { command = new ParsimonyCommand(); }
63 else if(commandName == "help") { command = new HelpCommand(); }
64 else if(commandName == "quit") { command = new QuitCommand(); }
65 else if(commandName == "collect.single") { command = new CollectCommand(); }
66 else if(commandName == "collect.shared") { command = new CollectSharedCommand(); }
67 else if(commandName == "rarefaction.single") { command = new RareFactCommand(); }
68 else if(commandName == "rarefaction.shared") { command = new RareFactSharedCommand(); }
69 else if(commandName == "summary.single") { command = new SummaryCommand(); }
70 else if(commandName == "summary.shared") { command = new SummarySharedCommand(); }
71 else if(commandName == "unifrac.weighted") { command = new UnifracWeightedCommand(); }
72 else if(commandName == "unifrac.unweighted") { command = new UnifracUnweightedCommand(); }
73 else { command = new NoCommand(); }
78 cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
82 cout << "An unknown error has occurred in the CommandFactory class function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
87 /***********************************************************/