Changeset 8642 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 07/18/07 20:30:13 (17 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MContinue.cc
r7808 r8642 131 131 } 132 132 133 *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl;134 return k FALSE;133 *fLog << inf << "My filter has vanished... skipping." << endl; 134 return kSKIP; 135 135 } 136 136 … … 153 153 if (!fTaskList->AddToListBefore(GetFilter(), this)) 154 154 { 155 *fLog << err << dbginf << "ERROR - Adding filter before MContinue ... abort." << endl;155 *fLog << err << dbginf << "ERROR - Adding filter before MContinue failed... abort." << endl; 156 156 return kFALSE; 157 157 } -
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r8011 r8642 102 102 // default constructor 103 103 // 104 MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), f Progress(NULL)104 MEvtLoop::MEvtLoop(const char *name) : fParList(NULL), fTaskList(NULL), fProgress(NULL) 105 105 { 106 106 fName = name; … … 1108 1108 void MEvtLoop::RecursiveRemove(TObject *obj) 1109 1109 { 1110 // If the tasklist was deleted... remove it 1111 if (obj==fTaskList) 1112 fTaskList = NULL; 1113 1114 // If the parlist was deleted...invalidate par- and tasklist 1110 1115 if (obj==fParList) 1111 1116 { … … 1114 1119 } 1115 1120 1121 // if the progress bar was deleted...remove it 1116 1122 if (obj==fProgress) 1117 1123 fProgress = NULL; 1118 1124 1119 if (obj==fDisplay)1120 SetDisplay(NULL);1121 1122 if (obj==fLog)1123 {1124 if (fParList)1125 fParList->SetLogStream(NULL); 1126 SetLogStream(NULL);1127 }1128 } 1125 // If it was something else check par- and tasklist 1126 if (fParList) 1127 fParList->RecursiveRemove(obj); 1128 else 1129 if (fTaskList) // Note that the tasklist is included in the parlist 1130 fTaskList->RecursiveRemove(obj); 1131 1132 // Now check for fDisplay and fLog 1133 MParContainer::RecursiveRemove(obj); 1134 } -
trunk/MagicSoft/Mars/mbase/MParContainer.cc
r8218 r8642 71 71 #include "MLogManip.h" 72 72 73 #include "MStatusDisplay.h" 74 73 75 TList *gListOfPrimitives; // forard declaration in MParContainer.h 74 76 … … 116 118 return; 117 119 118 *fLog << all << "Deleting " << GetDescriptor() << endl;120 *fLog << all << "Deleting " << this << " " << GetDescriptor() << endl; 119 121 if (TestBit(kMustCleanup) && gROOT && gROOT->MustClean()) 120 122 { … … 921 923 return ((TEnv&)env).GetValue(prefix, dflt); 922 924 } 925 926 // -------------------------------------------------------------------------- 927 // 928 // If object to remove is fDisplay set fDisplay to NULL. 929 // If object to remove is fLog set fLog to NULL. 930 // Call TObject::RecursiveRemove 931 // 932 void MParContainer::RecursiveRemove(TObject *obj) 933 { 934 if (obj==fDisplay) 935 fDisplay=NULL; 936 937 if (obj==fLog) 938 fLog=NULL; 939 940 if (fDisplay) 941 fDisplay->RecursiveRemove(obj); 942 943 if (fLog) 944 fLog->RecursiveRemove(obj); 945 946 TObject::RecursiveRemove(obj); 947 } 948 -
trunk/MagicSoft/Mars/mbase/MParContainer.h
r7804 r8642 146 146 MParContainer *GetNewObject(const char *name, TClass *base=MParContainer::Class()) const; 147 147 148 void RecursiveRemove(TObject *obj); 149 148 150 ClassDef(MParContainer, 0) //The basis for all parameter containers 149 151 }; -
trunk/MagicSoft/Mars/mbase/MParList.cc
r8218 r8642 312 312 313 313 TObject *obj = fContainer->Remove(cont); 314 if (!obj) 315 { 316 *fLog << warn << "Object not found in list..." << endl; 317 return; 318 } 319 320 *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl; 321 322 if (IsOwner() && !fAutodelete->FindObject(obj)) 314 315 fContainer->RecursiveRemove(obj); 316 317 // if (!obj) 318 // { 319 // *fLog << warn << "Object not found in list..." << endl; 320 // return; 321 //} 322 323 // *fLog << inf << "MParContainer '" << cont->GetName() << "' removed..." << endl; 324 325 if (obj && IsOwner() && !fAutodelete->FindObject(obj)) 323 326 delete obj; 327 } 328 329 // -------------------------------------------------------------------------- 330 // 331 // Call MParContainer::RecursiveRemove 332 // Call fContainer->RecursiveRemove 333 // 334 void MParList::RecursiveRemove(TObject *obj) 335 { 336 MParContainer::RecursiveRemove(obj); 337 338 if (obj==fContainer) 339 fContainer = NULL; 340 341 if (fContainer) 342 fContainer->RecursiveRemove(obj); 324 343 } 325 344 -
trunk/MagicSoft/Mars/mbase/MParList.h
r7804 r8642 86 86 } 87 87 88 void RecursiveRemove(TObject *obj); 89 88 90 void Reset(); 89 91 void SetReadyToSave(Bool_t flag=kTRUE); -
trunk/MagicSoft/Mars/mbase/MStatusDisplay.h
r7827 r8642 66 66 kPicMagic, kPicMars, 67 67 // kGui 68 kSearch, kTabs 68 kSearch, kTabs, 69 // kLastElement 70 kLastElement 69 71 } Status_t; 70 72 -
trunk/MagicSoft/Mars/mbase/MTask.cc
r8426 r8642 147 147 { 148 148 fFilter=filter; 149 if (filter) 150 AddToBranchList(filter->GetDataMember()); 149 if (!filter) 150 return; 151 152 fFilter->SetBit(kMustCleanup); // Better is better ;-) 153 AddToBranchList(filter->GetDataMember()); 151 154 } 152 155 … … 557 560 *fLog << "%) Evts skipped: " << str << endl; 558 561 } 562 563 // -------------------------------------------------------------------------- 564 // 565 // If obj==fFilter set fFilter to NULL 566 // Call MParcontainer::RecursiveRemove 567 // 568 void MTask::RecursiveRemove(TObject *obj) 569 { 570 if (obj==fFilter) 571 fFilter=NULL; 572 573 if (fFilter) 574 fFilter->RecursiveRemove(obj); 575 576 MParContainer::RecursiveRemove(obj); 577 } -
trunk/MagicSoft/Mars/mbase/MTask.h
r7804 r8642 123 123 void SavePrimitive(ofstream &out, Option_t *o=""); 124 124 125 // TObject 126 void RecursiveRemove(TObject *obj); 127 125 128 ClassDef(MTask, 2) //Abstract base class for a task 126 129 }; -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r8618 r8642 18 18 ! Author(s): Thomas Bretz 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 19 ! 20 ! Copyright: MAGIC Software Development, 2000-200 420 ! Copyright: MAGIC Software Development, 2000-2007 21 21 ! 22 22 ! … … 80 80 using namespace std; 81 81 82 //#define DEBUG_PROCESS 83 #undef DEBUG_PROCESS 84 82 85 const TString MTaskList::gsDefName = "MTaskList"; 83 86 const TString MTaskList::gsDefTitle = "A list for tasks to be executed"; … … 89 92 // this name in the parameter list (by MEvtLoop::SetParList) 90 93 // 91 MTaskList::MTaskList(const char *name, const char *title) : f NumPasses(0), fNumPass(0)94 MTaskList::MTaskList(const char *name, const char *title) : fTasks(0), fParList(0), fNumPasses(0), fNumPass(0) 92 95 { 93 96 fName = name ? name : gsDefName.Data(); … … 465 468 void MTaskList::Remove(MTask *task) 466 469 { 470 if (!task) 471 return; 472 473 // First remove it from the list(s) so that a later RecursiveRemove 474 // cannot fint the task again 467 475 TObject *obj = fTasks->Remove(task); 468 476 469 if (TestBit(kIsOwner)) 477 // Now do a recursive remove on all other tasks. 478 fTasks->RecursiveRemove(task); 479 480 if (obj && TestBit(kIsOwner)) 470 481 delete obj; 482 } 483 484 // -------------------------------------------------------------------------- 485 // 486 // Call MTask::RecursiveRemove 487 // Call fTasks->RecursiveRemove 488 // 489 void MTaskList::RecursiveRemove(TObject *obj) 490 { 491 MTask::RecursiveRemove(obj); 492 493 if (obj==fTasks) 494 fTasks=NULL; 495 496 if (fTasks) 497 { 498 fTasks->RecursiveRemove(obj); 499 500 // In theory this call is obsolete 501 fTasksProcess.RecursiveRemove(obj); 502 } 471 503 } 472 504 … … 620 652 MTask *task=NULL; 621 653 654 #ifdef DEBUG_PROCESS 655 *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - start." << endl; 656 #endif 657 622 658 // 623 659 // loop over all tasks for processing … … 626 662 while ( (task=(MTask*)Next()) ) 627 663 { 664 #ifdef DEBUG_PROCESS 665 *fLog << all << "Process - " << (void*)task << " " << flush; 666 *fLog << task->GetDescriptor() << "... " << flush; 667 #endif 628 668 // 629 669 // if the task has the wrong stream id skip it. … … 646 686 // everything was OK: go on with the next task 647 687 // 688 #ifdef DEBUG_PROCESS 689 *fLog << "true." << endl; 690 #endif 648 691 continue; 649 692 … … 668 711 // something occured: skip the rest of the tasks for this event 669 712 // 713 #ifdef DEBUG_PROCESS 714 *fLog << "continue." << endl; 715 #endif 670 716 rc = kCONTINUE; 671 717 break; … … 677 723 break; 678 724 } 725 726 #ifdef DEBUG_PROCESS 727 *fLog << all << "ProcessTaskList - " << GetDescriptor() << " - done." << endl; 728 #endif 679 729 680 730 return rc; -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r8618 r8642 97 97 Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const; 98 98 99 void RecursiveRemove(TObject *obj); 100 99 101 operator TIterator*() const; 100 102
Note:
See TracChangeset
for help on using the changeset viewer.