]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - STEER/STEER/AliDCSArray.cxx
Update master to aliroot
[u/mrichter/AliRoot.git] / STEER / STEER / AliDCSArray.cxx
... / ...
CommitLineData
1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16////////////////////////////////////////////////////////////////////////////////
17// //
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. //
21// //
22////////////////////////////////////////////////////////////////////////////////
23
24
25#include "AliDCSArray.h"
26#include "AliLog.h"
27
28//#include "TTimeStamp.h"
29#include <TObjArray.h>
30#include <TObjString.h>
31#include <TString.h>
32#include <TMath.h>
33
34ClassImp(AliDCSArray)
35
36AliDCSArray::AliDCSArray() :
37 TObject(),
38 fType(kInvalid),
39 fnentries(0),
40 fBool(0x0),
41 fChar(0x0),
42 fInt(0x0),
43 fUInt(0x0),
44 fFloat(0x0),
45 fStringArray(0x0),
46 fTimeStamp(-1.),
47 fDouble(0x0)
48{
49 //
50 // default constructor
51 //
52}
53
54//--------------------------------------------------------------------------
55AliDCSArray::AliDCSArray(Int_t nentries, Bool_t* value, Double_t timeStamp) :
56 TObject(),
57 fType(kBool),
58 fnentries(nentries),
59 fBool(new Bool_t[fnentries]),
60 fChar(0x0),
61 fInt(0x0),
62 fUInt(0x0),
63 fFloat(0x0),
64 fStringArray(0x0),
65 fTimeStamp(timeStamp),
66 fDouble(0x0)
67{
68 //
69 // constructor for Bool
70 //
71
72 for (Int_t i = 0; i<fnentries; i++){
73 fBool[i] = value[i];
74 }
75}
76
77//--------------------------------------------------------------------------
78AliDCSArray::AliDCSArray(Int_t nentries, Char_t* value, Double_t timeStamp) :
79 TObject(),
80 fType(kChar),
81 fnentries(nentries),
82 fBool(0x0),
83 fChar(new Char_t[fnentries]),
84 fInt(0x0),
85 fUInt(0x0),
86 fFloat(0x0),
87 fStringArray(0x0),
88 fTimeStamp(timeStamp),
89 fDouble(0x0)
90{
91 //
92 // constructor for Char
93 //
94 for (Int_t i = 0; i<fnentries; i++){
95 fChar[i] = value[i];
96 }
97}
98
99//-------------------------------------------------------------------------
100AliDCSArray::AliDCSArray(Int_t nentries, Int_t* value, Double_t timeStamp) :
101 TObject(),
102 fType(kInt),
103 fnentries(nentries),
104 fBool(0x0),
105 fChar(0x0),
106 fInt(new Int_t[fnentries]),
107 fUInt(0x0),
108 fFloat(0x0),
109 fStringArray(0x0),
110 fTimeStamp(timeStamp),
111 fDouble(0x0)
112{
113 //
114 // constructor for Int
115 //
116 for (Int_t i = 0; i<fnentries; i++){
117 fInt[i] = value[i];
118 }
119}
120
121//-------------------------------------------------------------------------
122AliDCSArray::AliDCSArray(Int_t nentries, UInt_t* value, Double_t timeStamp) :
123 TObject(),
124 fType(kUInt),
125 fnentries(nentries),
126 fBool(0x0),
127 fChar(0x0),
128 fInt(0x0),
129 fUInt(new UInt_t[fnentries]),
130 fFloat(0x0),
131 fStringArray(0x0),
132 fTimeStamp(timeStamp),
133 fDouble(0x0)
134{
135 //
136 // constructor for UInt
137 //
138
139 for (Int_t i = 0; i<fnentries; i++){
140 fUInt[i] = value[i];
141 }
142}
143
144//-------------------------------------------------------------------------
145AliDCSArray::AliDCSArray(Int_t nentries, Float_t* value, Double_t timeStamp) :
146 TObject(),
147 fType(kFloat),
148 fnentries(nentries),
149 fBool(0x0),
150 fChar(0x0),
151 fInt(0x0),
152 fUInt(0x0),
153 fFloat(new Float_t[fnentries]),
154 fStringArray(0x0),
155 fTimeStamp(timeStamp),
156 fDouble(0x0)
157{
158 //
159 // constructor for Float
160 //
161
162 for (Int_t i = 0; i<fnentries; i++){
163 fFloat[i] = value[i];
164 }
165}
166//-------------------------------------------------------------------------
167AliDCSArray::AliDCSArray(Int_t nentries, Double_t* value, Double_t timeStamp) :
168 TObject(),
169 fType(kDouble),
170 fnentries(nentries),
171 fBool(0x0),
172 fChar(0x0),
173 fInt(0x0),
174 fUInt(0x0),
175 fFloat(0x0),
176 fStringArray(0x0),
177 fTimeStamp(timeStamp),
178 fDouble(new Double_t[fnentries])
179{
180 //
181 // constructor for Double
182 //
183
184 for (Int_t i = 0; i<fnentries; i++){
185 fDouble[i] = value[i];
186 }
187}
188
189//------------------------------------------------------------------------
190AliDCSArray::AliDCSArray(Int_t nentries, TObjArray* value, Double_t timeStamp) :
191 TObject(),
192 fType(kString),
193 fnentries(nentries),
194 fBool(0x0),
195 fChar(0x0),
196 fInt(0x0),
197 fUInt(0x0),
198 fFloat(0x0),
199 fStringArray(new TObjArray()),
200 fTimeStamp(timeStamp),
201 fDouble(0x0)
202{
203 //
204 // constructor for String
205 //
206
207 fStringArray->SetOwner(1);
208 for (Int_t i = 0; i<fnentries; i++){
209 TObjString* strobj = new TObjString();
210 strobj->SetString(((TObjString*)value->At(i))->String());
211 fStringArray->Add(strobj);
212 }
213}
214
215//-----------------------------------------------------------------------
216AliDCSArray::~AliDCSArray()
217{
218 //
219 // destructor
220 //
221
222 if (fBool){
223 delete [] fBool;
224 fBool = 0x0;
225 }
226 if (fChar){
227 delete [] fChar;
228 fChar = 0x0;
229 }
230 if (fUInt){
231 delete [] fUInt;
232 fUInt = 0x0;
233 }
234 if (fInt){
235 delete [] fInt;
236 fInt = 0x0;
237 }
238 if (fFloat){
239 delete [] fFloat;
240 fFloat = 0x0;
241 }
242 if (fStringArray!=0x0){
243 delete fStringArray;
244 fStringArray = 0x0;
245 }
246 if (fDouble){
247 delete [] fDouble;
248 fDouble = 0x0;
249 }
250}
251
252//-----------------------------------------------------------------------
253void AliDCSArray::Init()
254{
255 //
256 // init helper, that initializes everything to 0
257 //
258
259 fType = kInvalid;
260
261 fnentries = 0;
262 fBool = 0x0;
263 fChar = 0x0;
264 fInt = 0x0;
265 fUInt = 0x0;
266 fFloat = 0x0;
267 fDouble = 0x0;
268 fStringArray = 0x0;
269
270 fTimeStamp = -1.;
271}
272