]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - SHUTTLE/DCSClient/AliDCSClient.h
TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / SHUTTLE / DCSClient / AliDCSClient.h
... / ...
CommitLineData
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
17class TObjArray;
18class TSocket;
19class TMap;
20class TCollection;
21
22class AliDCSClient: public TObject {
23public:
24
25 enum {
26 fgkBadState=-1, // Bad state
27 fgkInvalidParameter = -2, // Invalid parameter
28 fgkTimeout = -3, // Timeout
29 fgkBadMessage = -4, // Bad message
30 fgkCommError = -5, // Communication error
31 fgkServerError = -6, // Server error
32 fgkUnknownDP = -7 // unknown alias/DP error
33 };
34
35 AliDCSClient(const char* host, Int_t port, UInt_t timeout = 5000,
36 Int_t retries = 5, Int_t multiSplit = 100);
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 TMap* GetDPValues(const TSeqCollection* dpList, UInt_t startTime, UInt_t endTime, Int_t startIndex = 0, Int_t endIndex = -1);
47
48 TMap* GetAliasValues(const TSeqCollection* aliasList, UInt_t startTime, UInt_t endTime, Int_t startIndex = 0, Int_t endIndex = -1);
49
50 AliDCSMessage::ErrorCode GetServerErrorCode() const
51 { return fServerErrorCode;}
52
53 Int_t GetResultErrorCode() const {return fResultErrorCode;}
54 const TString& GetServerError() const {return fServerError;}
55
56
57 Bool_t IsConnected();
58
59 void Close();
60
61 static const char* GetErrorString(Int_t code);
62
63private:
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 static const char* fgkUnknownDPString; // Unknown alias/DP string
71
72 TSocket* fSocket; // Pointer to the TCP socket client
73 TString fHost; // server host
74 Int_t fPort; // server port
75 UInt_t fTimeout; // timeout parameter
76 Int_t fRetries; // number of retries
77 Int_t fMultiSplit; // number of datapoints that are queried at a time in a multi dp request, if set to 1 forces single requests
78 AliDCSMessage::ErrorCode fServerErrorCode; // server error code
79 TString fServerError; // server error string
80
81 Int_t fResultErrorCode; // result error code
82
83 Bool_t Connect();
84
85 Int_t SendBuffer(const char* buffer, Int_t size);
86 Int_t ReceiveBuffer(char* buffer, Int_t size);
87 Int_t SendMessage(AliDCSMessage& message);
88 Int_t ReceiveMessage(AliDCSMessage& message);
89
90 Int_t GetValues(AliDCSMessage::RequestType requestType,
91 const char* requestString, UInt_t startTime, UInt_t endTime,
92 TObjArray* result);
93
94 TMap* GetValues(AliDCSMessage::RequestType requestType,
95 const TSeqCollection* list, UInt_t startTime, UInt_t endTime,
96 Int_t startIndex, Int_t endIndex);
97
98 Int_t ReceiveValueSet(TObjArray* result, Int_t& ownerIndex);
99
100 AliDCSClient(const AliDCSClient& other); // not implemented
101 AliDCSClient& operator= (const AliDCSClient& other); // not implemented
102
103 ClassDef(AliDCSClient, 0);
104};
105
106#endif