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.1 2000/11/01 16:01:22 kowal2
19 Classes for handling the new hits structures
22 ///////////////////////////////////////////////////////////////////////////////
26 // Defined to make unified interface to primitive types (in Root described by//
27 // TDataType) and TClass. //
29 ///////////////////////////////////////////////////////////////////////////////
32 #include "AliDataType.h"
36 #include "TDataType.h"
46 AliDataType::AliDataType(const char *name)
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();
62 const char * AliDataType::GetClassName()
64 //class name of the object
65 return (fDataType) ? fDataType->GetName():0;
68 void AliDataType::StreamBuffer(TBuffer& b, const void *object, UInt_t size)
70 //streamer for buffer of objects
71 char * last = &((char*)object)[size*fSize];
72 char * pfirst = (char*)object;
75 switch ((EDataType) fDataType->GetType()){
77 for (p= pfirst; p<last;p+=fSize) b<<*((Char_t*)p);
80 for (p= pfirst; p<last;p+=fSize) b<<*((Short_t*)p);
83 for (p= pfirst; p<last;p+=fSize) b<<*((Int_t*)p);
86 for (p= pfirst; p<last;p+=fSize) b<<*((Long_t*)p);
89 for (p= pfirst; p<last;p+=fSize) b<<*((UChar_t*)p);
92 for (p= pfirst; p<last;p+=fSize) b<<*((UShort_t*)p);
95 for (p= pfirst; p<last;p+=fSize) b<<*((UInt_t*)p);
98 for (p= pfirst; p<last;p+=fSize) b<<*((Float_t*)p);
101 for (p= pfirst; p<last;p+=fSize) b<<*((Double_t*)p);
108 switch ((EDataType) fDataType->GetType()){
110 for (p= pfirst; p<last;p+=fSize) b>>*((Char_t*)p);
113 for (p= pfirst; p<last;p+=fSize) b>>*((Short_t*)p);
116 for (p= pfirst; p<last;p+=fSize) b>>*((Int_t*)p);
119 for (p= pfirst; p<last;p+=fSize) b>>*((Long_t*)p);
122 for (p= pfirst; p<last;p+=fSize) b>>*((UChar_t*)p);
125 for (p= pfirst; p<last;p+=fSize) b>>*((UShort_t*)p);
128 for (p= pfirst; p<last;p+=fSize) b>>*((UInt_t*)p);
131 for (p= pfirst; p<last;p+=fSize) b>>*((Float_t*)p);
134 for (p= pfirst; p<last;p+=fSize) b>>*((Double_t*)p);
142 void AliDataType::ObjectDump(void *p)
145 // dump object information
146 // assume that object p has type described by AliDataTYPE
147 switch ((EDataType) fDataType->GetType()){
149 cout<<*((Char_t*)p)<<"\n";
152 cout<<*((Short_t*)p)<<"\n";
155 cout<<*((Int_t*)p)<<"\n";
158 cout<<*((Long_t*)p)<<"\n";
161 cout<<*((UChar_t*)p)<<"\n";
164 cout<<*((UShort_t*)p)<<"\n";
167 cout<<*((UInt_t*)p)<<"\n";
170 cout<<*((Float_t*)p)<<"\n";
173 cout<<*((Double_t*)p)<<"\n";