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

Last change on this file since 9492 was 7804, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 3.0 KB
Line 
1#ifndef MARS_MEvtLoop
2#define MARS_MEvtLoop
3
4/////////////////////////////////////////////////////////////////////////////
5// //
6// MEvtLoop //
7// //
8// Class to execute the tasks in a tasklist //
9// //
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef MARS_MParContainer
13#include "MParContainer.h"
14#endif
15
16class MTask;
17class MParList;
18class MTaskList;
19class TGProgressBar;
20#ifdef __MARS__
21class MProgressBar;
22#endif
23
24class MEvtLoop : public MParContainer
25{
26private:
27 MParList *fParList;
28 MTaskList *fTaskList; //!
29
30 TGProgressBar *fProgress; //!
31
32 ULong_t fNumEvents; //!
33
34 enum { kIsOwner = BIT(14), kPrivateDisplay = BIT(15) };
35
36 Bool_t HasDuplicateNames(const TString txt) const;
37 Bool_t HasDuplicateNames(TObjArray &arr, const TString txt) const;
38
39 void StreamPrimitive(ostream &out) const;
40
41 Bool_t ProcessGuiEvents(Int_t num);
42 static UInt_t GetMemoryUsage();
43
44public:
45 enum Statistics_t {
46 kNoStatistics = 0,
47 kStdStatistics = 1,
48 kFullStatistics = 2
49 };
50
51 MEvtLoop(const char *name="Evtloop");
52 virtual ~MEvtLoop();
53
54 void SetParList(MParList *p);
55 MParList *GetParList() const { return fParList; }
56 MTaskList *GetTaskList() const { return fTaskList; }
57
58 MTask *FindTask(const char *name) const;
59 MTask *FindTask(const MTask *obj) const;
60
61 MStatusDisplay *GetDisplay() { return fDisplay; }
62 void SetDisplay(MStatusDisplay *d);
63 void SetPrivateDisplay(Bool_t b=kTRUE) { b ? SetBit(kPrivateDisplay) : ResetBit(kPrivateDisplay); } // Prevent status display from being cascaded in PreProcess
64
65 void SetOwner(Bool_t enable=kTRUE);
66
67 void SetProgressBar(TGProgressBar *bar);
68#ifdef __MARS__
69 void SetProgressBar(MProgressBar *bar);
70#endif
71
72 Bool_t PreProcess();
73 Int_t Process(UInt_t maxcnt);
74 Bool_t PostProcess() const;
75
76 Bool_t Eventloop(UInt_t maxcnt=0, Statistics_t printstat=kStdStatistics);
77
78 void MakeMacro(const char *filename="evtloop.C");
79
80 void SavePrimitive(ostream &out, Option_t *o="");
81 void SavePrimitive(ofstream &out, Option_t *o="");
82
83 Int_t Read(const char *name="Evtloop");
84 Int_t Write(const char *name="Evtloop", Int_t option=0, Int_t bufsize=0) const;
85 Int_t Write(const char *name="Evtloop", Int_t option=0, Int_t bufsize=0)
86 {
87 return const_cast<MEvtLoop*>(this)->Write(name, option, bufsize);
88 }
89
90 void Print(Option_t *opt="") const;
91
92 Int_t ReadEnv(const TEnv &env, TString prefix="", Bool_t print=kFALSE);
93 Bool_t WriteEnv(TEnv &env, TString prefix="", Bool_t print=kFALSE) const;
94
95 Bool_t ReadEnv(const char *config, Bool_t print=kFALSE);
96
97 void RecursiveRemove(TObject *obj);
98
99 ClassDef(MEvtLoop, 1) // Class to execute the tasks in a tasklist
100};
101
102#endif
Note: See TracBrowser for help on using the repository browser.