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 **************************************************************************/
16 ////////////////////////////////////////////////////////////////////////////////
18 // This class represents the value(s) of a the LHC DPs at a given timestamp //
19 // The variuos measurement that occurred at the same timestamp are associated //
20 // to the same timestamp. //
22 ////////////////////////////////////////////////////////////////////////////////
25 #include "AliDCSArray.h"
27 #include "TTimeStamp.h"
32 AliDCSArray::AliDCSArray() :
45 // default constructor
49 //--------------------------------------------------------------------------
50 AliDCSArray::AliDCSArray(Int_t nentries, Bool_t* value, TTimeStamp* timeStamp) :
54 fBool(new Bool_t[fnentries]),
63 // constructor for Bool
66 for (Int_t i = 0; i<fnentries; i++){
71 //--------------------------------------------------------------------------
72 AliDCSArray::AliDCSArray(Int_t nentries, Char_t* value, TTimeStamp* timeStamp) :
77 fChar(new Char_t[fnentries]),
85 // constructor for Char
87 for (Int_t i = 0; i<fnentries; i++){
92 //-------------------------------------------------------------------------
93 AliDCSArray::AliDCSArray(Int_t nentries, Int_t* value, TTimeStamp* timeStamp) :
99 fInt(new Int_t[fnentries]),
103 fTimeStamp(timeStamp)
106 // constructor for Int
108 for (Int_t i = 0; i<fnentries; i++){
113 //-------------------------------------------------------------------------
114 AliDCSArray::AliDCSArray(Int_t nentries, UInt_t* value, TTimeStamp* timeStamp) :
121 fUInt(new UInt_t[fnentries]),
124 fTimeStamp(timeStamp)
127 // constructor for UInt
130 for (Int_t i = 0; i<fnentries; i++){
135 //-------------------------------------------------------------------------
136 AliDCSArray::AliDCSArray(Int_t nentries, Float_t* value, TTimeStamp* timeStamp) :
144 fFloat(new Float_t[fnentries]),
146 fTimeStamp(timeStamp)
149 // constructor for Float
152 for (Int_t i = 0; i<fnentries; i++){
153 fFloat[i] = value[i];
157 //------------------------------------------------------------------------
158 AliDCSArray::AliDCSArray(Int_t nentries, TString* value, TTimeStamp* timeStamp) :
167 fString(new TString[fnentries]),
168 fTimeStamp(timeStamp)
171 // constructor for String
174 for (Int_t i = 0; i<fnentries; i++){
175 fString[i] = value[i];
179 //-----------------------------------------------------------------------
180 AliDCSArray::AliDCSArray(const AliDCSArray& c) :
183 fnentries(c.fnentries),
190 fTimeStamp(c.fTimeStamp)
196 if (fType == kBool && c.fBool){
197 fBool = new Bool_t[fnentries];
198 memcpy(fBool,c.fBool,fnentries*sizeof(Bool_t));
200 if (fType == kChar && c.fChar){
201 fChar = new Char_t[fnentries];
202 memcpy(fChar,c.fChar,fnentries*sizeof(Char_t));
204 if (fType == kUInt && c.fUInt){
205 fUInt = new UInt_t[fnentries];
206 memcpy(fUInt,c.fUInt,fnentries*sizeof(UInt_t));
208 if (fType == kInt && c.fInt){
209 fInt = new Int_t[fnentries];
210 memcpy(fInt,c.fInt,fnentries*sizeof(Int_t));
212 if (fType == kFloat && c.fFloat){
213 fFloat = new Float_t[fnentries];
214 memcpy(fFloat,c.fFloat,fnentries*sizeof(Float_t));
216 if (fType == kString && c.fString){
217 fString = new TString[fnentries];
218 memcpy(fString,c.fString,fnentries*sizeof(TString));
223 //-----------------------------------------------------------------------
224 AliDCSArray::~AliDCSArray()
260 //-----------------------------------------------------------------------
261 AliDCSArray &AliDCSArray::operator=(const AliDCSArray &c)
267 if(&c == this) return *this;
268 if (fType == kBool && c.fBool){
269 fBool = new Bool_t[fnentries];
270 memcpy(fBool,c.fBool,fnentries*sizeof(Bool_t));
272 if (fType == kChar && c.fChar){
273 fChar = new Char_t[fnentries];
274 memcpy(fChar,c.fChar,fnentries*sizeof(Char_t));
276 if (fType == kUInt && c.fUInt){
277 fUInt = new UInt_t[fnentries];
278 memcpy(fUInt,c.fUInt,fnentries*sizeof(UInt_t));
280 if (fType == kInt && c.fInt){
281 fInt = new Int_t[fnentries];
282 memcpy(fInt,c.fInt,fnentries*sizeof(Int_t));
284 if (fType == kFloat && c.fFloat){
285 fFloat = new Float_t[fnentries];
286 memcpy(fFloat,c.fFloat,fnentries*sizeof(Float_t));
288 if (fType == kString && c.fString){
289 fString = new TString[fnentries];
290 memcpy(fString,c.fString,fnentries*sizeof(TString));
296 //-----------------------------------------------------------------------
297 void AliDCSArray::Init()
300 // init helper, that initializes everything to 0