00001 # ifndef Env_h
00002 # define Env_h Env_h
00003
00004
00005 # include "Root.h"
00006 # include <vector>
00007 # include <map>
00008 # include "Page.h"
00009
00010
00011 namespace Conjecture {
00012
00013 class OCRModule;
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 class Env : public Root {
00028 public:
00029
00030
00031 Env(int argc, const char* argv[]);
00032 virtual ~Env();
00033
00039 bool processArgs(int argc, const char** argv);
00040
00047 Page* registerPage(const std::string& file);
00048
00053 Page* currentPage() { return this->currentRef(); }
00054
00059 void wrapup();
00060
00070 static void test(int argc = 0, const char* argv[] = NULL);
00071
00072
00073
00074 public:
00075 inline const std::string & moduleId() const { return this->_moduleId; }
00076 inline const Page* current() const { return this->_current; }
00077 inline const int verbose() const { return this->_verbose; }
00078 inline const std::string & infile() const { return this->_infile; }
00079 inline const std::string & outfile() const { return this->_outfile; }
00080 inline const std::vector<Page*> & pages() const { return this->_pages; }
00081 inline const std::string & rawdata() const { return this->_rawdata; }
00082 inline const char** argv() const { return this->_argv; }
00083 inline unsigned argc() const { return this->_argc; }
00084
00085
00086
00087
00088
00089
00090 inline const OCRModule* module() const { return this->_module; }
00091
00101 virtual OCRModule* makeModule();
00102
00103 protected:
00104 inline void currentIs(Page* current) { this->_current = current; }
00105 inline void moduleIdIs(const std::string & moduleId) { this->_moduleId = moduleId; }
00106 inline void pagesIs(const std::vector<Page*> & pages) { this->_pages = pages; }
00107 inline void verboseIs(int verbose) { this->_verbose = verbose; }
00108 inline void outfileIs(const std::string & outfile) { this->_outfile = outfile; }
00109 inline void infileIs(const std::string & infile) { this->_infile = infile; }
00110 inline void rawdataIs(const std::string & rawdata) { this->_rawdata = rawdata; }
00111 inline void argcIs(int argc) { this->_argc = argc; }
00112 inline void argvIs(const char** argv) { this->_argv = argv; }
00113
00114 private:
00115 inline Page*& currentRef() { return this->_current; }
00116 inline std::string & moduleIdRef() { return this->_moduleId; }
00117 inline std::string & rawdataRef() { return this->_rawdata; }
00118 inline int& verboseRef() { return this->_verbose; }
00119 inline std::string & outfileRef() { return this->_outfile; }
00120 inline std::string & infileRef() { return this->_infile; }
00121 inline std::vector<Page*>& pagesRef() { return this->_pages; }
00122
00136 std::string _rawdata;
00137
00143 std::string _moduleId;
00144
00156 OCRModule* _module;
00157 inline void moduleIs(OCRModule* module) { this->_module = module; }
00158 inline OCRModule* & moduleRef() { return this->_module; }
00159
00164 std::string _outfile;
00165
00170 std::string _infile;
00171
00176 Page* _current;
00177
00185 std::vector<Page*> _pages;
00186
00195 int _verbose;
00196
00201 unsigned _argc;
00202
00213 const char** _argv;
00214
00215 };
00216 };
00217
00218
00219 # include "Page.h"
00220
00221 # endif // Env_h
00222