Changeset 1715 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 01/19/03 14:52:29 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MContinue.cc
r1600 r1715 24 24 25 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MContinue // 28 // // 29 // Does nothing than return kCONTINUE in the Process-function // 30 // (use with filters) // 31 // // 26 // 27 // MContinue 28 // 29 // Does nothing than return kCONTINUE in the Process-function 30 // (use with filters). For more details see the description of the 31 // constructors. 32 // 32 33 ///////////////////////////////////////////////////////////////////////////// 33 34 #include "MContinue.h" 34 35 36 #include "MLog.h" 37 #include "MLogManip.h" 38 39 #include "MF.h" 40 #include "MParList.h" 41 #include "MTaskList.h" 42 35 43 ClassImp(MContinue); 36 44 37 MContinue::MContinue(const char *name, const char *title) 45 // -------------------------------------------------------------------------- 46 // 47 // Use this constructor if a rule (see MF for more details) shell be used. 48 // MContinue will create a MF object and use it as a filter for the 49 // instance. The MF-Task is added to the tasklist in front of the MContinue 50 // instance and also automatically deleted, eg. 51 // MContinue cont("MHillas.fSize<20"); 52 // tasklist.AddToList(&cont); 53 // would skip all events which fullfill "MHillas.fSize<20" from this point 54 // in the tasklist. 55 // 56 MContinue::MContinue(const TString rule, const char *name, const char *title) 38 57 { 39 58 fName = name ? name : "MContinue"; 40 59 fTitle = title ? title : "Task returning kCONTINUE"; 60 61 if (rule.IsNull()) 62 return; 63 64 SetBit(kIsOwner); 65 66 MTask::SetFilter(new MF(rule, TString("MF(")+fName+")")); 41 67 } 42 68 69 // -------------------------------------------------------------------------- 70 // 71 // Use this if you have a filter. Would be the same as if you would call: 72 // MContinue cont; 73 // cont.SetFilter(f); 74 // 43 75 MContinue::MContinue(MFilter *f, const char *name, const char *title) 44 76 { … … 48 80 SetFilter(f); 49 81 } 82 83 // -------------------------------------------------------------------------- 84 // 85 // Delete the filter if it was created automatically 86 // 87 MContinue::~MContinue() 88 { 89 if (TestBit(kIsOwner)) 90 delete GetFilter(); 91 } 92 93 // -------------------------------------------------------------------------- 94 // 95 // In case the filter was created automatically, PreProcess tries to find 96 // the tasklist MTaskList, adds the filter before this instance to the 97 // tasklist and preprocesses the filter. 98 // 99 Bool_t MContinue::PreProcess(MParList *list) 100 { 101 if (!TestBit(kIsOwner)) 102 return kTRUE; 103 104 MTaskList *tlist = (MTaskList*)list->FindObject("MTaskList"); 105 if (!tlist) 106 { 107 *fLog << err << dbginf << "ERROR - Tasklist 'MTaskList' not found... abort." << endl; 108 return kFALSE; 109 } 110 111 if (!GetFilter()) 112 { 113 *fLog << err << dbginf << "Unknown fatal Error! (fFilter=NULL?!?)" << endl; 114 return kFALSE; 115 } 116 117 if (!tlist->AddToListBefore(GetFilter(), this)) 118 { 119 *fLog << err << dbginf << "ERROR - Adding filter before MContinue... abort." << endl; 120 return kFALSE; 121 } 122 123 return GetFilter()->CallPreProcess(list); 124 } 125 -
trunk/MagicSoft/Mars/mbase/MContinue.h
r1538 r1715 20 20 { 21 21 private: 22 Bool_t PreProcess(MParList *list); 22 23 Bool_t Process() { return kCONTINUE; } 23 24 25 enum { kIsOwner = BIT(14) }; 26 24 27 public: 25 MContinue(const char *name=NULL, const char *title=NULL);28 MContinue(const TString rule="", const char *name=NULL, const char *title=NULL); 26 29 MContinue(MFilter *f, const char *name=NULL, const char *title=NULL); 30 ~MContinue(); 31 32 void SetFilter(MFilter *filter) { if (!TestBit(kIsOwner)) MTask::SetFilter(filter); } 27 33 28 34 ClassDef(MContinue, 1) //Task returning kCONTINUE -
trunk/MagicSoft/Mars/mbase/Makefile
r1540 r1715 20 20 # @endcode 21 21 22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain 22 INCLUDES = -I. -I../mraw -I../MRawFormat -I../mmc -I../mfileio -I../mmain -I../mfilter 23 23 24 24 # @code
Note:
See TracChangeset
for help on using the changeset viewer.