memory consumption measures only memory used by preprocessor
[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
fcbad67c 31 fgkServerError = -6, // Server error
32 fgkUnknownDP = -7 // unknown alias/DP error
eba76848 33 };
34
b41b252a 35//// friend class AliShuttle;
2bb7b766 36
73abe331 37 AliDCSClient(const char* host, Int_t port, UInt_t timeout = 5000,
b41b252a 38 Int_t retries = 5, Int_t multiSplit = 100);
73abe331 39 virtual ~AliDCSClient();
40
41
42 Int_t GetDPValues(const char* dpName, UInt_t startTime, UInt_t endTime,
2bb7b766 43 TObjArray* result);
73abe331 44
45 Int_t GetAliasValues(const char* alias, UInt_t startTime,
2bb7b766 46 UInt_t endTime, TObjArray* result);
73abe331 47
a038aa70 48 TMap* GetDPValues(const TSeqCollection* dpList, UInt_t startTime, UInt_t endTime, Int_t startIndex = 0, Int_t endIndex = -1);
73abe331 49
a038aa70 50 TMap* GetAliasValues(const TSeqCollection* aliasList, UInt_t startTime, UInt_t endTime, Int_t startIndex = 0, Int_t endIndex = -1);
73abe331 51
58bc3020 52 AliDCSMessage::ErrorCode GetServerErrorCode() const
bee83158 53 { return fServerErrorCode;}
73abe331 54
1790d4b7 55 Int_t GetResultErrorCode() const {return fResultErrorCode;}
bee83158 56 const TString& GetServerError() const {return fServerError;}
73abe331 57
58
59 Bool_t IsConnected();
60
61 void Close();
62
73abe331 63 static const char* GetErrorString(Int_t code);
64
65private:
58bc3020 66 static const char* fgkBadStateString; // Bad state string
67 static const char* fgkInvalidParameterString; // Invalid parameter string
68 static const char* fgkTimeoutString; // Timeout string
69 static const char* fgkBadMessageString; // Bad message string
70 static const char* fgkCommErrorString; // Communication error string
71 static const char* fgkServerErrorString; // Server error string
fcbad67c 72 static const char* fgkUnknownDPString; // Unknown alias/DP string
58bc3020 73
58bc3020 74 TSocket* fSocket; // Pointer to the TCP socket client
bee83158 75 TString fHost; // server host
76 Int_t fPort; // server port
58bc3020 77 UInt_t fTimeout; // timeout parameter
58bc3020 78 Int_t fRetries; // number of retries
b41b252a 79 Int_t fMultiSplit; // number of datapoints that are queried at a time in a multi dp request, if set to 1 forces single requests
1790d4b7 80 AliDCSMessage::ErrorCode fServerErrorCode; // server error code
58bc3020 81 TString fServerError; // server error string
1790d4b7 82
83 Int_t fResultErrorCode; // result error code
73abe331 84
bee83158 85 Bool_t Connect();
73abe331 86
87 Int_t SendBuffer(const char* buffer, Int_t size);
73abe331 88 Int_t ReceiveBuffer(char* buffer, Int_t size);
73abe331 89 Int_t SendMessage(AliDCSMessage& message);
2bb7b766 90 Int_t ReceiveMessage(AliDCSMessage& message);
73abe331 91
92 Int_t GetValues(AliDCSMessage::RequestType requestType,
93 const char* requestString, UInt_t startTime, UInt_t endTime,
2bb7b766 94 TObjArray* result);
95
a038aa70 96 TMap* GetValues(AliDCSMessage::RequestType requestType,
97 const TSeqCollection* list, UInt_t startTime, UInt_t endTime,
98 Int_t startIndex, Int_t endIndex);
73abe331 99
4e3d5771 100 Int_t ReceiveValueSet(TObjArray* result, Int_t& ownerIndex);
73abe331 101
bee83158 102 AliDCSClient(const AliDCSClient& other); // not implemented
103 AliDCSClient& operator= (const AliDCSClient& other); // not implemented
73abe331 104
105 ClassDef(AliDCSClient, 0);
106};
107
108#endif