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