]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliDCSValue.h
revision of AliDCSValue: Removed wrapper classes, reduced storage size per value...
[u/mrichter/AliRoot.git] / STEER / AliDCSValue.h
1 #ifndef ALI_DCS_VALUE_H
2 #define ALI_DCS_VALUE_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 value(s) of a DCS data point at a given timestamp
11 //
12
13 #include <TObject.h>
14
15 class AliDCSValue : public TObject {
16 public:
17   enum Type {
18     kInvalid = 0,
19
20     kBool = 1,
21     kChar = 2,
22     kInt = 3,
23     kUInt = 4,
24     kFloat = 5,
25
26     kDynBool = 11,
27     kDynChar = 12,
28     kDynInt = 13,
29     kDynUInt = 14,
30     kDynFloat = 15
31   };
32
33   AliDCSValue();
34   AliDCSValue(const AliDCSValue& c);
35
36   ~AliDCSValue();
37
38   AliDCSValue& operator=(const AliDCSValue& c);
39   virtual void Copy(TObject& c) const;
40
41   AliDCSValue(Bool_t value, UInt_t timeStamp);
42   AliDCSValue(Char_t value, UInt_t timeStamp);
43   AliDCSValue(Int_t value, UInt_t timeStamp);
44   AliDCSValue(UInt_t value, UInt_t timeStamp);
45   AliDCSValue(Float_t value, UInt_t timeStamp);
46
47   AliDCSValue(Int_t size, Bool_t* vals, UInt_t timeStamp);
48   AliDCSValue(Int_t size, Char_t* vals, UInt_t timeStamp);
49   AliDCSValue(Int_t size, Int_t* vals, UInt_t timeStamp);
50   AliDCSValue(Int_t size, UInt_t* vals, UInt_t timeStamp);
51   AliDCSValue(Int_t size, Float_t* vals, UInt_t timeStamp);
52
53   Bool_t GetBool() const { return fBool; }
54   Char_t GetChar() const { return fChar; }
55   Int_t GetInt() const { return fInt; }
56   UInt_t GetUInt() const { return fUInt; }
57   Float_t GetFloat() const { return fFloat; }
58
59   Bool_t GetDynBool(Int_t n) const { return fBoolPtr[n]; }
60   Char_t GetDynChar(Int_t n) const { return fCharPtr[n]; }
61   Int_t GetDynInt(Int_t n) const { return fIntPtr[n]; }
62   UInt_t GetDynUInt(Int_t n) const { return fUIntPtr[n]; }
63   Float_t GetDynFloat(Int_t n) const { return fFloatPtr[n]; }
64
65   Type GetType() const { return fType; }
66   Int_t GetDynamicSize() const { return fLength; }
67
68   UInt_t GetTimeStamp() const { return fTimeStamp; }
69   void SetTimeStamp(UInt_t timeStamp) { fTimeStamp = timeStamp; }
70
71   Int_t GetSize() const;
72   static Bool_t IsDynamic(Type type);
73
74   const Char_t* ToString() const;
75
76 protected:
77   void Init();
78
79   Type fType;           // type of the value stored
80
81   Bool_t fBool;         // bool value
82   Char_t fChar;         // char value
83   Int_t fInt;           // int value
84   UInt_t fUInt;         // uint value
85   Float_t fFloat;       // float value
86
87   UInt_t fLength;       // length of the following arrays, the ones that are != 0 are expected to contain fLength entries
88
89   Bool_t* fBoolPtr;     //[fLength] bool array
90   Char_t* fCharPtr;     //[fLength] char array
91   Int_t* fIntPtr;       //[fLength] int array
92   UInt_t* fUIntPtr;     //[fLength] uint array
93   Float_t* fFloatPtr;   //[fLength] float array
94
95   UInt_t fTimeStamp;    // timestamp of this value
96
97         ClassDef(AliDCSValue, 2);
98 };
99
100 #endif