5 * Created by Pat Schloss on 10/25/08.
6 * Copyright 2008 Patrick D. Schloss. All rights reserved.
10 #include "command.hpp"
11 #include "readdistphylipfilecommand.h"
12 #include "readdistcolumnfilecommand.h"
13 #include "readlistfilecommand.h"
14 #include "readrabundfilecommand.h"
15 #include "readsabundfilecommand.h"
16 #include "readsharedfilecommand.h"
17 #include "clustercommand.h"
18 #include "parselistcommand.h"
19 #include "sharedcommand.h"
20 #include "collectcommand.h"
21 #include "collectsharedcommand.h"
22 #include "rarefactcommand.h"
23 #include "summarycommand.h"
24 #include "summarysharedcommand.h"
25 #include "rarefactsharedcommand.h"
26 #include "nocommand.h"
27 #include "quitcommand.h"
28 #include "helpcommand.h"
29 #include "commandfactory.hpp"
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.phylip") { command = new ReadDistPhylipFileCommand(); }
56 else if(commandName == "read.column") { command = new ReadDistColumnFileCommand(); }
57 else if(commandName == "read.list") { command = new ReadListFileCommand(); }
58 else if(commandName == "read.rabund") { command = new ReadRAbundFileCommand(); }
59 else if(commandName == "read.sabund") { command = new ReadSAbundFileCommand(); }
60 else if(commandName == "read.shared") { command = new ReadSharedFileCommand(); }
61 else if(commandName == "cluster") { command = new ClusterCommand(); }
62 else if(commandName == "help") { command = new HelpCommand(); }
63 else if(commandName == "quit") { command = new QuitCommand(); }
64 else if(commandName == "collect.single") { command = new CollectCommand(); }
65 else if(commandName == "shared") { command = new SharedCommand(); }
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 == "parselist") { command = new ParseListCommand(); }
72 else { command = new NoCommand(); }
77 cout << "Standard Error: " << e.what() << " has occurred in the CommandFactory class Function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
81 cout << "An unknown error has occurred in the CommandFactory class function getCommand. Please contact Pat Schloss at pschloss@microbio.umass.edu." << "\n";
86 /***********************************************************/
88 /***********************************************************/