ROOT  6.06/09
Reference Guide
TStreamerElement.cxx
Go to the documentation of this file.
1 // @(#)root/meta:$Id$
2 // Author: Rene Brun 12/10/2000
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // //
15 //////////////////////////////////////////////////////////////////////////
16 
17 
18 #include "TROOT.h"
19 #include "TStreamerElement.h"
20 #include "TVirtualStreamerInfo.h"
21 #include "TClass.h"
22 #include "TClassEdit.h"
23 #include "TClassStreamer.h"
24 #include "TBaseClass.h"
25 #include "TDataMember.h"
26 #include "TDataType.h"
27 #include "TMethod.h"
28 #include "TMethodCall.h"
29 #include "TRealData.h"
30 #include "TFolder.h"
31 #include "TRef.h"
32 #include "TInterpreter.h"
33 #include "TError.h"
34 #include "TDataType.h"
35 #include "TVirtualMutex.h"
37 #include <iostream>
38 
39 #include <string>
40 namespace std {} using namespace std;
41 
42 const Int_t kMaxLen = 1024;
43 
45  TTHREAD_TLS_DECL_ARG(TString,includeName,kMaxLen);
46  return includeName;
47 }
48 
49 extern void *gMmallocDesc;
50 
51 ////////////////////////////////////////////////////////////////////////////////
52 /// Helper function to initialize the 'index/counter' value of
53 /// the Pointer streamerElements. If directive is a StreamerInfo and it correspond to the
54 /// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
55 /// for 'countClass'.
56 
57 static TStreamerBasicType *InitCounter(const char *countClass, const char *countName, TObject *directive)
58 {
59  TStreamerBasicType *counter = 0;
60 
61  if (directive && directive->InheritsFrom(TVirtualStreamerInfo::Class())) {
62 
63  if (strcmp(directive->GetName(),countClass)==0) {
64 
65  TVirtualStreamerInfo *info = (TVirtualStreamerInfo*)directive;
66  TStreamerElement *element = (TStreamerElement *)info->GetElements()->FindObject(countName);
67  if (!element) return 0;
68  if (element->IsA() != TStreamerBasicType::Class()) return 0;
69  counter = (TStreamerBasicType*)element;
70 
71  } else {
72 
73  TVirtualStreamerInfo *info = (TVirtualStreamerInfo*)directive;
74  TRealData* rdCounter = (TRealData*) info->GetClass()->GetListOfRealData()->FindObject(countName);
75  if (!rdCounter) return 0;
76  TDataMember *dmCounter = rdCounter->GetDataMember();
77 
78  TClass *cl = dmCounter->GetClass();
79  if (cl==0) return 0;
80  counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
81 
82  }
83  } else {
84 
85  TClass *cl = TClass::GetClass(countClass);
86  if (cl==0) return 0;
87  counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
88  }
89 
90  //at this point the counter may be declared to be skipped
91  if (counter) {
93  }
94  return counter;
95 }
96 
97 ////////////////////////////////////////////////////////////////////////////////
98 /// Parse comments to search for a range specifier of the style:
99 /// [xmin,xmax] or [xmin,xmax,nbits]
100 /// [0,1]
101 /// [-10,100];
102 /// [-pi,pi], [-pi/2,pi/4],[-2pi,2*pi]
103 /// [-10,100,16]
104 /// [0,0,8]
105 /// if nbits is not specified, or nbits <2 or nbits>32 it is set to 32
106 /// if (xmin==0 and xmax==0 and nbits <=16) the double word will be converted
107 /// to a float and its mantissa truncated to nbits significative bits.
108 ///
109 /// see comments in TBufferFile::WriteDouble32.
110 
111 static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
112 {
113  const Double_t kPi =3.14159265358979323846 ;
114  factor = xmin = xmax = 0;
115  if (!comments) return;
116  const char *left = strstr(comments,"[");
117  if (!left) return;
118  const char *right = strstr(left,"]");
119  if (!right) return;
120  const char *comma = strstr(left,",");
121  if (!comma || comma > right) {
122  //may be first bracket was a dimension specifier
123  left = strstr(right,"[");
124  if (!left) return;
125  right = strstr(left,"]");
126  if (!right) return;
127  comma = strstr(left,",");
128  if (!comma || comma >right) return;
129  }
130  //search if nbits is specified
131  const char *comma2 = 0;
132  if (comma) comma2 = strstr(comma+1,",");
133  if (comma2 > right) comma2 = 0;
134  Int_t nbits = 32;
135  if (comma2) {
136  TString sbits(comma2+1,right-comma2-1);
137  sscanf(sbits.Data(),"%d",&nbits);
138  if (nbits < 2 || nbits > 32) {
139  ::Error("GetRange","Illegal specification for the number of bits; %d. reset to 32.",nbits);
140  nbits = 32;
141  }
142  right = comma2;
143  }
144  TString range(left+1,right-left-1);
145  TString sxmin(left+1,comma-left-1);
146  sxmin.ToLower();
147  sxmin.ReplaceAll(" ","");
148  if (sxmin.Contains("pi")) {
149  if (sxmin.Contains("2pi")) xmin = 2*kPi;
150  else if (sxmin.Contains("2*pi")) xmin = 2*kPi;
151  else if (sxmin.Contains("twopi")) xmin = 2*kPi;
152  else if (sxmin.Contains("pi/2")) xmin = kPi/2;
153  else if (sxmin.Contains("pi/4")) xmin = kPi/4;
154  else if (sxmin.Contains("pi")) xmin = kPi;
155  if (sxmin.Contains("-")) xmin = -xmin;
156  } else {
157  sscanf(sxmin.Data(),"%lg",&xmin);
158  }
159  TString sxmax(comma+1,right-comma-1);
160  sxmax.ToLower();
161  sxmax.ReplaceAll(" ","");
162  if (sxmax.Contains("pi")) {
163  if (sxmax.Contains("2pi")) xmax = 2*kPi;
164  else if (sxmax.Contains("2*pi")) xmax = 2*kPi;
165  else if (sxmax.Contains("twopi")) xmax = 2*kPi;
166  else if (sxmax.Contains("pi/2")) xmax = kPi/2;
167  else if (sxmax.Contains("pi/4")) xmax = kPi/4;
168  else if (sxmax.Contains("pi")) xmax = kPi;
169  if (sxmax.Contains("-")) xmax = -xmax;
170  } else {
171  sscanf(sxmax.Data(),"%lg",&xmax);
172  }
173  UInt_t bigint;
174  if (nbits < 32) bigint = 1<<nbits;
175  else bigint = 0xffffffff;
176  if (xmin < xmax) factor = bigint/(xmax-xmin);
177  if (xmin >= xmax && nbits <15) xmin = nbits+0.1;
178 }
179 
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Default ctor.
184 
186 {
187  fType = 0;
188  fSize = 0;
189  fNewType = 0;
190  fArrayDim = 0;
191  fArrayLength = 0;
192  fStreamer = 0;
193  fOffset = 0;
194  fClassObject = (TClass*)(-1);
195  fNewClass = 0;
196  fTObjectOffset = 0;
197  fFactor = 0;
198  fXmin = 0;
199  fXmax = 0;
200  for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
201 }
202 
203 ////////////////////////////////////////////////////////////////////////////////
204 /// Create a TStreamerElement object.
205 
206 TStreamerElement::TStreamerElement(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
207  : TNamed(name,title)
208 {
209  fOffset = offset;
210  fType = dtype;
211  fSize = 0;
212  fNewType = fType;
213  fArrayDim = 0;
214  fArrayLength = 0;
215  if (typeName && !strcmp(typeName, "BASE")) {
216  // TStreamerBase case; fTypeName should stay "BASE".
217  fTypeName = typeName;
218  } else {
219  //must protect call into the interpreter
222  }
223  fStreamer = 0;
224  fClassObject = (TClass*)(-1);
225  fNewClass = 0;
226  fTObjectOffset = 0;
227  fFactor = 0;
228  fXmin = 0;
229  fXmax = 0;
230  for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
231  if (fTypeName == "Float16_t" || fTypeName == "Float16_t*") {
232  GetRange(title,fXmin,fXmax,fFactor);
233  if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
234  }
235  if (fTypeName == "Double32_t" || fTypeName == "Double32_t*") {
236  GetRange(title,fXmin,fXmax,fFactor);
237  if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
238  }
239 }
240 
241 ////////////////////////////////////////////////////////////////////////////////
242 /// TStreamerElement dtor.
243 
245 {
246 }
247 
248 
249 ////////////////////////////////////////////////////////////////////////////////
250 /// Returns true if the element cannot be split, false otherwise.
251 /// An element cannot be split if the corresponding class member has
252 /// the special characters "||" as the first characters in the
253 /// comment field.
254 
256 {
257  if (GetTitle()[0] != 0 && strspn(GetTitle(),"||") == 2) return kTRUE;
258  TClass *cl = GetClassPointer();
259  if (!cl) return kFALSE; //basic type
260 
261  switch(fType) {
267  return kTRUE;
268  }
269 
270  if ( !cl->CanSplit() ) return kTRUE;
271 
272  return kFALSE;
273 }
274 
275 ////////////////////////////////////////////////////////////////////////////////
276 /// Returns a pointer to the TClass of this element.
277 
279 {
280  if (fClassObject!=(TClass*)(-1)) return fClassObject;
281  TString className = fTypeName.Strip(TString::kTrailing, '*');
282  if (className.Index("const ")==0) className.Remove(0,6);
283  bool quiet = (fType == TVirtualStreamerInfo::kArtificial);
284  ((TStreamerElement*)this)->fClassObject = TClass::GetClass(className,kTRUE,quiet);
285  return fClassObject;
286 }
287 
288 ////////////////////////////////////////////////////////////////////////////////
289 /// Returns the TExec id for the EXEC instruction in the comment field
290 /// of a TRef data member.
291 
293 {
294  //check if element is a TRef or TRefArray
295  if (strncmp(fTypeName.Data(),"TRef",4) != 0) return 0;
296 
297  //if the UniqueID of this element has already been set, we assume
298  //that it contains the exec id of a TRef object.
299  if (GetUniqueID()) return GetUniqueID();
300 
301  //check if an Exec is specified in the comment field
302  char *action = (char*)strstr(GetTitle(),"EXEC:");
303  if (!action) return 0;
304  Int_t nch = strlen(action)+1;
305  char *caction = new char[nch];
306  strlcpy(caction,action+5,nch);
307  char *blank = (char*)strchr(caction,' ');
308  if (blank) *blank = 0;
309  //we have found the Exec name in the comment
310  //we register this Exec to the list of Execs.
311  Int_t index = TRef::AddExec(caction);
312  delete [] caction;
313  //we save the Exec index as the uniqueid of this STreamerElement
314  const_cast<TStreamerElement*>(this)->SetUniqueID(index+1);
315  return index+1;
316 }
317 
318 ////////////////////////////////////////////////////////////////////////////////
319 /// Return element name including dimensions, if any
320 /// Note that this function stores the name into a static array.
321 /// You should copy the result.
322 
323 const char *TStreamerElement::GetFullName() const
324 {
325  TTHREAD_TLS_DECL_ARG(TString,name,kMaxLen);
326  char cdim[20];
327  name = GetName();
328  for (Int_t i=0;i<fArrayDim;i++) {
329  snprintf(cdim,19,"[%d]",fMaxIndex[i]);
330  name += cdim;
331  }
332  return name;
333 }
334 
335 ////////////////////////////////////////////////////////////////////////////////
336 /// Fill type with the string representation of sequence
337 /// information including 'cached','repeat','write' or
338 /// 'nodelete'.
339 
341 {
342  sequenceType.Clear();
343  Bool_t first = kTRUE;
345  if (!first) sequenceType += ",";
346  first = kFALSE;
347  sequenceType += "wholeObject";
348  }
350  first = kFALSE;
351  sequenceType += "cached";
352  }
354  if (!first) sequenceType += ",";
355  first = kFALSE;
356  sequenceType += "repeat";
357  }
359  if (!first) sequenceType += ",";
360  first = kFALSE;
361  sequenceType += "nodelete";
362  }
364  if (!first) sequenceType += ",";
365  first = kFALSE;
366  sequenceType += "write";
367  }
368 }
369 
370 ////////////////////////////////////////////////////////////////////////////////
371 /// Returns size of this element in bytes.
372 
374 {
375  return fSize;
376 }
377 
378 ////////////////////////////////////////////////////////////////////////////////
379 /// Return the local streamer object.
380 
382 {
383  return fStreamer;
384 }
385 
386 ////////////////////////////////////////////////////////////////////////////////
387 /// Return type name of this element
388 /// in case the type name is not a standard basic type, return
389 /// the basic type name known to CINT.
390 
392 {
393  TDataType *dt = gROOT->GetType(fTypeName.Data());
394  if (fType < 1 || fType > 55) return fTypeName.Data();
395  if (dt && dt->GetType() > 0) return fTypeName.Data();
396  Int_t dtype = fType%20;
397  return TDataType::GetTypeName((EDataType)dtype);
398 }
399 
400 ////////////////////////////////////////////////////////////////////////////////
401 /// Initliaze the element.
402 
404 {
406  if (fClassObject && fClassObject->IsTObject()) {
408  }
409 }
410 
411 ////////////////////////////////////////////////////////////////////////////////
412 /// The early 3.00/00 and 3.01/01 versions used to store
413 /// dm->GetTypeName instead of dm->GetFullTypename
414 /// if this case is detected, the element type name is modified.
415 
416 Bool_t TStreamerElement::IsOldFormat(const char *newTypeName)
417 {
418  //if (!IsaPointer()) return kFALSE;
419  if (!strstr(newTypeName,fTypeName.Data())) return kFALSE;
420  //if (!strstr(fTypeName.Data(),newTypeName)) return kFALSE;
421  fTypeName = newTypeName;
422  return kTRUE;
423 }
424 
425 ////////////////////////////////////////////////////////////////////////////////
426 /// Return kTRUE if the element represent a base class.
427 
429 {
430  return kFALSE;
431 }
432 
433 ////////////////////////////////////////////////////////////////////////////////
434 /// Return kTRUE if the element represent an entity that is not written
435 /// to the disk (transient members, cache allocator/deallocator, etc.)
436 
438 {
439  if (fType == TVirtualStreamerInfo::kArtificial) {
440  // if (((const TStreamerArtificial*)this)->GetWriteFunc() == 0)
441  return kTRUE;
442  }
443  if (fType == TVirtualStreamerInfo::kCacheNew) return kTRUE;
444  if (fType == TVirtualStreamerInfo::kCacheDelete) return kTRUE;
445  if (fType == TVirtualStreamerInfo::kCache) return kTRUE;
446  if (fType == TVirtualStreamerInfo::kMissing) return kTRUE;
447  if (TVirtualStreamerInfo::kSkip <= fType && fType < TVirtualStreamerInfo::kSkip) return kTRUE;
448 
449  return kFALSE;
450 }
451 
452 ////////////////////////////////////////////////////////////////////////////////
453 /// Print the content of the element.
454 
456 {
457  TString temp(GetTypeName());
458  if (IsaPointer() && !fTypeName.Contains("*")) temp += "*";
459 
460  TString sequenceType;
461  GetSequenceType(sequenceType);
462  if (sequenceType.Length()) {
463  sequenceType.Prepend(" (");
464  sequenceType += ") ";
465  }
466  printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",
467  temp.Data(),GetFullName(),fOffset,fType,sequenceType.Data(),
468  GetTitle());
469 }
470 
471 ////////////////////////////////////////////////////////////////////////////////
472 /// Set number of array dimensions.
473 
475 {
476  fArrayDim = dim;
477  if (dim) fType += TVirtualStreamerInfo::kOffsetL;
478  fNewType = fType;
479 }
480 
481 ////////////////////////////////////////////////////////////////////////////////
482 ///set maximum index for array with dimension dim
483 
485 {
486  if (dim < 0 || dim > 4) return;
487  fMaxIndex[dim] = max;
488  if (fArrayLength == 0) fArrayLength = max;
489  else fArrayLength *= max;
490 }
491 
492 ////////////////////////////////////////////////////////////////////////////////
493 ///set pointer to Streamer function for this element
494 
496 {
497  fStreamer = streamer;
498 }
499 
500 ////////////////////////////////////////////////////////////////////////////////
501 /// Stream an object of class TStreamerElement.
502 
503 void TStreamerElement::Streamer(TBuffer &R__b)
504 {
505  UInt_t R__s, R__c;
506  if (R__b.IsReading()) {
507  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
508  //NOTE that when reading, one cannot use Class()->ReadBuffer
509  // TBuffer::Class methods used for reading streamerinfos from SQL database
510  // Any changes of class structure should be reflected by them starting from version 4
511 
512  R__b.ClassBegin(TStreamerElement::Class(), R__v);
513  R__b.ClassMember("TNamed");
514  TNamed::Streamer(R__b);
515  R__b.ClassMember("fType","Int_t");
516  R__b >> fType;
517  R__b.ClassMember("fSize","Int_t");
518  R__b >> fSize;
519  R__b.ClassMember("fArrayLength","Int_t");
520  R__b >> fArrayLength;
521  R__b.ClassMember("fArrayDim","Int_t");
522  R__b >> fArrayDim;
523  R__b.ClassMember("fMaxIndex","Int_t", 5);
524  if (R__v == 1) R__b.ReadStaticArray(fMaxIndex);
525  else R__b.ReadFastArray(fMaxIndex,5);
526  R__b.ClassMember("fTypeName","TString");
527  fTypeName.Streamer(R__b);
528  if (fType==11&&(fTypeName=="Bool_t"||fTypeName=="bool")) fType = 18;
529  if (R__v > 1) {
530  SetUniqueID(0);
531  //check if element is a TRef or TRefArray
532  GetExecID();
533  }
534  if (R__v <= 2 && this->IsA()==TStreamerBasicType::Class()) {
535  // In TStreamerElement v2, fSize was holding the size of
536  // the underlying data type. In later version it contains
537  // the full length of the data member.
538  TDataType *type = gROOT->GetType(GetTypeName());
539  if (type && fArrayLength) fSize = fArrayLength * type->Size();
540  }
541  if (R__v == 3) {
542  R__b >> fXmin;
543  R__b >> fXmax;
544  R__b >> fFactor;
545  if (fFactor > 0) SetBit(kHasRange);
546  }
547  if (R__v > 3) {
548  if (TestBit(kHasRange)) GetRange(GetTitle(),fXmin,fXmax,fFactor);
549  }
550  //R__b.CheckByteCount(R__s, R__c, TStreamerElement::IsA());
552  R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
553 
556  } else {
558  }
559 }
560 
561 ////////////////////////////////////////////////////////////////////////////////
562 ///function called by the TClass constructor when replacing an emulated class
563 ///by the real class
564 
565 void TStreamerElement::Update(const TClass *oldClass, TClass *newClass)
566 {
567  if (fClassObject == oldClass) {
568  fClassObject = newClass;
569  if (fClassObject && fClassObject->IsTObject()) {
571  }
572  } else if (fClassObject==0) {
573  // Well since some emulated class is replaced by a real class, we can
574  // assume a new library has been loaded. If this is the case, we should
575  // check whether the class now exist (this would be the case for example
576  // for reading STL containers).
577  fClassObject = (TClass*)-1;
578  GetClassPointer(); //force fClassObject
579  if (fClassObject && fClassObject->IsTObject()) {
581  }
582  }
583 }
584 
585 //______________________________________________________________________________
586 
587 //////////////////////////////////////////////////////////////////////////
588 // //
589 // TStreamerBase implement the streamer of the base class //
590 // //
591 //////////////////////////////////////////////////////////////////////////
592 
594 
595 ////////////////////////////////////////////////////////////////////////////////
596 
598  // Abuse TStreamerElement data member that is not used by TStreamerBase
599  fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
600  fStreamerFunc(0), fConvStreamerFunc(0), fStreamerInfo(0)
601 {
602  // Default ctor.
603 
604  fBaseClass = (TClass*)(-1);
605  fBaseVersion = 0;
606  fNewBaseClass = 0;
607 }
608 
609 ////////////////////////////////////////////////////////////////////////////////
610 
611 TStreamerBase::TStreamerBase(const char *name, const char *title, Int_t offset)
612  : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kBase,"BASE"),
613  // Abuse TStreamerElement data member that is not used by TStreamerBase
614  fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
615  fStreamerFunc(0), fConvStreamerFunc(0), fStreamerInfo(0)
616 
617 {
618  // Create a TStreamerBase object.
619 
620  if (strcmp(name,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
621  if (strcmp(name,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
622  fNewType = fType;
624  if (fBaseClass) {
625  if (fBaseClass->IsVersioned()) {
627  } else {
628  fBaseVersion = -1;
629  }
631  } else {
632  fBaseVersion = 0;
633  }
634  fNewBaseClass = 0;
635  Init();
636 }
637 
638 ////////////////////////////////////////////////////////////////////////////////
639 /// TStreamerBase dtor
640 
642 {
643 }
644 
645 ////////////////////////////////////////////////////////////////////////////////
646 /// Returns a pointer to the TClass of this element.
647 
649 {
650  if (fBaseClass!=(TClass*)(-1)) return fBaseClass;
651  ((TStreamerBase*)this)->fBaseClass = TClass::GetClass(GetName());
652  return fBaseClass;
653 }
654 
655 ////////////////////////////////////////////////////////////////////////////////
656 /// Returns size of baseclass in bytes.
657 
659 {
660  TClass *cl = GetClassPointer();
661  if (cl) return cl->Size();
662  return 0;
663 }
664 
665 ////////////////////////////////////////////////////////////////////////////////
666 /// Setup the element.
667 
669 {
671  if (!fBaseClass) return;
672 
673  InitStreaming();
674 }
675 
676 ////////////////////////////////////////////////////////////////////////////////
677 /// Setup the fStreamerFunc and fStreamerinfo
678 
680 {
681  if (fNewBaseClass) {
684  if (fBaseVersion > 0 || fBaseCheckSum == 0) {
686  } else {
688  }
689  } else if (fBaseClass && fBaseClass != (TClass*)-1) {
692  if (fBaseVersion >= 0 || fBaseCheckSum == 0) {
694  } else {
696  }
697  } else {
698  fStreamerFunc = 0;
699  fConvStreamerFunc = 0;
700  fStreamerInfo = 0;
701  }
702 }
703 
704 ////////////////////////////////////////////////////////////////////////////////
705 /// Return kTRUE if the element represent a base class.
706 
708 {
709  return kTRUE;
710 }
711 
712 ////////////////////////////////////////////////////////////////////////////////
713 /// Return the proper include for this element.
714 
715 const char *TStreamerBase::GetInclude() const
716 {
719  } else {
720  std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
721  IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
722  }
723  return IncludeNameBuffer();
724 }
725 
726 ////////////////////////////////////////////////////////////////////////////////
727 /// Print the content of the element.
728 
730 {
731  TString sequenceType;
732  GetSequenceType(sequenceType);
733  if (sequenceType.Length()) {
734  sequenceType.Prepend(" (");
735  sequenceType += ") ";
736  }
737  printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
738 }
739 
740 ////////////////////////////////////////////////////////////////////////////////
741 /// Read the content of the buffer.
742 
744 {
745  if (fConvStreamerFunc) {
746  // We have a custom Streamer member function, we must use it.
747  fConvStreamerFunc(b,pointer+fOffset,fNewBaseClass ? fBaseClass : nullptr);
748  } else if (fStreamerFunc) {
749  // We have a custom Streamer member function, we must use it.
750  fStreamerFunc(b,pointer+fOffset);
751  } else {
752  // We don't have a custom Streamer member function. That still doesn't mean
753  // that there is no streamer - it could be an external one:
754  // If the old base class has an adopted streamer we take that
755  // one instead of the new base class:
756  if( fNewBaseClass ) {
758  if (extstrm) {
759  // The new base class has an adopted streamer:
760  extstrm->SetOnFileClass(fBaseClass);
761  (*extstrm)(b, pointer);
762  } else {
764  }
765  } else {
766  TClassStreamer* extstrm = fBaseClass->GetStreamer();
767  if (extstrm) {
768  // The class has an adopted streamer:
769  (*extstrm)(b, pointer);
770  } else {
771  b.ReadClassBuffer( fBaseClass, pointer+fOffset );
772  }
773  }
774  }
775  return 0;
776 }
777 
778 ////////////////////////////////////////////////////////////////////////////////
779 /// Stream an object of class TStreamerBase.
780 
781 void TStreamerBase::Streamer(TBuffer &R__b)
782 {
783  UInt_t R__s, R__c;
784  if (R__b.IsReading()) {
785  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
786 
787  R__b.ClassBegin(TStreamerBase::Class(), R__v);
788 
789  R__b.ClassMember("TStreamerElement");
790  TStreamerElement::Streamer(R__b);
791  // If the class owning the TStreamerElement and the base class are not
792  // loaded, on the file their streamer info might be in the following
793  // order (derived class,base class) and hence the base class is not
794  // yet emulated.
795  fBaseClass = (TClass*)-1;
796  fNewBaseClass = 0;
797  // Eventually we need a v3 that stores directly fBaseCheckSum (and
798  // a version of TStreamerElement should not stored fMaxIndex)
799  if (R__v > 2) {
800  R__b.ClassMember("fBaseVersion","Int_t");
801  R__b >> fBaseVersion;
802  } else {
803  // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
806  }
808  R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
809  } else {
811  }
812 }
813 
814 ////////////////////////////////////////////////////////////////////////////////
815 ///Function called by the TClass constructor when replacing an emulated class
816 ///by the real class.
817 
818 void TStreamerBase::Update(const TClass *oldClass, TClass *newClass)
819 {
820  if (fClassObject == oldClass) fClassObject = newClass;
821  else if (fClassObject == 0) {
822  fClassObject = (TClass*)-1;
823  GetClassPointer(); //force fClassObject
824  }
825  if (fBaseClass == oldClass) fBaseClass = newClass;
826  else if (fBaseClass == 0 ) {
827  fBaseClass = (TClass*)-1;
828  GetClassPointer(); //force fClassObject
829  }
830  if (fClassObject != (TClass*)-1 &&
833  }
834  InitStreaming();
835 }
836 
837 ////////////////////////////////////////////////////////////////////////////////
838 /// Write the base class into the buffer.
839 
841 {
842  if (fStreamerFunc) {
843  // We have a custom Streamer member function, we must use it.
844  fStreamerFunc(b,pointer+fOffset);
845  } else {
846  // We don't have a custom Streamer member function. That still doesn't mean
847  // that there is no streamer - it could be an external one:
848  // If the old base class has an adopted streamer we take that
849  // one instead of the new base class:
850  if (fNewBaseClass) {
852  if (extstrm) {
853  // The new base class has an adopted streamer:
854  extstrm->SetOnFileClass(fBaseClass);
855  (*extstrm)(b, pointer);
856  return 0;
857  } else {
858  fNewBaseClass->WriteBuffer(b,pointer+fOffset);
859  return 0;
860  }
861  } else {
862  TClassStreamer* extstrm = fBaseClass->GetStreamer();
863  if (extstrm) {
864  (*extstrm)(b, pointer);
865  return 0;
866  } else {
867  fBaseClass->WriteBuffer(b,pointer+fOffset);
868  return 0;
869  }
870  }
871  }
872  return 0;
873 }
874 
875 //______________________________________________________________________________
876 
877 //////////////////////////////////////////////////////////////////////////
878 // //
879 // TStreamerBasicPointer implements the streamering of pointer to //
880 // fundamental types. //
881 // //
882 //////////////////////////////////////////////////////////////////////////
883 
885 
886 ////////////////////////////////////////////////////////////////////////////////
887 /// Default ctor.
888 
889 TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(0)
890 {
891  fCounter = 0;
892 }
893 
894 ////////////////////////////////////////////////////////////////////////////////
895 /// Create a TStreamerBasicPointer object.
896 
897 TStreamerBasicPointer::TStreamerBasicPointer(const char *name, const char *title, Int_t offset, Int_t dtype, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
898  : TStreamerElement(name,title,offset,dtype,typeName)
899 {
901  fCountName = countName;
902  fCountClass = countClass;
903  fCountVersion = countVersion; //currently unused
904  Init();
905 // printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
906 // name,countName,countClass,countVersion,fCounter);
907 }
908 
909 ////////////////////////////////////////////////////////////////////////////////
910 /// TStreamerBasicPointer dtor.
911 
913 {
914 }
915 
916 ////////////////////////////////////////////////////////////////////////////////
917 /// return offset of counter
918 
920 {
921  if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
922  if (!fCounter) return 0;
923  // FIXME: does not suport multiple inheritance for counter in base class.
924  // This is wrong in case counter is not in the same class or one of
925  // the left most (non virtual) base classes. For the other we would
926  // really need to use the object coming from the list of real data.
927  // (and even that need analysis for virtual base class).
928  return (ULong_t)fCounter->GetOffset();
929 }
930 
931 ////////////////////////////////////////////////////////////////////////////////
932 /// Returns size of basicpointer in bytes.
933 
935 {
936  if (fArrayLength) return fArrayLength*sizeof(void *);
937  return sizeof(void *);
938 }
939 
940 ////////////////////////////////////////////////////////////////////////////////
941 /// Setup the element.
942 /// If directive is a StreamerInfo and it correspond to the
943 /// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
944 /// for 'countClass'.
945 
947 {
948  fCounter = InitCounter( fCountClass, fCountName, directive );
949 }
950 
951 ////////////////////////////////////////////////////////////////////////////////
952 /// Set number of array dimensions.
953 
955 {
956  fArrayDim = dim;
957  //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
958  fNewType = fType;
959 }
960 
961 ////////////////////////////////////////////////////////////////////////////////
962 /// Stream an object of class TStreamerBasicPointer.
963 
964 void TStreamerBasicPointer::Streamer(TBuffer &R__b)
965 {
966  UInt_t R__s, R__c;
967  if (R__b.IsReading()) {
968  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
969  if (R__v > 1) {
970  R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
971  //Init();
972  //fCounter = InitCounter( fCountClass, fCountName );
973  return;
974  }
975  //====process old versions before automatic schema evolution
976  TStreamerElement::Streamer(R__b);
977  R__b >> fCountVersion;
978  fCountName.Streamer(R__b);
979  fCountClass.Streamer(R__b);
980  R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
981  } else {
983  }
984 }
985 
986 
987 //______________________________________________________________________________
988 
989 //////////////////////////////////////////////////////////////////////////
990 // //
991 // TStreamerLoop implement streaming of a few construct that require //
992 // looping over the data member and are not convered by other case //
993 // (most deprecated). //
994 // //
995 //////////////////////////////////////////////////////////////////////////
996 
998 
999 ////////////////////////////////////////////////////////////////////////////////
1000 /// Default ctor.
1001 
1002 TStreamerLoop::TStreamerLoop() : fCountVersion(0),fCountName(),fCountClass(),fCounter(0)
1003 {
1004 }
1005 
1006 ////////////////////////////////////////////////////////////////////////////////
1007 /// Create a TStreamerLoop object.
1008 
1009 TStreamerLoop::TStreamerLoop(const char *name, const char *title, Int_t offset, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
1010  : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kStreamLoop,typeName)
1011 {
1012  fCountName = countName;
1013  fCountClass = countClass;
1014  fCountVersion = countVersion; //currently unused
1015  Init();
1016 }
1017 
1018 ////////////////////////////////////////////////////////////////////////////////
1019 /// TStreamerLoop dtor.
1020 
1022 {
1023 }
1024 
1025 ////////////////////////////////////////////////////////////////////////////////
1026 /// return address of counter
1027 
1029 {
1030  //if (!fCounter) {
1031  // Init();
1032  // if (!fCounter) return 0;
1033  //}
1034  if (!fCounter) return 0;
1035  return (ULong_t)fCounter->GetOffset();
1036 }
1037 
1038 ////////////////////////////////////////////////////////////////////////////////
1039 /// Returns size of counter in bytes.
1040 
1042 {
1043  if (fArrayLength) return fArrayLength*sizeof(void*);
1044  return sizeof(void*);
1045 }
1046 
1047 ////////////////////////////////////////////////////////////////////////////////
1048 /// Setup the element.
1049 /// If directive is a StreamerInfo and it correspond to the
1050 /// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
1051 /// for 'countClass'.
1052 
1054 {
1055  fCounter = InitCounter( fCountClass, fCountName, directive );
1056 }
1057 
1058 ////////////////////////////////////////////////////////////////////////////////
1059 /// Return the proper include for this element.
1060 
1061 const char *TStreamerLoop::GetInclude() const
1062 {
1063  IncludeNameBuffer().Form("<%s>","TString.h"); //to be generalized
1064  return IncludeNameBuffer();
1065 }
1066 
1067 ////////////////////////////////////////////////////////////////////////////////
1068 /// Stream an object of class TStreamerLoop.
1069 
1070 void TStreamerLoop::Streamer(TBuffer &R__b)
1071 {
1072  UInt_t R__s, R__c;
1073  if (R__b.IsReading()) {
1074  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1075  if (R__v > 1) {
1076  R__b.ReadClassBuffer(TStreamerLoop::Class(), this, R__v, R__s, R__c);
1077  //Init();
1078  return;
1079  }
1080  //====process old versions before automatic schema evolution
1081  TStreamerElement::Streamer(R__b);
1082  R__b >> fCountVersion;
1083  fCountName.Streamer(R__b);
1084  fCountClass.Streamer(R__b);
1085  R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1086  } else {
1088  }
1089 }
1090 
1091 
1092 //______________________________________________________________________________
1093 
1094 //////////////////////////////////////////////////////////////////////////
1095 // //
1096 // TStreamerBasicType implement streaming of fundamental types (int, //
1097 // float, etc.). //
1098 // //
1099 //////////////////////////////////////////////////////////////////////////
1100 
1102 
1103 ////////////////////////////////////////////////////////////////////////////////
1104 /// Default ctor.
1105 
1106 TStreamerBasicType::TStreamerBasicType() : fCounter(0)
1107 {
1108 }
1109 
1110 ////////////////////////////////////////////////////////////////////////////////
1111 /// Create a TStreamerBasicType object.
1112 
1113 TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1114  : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1115 {
1116 }
1117 
1118 ////////////////////////////////////////////////////////////////////////////////
1119 /// TStreamerBasicType dtor.
1120 
1122 {
1123 }
1124 
1125 ////////////////////////////////////////////////////////////////////////////////
1126 /// return address of counter
1127 
1129 {
1130  if (fType == TVirtualStreamerInfo::kCounter ||
1132  return 0;
1133 }
1134 
1135 ////////////////////////////////////////////////////////////////////////////////
1136 /// Returns size of this element in bytes.
1137 
1139 {
1140  return fSize;
1141 }
1142 
1143 ////////////////////////////////////////////////////////////////////////////////
1144 /// Stream an object of class TStreamerBasicType.
1145 
1146 void TStreamerBasicType::Streamer(TBuffer &R__b)
1147 {
1148  UInt_t R__s, R__c;
1149  if (R__b.IsReading()) {
1150  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1151  if (R__v > 1) {
1152  R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1153  } else {
1154  //====process old versions before automatic schema evolution
1155  TStreamerElement::Streamer(R__b);
1156  R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1157  }
1158  Int_t type = fType;
1161  }
1162  switch(type) {
1163  // basic types
1164  case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1165  case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1166  case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1167  case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1168  case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1169  case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1170  case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1171  case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1172  case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1173  case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1174  case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1175  case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1176  case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1177  case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1178  case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1179  case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1180  case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1181  case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1182  default: return; // If we don't change the size let's not remultiply it.
1183  }
1184  if (fArrayLength) fSize *= GetArrayLength();
1185  } else {
1187  }
1188 }
1189 
1190 
1191 
1192 //______________________________________________________________________________
1193 
1194 //////////////////////////////////////////////////////////////////////////
1195 // //
1196 // TStreamerObject implements streaming of embedded objects whose type //
1197 // inherits from TObject. //
1198 // //
1199 //////////////////////////////////////////////////////////////////////////
1200 
1202 
1203 ////////////////////////////////////////////////////////////////////////////////
1204 /// Default ctor.
1205 
1207 {
1208 }
1209 
1210 ////////////////////////////////////////////////////////////////////////////////
1211 /// Create a TStreamerObject object.
1212 
1213 TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1214  : TStreamerElement(name,title,offset,0,typeName)
1215 {
1217  if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1218  if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1219  fNewType = fType;
1220  Init();
1221 }
1222 
1223 ////////////////////////////////////////////////////////////////////////////////
1224 /// TStreamerObject dtor.
1225 
1227 {
1228 }
1229 
1230 ////////////////////////////////////////////////////////////////////////////////
1231 /// Setup the element.
1232 
1234 {
1236  if (fClassObject && fClassObject->IsTObject()) {
1238  }
1239 }
1240 
1241 ////////////////////////////////////////////////////////////////////////////////
1242 /// Return the proper include for this element.
1243 
1244 const char *TStreamerObject::GetInclude() const
1245 {
1246  TClass *cl = GetClassPointer();
1247  if (cl && cl->HasInterpreterInfo()) {
1248  IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1249  } else {
1250  std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1251  IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1252  }
1253  return IncludeNameBuffer();
1254 }
1255 
1256 ////////////////////////////////////////////////////////////////////////////////
1257 /// Returns size of object class in bytes.
1258 
1260 {
1261  TClass *cl = GetClassPointer();
1262  Int_t classSize = 8;
1263  if (cl) classSize = cl->Size();
1264  if (fArrayLength) return fArrayLength*classSize;
1265  return classSize;
1266 }
1267 
1268 ////////////////////////////////////////////////////////////////////////////////
1269 /// Stream an object of class TStreamerObject.
1270 
1271 void TStreamerObject::Streamer(TBuffer &R__b)
1272 {
1273  UInt_t R__s, R__c;
1274  if (R__b.IsReading()) {
1275  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1276  if (R__v > 1) {
1277  R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1278  return;
1279  }
1280  //====process old versions before automatic schema evolution
1281  TStreamerElement::Streamer(R__b);
1282  R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1283  } else {
1285  }
1286 }
1287 
1288 
1289 //______________________________________________________________________________
1290 
1291 //////////////////////////////////////////////////////////////////////////
1292 // //
1293 // TStreamerObjectAny implement streaming of embedded object not //
1294 // inheriting from TObject. //
1295 // //
1296 //////////////////////////////////////////////////////////////////////////
1297 
1299 
1300 ////////////////////////////////////////////////////////////////////////////////
1301 /// Default ctor.
1302 
1304 {
1305 }
1306 
1307 ////////////////////////////////////////////////////////////////////////////////
1308 /// Create a TStreamerObjectAny object.
1309 
1310 TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1311  : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1312 {
1313  Init();
1314 }
1315 
1316 ////////////////////////////////////////////////////////////////////////////////
1317 /// TStreamerObjectAny dtor.
1318 
1320 {
1321 }
1322 
1323 ////////////////////////////////////////////////////////////////////////////////
1324 /// Setup the element.
1325 
1327 {
1329  if (fClassObject && fClassObject->IsTObject()) {
1331  }
1332 }
1333 
1334 ////////////////////////////////////////////////////////////////////////////////
1335 /// Return the proper include for this element.
1336 
1338 {
1339  TClass *cl = GetClassPointer();
1340  if (cl && cl->HasInterpreterInfo()) {
1341  IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1342  } else {
1343  std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1344  IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1345  }
1346  return IncludeNameBuffer();
1347 }
1348 
1349 ////////////////////////////////////////////////////////////////////////////////
1350 /// Returns size of anyclass in bytes.
1351 
1353 {
1354  TClass *cl = GetClassPointer();
1355  Int_t classSize = 8;
1356  if (cl) classSize = cl->Size();
1357  if (fArrayLength) return fArrayLength*classSize;
1358  return classSize;
1359 }
1360 
1361 ////////////////////////////////////////////////////////////////////////////////
1362 /// Stream an object of class TStreamerObjectAny.
1363 
1364 void TStreamerObjectAny::Streamer(TBuffer &R__b)
1365 {
1366  UInt_t R__s, R__c;
1367  if (R__b.IsReading()) {
1368  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1369  if (R__v > 1) {
1370  R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1371  return;
1372  }
1373  //====process old versions before automatic schema evolution
1374  TStreamerElement::Streamer(R__b);
1375  R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1376  } else {
1378  }
1379 }
1380 
1381 
1382 
1383 //______________________________________________________________________________
1384 
1385 //////////////////////////////////////////////////////////////////////////
1386 // //
1387 // TStreamerObjectPointer implements streaming of pointer to object //
1388 // inheriting from TObject. //
1389 // //
1390 //////////////////////////////////////////////////////////////////////////
1391 
1393 
1394 ////////////////////////////////////////////////////////////////////////////////
1395 /// Default ctor.
1396 
1398 {
1399 }
1400 
1401 ////////////////////////////////////////////////////////////////////////////////
1402 /// Create a TStreamerObjectPointer object.
1403 
1405  Int_t offset, const char *typeName)
1406  : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1407 {
1408  if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1409  fNewType = fType;
1410  Init();
1411 }
1412 
1413 ////////////////////////////////////////////////////////////////////////////////
1414 /// TStreamerObjectPointer dtor.
1415 
1417 {
1418 }
1419 
1420 ////////////////////////////////////////////////////////////////////////////////
1421 /// Setup the element.
1422 
1424 {
1426  if (fClassObject && fClassObject->IsTObject()) {
1428  }
1429 }
1430 
1431 ////////////////////////////////////////////////////////////////////////////////
1432 /// Return the proper include for this element.
1433 
1435 {
1436  TClass *cl = GetClassPointer();
1437  if (cl && cl->HasInterpreterInfo()) {
1438  IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1439  } else {
1440  std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1441  IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1442  }
1443 
1444  return IncludeNameBuffer();
1445 }
1446 
1447 ////////////////////////////////////////////////////////////////////////////////
1448 /// Returns size of objectpointer in bytes.
1449 
1451 {
1452  if (fArrayLength) return fArrayLength*sizeof(void *);
1453  return sizeof(void *);
1454 }
1455 
1456 ////////////////////////////////////////////////////////////////////////////////
1457 /// Set number of array dimensions.
1458 
1460 {
1461  fArrayDim = dim;
1462  //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1463  fNewType = fType;
1464 }
1465 
1466 ////////////////////////////////////////////////////////////////////////////////
1467 /// Stream an object of class TStreamerObjectPointer.
1468 
1469 void TStreamerObjectPointer::Streamer(TBuffer &R__b)
1470 {
1471  UInt_t R__s, R__c;
1472  if (R__b.IsReading()) {
1473  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1474  if (R__v > 1) {
1475  R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1476  return;
1477  }
1478  //====process old versions before automatic schema evolution
1479  TStreamerElement::Streamer(R__b);
1480  R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1481  } else {
1483  }
1484 }
1485 
1486 
1487 //______________________________________________________________________________
1488 
1489 //////////////////////////////////////////////////////////////////////////
1490 // //
1491 // TStreamerObjectPointerAny implements streaming of pointer to object //
1492 // not inheriting from TObject. //
1493 // //
1494 //////////////////////////////////////////////////////////////////////////
1495 
1497 
1498 ////////////////////////////////////////////////////////////////////////////////
1499 /// Default ctor.
1500 
1502 {
1503 }
1504 
1505 ////////////////////////////////////////////////////////////////////////////////
1506 /// Create a TStreamerObjectAnyPointer object.
1507 
1509  Int_t offset, const char *typeName)
1510  : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1511 {
1512  if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1513  fNewType = fType;
1514  Init();
1515 }
1516 
1517 ////////////////////////////////////////////////////////////////////////////////
1518 /// TStreamerObjectAnyPointer dtor.
1519 
1521 {
1522 }
1523 
1524 ////////////////////////////////////////////////////////////////////////////////
1525 /// Setup the element.
1526 
1528 {
1530  if (fClassObject && fClassObject->IsTObject()) {
1532  }
1533 }
1534 
1535 ////////////////////////////////////////////////////////////////////////////////
1536 /// Return the proper include for this element.
1537 
1539 {
1540  TClass *cl = GetClassPointer();
1541  if (cl && cl->HasInterpreterInfo()) {
1542  IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1543  } else {
1544  std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1545  IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1546  }
1547 
1548  return IncludeNameBuffer();
1549 }
1550 
1551 ////////////////////////////////////////////////////////////////////////////////
1552 /// Returns size of objectpointer in bytes.
1553 
1555 {
1556  if (fArrayLength) return fArrayLength*sizeof(void *);
1557  return sizeof(void *);
1558 }
1559 
1560 ////////////////////////////////////////////////////////////////////////////////
1561 /// Set number of array dimensions.
1562 
1564 {
1565  fArrayDim = dim;
1566  //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1567  fNewType = fType;
1568 }
1569 
1570 ////////////////////////////////////////////////////////////////////////////////
1571 /// Stream an object of class TStreamerObjectAnyPointer.
1572 
1573 void TStreamerObjectAnyPointer::Streamer(TBuffer &R__b)
1574 {
1575  if (R__b.IsReading()) {
1577  } else {
1579  }
1580 }
1581 
1582 
1583 //______________________________________________________________________________
1584 
1585 //////////////////////////////////////////////////////////////////////////
1586 // //
1587 // TSreamerString implements streaming of TString. //
1588 // //
1589 //////////////////////////////////////////////////////////////////////////
1590 
1592 
1593 ////////////////////////////////////////////////////////////////////////////////
1594 /// Default ctor.
1595 
1597 {
1598 }
1599 
1600 ////////////////////////////////////////////////////////////////////////////////
1601 /// Create a TStreamerString object.
1602 
1603 TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1604  : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1605 {
1606 }
1607 
1608 ////////////////////////////////////////////////////////////////////////////////
1609 /// TStreamerString dtor.
1610 
1612 {
1613 }
1614 
1615 ////////////////////////////////////////////////////////////////////////////////
1616 /// Return the proper include for this element.
1617 
1618 const char *TStreamerString::GetInclude() const
1619 {
1620  IncludeNameBuffer().Form("<%s>","TString.h");
1621  return IncludeNameBuffer();
1622 }
1623 
1624 ////////////////////////////////////////////////////////////////////////////////
1625 /// Returns size of anyclass in bytes.
1626 
1628 {
1629  if (fArrayLength) return fArrayLength*sizeof(TString);
1630  return sizeof(TString);
1631 }
1632 
1633 ////////////////////////////////////////////////////////////////////////////////
1634 /// Stream an object of class TStreamerString.
1635 
1636 void TStreamerString::Streamer(TBuffer &R__b)
1637 {
1638  UInt_t R__s, R__c;
1639  if (R__b.IsReading()) {
1640  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1641  if (R__v > 1) {
1642  R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1643  return;
1644  }
1645  //====process old versions before automatic schema evolution
1646  TStreamerElement::Streamer(R__b);
1647  R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1648  } else {
1650  }
1651 }
1652 
1653 //______________________________________________________________________________
1654 
1655 //////////////////////////////////////////////////////////////////////////
1656 // //
1657 // TStreamerSTL implements streamer of STL container. //
1658 // //
1659 //////////////////////////////////////////////////////////////////////////
1660 
1662 
1663 ////////////////////////////////////////////////////////////////////////////////
1664 /// Default ctor.
1665 
1666 TStreamerSTL::TStreamerSTL() : fSTLtype(0),fCtype(0)
1667 {
1668 }
1669 
1670 ////////////////////////////////////////////////////////////////////////////////
1671 /// Create a TStreamerSTL object.
1672 
1673 TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1674  const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1675  : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1676 {
1678 
1679  if (name==typeName /* intentional pointer comparison */
1680  || strcmp(name,typeName)==0) {
1681  // We have a base class.
1682  fName = fTypeName;
1683  }
1684  fSTLtype = proxy.GetCollectionType();
1685  fCtype = 0;
1686 
1687  if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1688 
1689  if (fSTLtype == ROOT::kSTLbitset) {
1690  // Nothing to check
1691  } else if (proxy.GetValueClass()) {
1692  if (proxy.HasPointers()) fCtype = TVirtualStreamerInfo::kObjectp;
1693  else fCtype = TVirtualStreamerInfo::kObject;
1694  } else {
1695  fCtype = proxy.GetType();
1696  if (proxy.HasPointers()) fCtype += TVirtualStreamerInfo::kOffsetP;
1697  }
1699 }
1700 
1701 ////////////////////////////////////////////////////////////////////////////////
1702 /// Create a TStreamerSTL object.
1703 
1704 TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1705  const char *typeName, const char *trueType, Bool_t dmPointer)
1706  : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1707 {
1708  const char *t = trueType;
1709  if (!t || !*t) t = typeName;
1710 
1712 
1713  if (name==typeName /* intentional pointer comparison */
1714  || strcmp(name,typeName)==0) {
1715  // We have a base class.
1716  fName = fTypeName;
1717  }
1718 
1719  Int_t nch = strlen(t);
1720  char *s = new char[nch+1];
1721  strlcpy(s,t,nch+1);
1722  char *sopen = strchr(s,'<');
1723  if (sopen == 0) {
1724  Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, s);
1725  return;
1726  }
1727  *sopen = 0; sopen++;
1728  // We are looking for the first arguments of the STL container, because
1729  // this arguments can be a templates we need to count the < and >
1730  char* current=sopen;
1731  for(int count = 0; *current!='\0'; current++) {
1732  if (*current=='<') count++;
1733  if (*current=='>') {
1734  if (count==0) break;
1735  count--;
1736  }
1737  if (*current==',' && count==0) break;
1738  }
1739  char *sclose = current; *sclose = 0; sclose--;
1740  char *sconst = strstr(sopen,"const ");
1741  char *sbracket = strstr(sopen,"<");
1742  if (sconst && (sbracket==0 || sconst < sbracket)) {
1743  // the string "const" may be part of the classname!
1744  char *pconst = sconst-1;
1745  if (*pconst == ' ' || *pconst == '<' || *pconst == '*' || *pconst == '\0') sopen = sconst + 5;
1746  }
1747  fSTLtype = 0;
1748  fCtype = 0;
1749  // Any class name that 'contains' the word will be counted
1750  // as a STL container. Is that really what we want.
1751  if (strstr(s,"vector")) fSTLtype = ROOT::kSTLvector;
1752  else if (strstr(s,"list")) fSTLtype = ROOT::kSTLlist;
1753  else if (strstr(s,"forward_list")) fSTLtype = ROOT::kSTLforwardlist;
1754  else if (strstr(s,"deque")) fSTLtype = ROOT::kSTLdeque;
1755  else if (strstr(s,"multimap")) fSTLtype = ROOT::kSTLmultimap;
1756  else if (strstr(s,"multiset")) fSTLtype = ROOT::kSTLmultiset;
1757  else if (strstr(s,"bitset")) fSTLtype = ROOT::kSTLbitset;
1758  else if (strstr(s,"map")) fSTLtype = ROOT::kSTLmap;
1759  else if (strstr(s,"set")) fSTLtype = ROOT::kSTLset;
1760  else if (strstr(s,"unordered_set")) fSTLtype = ROOT::kSTLunorderedset;
1761  else if (strstr(s,"unordered_multiset")) fSTLtype = ROOT::kSTLunorderedmultiset;
1762  else if (strstr(s,"unordered_map")) fSTLtype = ROOT::kSTLunorderedmap;
1763  else if (strstr(s,"unordered_multimap")) fSTLtype = ROOT::kSTLunorderedmultimap;
1764  if (fSTLtype == 0) { delete [] s; return;}
1765  if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1766 
1767  // find STL contained type
1768  while (*sopen==' ') sopen++;
1769  Bool_t isPointer = kFALSE;
1770  // Find stars outside of any template definitions in the
1771  // first template argument.
1772  char *star = strrchr(sopen,'>');
1773  if (star) star = strchr(star,'*');
1774  else star = strchr(sopen,'*');
1775  if (star) {
1776  isPointer = kTRUE;
1777  *star = 0;
1778  sclose = star - 1;
1779  }
1780  while (*sclose == ' ') {*sclose = 0; sclose--;}
1781 
1782 
1783  TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(sopen);
1784  if (fSTLtype == ROOT::kSTLbitset) {
1785  // Nothing to check
1786  } else if (dt) {
1787  fCtype = dt->GetType();
1788  if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1789  } else {
1790  // this could also be a nested enums ... which should work ... be let's see.
1791  TClass *cl = TClass::GetClass(sopen);
1792  if (cl) {
1793  if (isPointer) fCtype = TVirtualStreamerInfo::kObjectp;
1794  else fCtype = TVirtualStreamerInfo::kObject;
1795  } else {
1796  if (gCling->ClassInfo_IsEnum(sopen)) {
1797  if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1798  } else {
1799  if(strcmp(sopen,"string")) {
1800  // This case can happens when 'this' is a TStreamerElement for
1801  // a STL container containing something for which we do not have
1802  // a TVirtualStreamerInfo (This happens in particular is the collection
1803  // objects themselves are always empty) and we do not have the
1804  // dictionary/shared library for the container.
1805  if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1806  Warning("TStreamerSTL","For %s we could not find any information about the type %s %d %s",fTypeName.Data(),sopen,fSTLtype,s);
1807  }
1808  }
1809  }
1810  }
1811  }
1812  delete [] s;
1813 
1815 }
1816 
1817 ////////////////////////////////////////////////////////////////////////////////
1818 /// TStreamerSTL dtor.
1819 
1821 {
1822 }
1823 
1824 ////////////////////////////////////////////////////////////////////////////////
1825 /// We can not split STL's which are inside a variable size array.
1826 /// At least for now.
1827 
1829 {
1830  if (IsaPointer()) {
1831  if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1832  return kTRUE;
1833  }
1834 
1835  if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1836 
1837  if (TStreamerElement::CannotSplit()) return kTRUE;
1838 
1839  return kFALSE;
1840 }
1841 
1842 ////////////////////////////////////////////////////////////////////////////////
1843 /// Return true if the data member is a pointer.
1844 
1846 {
1847  const char *type_name = GetTypeName();
1848  if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1849  else return kFALSE;
1850 }
1851 
1852 
1853 ////////////////////////////////////////////////////////////////////////////////
1854 /// Return kTRUE if the element represent a base class.
1855 
1857 {
1858  TString ts(GetName());
1859 
1860  if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1861  if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1862  return kFALSE;
1863 }
1864 ////////////////////////////////////////////////////////////////////////////////
1865 /// Returns size of STL container in bytes.
1866 
1868 {
1869  // Since the STL collection might or might not be emulated and that the
1870  // sizeof the object depends on this, let's just always retrieve the
1871  // current size!
1872  TClass *cl = GetClassPointer();
1873  UInt_t size = 0;
1874  if (cl==0) {
1875  if (!TestBit(kWarned)) {
1876  Error("GetSize","Could not find the TClass for %s.\n"
1877  "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1878  const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1879  }
1880  } else {
1881  size = cl->Size();
1882  }
1883 
1884  if (fArrayLength) return fArrayLength*size;
1885  return size;
1886 }
1887 
1888 ////////////////////////////////////////////////////////////////////////////////
1889 /// Print the content of the element.
1890 
1892 {
1893  TString name(kMaxLen);
1894  TString cdim;
1895  name = GetName();
1896  for (Int_t i=0;i<fArrayDim;i++) {
1897  cdim.Form("[%d]",fMaxIndex[i]);
1898  name += cdim;
1899  }
1900  TString sequenceType;
1901  GetSequenceType(sequenceType);
1902  if (sequenceType.Length()) {
1903  sequenceType.Prepend(" (");
1904  sequenceType += ") ";
1905  }
1906  printf(" %-14s %-15s offset=%3d type=%2d %s,stl=%d, ctype=%d, %-20s\n",
1907  GetTypeName(),name.Data(),fOffset,fType,sequenceType.Data(),
1909 }
1910 
1911 ////////////////////////////////////////////////////////////////////////////////
1912 /// Return the proper include for this element.
1913 
1914 const char *TStreamerSTL::GetInclude() const
1915 {
1916  if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1917  else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1918  else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1919  else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1920  else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1921  else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1922  else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1923  else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1924  else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1925  else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1926  else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1927  else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1928  else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1929  return IncludeNameBuffer();
1930 }
1931 
1932 ////////////////////////////////////////////////////////////////////////////////
1933 /// Set pointer to Streamer function for this element
1934 /// NOTE: we do not take ownership
1935 
1937 {
1938  fStreamer = streamer;
1939 }
1940 
1941 ////////////////////////////////////////////////////////////////////////////////
1942 /// Stream an object of class TStreamerSTL.
1943 
1944 void TStreamerSTL::Streamer(TBuffer &R__b)
1945 {
1946  UInt_t R__s, R__c;
1947  if (R__b.IsReading()) {
1948  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1949  if (R__v > 2) {
1950  R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
1951  } else {
1952  //====process old versions before automatic schema evolution
1953  TStreamerElement::Streamer(R__b);
1954  R__b >> fSTLtype;
1955  R__b >> fCtype;
1956  R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
1957  }
1958  if (fSTLtype == ROOT::kSTLmultimap || fSTLtype == ROOT::kSTLset) {
1959  // For a long time those where inverted in TStreamerElement
1960  // compared to the other definitions. When we moved to version '4',
1961  // this got standardized, but we now need to fix it.
1962 
1963  if (fTypeName.BeginsWith("std::set") || fTypeName.BeginsWith("set")) {
1964  fSTLtype = ROOT::kSTLset;
1965  } else if (fTypeName.BeginsWith("std::multimap") || fTypeName.BeginsWith("multimap")) {
1966  fSTLtype = ROOT::kSTLmultimap;
1967  }
1968  }
1969 
1970  if (IsaPointer()) fType = TVirtualStreamerInfo::kSTLp;
1971  else fType = TVirtualStreamerInfo::kSTL;
1972  if (GetArrayLength() > 0) {
1974  }
1975  if (R__b.GetParent()) { // Avoid resetting during a cloning.
1977  SetBit(kDoNotDelete); // For backward compatibility
1978  } else if ( fSTLtype == ROOT::kSTLmap || fSTLtype == ROOT::kSTLmultimap) {
1979  // Here we would like to set the bit only if one of the element of the pair is a pointer,
1980  // however we have no easy to determine this short of parsing the class name.
1981  SetBit(kDoNotDelete); // For backward compatibility
1982  }
1983  }
1984  return;
1985  } else {
1986  // To enable forward compatibility we actually save with the old value
1987  Int_t tmp = fType;
1990  fType = tmp;
1991  }
1992 }
1993 
1994 //______________________________________________________________________________
1995 
1996 //////////////////////////////////////////////////////////////////////////
1997 // //
1998 // TStreamerSTLstring implements streaming std::string. //
1999 // //
2000 //////////////////////////////////////////////////////////////////////////
2001 
2003 
2004 ////////////////////////////////////////////////////////////////////////////////
2005 /// Default ctor.
2006 
2008 {
2009 }
2010 
2011 ////////////////////////////////////////////////////////////////////////////////
2012 /// Create a TStreamerSTLstring object.
2013 
2014 TStreamerSTLstring::TStreamerSTLstring(const char *name, const char *title, Int_t offset,
2015  const char *typeName, Bool_t dmPointer)
2016  : TStreamerSTL()
2017 {
2018  SetName(name);
2019  SetTitle(title);
2020 
2021  if (dmPointer) {
2023  } else {
2025  }
2026 
2027  fNewType = fType;
2028  fOffset = offset;
2029  fSTLtype = ROOT::kSTLstring;
2030  fCtype = ROOT::kSTLstring;
2031  fTypeName= typeName;
2032 
2033 }
2034 
2035 ////////////////////////////////////////////////////////////////////////////////
2036 /// TStreamerSTLstring dtor.
2037 
2039 {
2040 }
2041 
2042 ////////////////////////////////////////////////////////////////////////////////
2043 /// Return the proper include for this element.
2044 
2046 {
2047  IncludeNameBuffer() = "<string>";
2048  return IncludeNameBuffer();
2049 }
2050 
2051 ////////////////////////////////////////////////////////////////////////////////
2052 /// Returns size of anyclass in bytes.
2053 
2055 {
2056  if (fArrayLength) return fArrayLength*sizeof(string);
2057  return sizeof(string);
2058 }
2059 
2060 ////////////////////////////////////////////////////////////////////////////////
2061 /// Stream an object of class TStreamerSTLstring.
2062 
2063 void TStreamerSTLstring::Streamer(TBuffer &R__b)
2064 {
2065  UInt_t R__s, R__c;
2066  if (R__b.IsReading()) {
2067  Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2068  if (R__v > 1) {
2069  R__b.ReadClassBuffer(TStreamerSTLstring::Class(), this, R__v, R__s, R__c);
2070  return;
2071  }
2072  //====process old versions before automatic schema evolution
2073  TStreamerSTL::Streamer(R__b);
2074  R__b.CheckByteCount(R__s, R__c, TStreamerSTLstring::IsA());
2075  } else {
2077  }
2078 }
2079 
2080 //______________________________________________________________________________
2081 
2082 ///////////////////////////////////////////////////////////////////////////////
2083 // //
2084 // TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2085 // //
2086 ///////////////////////////////////////////////////////////////////////////////
2087 
2089 
2090 void TStreamerArtificial::Streamer(TBuffer& /* R__b */)
2091 {
2092  // Avoid streaming the synthetic/artificial streamer elements.
2093 
2094  // Intentionally, nothing to do at all.
2095  return;
2096 }
2097 
2099 {
2100  // Return the read function if any.
2101 
2102  return fReadFunc;
2103 }
2104 
2106 {
2107  // Return the raw read function if any.
2108 
2109  return fReadRawFunc;
2110 }
TObject * GetParent() const
Return pointer to parent of this buffer.
Definition: TBuffer.cxx:229
const char * GetInclude() const
Return the proper include for this element.
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:52
void SetBufferOffset(Int_t offset=0)
Definition: TBuffer.h:88
TStreamerBasicType()
value of data member when referenced by an array
virtual Int_t GetCollectionType() const =0
virtual ~TStreamerBase()
TStreamerBase dtor.
ROOT::TSchemaRule::ReadFuncPtr_t fReadFunc
void(* ReadRawFuncPtr_t)(char *, TBuffer &)
Definition: TSchemaRule.h:43
float xmin
Definition: THbookFile.cxx:93
Bool_t CannotSplit() const
We can not split STL's which are inside a variable size array.
virtual void ClassBegin(const TClass *, Version_t=-1)=0
Int_t fNewType
base offset for TObject if the element inherits from it
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Definition: TClass.cxx:2228
TString GetTypeName()
Get basic type of typedef, e,g.
Definition: TDataType.cxx:149
Int_t GetOffset() const
long long Long64_t
Definition: RtypesCore.h:69
const char * GetTypeName() const
ClassConvStreamerFunc_t fConvStreamerFunc
Pointer to a wrapper around a custom streamer member function.
Namespace for new ROOT classes and functions.
Definition: ROOT.py:1
Bool_t IsReading() const
Definition: TBuffer.h:81
virtual Bool_t InheritsFrom(const char *classname) const
Returns kTRUE if object inherits from class "classname".
Definition: TObject.cxx:487
short Version_t
Definition: RtypesCore.h:61
Int_t GetType() const
Definition: TDataType.h:70
const Int_t kMaxLen
Ssiz_t Length() const
Definition: TString.h:390
virtual TClass * GetClass() const =0
float Float_t
Definition: RtypesCore.h:53
const char Option_t
Definition: RtypesCore.h:62
virtual Bool_t CannotSplit() const
Returns true if the element cannot be split, false otherwise.
virtual TClass * GetValueClass() const =0
Bool_t IsaPointer() const
Return true if the data member is a pointer.
Double_t fXmin
pointer to element Streamer
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:33
virtual void Init(TObject *obj=0)
Setup the element.
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:46
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:635
unsigned short UShort_t
Definition: RtypesCore.h:36
virtual void SetName(const char *name)
Change (i.e.
Definition: TNamed.cxx:128
virtual Bool_t ClassInfo_IsEnum(const char *) const
Definition: TInterpreter.h:362
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition: TClass.cxx:5552
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
virtual ~TStreamerObjectAny()
TStreamerObjectAny dtor.
Buffer base class used for serializing objects.
Definition: TBuffer.h:40
Int_t GetSize() const
Returns size of objectpointer in bytes.
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
#define gROOT
Definition: TROOT.h:340
virtual Bool_t IsTransient() const
Return kTRUE if the element represent an entity that is not written to the disk (transient members...
virtual Int_t GetSize() const
Returns size of this element in bytes.
Basic string class.
Definition: TString.h:137
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1088
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
TClass * fBaseClass
checksum of the base class (used during memberwise streaming)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:496
const char * GetInclude() const
Return the proper include for this element.
virtual ~TStreamerObjectAnyPointer()
TStreamerObjectAnyPointer dtor.
ClassStreamerFunc_t fStreamerFunc
pointer to new base class if renamed
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
virtual ~TStreamerElement()
TStreamerElement dtor.
STL namespace.
TString & Prepend(const char *cs)
Definition: TString.h:604
ULong_t GetMethod() const
return address of counter
virtual EDataType GetType() const =0
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:558
virtual Int_t ReadStaticArray(Bool_t *b)=0
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
virtual ~TStreamerBasicType()
TStreamerBasicType dtor.
Int_t GetSize() const
Returns size of anyclass in bytes.
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:732
Bool_t IsVersioned() const
Definition: TClass.h:463
TList * GetListOfRealData() const
Definition: TClass.h:405
const char * Data() const
Definition: TString.h:349
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:395
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
Definition: TClass.cxx:2705
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:946
virtual void ClassMember(const char *, const char *=0, Int_t=-1, Int_t=-1)=0
ClassConvStreamerFunc_t GetConvStreamerFunc() const
Get a wrapper/accessor function around this class custom conversion streamer (member function)...
Definition: TClass.cxx:2860
ULong_t GetMethod() const
return offset of counter
virtual void Init(TObject *obj=0)
Initliaze the element.
Int_t GetSize() const
Returns size of anyclass in bytes.
void Class()
Definition: Class.C:29
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
const char * GetInclude() const
Return the proper include for this element.
UChar_t mod R__LOCKGUARD2(gSrvAuthenticateMutex)
void Clear()
Clear string without changing its capacity.
Definition: TString.cxx:1139
Int_t GetSize() const
Returns size of counter in bytes.
std::string ResolveTypedef(const char *tname, bool resolveAll=false)
virtual void Init(TObject *obj=0)
Setup the element.
virtual Bool_t IsaPointer() const
static TString & IncludeNameBuffer()
const char * GetInclude() const
Return the proper include for this element.
Int_t GetSize() const
Returns size of baseclass in bytes.
UInt_t & fBaseCheckSum
const char * GetInclude() const
Return the proper include for this element.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:918
virtual ~TStreamerObject()
TStreamerObject dtor.
Int_t WriteBuffer(TBuffer &b, void *pointer, const char *info="")
Function called by the Streamer functions to serialize object at p to buffer b.
Definition: TClass.cxx:6309
virtual ~TStreamerString()
TStreamerString dtor.
virtual void SetOnFileClass(const TClass *cl)
static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
Parse comments to search for a range specifier of the style: [xmin,xmax] or [xmin,xmax,nbits] [0,1] [-10,100]; [-pi,pi], [-pi/2,pi/4],[-2pi,2*pi] [-10,100,16] [0,0,8] if nbits is not specified, or nbits <2 or nbits>32 it is set to 32 if (xmin==0 and xmax==0 and nbits <=16) the double word will be converted to a float and its mantissa truncated to nbits significative bits.
virtual void Init(TObject *obj=0)
Setup the element.
static Int_t AddExec(const char *name)
If Exec with name does not exist in the list of Execs, it is created.
Definition: TRef.cxx:339
void Error(const char *location, const char *msgfmt,...)
virtual ~TStreamerBasicPointer()
TStreamerBasicPointer dtor.
Int_t GetArrayDim() const
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
Definition: TClass.cxx:6594
virtual void Update(const TClass *oldClass, TClass *newClass)
function called by the TClass constructor when replacing an emulated class by the real class ...
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition: TClass.cxx:6042
Double_t fXmax
Minimum of data member if a range is specified [xmin,xmax,nbits].
virtual void ls(Option_t *option="") const
Print the content of the element.
virtual void SetStreamer(TMemberStreamer *streamer)
set pointer to Streamer function for this element
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:743
ClassImp(TStreamerElement) TStreamerElement
Default ctor.
Int_t fTObjectOffset
element offset in class
virtual void ls(Option_t *option="") const
Print the content of the element.
virtual ~TStreamerSTLstring()
TStreamerSTLstring dtor.
TVirtualStreamerInfo * FindConversionStreamerInfo(const char *onfile_classname, UInt_t checksum) const
Return a Conversion StreamerInfo from the class 'classname' for the layout represented by 'checksum' ...
Definition: TClass.cxx:6711
Int_t GetSize() const
Returns size of basicpointer in bytes.
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist...
Definition: TClass.cxx:4337
virtual void Update(const TClass *oldClass, TClass *newClass)
Function called by the TClass constructor when replacing an emulated class by the real class...
TClass * GetClass() const
Definition: TDataMember.h:73
TStreamerBasicPointer()
pointer to basic type counter
Basic data type descriptor (datatype information is obtained from CINT).
Definition: TDataType.h:46
const char * GetTypeNameBasic() const
Return type name of this element in case the type name is not a standard basic type, return the basic type name known to CINT.
TVirtualStreamerInfo * GetConversionStreamerInfo(const char *onfile_classname, Int_t version) const
Return a Conversion StreamerInfo from the class 'classname' for version number 'version' to this clas...
Definition: TClass.cxx:6614
virtual Bool_t HasPointers() const =0
TStreamerLoop()
pointer to basic type counter
Int_t WriteBuffer(TBuffer &b, char *pointer)
Write the base class into the buffer.
TClass * IsA() const
Bool_t HasInterpreterInfo() const
Definition: TClass.h:374
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2321
unsigned int UInt_t
Definition: RtypesCore.h:42
Bool_t TestBit(UInt_t f) const
Definition: TObject.h:173
virtual Int_t GetExecID() const
Returns the TExec id for the EXEC instruction in the comment field of a TRef data member...
void * gMmallocDesc
Definition: TClass.cxx:112
short Short_t
Definition: RtypesCore.h:35
The TRealData class manages the effective list of all data members for a given class.
Definition: TRealData.h:34
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:51
ROOT::TSchemaRule::ReadRawFuncPtr_t fReadRawFunc
TSubString Strip(EStripType s=kTrailing, char c= ' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1069
The ROOT global object gROOT contains a list of all defined classes.
Definition: TClass.h:81
ClassStreamerFunc_t GetStreamerFunc() const
Get a wrapper/accessor function around this class custom streamer (member function).
Definition: TClass.cxx:2852
float xmax
Definition: THbookFile.cxx:93
Version_t GetClassVersion() const
Definition: TClass.h:382
virtual ~TStreamerObjectPointer()
TStreamerObjectPointer dtor.
Int_t GetSize() const
Returns size of objectpointer in bytes.
TString fName
Definition: TNamed.h:36
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual void Init(TObject *obj=0)
Setup the element.
TString & Remove(Ssiz_t pos)
Definition: TString.h:616
long Long_t
Definition: RtypesCore.h:50
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
Bool_t IsLoaded() const
Return true if the shared library of this class is currently in the a process's memory.
Definition: TClass.cxx:5526
Int_t GetSize() const
Returns size of this element in bytes.
void(* ReadFuncPtr_t)(char *, TVirtualObject *)
Definition: TSchemaRule.h:42
virtual ~TStreamerLoop()
TStreamerLoop dtor.
virtual const char * GetName() const
Returns name of object.
Definition: TObject.cxx:415
virtual void SetStreamer(TMemberStreamer *streamer)
Set pointer to Streamer function for this element NOTE: we do not take ownership. ...
ULong_t GetMethod() const
return address of counter
double Double_t
Definition: RtypesCore.h:55
virtual TObjArray * GetElements() const =0
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
const char * GetInclude() const
Return the proper include for this element.
unsigned long long ULong64_t
Definition: RtypesCore.h:70
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
unsigned long ULong_t
Definition: RtypesCore.h:51
virtual void ls(Option_t *option="") const
Print the content of the element.
virtual void Init(TObject *obj=0)
Setup the element.
EDataType
Definition: TDataType.h:30
virtual void SetType(Int_t dtype)
virtual Bool_t IsOldFormat(const char *newTypeName)
The early 3.00/00 and 3.01/01 versions used to store dm->GetTypeName instead of dm->GetFullTypename i...
TClassStreamer * GetStreamer() const
Return the Streamer Class allowing streaming (if any).
Definition: TClass.cxx:2827
Int_t GetSize() const
Returns size of object class in bytes.
TMemberStreamer * GetStreamer() const
Return the local streamer object.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
Definition: TClass.cxx:2881
Bool_t IsBase() const
Return kTRUE if the element represent a base class.
Int_t GetSize() const
Returns size of STL container in bytes.
TClass * fNewClass
pointer to class of object
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)
Definition: vector.h:440
TMemberStreamer * fStreamer
new element class when reading
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:433
#define name(a, b)
Definition: linkTestLib0.cpp:5
Mother of all ROOT objects.
Definition: TObject.h:58
Int_t Size() const
Get size of basic typedef'ed type.
Definition: TDataType.cxx:366
const char * GetInclude() const
Return the proper include for this element.
virtual void Init(TObject *obj=0)
Setup the element.
Bool_t IsBase() const
Return kTRUE if the element represent a base class.
char Char_t
Definition: RtypesCore.h:29
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
const char * GetDeclFileName() const
Definition: TClass.h:386
void GetSequenceType(TString &type) const
Fill type with the string representation of sequence information including 'cached','repeat','write' or 'nodelete'.
void SetArrayDim(Int_t dim)
Set number of array dimensions.
virtual void ClassEnd(const TClass *)=0
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:567
const char * GetInclude() const
Return the proper include for this element.
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
ROOT::TSchemaRule::ReadFuncPtr_t GetReadFunc()
static TStreamerBasicType * GetElementCounter(const char *countName, TClass *cl)
Get pointer to a TStreamerBasicType in TClass *cl static function.
Int_t ReadBuffer(TBuffer &b, char *pointer)
Read the content of the buffer.
Int_t GetType() const
Double_t fFactor
Maximum of data member if a range is specified [xmin,xmax,nbits].
TDataMember * GetDataMember() const
Definition: TRealData.h:57
void ResetBit(UInt_t f)
Definition: TObject.h:172
unsigned char UChar_t
Definition: RtypesCore.h:34
ROOT::TSchemaRule::ReadRawFuncPtr_t GetReadRawFunc()
virtual const char * GetFullName() const
Return element name including dimensions, if any Note that this function stores the name into a stati...
virtual void Init(TObject *obj=0)
Setup the element.
TStreamerBasicType * fCounter
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:504
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:582
Abstract Interface class describing Streamer information for one class.
const Bool_t kTRUE
Definition: Rtypes.h:91
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
Definition: TNamed.cxx:152
virtual ~TStreamerSTL()
TStreamerSTL dtor.
Int_t GetSize() const
Returns size of anyclass in bytes.
TClass * fNewBaseClass
pointer to base class
TVirtualStreamerInfo * fStreamerInfo
Pointer to a wrapper around a custom convertion streamer member function.
void InitStreaming()
Error message in case of checksum/version mismatch.
Int_t Size() const
Return size of object of this class.
Definition: TClass.cxx:5325
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
TStreamerBasicType * fCounter
TString fTypeName
new element type when reading
Int_t GetArrayLength() const
static TStreamerBasicType * InitCounter(const char *countClass, const char *countName, TObject *directive)
Helper function to initialize the 'index/counter' value of the Pointer streamerElements.
const char * GetInclude() const
Return the proper include for this element.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:904