]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliDCSArray.cxx
Obsolete code removed.
[u/mrichter/AliRoot.git] / STEER / AliDCSArray.cxx
CommitLineData
d96c6484 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
27#include "TTimeStamp.h"
28#include <TString.h>
29
30ClassImp(AliDCSArray)
31
32AliDCSArray::AliDCSArray() :
33 TObject(),
34 fType(kInvalid),
35 fnentries(0),
36 fBool(0x0),
37 fChar(0x0),
38 fInt(0x0),
39 fUInt(0x0),
40 fFloat(0x0),
41 fString(0x0),
42 fTimeStamp(0)
43{
44 //
45 // default constructor
46 //
47}
48
49//--------------------------------------------------------------------------
50AliDCSArray::AliDCSArray(Int_t nentries, Bool_t* value, TTimeStamp* timeStamp) :
51 TObject(),
52 fType(kBool),
53 fnentries(nentries),
54 fBool(new Bool_t[fnentries]),
55 fChar(0x0),
56 fInt(0x0),
57 fUInt(0x0),
58 fFloat(0x0),
59 fString(0x0),
60 fTimeStamp(timeStamp)
61{
62 //
63 // constructor for Bool
64 //
65
66 for (Int_t i = 0; i<fnentries; i++){
67 fBool[i] = value[i];
68 }
69}
70
71//--------------------------------------------------------------------------
72AliDCSArray::AliDCSArray(Int_t nentries, Char_t* value, TTimeStamp* timeStamp) :
73 TObject(),
74 fType(kChar),
75 fnentries(nentries),
76 fBool(0x0),
77 fChar(new Char_t[fnentries]),
78 fInt(0x0),
79 fUInt(0x0),
80 fFloat(0x0),
81 fString(0x0),
82 fTimeStamp(timeStamp)
83{
84 //
85 // constructor for Char
86 //
87 for (Int_t i = 0; i<fnentries; i++){
88 fChar[i] = value[i];
89 }
90}
91
92//-------------------------------------------------------------------------
93AliDCSArray::AliDCSArray(Int_t nentries, Int_t* value, TTimeStamp* timeStamp) :
94 TObject(),
95 fType(kInt),
96 fnentries(nentries),
97 fBool(0x0),
98 fChar(0x0),
99 fInt(new Int_t[fnentries]),
100 fUInt(0x0),
101 fFloat(0x0),
102 fString(0x0),
103 fTimeStamp(timeStamp)
104{
105 //
106 // constructor for Int
107 //
108 for (Int_t i = 0; i<fnentries; i++){
109 fInt[i] = value[i];
110 }
111}
112
113//-------------------------------------------------------------------------
114AliDCSArray::AliDCSArray(Int_t nentries, UInt_t* value, TTimeStamp* timeStamp) :
115 TObject(),
116 fType(kUInt),
117 fnentries(nentries),
118 fBool(0x0),
119 fChar(0x0),
120 fInt(0x0),
121 fUInt(new UInt_t[fnentries]),
122 fFloat(0x0),
123 fString(0x0),
124 fTimeStamp(timeStamp)
125{
126 //
127 // constructor for UInt
128 //
129
130 for (Int_t i = 0; i<fnentries; i++){
131 fUInt[i] = value[i];
132 }
133}
134
135//-------------------------------------------------------------------------
136AliDCSArray::AliDCSArray(Int_t nentries, Float_t* value, TTimeStamp* timeStamp) :
137 TObject(),
138 fType(kFloat),
139 fnentries(nentries),
140 fBool(0x0),
141 fChar(0x0),
142 fInt(0x0),
143 fUInt(0x0),
144 fFloat(new Float_t[fnentries]),
145 fString(0x0),
146 fTimeStamp(timeStamp)
147{
148 //
149 // constructor for Float
150 //
151
152 for (Int_t i = 0; i<fnentries; i++){
153 fFloat[i] = value[i];
154 }
155}
156
157//------------------------------------------------------------------------
158AliDCSArray::AliDCSArray(Int_t nentries, TString* value, TTimeStamp* timeStamp) :
159 TObject(),
160 fType(kString),
161 fnentries(nentries),
162 fBool(0x0),
163 fChar(0x0),
164 fInt(0x0),
165 fUInt(0x0),
166 fFloat(0x0),
167 fString(new TString[fnentries]),
168 fTimeStamp(timeStamp)
169{
170 //
171 // constructor for String
172 //
173
174 for (Int_t i = 0; i<fnentries; i++){
175 fString[i] = value[i];
176 }
177}
178
179//-----------------------------------------------------------------------
180AliDCSArray::AliDCSArray(const AliDCSArray& c) :
181 TObject(c),
182 fType(c.fType),
183 fnentries(c.fnentries),
184 fBool(0x0),
185 fChar(0x0),
186 fInt(0x0),
187 fUInt(0x0),
188 fFloat(0x0),
189 fString(0x0),
190 fTimeStamp(c.fTimeStamp)
191{
192 //
193 // copy constructor
194 //
195
196 if (fType == kBool && c.fBool){
197 fBool = new Bool_t[fnentries];
198 memcpy(fBool,c.fBool,fnentries*sizeof(Bool_t));
199 }
200 if (fType == kChar && c.fChar){
201 fChar = new Char_t[fnentries];
202 memcpy(fChar,c.fChar,fnentries*sizeof(Char_t));
203 }
204 if (fType == kUInt && c.fUInt){
205 fUInt = new UInt_t[fnentries];
206 memcpy(fUInt,c.fUInt,fnentries*sizeof(UInt_t));
207 }
208 if (fType == kInt && c.fInt){
209 fInt = new Int_t[fnentries];
210 memcpy(fInt,c.fInt,fnentries*sizeof(Int_t));
211 }
212 if (fType == kFloat && c.fFloat){
213 fFloat = new Float_t[fnentries];
214 memcpy(fFloat,c.fFloat,fnentries*sizeof(Float_t));
215 }
216 if (fType == kString && c.fString){
217 fString = new TString[fnentries];
218 memcpy(fString,c.fString,fnentries*sizeof(TString));
219 }
220
221}
222
223//-----------------------------------------------------------------------
224AliDCSArray::~AliDCSArray()
225{
226 //
227 // destructor
228 //
229
230 if (fBool){
231 fBool = 0x0;
232 delete fBool;
233 }
234 if (fChar){
235 fChar = 0x0;
236 delete fChar;
237 }
238 if (fUInt){
239 fUInt = 0x0;
240 delete fUInt;
241 }
242 if (fInt){
243 fInt = 0x0;
244 delete fInt;
245 }
246 if (fFloat){
247 fFloat = 0x0;
248 delete fFloat;
249 }
250 if (fString){
251 fString = 0x0;
252 delete fString;
253 }
254 if (fTimeStamp){
255 fTimeStamp = 0x0;
256 delete fTimeStamp;
257 }
258}
259
260//-----------------------------------------------------------------------
261AliDCSArray &AliDCSArray::operator=(const AliDCSArray &c)
262{
263 //
264 // operator =
265 //
266
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));
271 }
272 if (fType == kChar && c.fChar){
273 fChar = new Char_t[fnentries];
274 memcpy(fChar,c.fChar,fnentries*sizeof(Char_t));
275 }
276 if (fType == kUInt && c.fUInt){
277 fUInt = new UInt_t[fnentries];
278 memcpy(fUInt,c.fUInt,fnentries*sizeof(UInt_t));
279 }
280 if (fType == kInt && c.fInt){
281 fInt = new Int_t[fnentries];
282 memcpy(fInt,c.fInt,fnentries*sizeof(Int_t));
283 }
284 if (fType == kFloat && c.fFloat){
285 fFloat = new Float_t[fnentries];
286 memcpy(fFloat,c.fFloat,fnentries*sizeof(Float_t));
287 }
288 if (fType == kString && c.fString){
289 fString = new TString[fnentries];
290 memcpy(fString,c.fString,fnentries*sizeof(TString));
291 }
292
293 return *this;
294}
295
296//-----------------------------------------------------------------------
297void AliDCSArray::Init()
298{
299 //
300 // init helper, that initializes everything to 0
301 //
302
303 fType = kInvalid;
304
305 fnentries = 0;
306 fBool = 0x0;
307 fChar = 0x0;
308 fInt = 0x0;
309 fUInt = 0x0;
310 fFloat = 0x0;
311 fString = 0x0;
312
313 fTimeStamp = 0x0;
314}