]> git.donarmstrong.com Git - mothur.git/blob - engine.hpp
0e7721a1ba1a51566eaab52b909604a50d5a70eb
[mothur.git] / engine.hpp
1 #ifndef ENGINE_HPP
2 #define ENGINE_HPP
3
4 /*
5  *  engine.hpp
6  *  
7  *
8  *  Created by Pat Schloss on 8/15/08.
9  *  Copyright 2008 Patrick D. Schloss. All rights reserved.
10  *
11  */
12  
13
14
15 #include "mothur.h"
16 #include "globaldata.hpp"
17 #include "commandoptionparser.hpp"
18 #include "command.hpp"
19 #include "commandfactory.hpp"
20 #include "mothurout.h"
21
22 class GlobalData;
23
24 class Engine {
25 public:
26         Engine(); 
27         virtual ~Engine(){}
28         virtual bool getInput() = 0;
29         virtual string getCommand();
30         virtual string getOutputDir()                   {       return cFactory->getOutputDir();        }
31         virtual string getLogFileName()                 {       return cFactory->getLogfileName();      }
32         virtual bool getAppend()                                {       return cFactory->getAppend();           }
33
34         vector<string> getOptions()             {       return options;         }
35 protected:
36         vector<string> options;
37         CommandFactory* cFactory;
38         MothurOut* mout;
39 };
40
41
42
43 class BatchEngine : public Engine {
44 public:
45         BatchEngine(string, string);
46         ~BatchEngine();
47         virtual bool getInput();
48         int openedBatch;
49 private:
50         GlobalData* globaldata;
51         ifstream inputBatchFile;
52         string getNextCommand(ifstream&);
53
54 };
55
56
57
58 class InteractEngine : public Engine {
59 public:
60         InteractEngine(string);
61         ~InteractEngine();
62         virtual bool getInput();
63 private:
64         GlobalData* globaldata;
65 };
66
67
68 class ScriptEngine : public Engine {
69 public:
70         ScriptEngine(string, string);
71         ~ScriptEngine();
72         virtual bool getInput();
73         int openedBatch;
74 private:
75         GlobalData* globaldata;
76         string listOfCommands;
77         string getNextCommand(string&);
78
79 };
80
81
82 #endif