]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/AliDCSClient.h
Add new alignment object for fully misaligned PHOS
[u/mrichter/AliRoot.git] / SHUTTLE / AliDCSClient.h
1 #ifndef ALI_DCS_CLIENT_H
2 #define ALI_DCS_CLIENT_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 represents the AliDCSClient.
11 // The client used for data retrieval from DCS server.
12 //
13
14 #include "AliDCSMessage.h"
15
16 #include <TSocket.h>
17
18
19 class TObjArray;
20 class TMap;
21
22 class AliDCSClient: public TObject {
23 public:
24         
25         static const Int_t fgkBadState = -1;
26
27         static const Int_t fgkInvalidParameter = -2;
28
29         static const Int_t fgkTimeout = -3;
30
31         static const Int_t fgkBadMessage = -4;
32
33         static const Int_t fgkCommError = -5;
34
35         static const Int_t fgkServerError = -6;
36
37         static const char* fgkBadStateString;
38
39         static const char* fgkInvalidParameterString;
40
41         static const char* fgkTimeoutString;
42
43         static const char* fgkBadMessageString; 
44
45         static const char* fgkCommErrorString;
46
47         static const char* fgkServerErrorString;
48
49
50         AliDCSClient(const char* host, Int_t port, UInt_t timeout = 5000,
51                         Int_t retries = 5);
52         virtual ~AliDCSClient();
53
54
55         Int_t GetDPValues(const char* dpName, UInt_t startTime, UInt_t endTime,
56                                 TObjArray& result);
57
58         Int_t GetAliasValues(const char* alias, UInt_t startTime,
59                                 UInt_t endTime, TObjArray& result);
60
61         Int_t GetDPValues(UInt_t startTime, UInt_t endTime, TMap& result);
62
63         Int_t GetAliasValues(UInt_t startTime, UInt_t endTime, TMap& result);
64
65
66         AliDCSMessage::ErrorCode GetServerErrorCode()
67                 { return fServerErrorCode;};
68
69         const TString& GetServerError() {return fServerError;};
70
71
72         Bool_t IsConnected();
73
74         void Close();
75
76
77         static const char* GetErrorString(Int_t code);
78
79 private:
80
81         TSocket* fSocket;
82         
83         UInt_t fTimeout;
84
85         Int_t fRetries;
86         
87         AliDCSMessage::ErrorCode fServerErrorCode;
88         
89         TString fServerError;
90
91
92         Int_t SendBuffer(const char* buffer, Int_t size);
93
94         Int_t ReceiveBuffer(char* buffer, Int_t size);
95
96         Int_t SendMessage(AliDCSMessage& message);
97
98         Int_t ReceiveMessage(AliDCSMessage& message);   
99
100         Int_t GetValues(AliDCSMessage::RequestType requestType,
101                 const char* requestString, UInt_t startTime, UInt_t endTime,
102                 TObjArray& result);
103         
104         Int_t GetValues(AliDCSMessage::RequestType requestType,
105                 UInt_t startTime, UInt_t endTime, TMap& result);
106
107         Int_t ReceiveValueSet(TObjArray& result);
108
109
110         ClassDef(AliDCSClient, 0);
111 };
112
113 #endif