source: trunk/MagicSoft/Mars/mbase/MTaskList.h@ 9492

Last change on this file since 9492 was 8642, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 3.4 KB
Line 
1#ifndef MARS_MTaskList
2#define MARS_MTaskList
3
4///////////////////////////////////////////////////////////////////////
5// //
6// MTaskList //
7// //
8// Collection of tasks to be processed in the eventloop //
9// //
10///////////////////////////////////////////////////////////////////////
11
12#ifndef MARS_MTask
13#include "MTask.h"
14#endif
15
16class MLog;
17class MParList;
18class MInputStreamID;
19
20class MTaskList : public MTask
21{
22private:
23 static const TString gsDefName; // default name
24 static const TString gsDefTitle; // default title
25
26 TList *fTasks; // Container for the ordered list of different tasks
27 TList fTasksProcess; //! Task which overload the Process function
28 MParList *fParList; //! The parameter list given in PreProcess
29
30 UInt_t fNumPasses;
31 UInt_t fNumPass; //!
32
33 enum { kIsOwner = BIT(14) };
34
35 void Remove(MTask *task);
36 void StreamPrimitive(ostream &out) const;
37 Bool_t CheckAddToList(MTask *task, /*const char *tType,*/ const MTask *where=NULL) const;
38 Int_t ProcessTaskList();
39
40public:
41 MTaskList(const char *name=NULL, const char *title=NULL);
42 MTaskList(const MTaskList &ts);
43
44 ~MTaskList();
45
46 void SetLogStream(MLog *log);
47 void SetDisplay(MStatusDisplay *d);
48 void SetAccelerator(Byte_t acc=kAccStandard);
49 void SetNumPasses(UInt_t cnt=0) { fNumPasses=cnt; }
50
51 UInt_t GetNumPass() const { return fNumPass; }
52 UInt_t GetNumPasses() const { return fNumPasses; }
53
54 Bool_t AddToListBefore(MTask *task, const MTask *where, const char *tType="All");
55 Bool_t AddToListAfter(MTask *task, const MTask *where, const char *tType="All");
56 Bool_t AddToList(MTask *task, const char *tType="All");
57 Bool_t AddToList(const TList &list, const char *tType="All");
58 Bool_t AddToListAfter(const TList &list, const MTask *where, const char *tType="All");
59 Bool_t AddToListBefore(const TList &list, const MTask *where, const char *tType="All");
60
61 void SetSerialNumber(Byte_t num);
62
63 Bool_t Replace(MTask *obj);
64 Bool_t RemoveFromList(MTask *task);
65 Bool_t RemoveFromList(const TList &list);
66
67 TObject *FindObject(const char *name) const;
68 TObject *FindObject(const TObject *obj) const;
69
70 MTask *FindTask(const char *name) const
71 {
72 return (MTask*)FindObject(name);
73 }
74 MTask *FindTask(const MTask *obj) const
75 {
76 return (MTask*)FindObject(obj);
77 }
78 MTaskList *FindTaskList(const char *task);
79 MTaskList *FindTaskList(const MTask *task);
80
81 Bool_t ReInit(MParList *pList=NULL);
82
83 Int_t PreProcess(MParList *pList);
84 Int_t Process();
85 Int_t PostProcess();
86
87 void Print(Option_t *opt = "") const;
88 void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE, Double_t time=-1) const;
89 void SetOwner(Bool_t enable=kTRUE);
90
91 const TList *GetList() const { return fTasks; }
92
93 void GetNames(TObjArray &arr) const;
94 void SetNames(TObjArray &arr);
95
96 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE);
97 Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const;
98
99 void RecursiveRemove(TObject *obj);
100
101 operator TIterator*() const;
102
103 ClassDef(MTaskList, 1) //collection of tasks to be performed in the eventloop
104};
105
106#endif
Note: See TracBrowser for help on using the repository browser.