| 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 |  | 
|---|
| 16 | class MLog; | 
|---|
| 17 | class MParList; | 
|---|
| 18 | class MInputStreamID; | 
|---|
| 19 |  | 
|---|
| 20 | class MTaskList : public MTask | 
|---|
| 21 | { | 
|---|
| 22 | private: | 
|---|
| 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 | enum { kIsOwner = BIT(14) }; | 
|---|
| 31 |  | 
|---|
| 32 | void   Remove(MTask *task); | 
|---|
| 33 | void   StreamPrimitive(ofstream &out) const; | 
|---|
| 34 | Bool_t CheckAddToList(MTask *task, const char *tType, const MTask *where=NULL) const; | 
|---|
| 35 |  | 
|---|
| 36 | public: | 
|---|
| 37 | MTaskList(const char *name=NULL, const char *title=NULL); | 
|---|
| 38 | MTaskList(MTaskList &ts); | 
|---|
| 39 |  | 
|---|
| 40 | ~MTaskList(); | 
|---|
| 41 |  | 
|---|
| 42 | void SetLogStream(MLog *log); | 
|---|
| 43 | void SetDisplay(MStatusDisplay *d); | 
|---|
| 44 |  | 
|---|
| 45 | Bool_t AddToListBefore(MTask *task, const MTask *where, const char *tType="All"); | 
|---|
| 46 | Bool_t AddToListAfter(MTask *task, const MTask *where, const char *tType="All"); | 
|---|
| 47 | Bool_t AddToList(MTask *task, const char *tType="All"); | 
|---|
| 48 |  | 
|---|
| 49 | Bool_t RemoveFromList(MTask *task); | 
|---|
| 50 |  | 
|---|
| 51 | TObject *FindObject(const char *name) const; | 
|---|
| 52 | TObject *FindObject(const TObject *obj) const; | 
|---|
| 53 |  | 
|---|
| 54 | MTask *FindTask(const char *name) const | 
|---|
| 55 | { | 
|---|
| 56 | return (MTask*)FindObject(name); | 
|---|
| 57 | } | 
|---|
| 58 | MTask *FindTask(const MTask *obj) const | 
|---|
| 59 | { | 
|---|
| 60 | return (MTask*)FindObject(obj); | 
|---|
| 61 | } | 
|---|
| 62 |  | 
|---|
| 63 | Bool_t ReInit(MParList *pList=NULL); | 
|---|
| 64 |  | 
|---|
| 65 | Int_t PreProcess(MParList *pList); | 
|---|
| 66 | Int_t Process(); | 
|---|
| 67 | Int_t PostProcess(); | 
|---|
| 68 |  | 
|---|
| 69 | void Print(Option_t *opt = "") const; | 
|---|
| 70 | void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const; | 
|---|
| 71 | void SetOwner(Bool_t enable=kTRUE); | 
|---|
| 72 |  | 
|---|
| 73 | const TList *GetList() const { return fTasks; } | 
|---|
| 74 |  | 
|---|
| 75 | void GetNames(TObjArray &arr) const; | 
|---|
| 76 | void SetNames(TObjArray &arr); | 
|---|
| 77 |  | 
|---|
| 78 | Bool_t ReadEnv(const TEnv &env, TString prefix, Bool_t print=kFALSE); | 
|---|
| 79 | Bool_t WriteEnv(TEnv &env, TString prefix, Bool_t print=kFALSE) const; | 
|---|
| 80 |  | 
|---|
| 81 | ClassDef(MTaskList, 1) //collection of tasks to be performed in the eventloop | 
|---|
| 82 | }; | 
|---|
| 83 |  | 
|---|
| 84 | #endif | 
|---|