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