00001
00002
00003
00004
00005
00006
00007
00009 #ifndef JOBCENV_H
00010 #define JOBCENV_H
00011 #ifndef VECTOR
00012 #include <vector>
00013 #define VECTOR
00014 #endif
00015 #ifndef STRING
00016 #include <string>
00017 #define STRING
00018 #endif
00019 #ifndef CTIME
00020 #include <ctime>
00021 #define CTIME
00022 #endif
00023
00024 class MomNavigator;
00025 class JobController;
00026 class JobCRootEnv;
00027
00028 class JobCEnv
00029 {
00030 public:
00031 ~JobCEnv();
00032
00033
00034 int GetArgc() const;
00035 char* const* GetArgv() const;
00036 const char* GetArgv(int i) const;
00037 const char* GetModuleHelpList() const;
00038 const char* GetMacroFile(unsigned int i) const;
00039 const char* GetFileName(int i) const;
00040 int GetNfile() const;
00041 const char* GetDefaultOutputFileName() const;
00042 bool HaveInaccessibleFile() const;
00043
00044
00045 bool ContinueRun(int n) const;
00046 bool CheckTimeLimit(int* t) const;
00047 bool CheckRecordLimit(int n) const;
00048
00049
00050 bool IsBatch() const;
00051
00052
00053 int RunRootApp();
00054
00055 static JobCEnv& Instance();
00056 static JobCEnv& Instance(int argc, char** argv);
00057
00058
00059 struct Cleaner {
00060 void ClassIsUsed() { };
00061 ~Cleaner() {
00062 if (JobCEnv::fInstance) {
00063 delete JobCEnv::fInstance;
00064 JobCEnv::fInstance = 0;
00065 }
00066 }
00067 };
00068 friend struct Cleaner;
00069
00070 private:
00071 JobCEnv();
00072 JobCEnv(int argc, char** argv);
00073
00074 void AddDataFile(const char *filename);
00075 void AddMacroFile(const char *filelist);
00076 void CreateInteractiveMom();
00077 void DeleteInteractiveMom();
00078 void ProcessCommandLine(int argc, char *const *argv);
00079 void SetTimeLimit(const char* timelimit);
00080 void SetSignalHandlers();
00081
00082
00083 int fArgc;
00084 char* const* fArgv;
00085 const char* fModuleHelpList;
00086 std::vector<std::string> fDataFileList;
00087 std::vector<std::string> fMacroFileList;
00088 std::string fDfltOutFile;
00089
00090
00091 time_t fTimeStart;
00092 double fTimeLimit;
00093 int fRecordLimit;
00094
00095
00096 bool fIsBatch;
00097
00098
00099 JobCRootEnv* fRootEnv;
00100
00101
00102 static JobCEnv* fInstance;
00103 };
00104
00105 #endif // JOBCENV_H
00106