db0b8e068a453d8103aa8767d7c353ef5b03ef43
[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 // For more info see AliShuttleTrigger.cxx
13 //
14
15 #include <TObject.h>
16 #include <TSysEvtHandler.h>
17 #include <TMutex.h>
18 #include <TCondition.h>
19
20
21 class AliShuttle;
22 class AliShuttleConfig;
23
24 class AliShuttleTrigger;
25 class DATENotifier;
26
27 class TerminateSignalHandler: public TSignalHandler {
28         
29 public:
30         TerminateSignalHandler(): TSignalHandler((ESignals) 0,0), fTrigger(0) { }
31         TerminateSignalHandler(AliShuttleTrigger* trigger, ESignals signal):
32                 TSignalHandler(signal, kFALSE), fTrigger(trigger) {}
33
34         virtual ~TerminateSignalHandler() { }
35         virtual Bool_t Notify();
36
37 private:
38
39         TerminateSignalHandler(const TerminateSignalHandler& other);    
40         TerminateSignalHandler& operator= (const TerminateSignalHandler& other);        
41
42         AliShuttleTrigger* fTrigger;  // pointer to the current AliShuttleTrigger
43
44         ClassDef(TerminateSignalHandler, 0)
45 };
46
47 class AliShuttleTrigger: public TObject {
48
49 public:
50         AliShuttleTrigger(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
51         ~AliShuttleTrigger();
52
53         AliShuttle* GetShuttle() {return fShuttle;}
54
55         Bool_t Collect(Int_t run);
56         Bool_t CollectNew();
57         Bool_t CollectAll();
58
59         virtual Bool_t Notify();
60         void Terminate();
61
62         void Run();
63
64 private:
65         AliShuttleTrigger(const AliShuttleTrigger& other);
66         AliShuttleTrigger& operator= (const AliShuttleTrigger& other);
67
68         const AliShuttleConfig* fConfig;
69
70         AliShuttle* fShuttle;           // Pointer to the actual Shuttle instance
71
72         Bool_t fNotified;               // Notified flag
73         Bool_t fTerminate;              // Terminate flag
74
75         TMutex fMutex;                  // Mutex
76         TCondition fCondition;          // Condition 
77
78         TerminateSignalHandler fQuitSignalHandler;              // Quit signal 
79         TerminateSignalHandler fInterruptSignalHandler;         // Interrupt signal
80
81
82         ClassDef(AliShuttleTrigger, 0)
83 };
84
85 #endif