Changeset 4732 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 08/25/04 17:30:31 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MEvtLoop.cc
r4722 r4732 933 933 // CleaningLevel1: 3.0 934 934 // 935 // 936 // With the argument prefix you can overwrite the name of the MEvtLoop object 937 // as prefix - use with extreme care! The prifix argument must not end with 938 // a dot! 939 // 940 // 935 941 // Warning: The programmer is responsible for the names to be unique in 936 942 // all Mars classes. … … 938 944 Int_t MEvtLoop::ReadEnv(const TEnv &env, TString prefix, Bool_t print) 939 945 { 940 if (!prefix.IsNull()) 941 *fLog << warn << "WARNING - Second argument in MEvtLoop::ReadEnv has no meaning... ignored." << endl; 942 943 prefix = fName; 946 // if (!prefix.IsNull()) 947 // *fLog << warn << "WARNING - Second argument in MEvtLoop::ReadEnv has no meaning... ignored." << endl; 948 949 if (prefix.IsNull()) 950 prefix = fName; 944 951 prefix += "."; 945 952 -
trunk/MagicSoft/Mars/mbase/MLog.cc
r4722 r4732 107 107 #include <TGTextView.h> 108 108 109 #include "M LogPlugin.h"109 #include "MArgs.h" 110 110 #include "MParContainer.h" 111 #include "MArgs.h" 111 112 #include "MLogHtml.h" 112 113 113 114 ClassImp(MLog); … … 520 521 *this << " -v# Verbosity level # [default=2]" << endl; 521 522 *this << " -a, --no-colors Do not use Ansii color codes" << endl; 523 *this << " --log[=file] Write log-out to ascii-file [default: prgname.log]" << endl; 524 *this << " --html[=file] Write log-out to html-file [default: prgname.html]" << endl; 522 525 *this << " --debug[=n] Enable root debugging [default: gDebug=1]" << endl; 526 *this << " --null Null output (supresses all output)" << endl; 523 527 } 524 528 … … 527 531 // Setup MLog and global debug output from command line arguments. 528 532 // 529 // gLog << " -v# Verbosity level # [default=2]" << endl;530 // gLog << " -a, --no-colors Do not use Ansii color codes" << endl;531 // gLog << " --debug[=n] Enable root debugging (Default: gDebug=1)" << endl;532 //533 533 void MLog::Setup(MArgs &arg) 534 534 { 535 if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a")) 536 SetNoColors(); 537 538 SetDebugLevel(arg.HasOption("-v") ? arg.GetIntAndRemove("-v") : 2); 539 535 // FXIME: This is not really at a place where it belongs to! 540 536 gDebug = arg.HasOption("--debug=") ? arg.GetIntAndRemove("--debug=") : 0; 541 537 if (gDebug==0 && arg.HasOnlyAndRemove("--debug")) 542 538 gDebug=1; 539 540 TString f1 = arg.GetStringAndRemove("--log=", ""); 541 if (f1.IsNull() && arg.HasOnlyAndRemove("--log")) 542 f1 = Form("%s.log", arg.GetName()); 543 if (!f1.IsNull()) 544 { 545 SetOutputFile(f1); 546 EnableOutputDevice(eFile); 547 } 548 549 TString f2 = arg.GetStringAndRemove("--html=", ""); 550 if (f2.IsNull() && arg.HasOnlyAndRemove("--html")) 551 f2 = Form("%s.html", arg.GetName()); 552 if (!f2.IsNull()) 553 { 554 MLogHtml *html = new MLogHtml(f2); 555 html->SetBit(kCanDelete); 556 AddPlugin(html); 557 } 558 559 const Bool_t null = arg.HasOnlyAndRemove("--null"); 560 if (null) 561 SetNullOutput(); 562 563 if (arg.HasOnlyAndRemove("--no-colors") || arg.HasOnlyAndRemove("-a")) 564 SetNoColors(); 565 566 SetDebugLevel(arg.GetIntAndRemove("-v", 2)); 543 567 } 544 568 … … 653 677 // is automatically removed from the list of active plugins. 654 678 // 679 // If MLog should take the ownership cal plug->SetBit(kCanDelete); 680 // 655 681 void MLog::AddPlugin(MLogPlugin *plug) 656 682 { 657 683 fPlugins->Add(plug); 658 plug->SetBit(kMustCleanup); 659 } 684 } -
trunk/MagicSoft/Mars/mbase/MTaskEnv.cc
r4723 r4732 27 27 // MTaskEnv 28 28 // 29 // If you want to create a new task inside a macro you will have to compile 30 // your macro using macro.C++, because the root interpreter cannot use 31 // uncompiled classes. To workaround this problem you can write simple 32 // funcions (which can be handled by CINT) and use MTaskEnv. 33 // 34 // This is a simple way to develop new code in a macro without need 35 // to compile it. 36 // 37 // Example: 38 // Int_t Process() 39 // { 40 // gLog << "Processing..." << endl; 41 // return kTRUE; 42 // } 43 // 44 // void main() 45 // { 46 // MTaskEnv task; 47 // task.SetProcess(Process); 48 // MTaskList list; 49 // list.AddToList(&task); 50 // } 29 // This class is used if a task - at runtime - should be replaced or setup 30 // from a resource file, eg. 31 // 32 // 33 // resources.rc: 34 // MyTask: MThisIsMyClass 35 // MyTask.Resource1: yes 36 // MyTask.Resource2: 50 37 // 38 // macro.C: 39 // MTaskList list; 40 // 41 // MDefaultTask def; 42 // MTaskEnv taskenv("MyTask"); 43 // taskenv.SetDefault(&def); 44 // 45 // list.AddToList(&taskenv); 46 // [...] 47 // evtloop.ReadEnv("resource.rc"); 48 // 49 // In this case MTaskEnv will act like MDefaultTask if nothing is found in the 50 // resource file. If the task is setup via the resource file like in the 51 // example above it will act like a MThisIsMyClass setup with Resource1 and 52 // Resource2. 53 // 54 // 55 // You can also skip the task completely if you setup (in lower case letters!) 56 // 57 // resources.rc: 58 // MyTask: <dummy> 59 // 60 // 61 // A third option is to setup a MTaskEnv to be skipped except a task is 62 // initialized through the resource file: 63 // MTaskEnv taskenv("MyTask"); 64 // taskenv.SetDefault(0); 51 65 // 52 66 // … … 165 179 Bool_t MTaskEnv::ReInit(MParList *list) 166 180 { 167 *fLog << fTask->ClassName() << " -" << flush;181 *fLog << fTask->ClassName() << " <MTaskEnv>... " << flush; 168 182 return fTask->ReInit(list); 169 183 } … … 171 185 Int_t MTaskEnv::PreProcess(MParList *list) 172 186 { 187 if (TestBit(kIsDummy)) 188 { 189 *fLog << inf << "Dummy Task... skipped." << endl; 190 return kSKIP; 191 } 192 173 193 if (!fTask) 174 194 { … … 177 197 } 178 198 179 *fLog << fTask->ClassName() << " -" << flush;199 *fLog << fTask->ClassName() << " <MTaskEnv>... " << flush; 180 200 return fTask->CallPreProcess(list); 181 201 } … … 188 208 Int_t MTaskEnv::PostProcess() 189 209 { 190 *fLog << fTask->ClassName() << " -" << flush;210 *fLog << fTask->ClassName() << " <MTaskEnv>... " << flush; 191 211 return fTask->CallPostProcess(); 192 212 } … … 200 220 task.ReplaceAll("\015", ""); 201 221 task = task.Strip(TString::kBoth); 222 223 if (task=="<dummy>") 224 { 225 if (TestBit(kIsOwner) && fTask) 226 delete fTask; 227 fTask = 0; 228 SetBit(kIsDummy); 229 return kTRUE; 230 } 231 202 232 fTask = GetTask(task.Data()); 203 233 if (!fTask) -
trunk/MagicSoft/Mars/mbase/MTaskEnv.h
r4723 r4732 14 14 MTask *fTask; 15 15 16 enum { kIsOwner = BIT(14) };16 enum { kIsOwner = BIT(14), kIsDummy = BIT(15) }; 17 17 18 18 MTask *GetTask(const char *name) const; … … 33 33 void SetOwner(Bool_t b=kTRUE) { b ? SetBit(kIsOwner) : ResetBit(kIsOwner); } 34 34 35 void SetDefault(MTask *task) { fTask = task; }35 void SetDefault(MTask *task) { fTask = task; if (!task) SetBit(kIsDummy); } 36 36 void SetDefault(const char *def); 37 37 -
trunk/MagicSoft/Mars/mbase/MTime.cc
r4627 r4732 70 70 71 71 #include <iomanip> 72 73 #ifndef __USE_XOPEN 74 #define __USE_XOPEN // on some systems needed for strptime 75 #endif 72 76 73 77 #include <time.h> // struct tm
Note:
See TracChangeset
for help on using the changeset viewer.