Changeset 2052 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 05/02/03 08:56:31 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r2042 r2052 190 190 fDisplay->SetWindowName(TString("Status Display: ")+fName); 191 191 fDisplay->SetIconName(fName); 192 // Set status lines193 fDisplay->SetStatusLine1("PreProcessing...");194 fDisplay->SetStatusLine2("");195 192 // Start automatic update 196 193 fDisplay->StartUpdate(); … … 207 204 if (!fTaskList->PreProcess(fParList)) 208 205 { 209 *fLog << err << "Error detected while PreProcessing " << endl;206 *fLog << err << "Error detected while PreProcessing." << endl; 210 207 return kFALSE; 211 208 } … … 422 419 // execute the post process of all tasks 423 420 // 424 if (fDisplay)425 {426 // Set status lines427 fDisplay->SetStatusLine1("PostProcessing...");428 fDisplay->SetStatusLine2("");429 }430 421 return fTaskList->PostProcess(); 431 422 } … … 433 424 // -------------------------------------------------------------------------- 434 425 // 435 // See class description above. 426 // See class description above. Returns kTRUE if PreProcessing, 427 // Processing and PostProcessing was successfull, otherwise kFALSE. 436 428 // 437 429 Bool_t MEvtLoop::Eventloop(Int_t maxcnt, const char *tlist) … … 446 438 447 439 // 448 // Now postprocess all tasks. Only successfully preprocessed tasks are 449 // postprocessed. If the Postprocessing of one task fail return an error. 440 // Now postprocess all tasks. Only successfully preprocessed tasks 441 // are postprocessed. If the Postprocessing of one task fails 442 // return an error. 450 443 // 451 444 if (!PostProcess()) 452 return kFALSE; 445 { 446 *fLog << err << "Error detected while PostProcessing." << endl; 447 rc = kFALSE; 448 } 453 449 454 450 if (!fDisplay) … … 457 453 // Set status lines 458 454 fDisplay->SetStatusLine1(fName); 459 fDisplay->SetStatusLine2(rc ? "Done." : "E RROR");455 fDisplay->SetStatusLine2(rc ? "Done." : "Error!"); 460 456 // Stop automatic update 461 457 fDisplay->StopUpdate(); -
trunk/MagicSoft/Mars/mbase/MLog.cc
r1895 r2052 175 175 MLog::MLog(MLog &log) 176 176 { 177 fOutputLevel 178 fDebugLevel 179 fDevice 177 fOutputLevel = log.fOutputLevel; 178 fDebugLevel = log.fDebugLevel; 179 fDevice = log.fDevice; 180 180 } 181 181 … … 208 208 if (fDevice&eGui && fgui) 209 209 { 210 char **newstr = new char*[fNumLines+1]; 211 212 for (int i=0; i<fNumLines; i++) 213 newstr[i] = fGuiLines[i]; 214 215 if (fNumLines>0) 216 delete fGuiLines; 217 218 char *dummy = new char[len]; 219 memcpy(dummy, fBase, len-1); 220 dummy[len-1]='\0'; 221 222 newstr[fNumLines++] = dummy; 223 224 fGuiLines = newstr; 210 // check whether the current text was flushed or endl'ed 211 const Bool_t flushed = fBase[len-1]!='\n'; 212 213 // for the gui remove trailing characters ('\n' or '\0') 214 fBase[len-1]='\0'; 215 216 // add new text to line storage 217 fGuiLine += fBase; 218 219 if (!flushed) 220 { 221 // add a new TString* to the array of gui lines 222 TString **newstr = new TString*[fNumLines+1]; 223 memcpy(newstr, fGuiLines, fNumLines*sizeof(TString*)); 224 if (fNumLines>0) 225 delete fGuiLines; 226 fGuiLines = newstr; 227 228 // add Gui line as last line of array 229 fGuiLines[fNumLines++] = new TString(fGuiLine); 230 fGuiLine = ""; 231 } 225 232 } 226 233 } … … 231 238 return; 232 239 240 // lock mutex 233 241 Lock(); 234 242 243 // copy lines to TGListBox 235 244 for (int i=0; i<fNumLines; i++) 236 245 { 237 fgui->AddEntry(fGuiLines[i], fGuiLineId++); 246 // Replace all tabs by 7 white spaces 247 fGuiLines[i]->ReplaceAll("\t", " "); 248 fgui->AddEntry(*fGuiLines[i], fGuiLineId++); 238 249 delete fGuiLines[i]; 239 250 } 240 241 251 delete fGuiLines; 242 252 243 253 fNumLines=0; 244 254 255 // cut list box top 1000 lines 245 256 fgui->RemoveEntries(0, fGuiLineId-1000); 257 // show last entry 246 258 fgui->SetTopEntry(fGuiLineId-1); 259 // tell a main loop, that list box contents have changed 247 260 fgui->SetBit(kHasChanged); 248 261 262 // release mutex 249 263 UnLock(); 250 264 } -
trunk/MagicSoft/Mars/mbase/MLog.h
r1895 r2052 4 4 #ifndef ROOT_TObject 5 5 #include <TObject.h> 6 #endif 7 #ifndef ROOT_TString 8 #include <TString.h> 6 9 #endif 7 10 … … 23 26 24 27 private: 25 char fBuffer; //!26 char fBase[bsz ];//! Buffer to store the data in27 char *fPPtr; //! Pointer to present position in buffer28 const char *fEPtr; //! Pointer to end of buffer28 char fBuffer; //! 29 char fBase[bsz+1]; //! Buffer to store the data in 30 char *fPPtr; //! Pointer to present position in buffer 31 const char *fEPtr; //! Pointer to end of buffer 29 32 30 UInt_t fOutputLevel; //! Present output level of the stream31 UInt_t fDebugLevel; //! Present global debug level32 UInt_t fDevice; //! Flag to indicate the present streams33 UInt_t fOutputLevel; //! Present output level of the stream 34 UInt_t fDebugLevel; //! Present global debug level 35 UInt_t fDevice; //! Flag to indicate the present streams 33 36 34 Bool_t fIsNull; //! Switch output completely off37 Bool_t fIsNull; //! Switch output completely off 35 38 36 Int_t fGuiLineId; 39 Int_t fGuiLineId; //! 37 40 38 41 ofstream *fout; //! possible file output stream … … 40 43 TGListBox *fgui; //! Listbox output 41 44 42 Bool_t fIsDirectGui; //! Pipe text directly to the GUI (for single threaded environments) 43 char **fGuiLines; //! Lines to pipe to gui 44 Int_t fNumLines; 45 Bool_t fIsDirectGui; //! Pipe text directly to the GUI (for single threaded environments) 46 TString **fGuiLines; //! Lines to pipe to gui 47 Int_t fNumLines; //! 48 // Bool_t fGuiLineFlushed; 49 TString fGuiLine; //! 45 50 46 51 #ifdef _REENTRANT -
trunk/MagicSoft/Mars/mbase/MParList.cc
r1965 r2052 222 222 return; 223 223 224 TObjArrayIter Next(list);224 MIter Next(list); 225 225 226 226 MParContainer *cont = NULL; 227 while ((cont= (MParContainer*)Next()))227 while ((cont=Next())) 228 228 AddToList(cont); 229 229 } … … 505 505 *fLog << all << " " << GetDescriptor() << endl; 506 506 *fLog << setfill('-') << setw(strlen(GetDescriptor())+2) << "" << endl; 507 507 508 MParContainer *obj = NULL; 508 TIter Next(fContainer);509 while ((obj= (MParContainer*)Next()))509 MIter Next(fContainer); 510 while ((obj=Next())) 510 511 { 511 512 *fLog << " " << obj->GetDescriptor(); … … 802 803 MParContainer *cont = NULL; 803 804 804 TIter Next(fContainer);805 while ((cont= (MParContainer*)Next()))805 MIter Next(fContainer); 806 while ((cont=Next())) 806 807 { 807 808 if (cont->InheritsFrom("MTaskList")) … … 878 879 MParContainer *cont = NULL; 879 880 880 TIter Next(fContainer);881 while ((cont= (MParContainer*)Next()))881 MIter Next(fContainer); 882 while ((cont=Next())) 882 883 if (!cont->WriteEnv(env, prefix, print)) 883 884 return kFALSE; -
trunk/MagicSoft/Mars/mbase/MTask.cc
r2015 r2052 16 16 ! 17 17 ! 18 ! Author(s): Thomas Bretz <mailto:tbretz@uni-sw.gwdg.de>, 12/200019 ! 20 ! Copyright: MAGIC Software Development, 2000-200 118 ! Author(s): Thomas Bretz, 12/2000 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! 20 ! Copyright: MAGIC Software Development, 2000-2003 21 21 ! 22 22 ! … … 76 76 #include "MFilter.h" 77 77 #include "MGGroupFrame.h" 78 #include "MStatusDisplay.h" 78 79 79 80 ClassImp(MTask); … … 166 167 fNumExecutions = 0; 167 168 169 *fLog << all << fName << "... " << flush; 170 if (fDisplay) 171 fDisplay->SetStatusLine2(*this); 172 168 173 switch (PreProcess(plist)) 169 174 { … … 220 225 221 226 fIsPreprocessed = kFALSE; 227 228 *fLog << all << fName << "... " << flush; 229 if (fDisplay) 230 fDisplay->SetStatusLine2(*this); 222 231 223 232 return PostProcess(); -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r2015 r2052 65 65 #include "MLogManip.h" 66 66 67 #include "MIter.h" 67 68 #include "MFilter.h" 68 69 #include "MParList.h" … … 288 289 MTask *task=NULL; 289 290 // 290 // loop over all tasks for preproccesing291 // loop over all tasks for reinitialization 291 292 // 292 293 while ((task=(MTask*)Next())) … … 330 331 { 331 332 *fLog << all << "Preprocessing... " << flush; 333 if (fDisplay) 334 { 335 // Set status lines 336 fDisplay->SetStatusLine1("PreProcessing..."); 337 fDisplay->SetStatusLine2(""); 338 } 332 339 333 340 fParList = pList; … … 347 354 while ((task=(MTask*)Next())) 348 355 { 349 *fLog << all << task->GetName() << "... " << flush;350 if (fDisplay)351 fDisplay->SetStatusLine2(*task);352 353 356 // 354 357 // PreProcess the task and check for it's return value. … … 494 497 { 495 498 *fLog << all << "Postprocessing... " << flush; 499 if (fDisplay) 500 { 501 // Set status lines 502 fDisplay->SetStatusLine1("PostProcessing..."); 503 fDisplay->SetStatusLine2(""); 504 } 496 505 497 506 // … … 518 527 while ( (task=(MTask*)Next()) ) 519 528 { 520 *fLog << all << task->GetName() << "... " << flush;521 if (fDisplay)522 fDisplay->SetStatusLine2(*task);523 524 529 if (!task->CallPostProcess()) 525 530 return kFALSE; … … 602 607 out << ";" << endl << endl; 603 608 604 TIter Next(fTasks);609 MIter Next(fTasks); 605 610 606 611 MParContainer *cont = NULL; 607 while ((cont= (MParContainer*)Next()))612 while ((cont=Next())) 608 613 { 609 614 cont->SavePrimitive(out, ""); … … 654 659 MParContainer *cont = NULL; 655 660 656 TIter Next(fTasks);657 while ((cont= (MParContainer*)Next()))661 MIter Next(fTasks); 662 while ((cont=Next())) 658 663 { 659 664 if (cont->InheritsFrom("MTaskList")) … … 730 735 MParContainer *cont = NULL; 731 736 732 TIter Next(fTasks);733 while ((cont= (MParContainer*)Next()))737 MIter Next(fTasks); 738 while ((cont=Next())) 734 739 if (!cont->WriteEnv(env, prefix, print)) 735 740 return kFALSE;
Note:
See TracChangeset
for help on using the changeset viewer.