Changeset 6553 for trunk/MagicSoft/Mars/mjobs/MJob.cc
- Timestamp:
- 02/16/05 19:53:21 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mjobs/MJob.cc
r6177 r6553 29 29 // A base class for jobs 30 30 // 31 // SetDebugEnv(0) // switch off debugging 32 // SetDebugEnv(1) // reserved 33 // SetDebugEnv(2) // print untouched resources after evtloop resources setup 34 // SetDebugEnv(3) // do 2) and debug setting env completely 35 // 31 36 ///////////////////////////////////////////////////////////////////////////// 32 37 #include "MJob.h" 33 38 34 #include <TEnv.h>39 #include "MEnv.h" 35 40 #include <TFile.h> 36 41 #include <TSystem.h> … … 54 59 // Sets fDataFlag to 0 55 60 // 56 MJob::MJob(const char *name, const char *title) : fEnv(0), f Overwrite(kFALSE), fMaxEvents(0)61 MJob::MJob(const char *name, const char *title) : fEnv(0), fEnvDebug(0), fOverwrite(kFALSE), fMaxEvents(0) 57 62 58 63 { … … 61 66 } 62 67 68 void MJob::ClearEnv() 69 { 70 if (fEnv && TestBit(kIsOwner)) 71 delete fEnv; 72 ResetBit(kIsOwner); 73 fEnv=0; 74 } 75 63 76 MJob::~MJob() 64 77 { 65 if (fEnv) 66 delete fEnv; 78 ClearEnv(); 67 79 } 68 80 69 81 Bool_t MJob::SetEnv(const char *env, const char *prefix) 70 82 { 71 if (fEnv) 72 { 73 delete fEnv; 74 fEnv = 0; 75 } 83 ClearEnv(); 76 84 77 85 const Bool_t fileexist = !gSystem->AccessPathName(env, kFileExists); … … 82 90 } 83 91 84 fEnv = new TEnv(env); 92 fEnv = new MEnv(env); 93 SetBit(kIsOwner); 85 94 86 95 fEnvPrefix = prefix; … … 94 103 } 95 104 105 void MJob::SetEnv(MEnv *env, const char *prefix) 106 { 107 ClearEnv(); 108 109 fEnv = env; 110 111 fEnvPrefix = prefix; 112 if (!prefix) 113 fEnvPrefix = fName.First(' ')>0 ? fName(0, fName.First(' ')) : fName; 114 115 if (fEnvPrefix.EndsWith(".")) 116 fEnvPrefix.Remove(fEnvPrefix.Length()-1); 117 } 118 96 119 void MJob::FixPath(TString &path) const 97 120 { … … 123 146 } 124 147 148 const TEnv *MJob::GetEnv() const 149 { 150 return static_cast<const TEnv *const>(fEnv); 151 } 152 125 153 Int_t MJob::GetEnv(const char *name, Int_t dflt) const 126 154 { … … 140 168 Bool_t MJob::HasEnv(const char *name) const 141 169 { 142 return IsEnvDefined(*fEnv, fEnvPrefix, name, fEnvDebug );//fEnv->Lookup(Form("%s%s", fEnvPrefix.Data(), name));170 return IsEnvDefined(*fEnv, fEnvPrefix, name, fEnvDebug>2);//fEnv->Lookup(Form("%s%s", fEnvPrefix.Data(), name)); 143 171 } 144 172 … … 163 191 SetMaxEvents(GetEnv("MaxEvents", fMaxEvents)); 164 192 SetOverwrite(GetEnv("Overwrite", fOverwrite)); 193 SetEnvDebug( GetEnv("EnvDebug", fEnvDebug)); 165 194 166 195 return CheckEnvLocal(); … … 172 201 return kTRUE; 173 202 174 return loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug) ? kTRUE : kFALSE; 203 if (!loop.ReadEnv(*fEnv, fEnvPrefix, fEnvDebug>2)) 204 return kFALSE; 205 206 if (fEnvDebug>1) 207 fEnv->PrintUntouched(); 208 209 return kTRUE; 175 210 } 176 211
Note:
See TracChangeset
for help on using the changeset viewer.