Changeset 752 for trunk/MagicSoft/Mars/mbase/MTaskList.cc
- Timestamp:
- 04/18/01 14:36:05 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r749 r752 23 23 \* ======================================================================== */ 24 24 25 /////////////////////////////////////////////////////////////////////// 26 // //27 // MTaskList //28 // //29 // Collection of tasks to be processed in the eventloop //30 // //31 /////////////////////////////////////////////////////////////////////// 25 ///////////////////////////////////////////////////////////////////////////// 26 // // 27 // MTaskList // 28 // // 29 // Collection of tasks to be processed in the eventloop // 30 // // 31 ///////////////////////////////////////////////////////////////////////////// 32 32 33 33 #include "MTaskList.h" … … 39 39 ClassImp(MTaskList) 40 40 41 // -------------------------------------------------------------------------- 42 // 43 // the name for the task list must be the same for all task lists 44 // because the task list (at the moment) is identified by exactly 45 // this name in the parameter list (by MEvtLoop::SetParList) 46 // 41 47 MTaskList::MTaskList(const char *title) 42 48 { 43 //44 // the name for the task list must be the same for all task lists45 // because the task list (at the moment) is identified by exactly46 // this name in the parameter list (by MEvtLoop::SetParList)47 //48 49 *fName = "MTaskList"; 49 50 *fTitle = title ? title : "List for Tasks"; 50 51 // 52 // default constructor: create empty task list 53 // 54 } 55 51 } 52 53 // -------------------------------------------------------------------------- 54 // 55 // CopyConstructor 56 // creates a new TaskList and put the contents of an existing 57 // TaskList in the new TaskList. 58 // 56 59 MTaskList::MTaskList(MTaskList &ts) 57 60 { 58 //59 // CopyConstructor60 // creates a new TaskList and put the contents of an existing61 // TaskList in the new TaskList.62 //63 61 fTasks.AddAll(&ts.fTasks); 64 62 } 65 63 64 // -------------------------------------------------------------------------- 65 // 66 // create the Iterator over the tasklist 67 // 66 68 void MTaskList::SetLogStream(MLog *log) 67 69 { 68 //69 // create the Iterator over the tasklist70 //71 70 TIter Next(&fTasks); 72 71 … … 83 82 84 83 84 // -------------------------------------------------------------------------- 85 // 86 // schedule task for execution, whether as first task, or after 87 // 'where'. 'tType' is the event type which should be processed 88 // 85 89 Bool_t MTaskList::AddToList(MTask *task, const char *type, MTask *where) 86 90 { 87 // schedule task for execution, whether as first task, or after88 // 'where'. 'tType' is the event type which should be processed89 91 if (!task) 90 92 return kTRUE; … … 125 127 } 126 128 127 129 // -------------------------------------------------------------------------- 130 // 131 // do pre processing (before eventloop) of all tasks in the task-list 132 // 128 133 Bool_t MTaskList::PreProcess( MParList *pList ) 129 134 { 130 //131 // do pre processing (before eventloop) of all tasks in the task-list132 //133 135 *fLog << "Preprocessing... " << flush; 134 136 … … 156 158 } 157 159 160 // -------------------------------------------------------------------------- 161 // 162 // do the event execution of all tasks in the task-list 163 // 158 164 Bool_t MTaskList::Process() 159 165 { 160 // 161 // do the event execution of all tasks in the task-list 162 // 163 164 // 165 // create the Iterator for the TaskList 166 // 167 TIter Next(&fTasks); 168 MTask *task=NULL; 169 170 // 171 // loop over all tasks for processing 172 // 173 while ( (task=(MTask*)Next()) ) 174 { 175 if (!strcmp(GetStreamId(), task->GetStreamId()) || 176 !strcmp(task->GetStreamId(), "All")) 177 { 178 switch (task->Process()) 179 { 180 case kTRUE: 181 // 182 // everything was OK: go on 183 // 184 continue; 185 186 case kFALSE: 187 // 188 // an error occured: stop eventloop 189 // 190 return kFALSE; 191 192 case kCONTINUE: 193 // 194 // something occured: skip the rest of the tasks for this event 195 // 196 break; 197 } 198 } 199 } 200 return kTRUE; 201 } 202 166 // 167 // create the Iterator for the TaskList 168 // 169 TIter Next(&fTasks); 170 MTask *task=NULL; 171 172 // 173 // loop over all tasks for processing 174 // 175 while ( (task=(MTask*)Next()) ) 176 { 177 // 178 // if the task has the wrong stream id skip it. 179 // 180 if (strcmp(GetStreamId(), task->GetStreamId()) && 181 strcmp(task->GetStreamId(), "All")) 182 continue; 183 184 // 185 // if it has the right stream id execute the Process() function 186 // and check what the result of it is. 187 // 188 switch (task->Process()) 189 { 190 case kTRUE: 191 // 192 // everything was OK: go on 193 // 194 continue; 195 196 case kFALSE: 197 // 198 // an error occured: stop eventloop 199 // 200 return kFALSE; 201 202 case kCONTINUE: 203 // 204 // something occured: skip the rest of the tasks for this event 205 // 206 break; 207 } 208 } 209 return kTRUE; 210 } 211 212 // -------------------------------------------------------------------------- 213 // 214 // do post processing (before eventloop) of all tasks in the task-list 215 // 203 216 Bool_t MTaskList::PostProcess() 204 217 { 205 //206 // do post processing (before eventloop) of all tasks in the task-list207 //208 209 218 *fLog << "Postprocessing... " << flush; 210 219 211 // 212 // create the Iterator for the TaskList 213 // 214 TIter Next(&fTasks); 215 216 MTask *task=NULL; 217 218 // 219 // loop over all tasks for postprocessing 220 // 221 while ( (task=(MTask*)Next()) ) 222 { 223 *fLog << task->GetName() << "... " << flush; 224 225 if (!task->PostProcess()) 226 return kFALSE; 227 } 228 229 *fLog << endl; 230 231 return kTRUE; 232 } 233 234 235 220 // 221 // create the Iterator for the TaskList 222 // 223 TIter Next(&fTasks); 224 225 MTask *task=NULL; 226 227 // 228 // loop over all tasks for postprocessing 229 // 230 while ( (task=(MTask*)Next()) ) 231 { 232 *fLog << task->GetName() << "... " << flush; 233 234 if (!task->PostProcess()) 235 return kFALSE; 236 } 237 238 *fLog << endl; 239 240 return kTRUE; 241 } 242 243 // -------------------------------------------------------------------------- 236 244 void MTaskList::Print(Option_t *t) 237 245 {
Note:
See TracChangeset
for help on using the changeset viewer.