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.3 2006/07/20 09:43:46 jgrosseo
19 removing dynamic types
21 Revision 1.2 2006/07/04 14:58:11 jgrosseo
22 revision of AliDCSValue: Removed wrapper classes, reduced storage size per value by factor 2
24 Revision 1.1 2006/06/02 14:14:36 hristov
25 Separate library for CDB (Jan)
27 Revision 1.2 2006/03/07 07:52:34 hristov
28 New version (B.Yordanov)
30 Revision 1.2 2005/11/17 14:43:23 byordano
33 Revision 1.1.1.1 2005/10/28 07:33:58 hristov
34 Initial import as subdirectory in AliRoot
36 Revision 1.1.1.1 2005/09/12 22:11:40 byordano
39 Revision 1.2 2005/08/30 10:53:23 byordano
40 some more descriptions added
45 // This class represents the value(s) of
46 // a DCS data point at a given timestamp.
47 // It stores different data types, the current implementation has a member for all of them.
48 // This is definitly not efficient, but the only way to use the automatic streamers generated by ROOT.
50 // Each element of this value series has two fields:
51 // fValue - primitive value which represents the real measured value
52 // fTimestamp - timestamp when the measurement was made
55 #include "AliDCSValue.h"
57 #include "TTimeStamp.h"
62 AliDCSValue::AliDCSValue() :
72 // default constructor
75 AliDCSValue::AliDCSValue(Bool_t value, UInt_t timeStamp) :
88 AliDCSValue::AliDCSValue(Char_t value, UInt_t timeStamp) :
101 AliDCSValue::AliDCSValue(Int_t value, UInt_t timeStamp) :
109 fTimeStamp(timeStamp)
114 AliDCSValue::AliDCSValue(UInt_t value, UInt_t timeStamp) :
122 fTimeStamp(timeStamp)
127 AliDCSValue::AliDCSValue(Float_t value, UInt_t timeStamp) :
135 fTimeStamp(timeStamp)
141 fTimeStamp = timeStamp;
147 AliDCSValue::AliDCSValue(const AliDCSValue& c) :
155 fTimeStamp(c.fTimeStamp)
160 void AliDCSValue::Init()
162 // init helper, that initializes everything to 0
175 AliDCSValue::~AliDCSValue()
180 AliDCSValue &AliDCSValue::operator=(const AliDCSValue &c)
182 // assigment operator
185 ((AliDCSValue &) c).Copy(*this);
190 void AliDCSValue::Copy(TObject& c) const
194 AliDCSValue& target = (AliDCSValue &) c;
198 target.fType = fType;
200 target.fBool = fBool;
201 target.fChar = fChar;
203 target.fUInt = fUInt;
204 target.fFloat = fFloat;
206 target.fTimeStamp = fTimeStamp;
209 Int_t AliDCSValue::GetSize() const
211 // returns size in bytes of stored structure
213 Int_t size = sizeof(fTimeStamp);
217 case kBool: size += sizeof(Bool_t); break;
218 case kChar: size += sizeof(Char_t); break;
219 case kInt: size += sizeof(Int_t); break;
220 case kUInt: size += sizeof(UInt_t); break;
221 case kFloat: size += sizeof(Float_t); break;
223 case kInvalid: break;
229 const Char_t* AliDCSValue::ToString() const
235 case kBool: str.Form("%d", fBool); break;
236 case kChar: str.Form("%d", fChar); break;
237 case kInt: str.Form("%d", fInt); break;
238 case kUInt: str.Form("%d", fUInt); break;
239 case kFloat: str.Form("%f", fFloat); break;
241 case kInvalid: break;
244 return Form("%s Timestamp: %s", str.Data(), TTimeStamp(fTimeStamp).AsString());