X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=commandfactory.hpp;h=eb85c68513bc43ece5cf9802917ebe336bc03d5a;hb=250e3b11b1c9c1e1ad458ab6c7e71ac2e67e11d9;hp=d84be62a074dde5dc29b8006a636bd7b67b9607d;hpb=315e38cf393c82be238da5b32574f225a020d25c;p=mothur.git diff --git a/commandfactory.hpp b/commandfactory.hpp index d84be62..eb85c68 100644 --- a/commandfactory.hpp +++ b/commandfactory.hpp @@ -1,42 +1,62 @@ -#ifndef COMMANDFACTORY_HPP -#define COMMANDFACTORY_HPP - -/* - * commandfactory.h - * - * - * Created by Pat Schloss on 10/25/08. - * Copyright 2008 Patrick D. Schloss. All rights reserved. - * - */ - -#include "mothur.h" - -class Command; - -class CommandFactory { -public: - static CommandFactory* getInstance(); - Command* getCommand(string, string); - Command* getCommand(); - bool isValidCommand(string); - void printCommands(ostream&); - void setOutputDirectory(string o) { outputDir = o; } - void setInputDirectory(string i) { inputDir = i; } - string getOutputDir() { return outputDir; } - -private: - Command* command; - map commands; - map::iterator it; - string outputDir, inputDir; - - static CommandFactory* _uniqueInstance; - CommandFactory( const CommandFactory& ); // Disable copy constructor - void operator=( const CommandFactory& ); // Disable assignment operator - CommandFactory(); - ~CommandFactory(); - -}; - -#endif +#ifndef COMMANDFACTORY_HPP +#define COMMANDFACTORY_HPP + +/* + * commandfactory.h + * + * + * Created by Pat Schloss on 10/25/08. + * Copyright 2008 Patrick D. Schloss. All rights reserved. + * + */ + +#include "mothur.h" +#include "mothurout.h" +#include "currentfile.h" + +class Command; + +class CommandFactory { +public: + static CommandFactory* getInstance(); + Command* getCommand(string, string, string); + Command* getCommand(string, string); + Command* getCommand(string); + //Command* getCommand(); + bool isValidCommand(string); + bool isValidCommand(string, string); + void printCommands(ostream&); + void printCommandsCategories(ostream&); + void setOutputDirectory(string o) { if(m->dirCheck(o) || (o == "")) { outputDir = o; m->setOutputDir(o); } } + void setInputDirectory(string i) { if(m->dirCheck(i) || (i == "")) { inputDir = i; } } + void setLogfileName(string n, bool a) { logFileName = n; append = a; } + string getLogfileName() { return logFileName; } + bool getAppend() { return append; } + string getOutputDir() { return outputDir; } + bool MPIEnabled(string); + map getListCommands() { return commands; } + +private: + Command* command; + Command* shellcommand; + Command* pipecommand; + + MothurOut* m; + CurrentFile* currentFile; + + map commands; + map::iterator it; + string outputDir, inputDir, logFileName; + bool append; + + int checkForRedirects(string); + + static CommandFactory* _uniqueInstance; + CommandFactory( const CommandFactory& ); // Disable copy constructor + void operator=( const CommandFactory& ); // Disable assignment operator + CommandFactory(); + ~CommandFactory(); + +}; + +#endif