source: trunk/MagicSoft/Mars/mbase/MTask.h@ 1526

Last change on this file since 1526 was 1501, checked in by tbretz, 22 years ago
*** empty log message ***
File size: 2.8 KB
Line 
1#ifndef MARS_MTask
2#define MARS_MTask
3
4/////////////////////////////////////////////////////////////////////////////
5// //
6// MTask //
7// //
8// Abstract base class for a task //
9// //
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef MARS_MInputStreamID
13#include "MInputStreamID.h"
14#endif
15
16class TList;
17
18class MFilter;
19class MParList;
20
21class MTask : public MInputStreamID
22{
23private:
24 TList *fListOfBranches; //! List of Branch names for auto enabeling scheme
25
26 MFilter *fFilter; // Filter for conditional task execution
27
28 Bool_t fIsPreprocessed; //! Indicates the success of the PreProcessing (set by MTaskList)
29 UInt_t fNumExecutions; //! Number of Excutions
30
31 virtual Bool_t PreProcess(MParList *pList);
32 virtual Bool_t Process();
33 virtual Bool_t PostProcess();
34
35protected:
36 void AddToBranchList(const char *b);
37 void AddToBranchList(const TString &str)
38 {
39 AddToBranchList((const char*)str);
40 }
41 void AddToBranchList(const char *master, const char *sub, const UInt_t first, const UInt_t last)
42 {
43 if (first==0 && last==0)
44 {
45 AddToBranchList(sub);
46 return;
47 }
48
49 for (unsigned int i=first; i<last+1; i++)
50 AddToBranchList(Form("%s;%d.%s", master, i, sub));
51 }
52 void AddToBranchList(TString &master, TString &sub, const UInt_t first, const UInt_t last)
53 {
54 AddToBranchList((const char*)master, (const char*)sub, first, last);
55 }
56 void AddToBranchList(const char *master, const char *sub, const UInt_t num)
57 {
58 AddToBranchList(master, sub, 0, num);
59 }
60 void AddToBranchList(TString &master, TString &sub, const UInt_t num)
61 {
62 AddToBranchList(master, sub, 0, num);
63 }
64
65public:
66 MTask(const char *name=NULL, const char *title=NULL);
67 MTask(MTask &t);
68 virtual ~MTask();
69
70 void SetFilter(MFilter *filter) { fFilter=filter; }
71 const MFilter *GetFilter() const { return fFilter; }
72 virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
73
74 UInt_t GetNumExecutions() { return fNumExecutions; }
75
76 virtual Bool_t ReInit(MParList *pList);
77
78 virtual Bool_t CallPreProcess(MParList *plist);
79 virtual Bool_t CallProcess();
80 virtual Bool_t CallPostProcess();
81
82 const TList *GetListOfBranches() const { return fListOfBranches; }
83
84 void SavePrimitive(ofstream &out, Option_t *o="");
85
86 ClassDef(MTask, 1) //Abstract base class for a task
87};
88
89#endif
Note: See TracBrowser for help on using the repository browser.