The Init method of AliITSreconstruction has to be called by the user. This was done...
[u/mrichter/AliRoot.git] / CONTAINERS / AliDataType.cxx
CommitLineData
08edbb90 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$Log$
13ee3489 18Revision 1.1 2000/11/01 16:01:22 kowal2
19Classes for handling the new hits structures
20
08edbb90 21*/
22///////////////////////////////////////////////////////////////////////////////
23// //
24// AliDataType //
25// //
26// Defined to make unified interface to primitive types (in Root described by//
27// TDataType) and TClass. //
28// //
29///////////////////////////////////////////////////////////////////////////////
30
31
32#include "AliDataType.h"
08edbb90 33
34#include "TMath.h"
35#include "TClass.h"
36#include "TDataType.h"
37
38#include "TROOT.h"
39#include "iostream.h"
40
41
42ClassImp(AliDataType)
43
44
45
46AliDataType::AliDataType(const char *name)
47{
48 //
49 // AliData type constructor
50 fDataType = new TDataType(name);
51 if (fDataType->GetType()<0) fDataType= (gROOT->GetType(name,kTRUE));
52 if ((fDataType) && (fDataType->GetType())){
53 fSize = fDataType->Size();
54 // fType = (EDataType) fDataType->GetType();
55 SetTitle(name);
56 SetName(name);
57 fgList.Add(this);
58 }
59}
60
61
62const char * AliDataType::GetClassName()
63{
64 //class name of the object
65 return (fDataType) ? fDataType->GetName():0;
66}
67
68void AliDataType::StreamBuffer(TBuffer& b, const void *object, UInt_t size)
69{
70 //streamer for buffer of objects
71 char * last = &((char*)object)[size*fSize];
72 char * pfirst = (char*)object;
73 char *p;
74 if (b.IsWriting()){
75 switch ((EDataType) fDataType->GetType()){
76 case kChar_t:
77 for (p= pfirst; p<last;p+=fSize) b<<*((Char_t*)p);
78 break;
79 case kShort_t:
80 for (p= pfirst; p<last;p+=fSize) b<<*((Short_t*)p);
81 break;
82 case kInt_t:
83 for (p= pfirst; p<last;p+=fSize) b<<*((Int_t*)p);
84 break;
85 case kLong_t:
86 for (p= pfirst; p<last;p+=fSize) b<<*((Long_t*)p);
87 break;
88 case kUChar_t:
89 for (p= pfirst; p<last;p+=fSize) b<<*((UChar_t*)p);
90 break;
91 case kUShort_t:
92 for (p= pfirst; p<last;p+=fSize) b<<*((UShort_t*)p);
93 break;
94 case kUInt_t:
95 for (p= pfirst; p<last;p+=fSize) b<<*((UInt_t*)p);
96 break;
97 case kFloat_t:
98 for (p= pfirst; p<last;p+=fSize) b<<*((Float_t*)p);
99 break;
100 case kDouble_t:
101 for (p= pfirst; p<last;p+=fSize) b<<*((Double_t*)p);
102 break;
103 default:
104 break;
105 }
106 }
107 else
108 switch ((EDataType) fDataType->GetType()){
109 case kChar_t:
110 for (p= pfirst; p<last;p+=fSize) b>>*((Char_t*)p);
111 break;
112 case kShort_t:
113 for (p= pfirst; p<last;p+=fSize) b>>*((Short_t*)p);
114 break;
115 case kInt_t:
116 for (p= pfirst; p<last;p+=fSize) b>>*((Int_t*)p);
117 break;
118 case kLong_t:
119 for (p= pfirst; p<last;p+=fSize) b>>*((Long_t*)p);
120 break;
121 case kUChar_t:
122 for (p= pfirst; p<last;p+=fSize) b>>*((UChar_t*)p);
123 break;
124 case kUShort_t:
125 for (p= pfirst; p<last;p+=fSize) b>>*((UShort_t*)p);
126 break;
127 case kUInt_t:
128 for (p= pfirst; p<last;p+=fSize) b>>*((UInt_t*)p);
129 break;
130 case kFloat_t:
131 for (p= pfirst; p<last;p+=fSize) b>>*((Float_t*)p);
132 break;
133 case kDouble_t:
134 for (p= pfirst; p<last;p+=fSize) b>>*((Double_t*)p);
135 break;
136 default:
137 break;
138 }
139
140}
141
142void AliDataType::ObjectDump(void *p)
143{
144 //
145 // dump object information
146 // assume that object p has type described by AliDataTYPE
147 switch ((EDataType) fDataType->GetType()){
148 case kChar_t:
149 cout<<*((Char_t*)p)<<"\n";
150 break;
151 case kShort_t:
152 cout<<*((Short_t*)p)<<"\n";
153 break;
154 case kInt_t:
155 cout<<*((Int_t*)p)<<"\n";
156 break;
157 case kLong_t:
158 cout<<*((Long_t*)p)<<"\n";
159 break;
160 case kUChar_t:
161 cout<<*((UChar_t*)p)<<"\n";
162 break;
163 case kUShort_t:
164 cout<<*((UShort_t*)p)<<"\n";
165 break;
166 case kUInt_t:
167 cout<<*((UInt_t*)p)<<"\n";
168 break;
169 case kFloat_t:
170 cout<<*((Float_t*)p)<<"\n";
171 break;
172 case kDouble_t:
173 cout<<*((Double_t*)p)<<"\n";
174 break;
175 default:
176 break;
177 }
178}