1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 Revision 1.2 2006/07/04 14:58:11 jgrosseo
19 revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
21 Revision 1.1 2006/06/02 14:14:36 hristov
22 Separate library for CDB (Jan)
24 Revision 1.2 2006/03/07 07:52:34 hristov
25 New version (B.Yordanov)
27 Revision 1.2 2005/11/17 14:43:23 byordano
30 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
31 Initial import as subdirectory in AliRoot
33 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
36 Revision 1.2 2005/08/30 10:53:23 byordano
37 some more descriptions added
42 // This class represents the value(s) of
43 // a DCS data point at a given timestamp.
44 // It stores different data types, the current implementation has a member for all of them.
45 // This is definitly not efficient, but the only way to use the automatic streamers generated by ROOT.
47 // Each element of this value series has two fields:
48 // fValue - primitive value which represents the real measured value
49 // fTimestamp - timestamp when the measurement was made
52 #include "AliDCSValue.h"
54 #include "TTimeStamp.h"
59 AliDCSValue::AliDCSValue() : TObject()
61 // default constructor
66 AliDCSValue::AliDCSValue(Bool_t value, UInt_t timeStamp) : TObject()
72 fTimeStamp = timeStamp;
78 AliDCSValue::AliDCSValue(Char_t value, UInt_t timeStamp) : TObject()
84 fTimeStamp = timeStamp;
90 AliDCSValue::AliDCSValue(Int_t value, UInt_t timeStamp) : TObject()
96 fTimeStamp = timeStamp;
102 AliDCSValue::AliDCSValue(UInt_t value, UInt_t timeStamp) : TObject()
108 fTimeStamp = timeStamp;
114 AliDCSValue::AliDCSValue(Float_t value, UInt_t timeStamp) : TObject()
120 fTimeStamp = timeStamp;
126 AliDCSValue::AliDCSValue(const AliDCSValue& c) : TObject(c)
130 ((AliDCSValue &)c).Copy(*this);
133 void AliDCSValue::Init()
135 // init helper, that initializes everything to 0
148 AliDCSValue::~AliDCSValue()
153 AliDCSValue &AliDCSValue::operator=(const AliDCSValue &c)
155 // assigment operator
158 ((AliDCSValue &) c).Copy(*this);
163 void AliDCSValue::Copy(TObject& c) const
167 AliDCSValue& target = (AliDCSValue &) c;
171 target.fType = fType;
173 target.fBool = fBool;
174 target.fChar = fChar;
176 target.fUInt = fUInt;
177 target.fFloat = fFloat;
179 target.fTimeStamp = fTimeStamp;
182 Int_t AliDCSValue::GetSize() const
184 // returns size in bytes of stored structure
186 Int_t size = sizeof(fTimeStamp);
190 case kBool: size += sizeof(Bool_t); break;
191 case kChar: size += sizeof(Char_t); break;
192 case kInt: size += sizeof(Int_t); break;
193 case kUInt: size += sizeof(UInt_t); break;
194 case kFloat: size += sizeof(Float_t); break;
196 case kInvalid: break;
202 const Char_t* AliDCSValue::ToString() const
208 case kBool: str.Form("%d", fBool); break;
209 case kChar: str.Form("%d", fChar); break;
210 case kInt: str.Form("%d", fInt); break;
211 case kUInt: str.Form("%d", fUInt); break;
212 case kFloat: str.Form("%f", fFloat); break;
214 case kInvalid: break;
217 return Form("%s Timestamp: %s", str.Data(), TTimeStamp(fTimeStamp).AsString());