Changeset 1524 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 09/16/02 10:10:17 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MFilter.cc
r1481 r1524 101 101 TString MFilter::GetRule() const 102 102 { 103 return "<GetRule n ot availablefor " + fName + ">";103 return "<GetRule n/a for " + fName + ">"; 104 104 } -
trunk/MagicSoft/Mars/mbase/MLog.cc
r1268 r1524 75 75 // which is used for the output (i) 76 76 // 77 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), f GuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL)77 MLog::MLog(int i) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(i), fIsNull(kFALSE), fGuiLineId(0), fout(NULL), fOutAllocated(kFALSE), fgui(NULL) 78 78 { 79 79 Init(); … … 85 85 // ofstream as the default output device 86 86 // 87 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), f GuiLineId(0), fout(&out), fOutAllocated(kFALSE), fgui(NULL)87 MLog::MLog(ofstream &out) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0), fout(&out), fOutAllocated(kFALSE), fgui(NULL) 88 88 { 89 89 Init(); … … 106 106 // or not. 107 107 // 108 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), f GuiLineId(0), fgui(NULL)108 MLog::MLog(const char *fname, int flag) : ostream(this), fPPtr(fBase), fEPtr(fBase+bsz), fOutputLevel(0), fDebugLevel((unsigned)-1), fDevice(eFile), fIsNull(kFALSE), fGuiLineId(0), fgui(NULL) 109 109 { 110 110 Init(); … … 132 132 void MLog::WriteBuffer() 133 133 { 134 // 135 // restart writing to the buffer at its first char 136 // 134 137 const int len = fPPtr - fBase; 138 139 fPPtr = fBase; 140 141 if (fIsNull) 142 return; 135 143 136 144 if (fDevice&eStdout) … … 153 161 delete dummy; 154 162 } 155 156 //157 // restart writing to the buffer at its first char158 //159 fPPtr = fBase;160 163 } 161 164 -
trunk/MagicSoft/Mars/mbase/MLog.h
r1014 r1524 31 31 UInt_t fDebugLevel; //! Present global debug level 32 32 UInt_t fDevice; //! Flag to indicate the present streams 33 34 Bool_t fIsNull; //! Switch output completely off 33 35 34 36 Int_t fGuiLineId; … … 122 124 } 123 125 126 void SetNullOutput(Bool_t n=kTRUE) { fIsNull = n; } 127 124 128 ClassDef(MLog, 0) // This is what we call 'The logging system' 125 129 }; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1487 r1524 50 50 #include "MLogManip.h" 51 51 52 #include "MIter.h" 53 52 54 ClassImp(MParList); 53 55 … … 105 107 // automatically deleted. 106 108 // 107 TestBit(kIsOwner) ? fContainer->SetOwner() : fAutodelete->SetOwner(); 109 IsOwner() ? fContainer->SetOwner() : fAutodelete->SetOwner(); 110 111 // FIXME? If fContainer is owner do we have to remove the object 112 // from fAutodelete due to the acces when checking for a 113 // garbage collection? 108 114 109 115 delete fContainer; … … 236 242 { 237 243 *fLog << warn << "No object with the same name '"; 238 *fLog << cont->GetName() << "' in list... ignored." << endl;239 return kFALSE;244 *fLog << cont->GetName() << "' in list... adding." << endl; 245 return AddToList(cont); 240 246 } 241 247 242 248 fContainer->Remove(obj); 243 249 244 if ( TestBit(kIsOwner) && !fAutodelete->FindObject(obj))250 if (IsOwner() && !fAutodelete->FindObject(obj)) 245 251 delete obj; 246 252 247 *fLog << inf << "MParContainer '" << obj->GetName() << "' found and replaced..." << endl;253 *fLog << inf << "MParContainer '" << cont->GetName() << "' found and replaced..." << endl; 248 254 249 255 return AddToList(cont); 256 } 257 258 // -------------------------------------------------------------------------- 259 // 260 // Find an object with the same name in the list and remove it. 261 // If the kIsOwner flag is set and the object was not created 262 // automatically, the object is deleted. 263 // 264 void MParList::Remove(MParContainer *cont) 265 { 266 // 267 // check if the object (you want to add) exists 268 // 269 if (!cont) 270 return; 271 272 TObject *obj = fContainer->Remove(cont); 273 if (!obj) 274 { 275 *fLog << warn << "Object not found in list..." << endl; 276 return; 277 } 278 279 *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl; 280 281 if (IsOwner() && !fAutodelete->FindObject(obj)) 282 delete obj; 250 283 } 251 284 … … 470 503 TIter Next(fContainer); 471 504 while ((obj=(MParContainer*)Next())) 472 *fLog << " " << obj->GetDescriptor() << endl; 505 { 506 *fLog << " " << obj->GetDescriptor(); 507 if (fAutodelete->FindObject(obj)) 508 *fLog << " <autodel>"; 509 *fLog << endl; 510 } 473 511 *fLog << endl; 474 512 } … … 492 530 { 493 531 fContainer->ForEach(MParContainer, Reset)(); 494 }532 } 495 533 496 534 // -------------------------------------------------------------------------- … … 663 701 } 664 702 703 void MParList::SavePrimitive(ofstream &out, Option_t *o) 704 { 705 Bool_t saved = IsSavedAsPrimitive(); 706 707 MParContainer::SavePrimitive(out); 708 709 MIter Next(fContainer); 710 711 MParContainer *cont = NULL; 712 while ((cont=Next())) 713 { 714 // 715 // Because it was automatically created don't store its primitive 716 // I guess it will be automatically created again 717 // 718 if (fAutodelete->FindObject(cont) || cont->IsSavedAsPrimitive()) 719 continue; 720 721 cont->SavePrimitive(out, ""); 722 723 out << " " << GetUniqueName() << "."; 724 out << (cont->InheritsFrom("MTaskList") && saved ? "Replace" : "AddToList"); 725 out << "(&" << cont->GetUniqueName() << ");" << endl << endl; 726 } 727 } 728 665 729 // -------------------------------------------------------------------------- 666 730 // … … 680 744 } 681 745 out << ";" << endl << endl; 682 683 TIter Next(fContainer);684 685 MParContainer *cont = NULL;686 while ((cont=(MParContainer*)Next()))687 {688 cont->SavePrimitive(out, "");689 690 out << " " << GetUniqueName() << ".AddToList(&";691 out << cont->GetUniqueName() << ");" << endl << endl;692 }693 746 } 694 747 -
trunk/MagicSoft/Mars/mbase/MParList.h
r1477 r1524 36 36 37 37 public: 38 enum { kDoNotReset = BIT(15) }; 39 38 40 MParList(const char *name=NULL, const char *title=NULL); 39 41 MParList(MParList &ts); … … 45 47 46 48 Bool_t Replace(MParContainer *obj); 49 void Remove(MParContainer *obj); 47 50 48 51 void SetLogStream(MLog *log); … … 78 81 79 82 void SetOwner(Bool_t enable=kTRUE); 83 Bool_t IsOwner() const { return TestBit(kIsOwner); } 80 84 81 85 void Print(Option_t *t = NULL) const; … … 84 88 void SetNames(TObjArray &arr); 85 89 90 void SavePrimitive(ofstream &out, Option_t *o=""); 91 86 92 ClassDef(MParList, 1) // list of parameter containers (MParContainer) 87 93 }; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1501 r1524 372 372 // Reset all containers. 373 373 // 374 // FIXME: To run a tasklist as a single task in another tasklist we 375 // have to make sure, that the Parameter list isn't reset. 376 // 377 fParList->SetReadyToSave(kFALSE); 378 fParList->Reset(); 374 // Make sure, that the parameter list is not reset from a tasklist 375 // running as a task in another tasklist. 376 // 377 const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset); 378 if (!noreset) 379 { 380 fParList->SetReadyToSave(); 381 fParList->Reset(); 382 fParList->SetBit(MParList::kDoNotReset); 383 } 379 384 380 385 // … … 428 433 } 429 434 435 if (!noreset) 436 fParList->ResetBit(MParList::kDoNotReset); 437 430 438 return kTRUE; 431 439 }
Note:
See TracChangeset
for help on using the changeset viewer.