Implement symbolic links
[u/mrichter/AliRoot.git] / SHUTTLE / AliShuttleTrigger.h
CommitLineData
d477ad88 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.
58bc3020 12// For more info see AliShuttleTrigger.cxx
d477ad88 13//
14
15#include <TObject.h>
16#include <TSysEvtHandler.h>
17#include <TMutex.h>
18#include <TCondition.h>
19
20
21class AliCDBStorage;
22class AliShuttle;
23class AliShuttleConfig;
24
25class AliShuttleTrigger;
26class DATENotifier;
27
28class TerminateSignalHandler: public TSignalHandler {
29
d477ad88 30public:
58bc3020 31 TerminateSignalHandler(): TSignalHandler((ESignals) 0,0), fTrigger(0) { }
d477ad88 32 TerminateSignalHandler(AliShuttleTrigger* trigger, ESignals signal):
33 TSignalHandler(signal, kFALSE), fTrigger(trigger) {}
34
58bc3020 35 virtual ~TerminateSignalHandler() { }
d477ad88 36 virtual Bool_t Notify();
37
58bc3020 38private:
39
40 TerminateSignalHandler(const TerminateSignalHandler& other);
41 TerminateSignalHandler& operator= (const TerminateSignalHandler& other);
42
43 AliShuttleTrigger* fTrigger; // pointer to the current AliShuttleTrigger
44
d477ad88 45 ClassDef(TerminateSignalHandler, 0)
46};
47
48class AliShuttleTrigger: public TObject {
49public:
b948db8d 50 AliShuttleTrigger(const AliShuttleConfig* config, UInt_t timeout = 5000, Int_t retries = 5);
d477ad88 51 ~AliShuttleTrigger();
52
53 AliShuttle* GetShuttle() {return fShuttle;}
54
55 Bool_t Collect(Int_t run);
56 Bool_t CollectNew();
57 Bool_t CollectAll();
7bfb2090 58
59 Bool_t SetNewLastRun(Int_t run);
60
d477ad88 61 virtual Bool_t Notify();
62 void Terminate();
63
64 void Run();
65
66private:
67
58bc3020 68 AliShuttleTrigger(const AliShuttleTrigger& other);
69 AliShuttleTrigger& operator= (const AliShuttleTrigger& other);
70
71 class AliShuttleTriggerDATEEntry: public TObject {
d477ad88 72 public:
58bc3020 73 AliShuttleTriggerDATEEntry(Int_t run, UInt_t startTime, UInt_t endTime):
d477ad88 74 fRun(run), fStartTime(startTime), fEndTime(endTime) {}
75
58bc3020 76 Int_t GetRun() const {return fRun;}
77 UInt_t GetStartTime() const {return fStartTime;}
78 UInt_t GetEndTime() const {return fEndTime;}
d477ad88 79
58bc3020 80 private:
81 Int_t fRun; // Run number
82 UInt_t fStartTime; // Run start time
83 UInt_t fEndTime; // Run end time
84 ClassDef(AliShuttleTriggerDATEEntry, 0)
d477ad88 85 };
86
a7160fe9 87 Bool_t RetrieveDATEEntries(const char* whereClause, TObjArray& entries);
7bfb2090 88 Bool_t RetrieveConditionsData(const TObjArray& dateEntries, Bool_t updateLastRun);
89
90 Bool_t ReadLastRun();
91 Bool_t WriteLastRun();
d477ad88 92
93 const AliShuttleConfig* fConfig;
b948db8d 94 //AliCDBStorage* fLocalStorage;
d477ad88 95
58bc3020 96 AliShuttle* fShuttle; // Pointer to the actual Shuttle instance
d477ad88 97
58bc3020 98 Bool_t fNotified; // Notified flag
99 Bool_t fTerminate; // Terminate flag
d477ad88 100
7bfb2090 101 Int_t fLastRun; // last sucessfully processed run
102
58bc3020 103 TMutex fMutex; // Mutex
104 TCondition fCondition; // Condition
d477ad88 105
58bc3020 106 TerminateSignalHandler fQuitSignalHandler; // Quit signal
107 TerminateSignalHandler fInterruptSignalHandler; // Interrupt signal
d477ad88 108
109
110 ClassDef(AliShuttleTrigger, 0)
111};
112
113#endif