source: tags/Mars-V0.5/mbase/MTask.h

Last change on this file was 1020, checked in by tbretz, 23 years ago
*** empty log message ***
File size: 2.6 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 TOrdCollection;
17
18class MFilter;
19class MParList;
20
21class MTask : public MInputStreamID
22{
23private:
24 TOrdCollection *fListOfBranches; // List of Branch names for auto enabeling scheme
25
26 const 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(const MFilter *filter) { fFilter=filter; }
71 virtual void PrintStatistics(const Int_t lvl=0) const;
72
73 UInt_t GetNumExecutions() { return fNumExecutions; }
74
75 Bool_t CallPreProcess(MParList *plist);
76 Bool_t CallProcess();
77 Bool_t CallPostProcess();
78
79 const TOrdCollection *GetListOfBranches() const { return fListOfBranches; }
80
81 ClassDef(MTask, 0) //Abstract base class for a task
82};
83
84#endif
Note: See TracBrowser for help on using the repository browser.