o) removed files that were moved to STEER
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleTrigger.h
1 #ifndef ALI_SHUTTLE_TRIGGER_H
2 #define ALI_SHUTTLE_TRIGGER_H
3
4 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5  * See cxx source for full Copyright notice                               */
6
7 /* $Id$ */
8
9 //
10 // This class is to deal with DAQ LogBook and DAQ end run notification.
11 // It executes AliShuttle for retrieval of conditions data.
12 //
13
14 #include <TObject.h>
15 #include <TSysEvtHandler.h>
16 #include <TMutex.h>
17 #include <TCondition.h>
18
19
20 class AliCDBStorage;
21 class AliShuttle;
22 class AliShuttleConfig;
23
24 class AliShuttleTrigger;
25 class DATENotifier;
26
27 class TerminateSignalHandler: public TSignalHandler {
28         
29         AliShuttleTrigger* fTrigger;
30 public:
31         TerminateSignalHandler(AliShuttleTrigger* trigger, ESignals signal):
32                 TSignalHandler(signal, kFALSE), fTrigger(trigger) {}
33
34         virtual Bool_t Notify();
35
36         ClassDef(TerminateSignalHandler, 0)
37 };
38
39 class AliShuttleTrigger: public TObject {
40 public:
41         AliShuttleTrigger(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
42         ~AliShuttleTrigger();
43
44         AliShuttle* GetShuttle() {return fShuttle;}
45
46         Bool_t Collect(Int_t run);
47         Bool_t CollectNew();
48         Bool_t CollectAll();
49         
50         virtual Bool_t Notify();
51         void Terminate();
52
53         void Run();
54
55 private:
56
57         class DATEEntry: public TObject {
58                 Int_t fRun;
59                 UInt_t fStartTime;
60                 UInt_t fEndTime;
61         public:
62                 DATEEntry(Int_t run, UInt_t startTime, UInt_t endTime):
63                         fRun(run), fStartTime(startTime), fEndTime(endTime) {}
64
65                 Int_t GetRun() {return fRun;}
66                 UInt_t GetStartTime() {return fStartTime;}
67                 UInt_t GetEndTime() {return fEndTime;}
68
69                 ClassDef(DATEEntry, 0)
70         };
71
72         Bool_t RetrieveDATEEntries(const char* whereClause, TObjArray& entries,
73                         Int_t& lastRun);
74         Bool_t RetrieveConditionsData(const TObjArray& dateEntries);
75
76         const AliShuttleConfig* fConfig;
77         //AliCDBStorage* fLocalStorage;
78
79         AliShuttle* fShuttle;
80
81         Bool_t fNotified;
82         Bool_t fTerminate;
83
84         TMutex fMutex;
85         TCondition fCondition;
86
87         TerminateSignalHandler fQuitSignalHandler;
88         TerminateSignalHandler fInterruptSignalHandler;
89
90
91         ClassDef(AliShuttleTrigger, 0)
92 };
93
94 #endif