Changeset 4828 for trunk/MagicSoft/Mars/mbase
- Timestamp:
- 09/02/04 14:32:50 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mbase
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mbase/MParContainer.h
r4710 r4828 101 101 virtual void SetDisplay(MStatusDisplay *d) { fDisplay = d; } 102 102 103 // FIXME: Change to ostream! 103 // FIXME: Change to ostream! Seems to be difficult, because 104 // MTaskListStreamPrimitive calls SavePrimitive(ofstream&). 105 // Maybe with a cast? 104 106 virtual void StreamPrimitive(ofstream &out) const; 105 107 -
trunk/MagicSoft/Mars/mbase/MParList.cc
r4694 r4828 51 51 52 52 #include "MIter.h" 53 #include "MTaskList.h" 53 54 54 55 ClassImp(MParList); … … 376 377 TObject *l = FindObject(tlist, "MTaskList"); 377 378 return (MTask*)(l ? l->FindObject(name) : NULL); 379 } 380 381 // -------------------------------------------------------------------------- 382 // 383 // Find a tasklist which contains a task with name name 384 // 385 MTaskList *MParList::FindTaskListWithTask(const char *name) const 386 { 387 TIter Next(fContainer); 388 TObject *o=0; 389 while ((o=Next())) 390 { 391 MTaskList *l1 = dynamic_cast<MTaskList*>(o); 392 if (!l1) 393 continue; 394 395 MTaskList *l2 = l1->FindTaskList(name); 396 if (l2) 397 return l2; 398 } 399 return 0; 400 } 401 402 // -------------------------------------------------------------------------- 403 // 404 // Find a tasklist which contains a task task 405 // 406 MTaskList *MParList::FindTaskListWithTask(const MTask *task) const 407 { 408 TIter Next(fContainer); 409 TObject *o=0; 410 while ((o=Next())) 411 { 412 MTaskList *l1 = dynamic_cast<MTaskList*>(o); 413 if (!l1) 414 continue; 415 416 MTaskList *l2 = l1->FindTaskList(task); 417 if (l2) 418 return l2; 419 } 420 return 0; 378 421 } 379 422 -
trunk/MagicSoft/Mars/mbase/MParList.h
r4694 r4828 22 22 class MLog; 23 23 class MTask; 24 class MTaskList; 24 25 25 26 class MParList : public MParContainer … … 53 54 void SetDisplay(MStatusDisplay *d); 54 55 55 TObject *FindObject(const char *name) const;56 TObject *FindObject(const TObject *obj) const;56 TObject *FindObject(const char *name) const; 57 TObject *FindObject(const TObject *obj) const; 57 58 58 TObject *FindObject(const char *name, const char *classname) const;59 TObject *FindObject(const TObject *obj, const char *classname) const;59 TObject *FindObject(const char *name, const char *classname) const; 60 TObject *FindObject(const TObject *obj, const char *classname) const; 60 61 61 MTask *FindTask(const char *name, const char *tlist="MTaskList") const; 62 MTask *FindTask(const char *name, const char *tlist="MTaskList") const; 63 MTaskList *FindTaskListWithTask(const char *name) const; 64 MTaskList *FindTaskListWithTask(const MTask *task) const; 62 65 63 66 MParContainer *FindCreateObj(const char *classname, const char *objname=NULL); -
trunk/MagicSoft/Mars/mbase/MTaskList.cc
r4601 r4828 229 229 Bool_t MTaskList::AddToListBefore(MTask *task, const MTask *where, const char *type) 230 230 { 231 if (task==this) 232 { 233 *fLog << warn << "WARNING - You cannot add a tasklist to itself. This" << endl; 234 *fLog << " would create infinite recursions...ignored." << endl; 235 return kFALSE; 236 237 } 238 231 239 // FIXME: We agreed to put the task into list in an ordered way. 232 240 if (!CheckAddToList(task, type, where)) … … 249 257 Bool_t MTaskList::AddToListAfter(MTask *task, const MTask *where, const char *type) 250 258 { 259 if (task==this) 260 { 261 *fLog << warn << "WARNING - You cannot add a tasklist to itself. This" << endl; 262 *fLog << " would create infinite recursions...ignored." << endl; 263 return kFALSE; 264 265 } 266 251 267 // FIXME: We agreed to put the task into list in an ordered way. 252 253 268 if (!CheckAddToList(task, type, where)) 254 269 return kFALSE; … … 270 285 Bool_t MTaskList::AddToList(MTask *task, const char *type) 271 286 { 287 if (task==this) 288 { 289 *fLog << warn << "WARNING - You cannot add a tasklist to itself. This" << endl; 290 *fLog << " would create infinite recursions...ignored." << endl; 291 return kFALSE; 292 293 } 294 272 295 // FIXME: We agreed to put the task into list in an ordered way. 273 274 296 if (!CheckAddToList(task, type)) 275 297 return kFALSE; … … 301 323 { 302 324 return fTasks->FindObject(obj); 325 } 326 327 // -------------------------------------------------------------------------- 328 // 329 // find recursively a tasklist which contains a task with name task 330 // 331 MTaskList *MTaskList::FindTaskList(const char *task) 332 { 333 if (FindObject(task)) 334 return this; 335 336 TIter Next(fTasks); 337 TObject *o = 0; 338 while ((o=Next())) 339 { 340 MTaskList *l = dynamic_cast<MTaskList*>(o); 341 if (!l) 342 continue; 343 344 if (l->FindObject(task)) 345 return l; 346 } 347 return 0; 348 } 349 350 // -------------------------------------------------------------------------- 351 // 352 // find recursively a tasklist which contains a task task 353 // 354 MTaskList *MTaskList::FindTaskList(const MTask *task) 355 { 356 if (FindObject(task)) 357 return this; 358 359 TIter Next(fTasks); 360 TObject *o = 0; 361 while ((o=Next())) 362 { 363 MTaskList *l = dynamic_cast<MTaskList*>(o); 364 if (!l) 365 continue; 366 367 if (l->FindObject(task)) 368 return l; 369 } 370 371 return 0; 303 372 } 304 373 -
trunk/MagicSoft/Mars/mbase/MTaskList.h
r4601 r4828 62 62 return (MTask*)FindObject(obj); 63 63 } 64 MTaskList *FindTaskList(const char *task); 65 MTaskList *FindTaskList(const MTask *task); 64 66 65 67 Bool_t ReInit(MParList *pList=NULL);
Note:
See TracChangeset
for help on using the changeset viewer.