4884201353b323084d4e5d61ce6fbc85f78b872c
[u/mrichter/AliRoot.git] / MONITOR / alistoragemanager / AliStorageEventManager.h
1 #ifndef AliStorageEventManager_H
2 #define AliStorageEventManager_H
3
4 #include "AliESDEvent.h"
5 #include "AliStorageTypes.h"
6
7 #include <vector>
8 #include <string>
9 #include <sstream>
10
11 #include <TMessage.h>
12
13 namespace zmq
14 {
15         class context_t;
16         class socket_t;
17 }
18
19 class AliStorageEventManager
20 {
21 public:
22         static AliStorageEventManager* GetEventManagerInstance();
23
24         void Send(std::vector<serverListStruct> list,storageSockets socket);
25         void Send(struct serverRequestStruct *request,storageSockets socket);
26         bool Send(struct clientRequestStruct *request,storageSockets socket,int timeout = -1);
27         void Send(AliESDEvent *event,storageSockets socket);
28         void Send(long message,storageSockets socket);
29         void Send(bool message,storageSockets socket);
30         void SendAsXml(AliESDEvent *event,storageSockets socket);
31         
32         std::vector<serverListStruct> GetServerListVector(storageSockets socket);
33         AliESDEvent* GetEvent(storageSockets socket,int timeout=-1,TTree **tmpTree=0);
34         struct serverRequestStruct* GetServerStruct(storageSockets socket);
35         struct clientRequestStruct* GetClientStruct(storageSockets socket);
36         long GetLong(storageSockets socket);
37         bool GetBool(storageSockets socket);
38
39
40         bool CreateSocket(storageSockets socket);
41 private:
42         AliStorageEventManager();
43         ~AliStorageEventManager();
44
45         static AliStorageEventManager *fManagerInstance;
46
47         std::string fStorageServer;
48         std::string fEventServer;
49         int fStorageServerPort;
50         int fStorageClientPort;
51         int fEventServerPort;
52         int fXmlServerPort;
53         
54         zmq::context_t *fContexts[7];
55         zmq::socket_t *fSockets[7];
56
57         AliStorageEventManager(const AliStorageEventManager&);
58         AliStorageEventManager& operator=(const AliStorageEventManager&);
59 };
60
61 #endif