Adding new functionality -
[u/mrichter/AliRoot.git] / SHUTTLE / DCSClient / AliDCSClient.h
CommitLineData
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 17class TObjArray;
58bc3020 18class TSocket;
73abe331 19class TMap;
a038aa70 20class TCollection;
73abe331 21
22class AliDCSClient: public TObject {
23public:
2bb7b766 24
eba76848 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 };
33
58bc3020 34 friend class AliShuttle;
2bb7b766 35
73abe331 36 AliDCSClient(const char* host, Int_t port, UInt_t timeout = 5000,
37 Int_t retries = 5);
38 virtual ~AliDCSClient();
39
40
41 Int_t GetDPValues(const char* dpName, UInt_t startTime, UInt_t endTime,
2bb7b766 42 TObjArray* result);
73abe331 43
44 Int_t GetAliasValues(const char* alias, UInt_t startTime,
2bb7b766 45 UInt_t endTime, TObjArray* result);
73abe331 46
a038aa70 47 TMap* GetDPValues(const TSeqCollection* dpList, UInt_t startTime, UInt_t endTime, Int_t startIndex = 0, Int_t endIndex = -1);
73abe331 48
a038aa70 49 TMap* GetAliasValues(const TSeqCollection* aliasList, UInt_t startTime, UInt_t endTime, Int_t startIndex = 0, Int_t endIndex = -1);
73abe331 50
58bc3020 51 AliDCSMessage::ErrorCode GetServerErrorCode() const
73abe331 52 { return fServerErrorCode;};
53
58bc3020 54 const TString& GetServerError() const {return fServerError;};
73abe331 55
56
57 Bool_t IsConnected();
58
59 void Close();
60
61
62 static const char* GetErrorString(Int_t code);
63
64private:
58bc3020 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
2bb7b766 72 AliDCSClient(const AliDCSClient& other);
73 AliDCSClient& operator= (const AliDCSClient& other);
58bc3020 74
75 TSocket* fSocket; // Pointer to the TCP socket client
2bb7b766 76
58bc3020 77 UInt_t fTimeout; // timeout parameter
73abe331 78
58bc3020 79 Int_t fRetries; // number of retries
2bb7b766 80
58bc3020 81 AliDCSMessage::ErrorCode fServerErrorCode; // error code
2bb7b766 82
58bc3020 83 TString fServerError; // server error string
73abe331 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
2bb7b766 92 Int_t ReceiveMessage(AliDCSMessage& message);
73abe331 93
94 Int_t GetValues(AliDCSMessage::RequestType requestType,
95 const char* requestString, UInt_t startTime, UInt_t endTime,
2bb7b766 96 TObjArray* result);
97
a038aa70 98 TMap* GetValues(AliDCSMessage::RequestType requestType,
99 const TSeqCollection* list, UInt_t startTime, UInt_t endTime,
100 Int_t startIndex, Int_t endIndex);
73abe331 101
2bb7b766 102 Int_t ReceiveValueSet(TObjArray* result);
73abe331 103
104
105 ClassDef(AliDCSClient, 0);
106};
107
108#endif