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 **************************************************************************/
19 ///////////////////////////////////////////////////////////////////////////////
23 // Defined to make unified interface to primitive types (in Root described by//
24 // TDataType) and TClass. //
26 ///////////////////////////////////////////////////////////////////////////////
29 #include "AliDataType.h"
30 #include "AliCTypes.h"
34 #include "TDataType.h"
44 AliDataType::AliDataType(const char *name)
47 // AliData type constructor
48 fDataType = new TDataType(name);
49 if (fDataType->GetType()<0) fDataType= (gROOT->GetType(name,kTRUE));
50 if ((fDataType) && (fDataType->GetType())){
51 fSize = fDataType->Size();
52 // fType = (EDataType) fDataType->GetType();
60 const char * AliDataType::GetClassName()
62 //class name of the object
63 return (fDataType) ? fDataType->GetName():0;
66 void AliDataType::StreamBuffer(TBuffer& b, const void *object, UInt_t size)
68 //streamer for buffer of objects
69 char * last = &((char*)object)[size*fSize];
70 char * pfirst = (char*)object;
73 switch ((EDataType) fDataType->GetType()){
75 for (p= pfirst; p<last;p+=fSize) b<<*((Char_t*)p);
78 for (p= pfirst; p<last;p+=fSize) b<<*((Short_t*)p);
81 for (p= pfirst; p<last;p+=fSize) b<<*((Int_t*)p);
84 for (p= pfirst; p<last;p+=fSize) b<<*((Long_t*)p);
87 for (p= pfirst; p<last;p+=fSize) b<<*((UChar_t*)p);
90 for (p= pfirst; p<last;p+=fSize) b<<*((UShort_t*)p);
93 for (p= pfirst; p<last;p+=fSize) b<<*((UInt_t*)p);
96 for (p= pfirst; p<last;p+=fSize) b<<*((Float_t*)p);
99 for (p= pfirst; p<last;p+=fSize) b<<*((Double_t*)p);
106 switch ((EDataType) fDataType->GetType()){
108 for (p= pfirst; p<last;p+=fSize) b>>*((Char_t*)p);
111 for (p= pfirst; p<last;p+=fSize) b>>*((Short_t*)p);
114 for (p= pfirst; p<last;p+=fSize) b>>*((Int_t*)p);
117 for (p= pfirst; p<last;p+=fSize) b>>*((Long_t*)p);
120 for (p= pfirst; p<last;p+=fSize) b>>*((UChar_t*)p);
123 for (p= pfirst; p<last;p+=fSize) b>>*((UShort_t*)p);
126 for (p= pfirst; p<last;p+=fSize) b>>*((UInt_t*)p);
129 for (p= pfirst; p<last;p+=fSize) b>>*((Float_t*)p);
132 for (p= pfirst; p<last;p+=fSize) b>>*((Double_t*)p);
140 void AliDataType::ObjectDump(void *p)
143 // dump object information
144 // assume that object p has type described by AliDataTYPE
145 switch ((EDataType) fDataType->GetType()){
147 cout<<*((Char_t*)p)<<"\n";
150 cout<<*((Short_t*)p)<<"\n";
153 cout<<*((Int_t*)p)<<"\n";
156 cout<<*((Long_t*)p)<<"\n";
159 cout<<*((UChar_t*)p)<<"\n";
162 cout<<*((UShort_t*)p)<<"\n";
165 cout<<*((UInt_t*)p)<<"\n";
168 cout<<*((Float_t*)p)<<"\n";
171 cout<<*((Double_t*)p)<<"\n";