Changeset 3788 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 04/21/04 15:38:08 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MTask.cc
r3666 r3788 77 77 // etc. PostProcess is only executed in case of 78 78 // PreProcess was successfull (returned kTRUE) 79 // 80 // 81 // Remark: Using a MTask in your tasklist doesn't make much sense, 82 // because it is doing nothing. However it is a nice tool 83 // to count something (exspecially if used together with a 84 // filter) 85 // 79 86 // 80 87 // Version 1: … … 391 398 void MTask::PrintStatistics(const Int_t lvl, Bool_t title, Double_t time) const 392 399 { 393 if (!OverwritesProcess() )400 if (!OverwritesProcess() && IsA()!=MTask::Class()) 394 401 return; 395 402 … … 447 454 // Check whether we reached the base class MTask 448 455 // 449 if ( TString(cls->GetName())=="MTask")456 if (cls==MTask::Class()) 450 457 return kFALSE; 451 458 -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r3666 r3788 43 43 // from the list. 44 44 // 45 // Remark: The Process function is only executed if the class of your task 46 // overloads Process() or if the task itself is a MTask. This 47 // means if you have a task without Process() (only PreProcess 48 // and PostProcess no time is lost during execution) 49 // 45 50 // Warning: 46 51 // Be carefull if you are writing your tasklist … … 300 305 // -------------------------------------------------------------------------- 301 306 // 307 // removes a task from the list (used in PreProcess). 308 // if kIsOwner is set the task is deleted. (see SetOwner()) 309 // 310 void MTaskList::Remove(MTask *task) 311 { 312 TObject *obj = fTasks->Remove(task); 313 314 if (TestBit(kIsOwner)) 315 delete obj; 316 } 317 318 // -------------------------------------------------------------------------- 319 // 320 // do pre processing (before eventloop) of all tasks in the task-list 321 // Only if a task overwrites the Process function the task is 322 // added to the fTaskProcess-List. This makes the execution of the 323 // tasklist a little bit (only a little bit) faster, bacause tasks 324 // doing no Processing are not Processed. 325 // 326 Int_t MTaskList::PreProcess(MParList *pList) 327 { 328 *fLog << all << "Preprocessing... " << flush; 329 if (fDisplay) 330 { 331 // Set status lines 332 fDisplay->SetStatusLine1("PreProcessing..."); 333 fDisplay->SetStatusLine2(""); 334 } 335 336 fParList = pList; 337 338 // 339 // Make sure, that the ReadyToSave flag is not reset from a tasklist 340 // running as a task in another tasklist. 341 // 342 const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset); 343 if (!noreset) 344 fParList->SetBit(MParList::kDoNotReset); 345 346 // 347 // create the Iterator over the tasklist 348 // 349 TIter Next(fTasks); 350 351 MTask *task=NULL; 352 353 // 354 // loop over all tasks for preproccesing 355 // 356 while ((task=(MTask*)Next())) 357 { 358 // 359 // PreProcess the task and check for it's return value. 360 // 361 switch (task->CallPreProcess(fParList)) 362 { 363 case kFALSE: 364 return kFALSE; 365 366 case kTRUE: 367 // Handle GUI events (display changes, mouse clicks) 368 if (fDisplay) 369 gSystem->ProcessEvents(); 370 continue; 371 372 case kSKIP: 373 Remove(task); 374 continue; 375 } 376 377 *fLog << err << dbginf << "PreProcess of " << task->GetDescriptor(); 378 *fLog << " returned an unknown value... aborting." << endl; 379 return kFALSE; 380 } 381 382 *fLog << all << endl; 383 384 // 385 // Reset the ReadyToSave flag. 386 // 387 if (!noreset) 388 { 389 fParList->SetReadyToSave(kFALSE); 390 fParList->ResetBit(MParList::kDoNotReset); 391 } 392 393 // 394 // loop over all tasks to fill fTasksProcess 395 // 396 Next.Reset(); 397 fTasksProcess.Clear(); 398 while ((task=(MTask*)Next())) 399 if (task->IsA()==MTask::Class() || task->OverwritesProcess()) 400 fTasksProcess.Add(task); 401 402 return kTRUE; 403 } 404 405 // -------------------------------------------------------------------------- 406 // 302 407 // do reinit of all tasks in the task-list 303 408 // … … 348 453 pList->ResetBit(MParList::kDoNotReset); 349 454 } 350 351 return kTRUE;352 }353 354 // --------------------------------------------------------------------------355 //356 // removes a task from the list (used in PreProcess).357 // if kIsOwner is set the task is deleted. (see SetOwner())358 //359 void MTaskList::Remove(MTask *task)360 {361 TObject *obj = fTasks->Remove(task);362 363 if (TestBit(kIsOwner))364 delete obj;365 }366 367 // --------------------------------------------------------------------------368 //369 // do pre processing (before eventloop) of all tasks in the task-list370 // Only if a task overwrites the Process function the task is371 // added to the fTaskProcess-List. This makes the execution of the372 // tasklist a little bit (only a little bit) faster, bacause tasks373 // doing no Processing are not Processed.374 //375 Int_t MTaskList::PreProcess(MParList *pList)376 {377 *fLog << all << "Preprocessing... " << flush;378 if (fDisplay)379 {380 // Set status lines381 fDisplay->SetStatusLine1("PreProcessing...");382 fDisplay->SetStatusLine2("");383 }384 385 fParList = pList;386 387 //388 // Make sure, that the ReadyToSave flag is not reset from a tasklist389 // running as a task in another tasklist.390 //391 const Bool_t noreset = fParList->TestBit(MParList::kDoNotReset);392 if (!noreset)393 fParList->SetBit(MParList::kDoNotReset);394 395 //396 // create the Iterator over the tasklist397 //398 TIter Next(fTasks);399 400 MTask *task=NULL;401 402 //403 // loop over all tasks for preproccesing404 //405 while ((task=(MTask*)Next()))406 {407 //408 // PreProcess the task and check for it's return value.409 //410 switch (task->CallPreProcess(fParList))411 {412 case kFALSE:413 return kFALSE;414 415 case kTRUE:416 // Handle GUI events (display changes, mouse clicks)417 if (fDisplay)418 gSystem->ProcessEvents();419 continue;420 421 case kSKIP:422 Remove(task);423 continue;424 }425 426 *fLog << err << dbginf << "PreProcess of " << task->GetDescriptor();427 *fLog << " returned an unknown value... aborting." << endl;428 return kFALSE;429 }430 431 *fLog << all << endl;432 433 //434 // Reset the ReadyToSave flag.435 //436 if (!noreset)437 {438 fParList->SetReadyToSave(kFALSE);439 fParList->ResetBit(MParList::kDoNotReset);440 }441 442 //443 // loop over all tasks to fill fTasksProcess444 //445 Next.Reset();446 fTasksProcess.Clear();447 while ((task=(MTask*)Next()))448 if (task->OverwritesProcess())449 fTasksProcess.Add(task);450 455 451 456 return kTRUE;
Note:
See TracChangeset
for help on using the changeset viewer.