- Timestamp:
- 06/09/08 13:36:25 (16 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r8929 r8930 18 18 19 19 -*-*- END OF LINE -*-*- 20 21 22 2008/06/09 Thomas Bretz 23 24 * mbase/MArgs.[h,cc]: 25 - for convinience store the full command line as Title 26 - replaced *fArgv by fArgv 27 28 * mbase/MObjLookup.cc: 29 - replaced C-style cast by reinterpret_cast 30 20 31 21 32 -
trunk/MagicSoft/Mars/mbase/MArgs.cc
r7808 r8930 18 18 ! Author(s): Thomas Bretz, 7/2003 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2003-200 420 ! Copyright: MAGIC Software Development, 2003-2008 21 21 ! 22 22 ! … … 62 62 MArgs::MArgs(int argc, char **argv, Bool_t root) : fArgc(argc) 63 63 { 64 TString cmdline; 64 65 // FIXME: argv has no const-qualifier to be idetical with 65 66 // TApplication. 66 fName = argv[0];67 68 fArgv = new TList; 69 fArgv ->SetOwner();67 fName = argv[0]; 68 fTitle = argv[0]; 69 70 fArgv.SetOwner(); 70 71 71 72 for (int i=1; i<argc; i++) 72 73 { 73 MArgsEntry &o = *new MArgsEntry(argv[i]); 74 fArgv->Add(&o); 74 fTitle += " "; 75 fTitle += argv[i]; 76 fArgv.Add(new MArgsEntry(argv[i])); 75 77 } 76 78 … … 79 81 80 82 HasOnlyAndRemove("-b"); 81 }82 83 // --------------------------------------------------------------------------84 //85 // Deletes fArgv.86 //87 MArgs::~MArgs()88 {89 delete fArgv;90 83 } 91 84 … … 95 88 // Using 'options' as option only 'options' are printed. 96 89 // Using 'arguments' as option only 'arguments' are printed. 90 // Using 'cmdline' as option the command line is printed instead of 91 // just the program name 97 92 // 98 93 void MArgs::Print(const Option_t *o) const 99 94 { 100 gLog << all << underline << fName << ":" << endl; 101 102 const TString str(o); 95 TString str(o); 96 97 gLog << all << underline; 98 if (str.Contains("cmdline")) 99 gLog << fTitle << endl; 100 else 101 gLog << fName << ":" << endl; 102 103 str.ReplaceAll("cmdline", ""); 104 str.ReplaceAll(" ", ""); 103 105 104 106 if (!str.CompareTo("options", TString::kIgnoreCase)) 105 107 { 106 TIter Next( fArgv);108 TIter Next(&fArgv); 107 109 TString *s = NULL; 108 110 while ((s=dynamic_cast<TString*>(Next()))) … … 114 116 if (!str.CompareTo("arguments", TString::kIgnoreCase)) 115 117 { 116 TIter Next( fArgv);118 TIter Next(&fArgv); 117 119 TString *s = NULL; 118 120 while ((s=dynamic_cast<TString*>(Next()))) … … 122 124 } 123 125 124 fArgv ->Print();126 fArgv.Print(); 125 127 } 126 128 … … 156 158 TString MArgs::GetString(const TString name) const 157 159 { 158 TIter Next( fArgv);160 TIter Next(&fArgv); 159 161 TString *s = NULL; 160 162 while ((s=dynamic_cast<TString*>(Next()))) … … 200 202 const TString name = n.Strip(TString::kBoth); 201 203 202 TIter Next( fArgv);204 TIter Next(&fArgv); 203 205 TString *s = NULL; 204 206 while ((s=dynamic_cast<TString*>(Next()))) … … 206 208 { 207 209 TString str = s->Data()+s->Index(name)+name.Length(); 208 delete fArgv ->Remove(dynamic_cast<TObject*>(s));210 delete fArgv.Remove(dynamic_cast<TObject*>(s)); 209 211 return str; 210 212 } … … 281 283 Int_t num = 0; 282 284 283 TIter Next( fArgv);285 TIter Next(&fArgv); 284 286 TString *s = NULL; 285 287 while ((s=dynamic_cast<TString*>(Next()))) … … 303 305 Int_t num = 0; 304 306 305 TIter Next( fArgv);307 TIter Next(&fArgv); 306 308 TString *s = NULL; 307 309 while ((s=dynamic_cast<TString*>(Next()))) … … 320 322 Int_t num = 0; 321 323 322 TIter Next( fArgv);324 TIter Next(&fArgv); 323 325 TString *s = NULL; 324 326 while ((s=dynamic_cast<TString*>(Next()))) … … 335 337 Int_t MArgs::GetNumEntries() const 336 338 { 337 return fArgv ->GetSize();339 return fArgv.GetSize(); 338 340 } 339 341 … … 349 351 const TString name = n.Strip(TString::kBoth); 350 352 351 TIter Next( fArgv);353 TIter Next(&fArgv); 352 354 TString *s = NULL; 353 355 while ((s=dynamic_cast<TString*>(Next()))) … … 369 371 const TString name = n.Strip(TString::kBoth); 370 372 371 TIter Next( fArgv);373 TIter Next(&fArgv); 372 374 TString *s = NULL; 373 375 while ((s=dynamic_cast<TString*>(Next()))) … … 391 393 const TString name = n.Strip(TString::kBoth); 392 394 393 TIter Next( fArgv);395 TIter Next(&fArgv); 394 396 TString *s = NULL; 395 397 while ((s=dynamic_cast<TString*>(Next()))) … … 417 419 Bool_t rc = kFALSE; 418 420 419 TIter Next( fArgv);421 TIter Next(&fArgv); 420 422 TString *s = NULL; 421 423 while ((s=dynamic_cast<TString*>(Next()))) 422 424 if (*s==name) 423 425 { 424 delete fArgv ->Remove(dynamic_cast<TObject*>(s));426 delete fArgv.Remove(dynamic_cast<TObject*>(s)); 425 427 rc = kTRUE; 426 428 } -
trunk/MagicSoft/Mars/mbase/MArgs.h
r7169 r8930 27 27 { 28 28 private: 29 Int_t fArgc;30 TList *fArgv; //->29 Int_t fArgc; //! 30 TList fArgv; //! 31 31 32 32 public: 33 33 MArgs(int argc, char **argv, Bool_t root=kFALSE); 34 ~MArgs();35 34 35 // TObject 36 36 void Print(const Option_t *o="") const; 37 37 … … 39 39 // FIXME: Add default option 40 40 41 // MArgs 41 42 Int_t GetInt(const TString name) const; 42 43 Double_t GetFloat(const TString name) const; -
trunk/MagicSoft/Mars/mbase/MObjLookup.cc
r8892 r8930 49 49 while (iter.Next(key, value)) 50 50 { 51 TObject *o = (TObject*)value;51 TObject *o = reinterpret_cast<TObject*>(value); 52 52 if (o->TestBit(kCanDelete) || TestBit(kIsOwner)) 53 53 delete o; … … 88 88 TObject *MObjLookup::GetObj(Long_t key) const 89 89 { 90 TObject *o = (TObject*)const_cast<TExMap&>(fMap).GetValue(key);90 TObject *o = reinterpret_cast<TObject*>(const_cast<TExMap&>(fMap).GetValue(key)); 91 91 return o ? o : fDefault; 92 92 }
Note:
See TracChangeset
for help on using the changeset viewer.