Changeset 1023 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 11/01/01 10:19:46 (23 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MParList.cc
r1022 r1023 66 66 fContainer = new TOrdCollection; 67 67 fAutodelete = new TOrdCollection; 68 69 fAutodelete->SetOwner();70 68 } 71 69 … … 89 87 MParList::~MParList() 90 88 { 91 if (TestBit(kIsOwner)) 92 fContainer->SetOwner(); 89 const Bool_t isowner = TestBit(kIsOwner); 90 91 // 92 // Case: 93 // 1) MParList is owner of the containers: 94 // All container are stored in fContainer, and become deleted by 95 // 'delete fContainer'. Some of these containers, which were 96 // created automatically are stored in fAutodelete, too. To prevent 97 // double deletion this containers are not deleted by the destructor 98 // of fAutodelete. 99 // 2) MParList is not owner of the containers: 100 // The containers which were Added by AddToList are not touched. 101 // Only the containers which were created automatically are also 102 // automatically deleted. 103 // 104 fContainer->SetOwner(isowner); 105 fAutodelete->SetOwner(!isowner); 93 106 94 107 delete fContainer; … … 113 126 void MParList::SetLogStream(MLog *log) 114 127 { 115 TIter Next(fContainer); 116 117 MParContainer *cont=NULL; 118 119 // 120 // loop over all tasks for preproccesing 121 // 122 while ( (cont=(MParContainer*)Next()) ) 123 cont->SetLogStream(log); 124 128 fContainer->ForEach(MParContainer, SetLogStream)(log); 125 129 MParContainer::SetLogStream(log); 126 130 } … … 209 213 MParContainer *cont = NULL; 210 214 while ((cont=(MParContainer*)Next())) 211 {212 215 AddToList(cont); 213 /* //214 // Get Name of new container215 //216 const char *name = cont->GetName();217 218 //219 // Check if the new container is already existing in the list220 //221 const TObject *objn = fContainer->FindObject(name);222 const TObject *objt = fContainer->FindObject(cont);223 224 if (objn || objt)225 {226 //227 // If the container is already in the list ignore it.228 //229 if (objt || objn==cont)230 {231 *fLog << dbginf << "Warning: Container '" << cont->GetName() << ", 0x" << (void*)cont;232 *fLog << "' already existing in '" << GetName() << "'... ignoring." << endl;233 continue;234 }235 236 //237 // Otherwise add it to the list, but print a warning message238 //239 *fLog << dbginf << "Warning: Container with the same name '" << cont->GetName();240 *fLog << "' already existing in '" << GetName() << "'." << endl;241 *fLog << "You may not be able to get a pointer to container task by name." << endl;242 }243 244 *fLog << "Adding " << name << " to " << GetName() << "... " << flush;245 246 fContainer->Add(cont);247 248 *fLog << "Done." << endl;*/249 }250 216 } 251 217 … … 426 392 void MParList::SetReadyToSave(Bool_t flag) 427 393 { 428 TIter Next(fContainer); 429 430 MParContainer *cont=NULL; 431 432 // 433 // loop over all tasks for preproccesing 434 // 435 while ( (cont=(MParContainer*)Next()) ) 436 cont->SetReadyToSave(flag); 437 394 fContainer->ForEach(MParContainer, SetReadyToSave)(flag); 438 395 MParContainer::SetReadyToSave(flag); 439 396 } … … 445 402 void MParList::Reset() 446 403 { 447 TIter Next(fContainer); 448 449 MParContainer *cont=NULL; 450 451 // 452 // loop over all tasks for preproccesing 453 // 454 while ((cont=(MParContainer*)Next())) 455 cont->Reset(); 404 fContainer->ForEach(MParContainer, Reset)(); 456 405 } 457 406 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r1006 r1023 113 113 void MTaskList::SetLogStream(MLog *log) 114 114 { 115 // 116 // create the Iterator over the tasklist 117 // 118 TIter Next(fTasks); 119 120 MTask *task=NULL; 121 122 // 123 // loop over all tasks for preproccesing 124 // 125 while ((task=(MTask*)Next())) 126 task->SetLogStream(log); 127 115 fTasks->ForEach(MTask, SetLogStream)(log); 128 116 MParContainer::SetLogStream(log); 129 117 } … … 383 371 // create the Iterator for the TaskList 384 372 // 385 TIter Next(fTasks); 386 387 MTask *task=NULL; 388 // 389 // loop over all tasks for postprocessing 390 // only tasks which have successfully been preprocessed are postprocessed. 391 // 392 while ( (task=(MTask*)Next()) ) 393 task->PrintStatistics(lvl+1); 373 fTasks->ForEach(MTask, PrintStatistics)(lvl+1); 394 374 395 375 if (lvl==0)
Note:
See TracChangeset
for help on using the changeset viewer.