00001 # ifndef Conjecture_Env_h
00002 # define Conjecture_Env_h Conjecture_Env_h
00003
00004
00005
00006
00007
00008 # include "Root.h"
00009 # include <vector>
00010 # include <map>
00011 # include "Page.h"
00012
00013
00014 namespace Conjecture {
00015
00016 class OCRModule;
00017
00030 class Env : public Root {
00031 public:
00032
00033
00034 Env(int argc, const char* argv[]);
00035 virtual ~Env();
00036
00042 bool processArgs(int argc, const char** argv);
00043
00050 Page* registerPage(const std::string& file);
00051
00056 Page* currentPage() { return this->currentRef(); }
00057
00062 void wrapup();
00063
00073 static void test(int argc = 0, const char* argv[] = NULL);
00074
00075
00076
00077 public:
00078 inline const std::string & moduleId() const { return this->_moduleId; }
00079 inline const Page* current() const { return this->_current; }
00080 inline const int verbose() const { return this->_verbose; }
00081 inline const std::string & infile() const { return this->_infile; }
00082 inline const std::string & outfile() const { return this->_outfile; }
00083 inline const std::vector<Page*> & pages() const { return this->_pages; }
00084 inline const std::string & rawdata() const { return this->_rawdata; }
00085 inline const char** argv() const { return this->_argv; }
00086 inline unsigned argc() const { return this->_argc; }
00087
00093 inline const OCRModule* module() const { return this->_module; }
00094
00104 virtual OCRModule* makeModule();
00105
00106 protected:
00107 inline void currentIs(Page* current) { this->_current = current; }
00108 inline void moduleIdIs(const std::string & moduleId) { this->_moduleId = moduleId; }
00109 inline void pagesIs(const std::vector<Page*> & pages) { this->_pages = pages; }
00110 inline void verboseIs(int verbose) { this->_verbose = verbose; }
00111 inline void outfileIs(const std::string & outfile) { this->_outfile = outfile; }
00112 inline void infileIs(const std::string & infile) { this->_infile = infile; }
00113 inline void rawdataIs(const std::string & rawdata) { this->_rawdata = rawdata; }
00114 inline void argcIs(int argc) { this->_argc = argc; }
00115 inline void argvIs(const char** argv) { this->_argv = argv; }
00116
00117 private:
00118 inline Page*& currentRef() { return this->_current; }
00119 inline std::string & moduleIdRef() { return this->_moduleId; }
00120 inline std::string & rawdataRef() { return this->_rawdata; }
00121 inline int& verboseRef() { return this->_verbose; }
00122 inline std::string & outfileRef() { return this->_outfile; }
00123 inline std::string & infileRef() { return this->_infile; }
00124 inline std::vector<Page*>& pagesRef() { return this->_pages; }
00125
00139 std::string _rawdata;
00140
00146 std::string _moduleId;
00147
00159 OCRModule* _module;
00160 inline void moduleIs(OCRModule* module) { this->_module = module; }
00161 inline OCRModule* & moduleRef() { return this->_module; }
00162
00167 std::string _outfile;
00168
00173 std::string _infile;
00174
00179 Page* _current;
00180
00188 std::vector<Page*> _pages;
00189
00198 int _verbose;
00199
00204 unsigned _argc;
00205
00216 const char** _argv;
00217
00218 };
00219 };
00220
00221
00222 # include "Page.h"
00223
00224 # endif // Conjecture_Env_h
00225