]> git.uio.no Git - u/mrichter/AliRoot.git/blob - SHUTTLE/DCSClient/AliDCSClient.h
major update (Alberto)
[u/mrichter/AliRoot.git] / SHUTTLE / DCSClient / 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 // For more info see AliDCSClient.cxx
13 //
14
15 #include "AliDCSMessage.h"
16
17 class TObjArray;
18 class TSocket;
19 class TMap;
20
21 class AliDCSClient: public TObject {
22 public:
23
24         enum {
25                 fgkBadState=-1,              // Bad state
26                 fgkInvalidParameter = -2,    // Invalid parameter
27                 fgkTimeout = -3,             // Timeout
28                 fgkBadMessage = -4,          // Bad message
29                 fgkCommError = -5,           // Communication error
30                 fgkServerError = -6          // Server error
31         };
32         
33         friend class AliShuttle;
34
35         AliDCSClient(const char* host, Int_t port, UInt_t timeout = 5000,
36                         Int_t retries = 5);
37         virtual ~AliDCSClient();
38
39
40         Int_t GetDPValues(const char* dpName, UInt_t startTime, UInt_t endTime,
41                                 TObjArray* result);
42
43         Int_t GetAliasValues(const char* alias, UInt_t startTime,
44                                 UInt_t endTime, TObjArray* result);
45
46         Int_t GetDPValues(UInt_t startTime, UInt_t endTime, TMap& result);
47
48         Int_t GetAliasValues(UInt_t startTime, UInt_t endTime, TMap& result);
49
50
51         AliDCSMessage::ErrorCode GetServerErrorCode() const
52                 { return fServerErrorCode;};
53
54         const TString& GetServerError() const {return fServerError;};
55
56
57         Bool_t IsConnected();
58
59         void Close();
60
61
62         static const char* GetErrorString(Int_t code);
63
64 private:
65         static const char* fgkBadStateString;           // Bad state string
66         static const char* fgkInvalidParameterString;   // Invalid parameter string
67         static const char* fgkTimeoutString;            // Timeout string
68         static const char* fgkBadMessageString;         // Bad message string
69         static const char* fgkCommErrorString;          // Communication error string
70         static const char* fgkServerErrorString;        // Server error string
71
72         AliDCSClient(const AliDCSClient& other);
73         AliDCSClient& operator= (const AliDCSClient& other);
74
75         TSocket* fSocket;       // Pointer to the TCP socket client
76
77         UInt_t fTimeout;        // timeout parameter
78
79         Int_t fRetries;         // number of retries
80
81         AliDCSMessage::ErrorCode fServerErrorCode;      // error code
82
83         TString fServerError;   // server error string
84
85
86         Int_t SendBuffer(const char* buffer, Int_t size);
87
88         Int_t ReceiveBuffer(char* buffer, Int_t size);
89
90         Int_t SendMessage(AliDCSMessage& message);
91
92         Int_t ReceiveMessage(AliDCSMessage& message);
93
94         Int_t GetValues(AliDCSMessage::RequestType requestType,
95                 const char* requestString, UInt_t startTime, UInt_t endTime,
96                 TObjArray* result);
97
98         Int_t GetValues(AliDCSMessage::RequestType requestType,
99                 UInt_t startTime, UInt_t endTime, TMap& result);
100
101         Int_t ReceiveValueSet(TObjArray* result);
102
103
104         ClassDef(AliDCSClient, 0);
105 };
106
107 #endif