AliRoot Core  3dc7879 (3dc7879)
AliDCSValue.h
Go to the documentation of this file.
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 
27  AliDCSValue();
28  AliDCSValue(const AliDCSValue& c);
29 
30  virtual ~AliDCSValue();
31 
33  virtual void Copy(TObject& c) const;
34 
35  AliDCSValue(Bool_t value, UInt_t timeStamp);
36  AliDCSValue(Char_t value, UInt_t timeStamp);
37  AliDCSValue(Int_t value, UInt_t timeStamp);
38  AliDCSValue(UInt_t value, UInt_t timeStamp);
39  AliDCSValue(Float_t value, UInt_t timeStamp);
40 
41  Bool_t GetBool() const;
42  Char_t GetChar() const;
43  Int_t GetInt() const;
44  UInt_t GetUInt() const;
45  Float_t GetFloat() const;
46 
47  operator Bool_t() const { return GetBool(); }
48  operator Char_t() const { return GetChar(); }
49  operator Int_t() const { return GetInt(); }
50  operator UInt_t() const { return GetUInt(); }
51  operator Float_t() const { return GetFloat(); }
52 
53  Type GetType() const { return fType; }
54 
55  UInt_t GetTimeStamp() const { return fTimeStamp; }
56  void SetTimeStamp(UInt_t timeStamp) { fTimeStamp = timeStamp; }
57 
58  Int_t GetSize() const;
59 
60  const Char_t* ToString() const;
61  void Print(Option_t* /*opt*/) const;
62 
63 
64 /**********************************************/
65 
66  Int_t Compare(const TObject* obj) const
67  { if( fTimeStamp < ((AliDCSValue *)obj )->fTimeStamp ) return -1;
68  if( fTimeStamp == ((AliDCSValue *)obj )->fTimeStamp ) return 0;
69  return 1;
70  }
71 
72  Bool_t IsSortable() const { return kTRUE; }
73 
74 /*********************************************/
75 
76 
77 protected:
78  void Init();
79 
80  Type fType; // type of the value stored
81 
82  Bool_t fBool; // bool value
83  Char_t fChar; // char value
84  Int_t fInt; // int value
85  UInt_t fUInt; // uint value
86  Float_t fFloat; // float value
87 
88  UInt_t fTimeStamp; // timestamp of this value
89 
90  ClassDef(AliDCSValue, 2);
91 };
92 
93 #endif
Int_t fInt
Definition: AliDCSValue.h:84
virtual void Copy(TObject &c) const
UInt_t fTimeStamp
Definition: AliDCSValue.h:88
UInt_t GetUInt() const
Bool_t IsSortable() const
Definition: AliDCSValue.h:72
Float_t GetFloat() const
Float_t fFloat
Definition: AliDCSValue.h:86
AliDCSValue & operator=(const AliDCSValue &c)
Bool_t fBool
Definition: AliDCSValue.h:82
const Char_t * ToString() const
Int_t GetSize() const
void SetTimeStamp(UInt_t timeStamp)
Definition: AliDCSValue.h:56
UInt_t fUInt
Definition: AliDCSValue.h:85
Int_t Compare(const TObject *obj) const
Definition: AliDCSValue.h:66
Char_t GetChar() const
Bool_t GetBool() const
Int_t GetInt() const
UInt_t GetTimeStamp() const
Definition: AliDCSValue.h:55
Char_t fChar
Definition: AliDCSValue.h:83
void Print(Option_t *) const
Type GetType() const
Definition: AliDCSValue.h:53
virtual ~AliDCSValue()