]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MONITOR/AliRecoServerThread.h
Update from Marta on her EMCAL user tasks
[u/mrichter/AliRoot.git] / MONITOR / AliRecoServerThread.h
1 // Author: Mihai Niculescu 2013
2
3 /**************************************************************************
4  * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
5  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
6  * full copyright notice.                                                 *
7  **************************************************************************/
8  
9 #ifndef __AliRecoServerThread_H__
10 #define __AliRecoServerThread_H__
11
12 #include <TQObject.h>
13 #include <RQ_OBJECT.h>
14 #include <TMutex.h>
15 #include <TCondition.h>
16
17 class TCondition;
18 class TMessage;
19 class TThread;
20
21 class AliReconstruction;
22 class AliESDEvent;
23
24 namespace zmq{
25         class context_t;
26         class socket_t;
27 }
28
29 class AliRecoServerThread : public TQObject
30 {
31 public:
32   AliRecoServerThread(zmq::context_t *context, AliReconstruction* reco);
33   virtual ~AliRecoServerThread();
34
35         Bool_t Start(const char* host);
36         Int_t Stop();
37         Bool_t ForceStop(); // imediate kill it, use it with rarely and with caution
38
39         zmq::context_t*                 GetContext() { return fContext; }
40         AliReconstruction*      GetReconstruction() { return fReco; }
41         const char*                                     GetHost() { return fHost.Data(); }
42         TCondition*                                                     Condition() { return fCond; }
43         
44         void Finished(Int_t status); // *SIGNAL*
45
46 private:
47         static void* RunThreaded(void* arg);
48         static void SendStreamerInfos(TMessage* mess, zmq::socket_t *sock);
49         static void SendEvent(AliESDEvent* event, zmq::socket_t* socket);
50         
51         // shared
52         zmq::context_t* fContext;
53         AliReconstruction* fReco;
54
55         // local        
56         TString                                                                         fHost;
57   TThread*                                                              fThread;
58   TCondition*                                           fCond; // condition whether to stop reco/clean exit thread
59
60 private:
61   AliRecoServerThread(const AliRecoServerThread&);            // Not implemented
62   AliRecoServerThread& operator=(const AliRecoServerThread&); // Not implemented
63   
64 public:
65   
66   ClassDef(AliRecoServerThread, 0);  
67 };
68 #endif /* __AliReconstructionThread_H__ */
69