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