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

Last change on this file since 2018 was 2015, 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 void AddToBranchList(const char *master, const char *sub, const UInt_t first, const UInt_t last)
39 {
40 if (first==0 && last==0)
41 {
42 AddToBranchList(sub);
43 return;
44 }
45
46 for (unsigned int i=first; i<last+1; i++)
47 AddToBranchList(Form("%s;%d.%s", master, i, sub));
48 }
49 void AddToBranchList(TString &master, TString &sub, const UInt_t first, const UInt_t last)
50 {
51 AddToBranchList((const char*)master, (const char*)sub, first, last);
52 }
53 void AddToBranchList(const char *master, const char *sub, const UInt_t num)
54 {
55 AddToBranchList(master, sub, 0, num);
56 }
57 void AddToBranchList(TString &master, TString &sub, const UInt_t num)
58 {
59 AddToBranchList(master, sub, 0, num);
60 }
61
62public:
63 MTask(const char *name=NULL, const char *title=NULL);
64 MTask(MTask &t);
65 virtual ~MTask();
66
67 virtual void SetFilter(MFilter *filter) { fFilter=filter; }
68 const MFilter *GetFilter() const { return fFilter; }
69 MFilter *GetFilter() { return fFilter; } // for MContinue only
70 virtual void PrintStatistics(const Int_t lvl=0, Bool_t title=kFALSE) const;
71
72 UInt_t GetNumExecutions() { return fNumExecutions; }
73
74 virtual Bool_t ReInit(MParList *pList);
75
76 virtual Bool_t CallPreProcess(MParList *plist);
77 virtual Bool_t CallProcess();
78 virtual Bool_t CallPostProcess();
79
80 const TList *GetListOfBranches() const { return fListOfBranches; }
81
82 Bool_t OverwritesProcess(TClass *cls=NULL) const;
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.