Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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#include "TROOT.h"
13#include "TStreamerElement.h"
15#include "TBuffer.h"
16#include "TClass.h"
17#include "TClassEdit.h"
18#include "TClassStreamer.h"
19#include "TClassTable.h"
20#include "TBaseClass.h"
21#include "TDataMember.h"
22#include "TDataType.h"
23#include "TEnum.h"
24#include "TRealData.h"
25#include "ThreadLocalStorage.h"
26#include "TList.h"
27#include "TRef.h"
28#include "TInterpreter.h"
29#include "TError.h"
30#include "TObjArray.h"
31#include "TVirtualMutex.h"
33#include "strlcpy.h"
34#include "snprintf.h"
35
36#include <string>
37
38using std::string;
39
40const Int_t kMaxLen = 1024;
41
46
48{
49 TString className = type_name.Strip(TString::kTrailing, '*');
50 if (className.Index("const ")==0) className.Remove(0,6);
51 return className;
52}
53////////////////////////////////////////////////////////////////////////////////
54/// Helper function to initialize the 'index/counter' value of
55/// the Pointer streamerElements. If directive is a StreamerInfo and it correspond to the
56/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
57/// for 'countClass'.
58
60{
61 TStreamerBasicType *counter = nullptr;
62
64
65 if (directive) {
66
67 if (directive->GetClass() == cl) {
68 // The info we have been passed is indeed describing the counter holder, just look there.
69
70 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
71 if (!element) return nullptr;
72 if (element->IsA() != TStreamerBasicType::Class()) return nullptr;
73 counter = (TStreamerBasicType*)element;
74
75 } else {
76 if (directive->GetClass()->GetListOfRealData()) {
77 TRealData* rdCounter = (TRealData*) directive->GetClass()->GetListOfRealData()->FindObject(countName);
78 if (!rdCounter) return nullptr;
79 TDataMember *dmCounter = rdCounter->GetDataMember();
80 cl = dmCounter->GetClass();
81 } else {
82 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
83 if (!element) return nullptr;
84 if (element->IsA() != TStreamerBasicType::Class()) return nullptr;
85 cl = directive->GetClass();
86 }
87 if (cl==nullptr) return nullptr;
89 }
90 } else {
91
92 if (cl==nullptr) return nullptr;
94 }
95
96 //at this point the counter may be declared to be skipped
97 if (counter) {
99 }
100 return counter;
101}
102
103////////////////////////////////////////////////////////////////////////////////
104/// Parse comments to search for a range specifier of the style:
105/// [xmin,xmax] or [xmin,xmax,nbits]
106/// [0,1]
107/// [-10,100];
108/// [-pi,pi], [-pi/2,pi/4],[-2pi,2*pi]
109/// [-10,100,16]
110/// [0,0,8]
111/// if nbits is not specified, or nbits <2 or nbits>32 it is set to 32
112/// if (xmin==0 and xmax==0 and nbits <=16) the double word will be converted
113/// to a float and its mantissa truncated to nbits significative bits.
114///
115/// see comments in TBufferFile::WriteDouble32.
116
117static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
118{
119 const Double_t kPi =3.14159265358979323846 ;
120 factor = xmin = xmax = 0;
121 if (!comments) return;
122 const char *left = strstr(comments,"[");
123 if (!left) return;
124 const char *right = strstr(left,"]");
125 if (!right) return;
126 const char *comma = strstr(left,",");
127 if (!comma || comma > right) {
128 //may be first bracket was a dimension specifier
129 left = strstr(right,"[");
130 if (!left) return;
131 right = strstr(left,"]");
132 if (!right) return;
133 comma = strstr(left,",");
134 if (!comma || comma >right) return;
135 }
136 //search if nbits is specified
137 const char *comma2 = nullptr;
138 if (comma) comma2 = strstr(comma+1,",");
139 if (comma2 > right) comma2 = nullptr;
140 Int_t nbits = 32;
141 if (comma2) {
142 TString sbits(comma2+1,right-comma2-1);
143 sscanf(sbits.Data(),"%d",&nbits);
144 if (nbits < 2 || nbits > 32) {
145 ::Error("GetRange","Illegal specification for the number of bits; %d. reset to 32.",nbits);
146 nbits = 32;
147 }
148 right = comma2;
149 }
150 TString range(left+1,right-left-1);
151 TString sxmin(left+1,comma-left-1);
152 sxmin.ToLower();
153 sxmin.ReplaceAll(" ","");
154 if (sxmin.Contains("pi")) {
155 if (sxmin.Contains("2pi")) xmin = 2*kPi;
156 else if (sxmin.Contains("2*pi")) xmin = 2*kPi;
157 else if (sxmin.Contains("twopi")) xmin = 2*kPi;
158 else if (sxmin.Contains("pi/2")) xmin = kPi/2;
159 else if (sxmin.Contains("pi/4")) xmin = kPi/4;
160 else if (sxmin.Contains("pi")) xmin = kPi;
161 if (sxmin.Contains("-")) xmin = -xmin;
162 } else {
163 sscanf(sxmin.Data(),"%lg",&xmin);
164 }
165 TString sxmax(comma+1,right-comma-1);
166 sxmax.ToLower();
167 sxmax.ReplaceAll(" ","");
168 if (sxmax.Contains("pi")) {
169 if (sxmax.Contains("2pi")) xmax = 2*kPi;
170 else if (sxmax.Contains("2*pi")) xmax = 2*kPi;
171 else if (sxmax.Contains("twopi")) xmax = 2*kPi;
172 else if (sxmax.Contains("pi/2")) xmax = kPi/2;
173 else if (sxmax.Contains("pi/4")) xmax = kPi/4;
174 else if (sxmax.Contains("pi")) xmax = kPi;
175 if (sxmax.Contains("-")) xmax = -xmax;
176 } else {
177 sscanf(sxmax.Data(),"%lg",&xmax);
178 }
180 if (nbits < 32) bigint = 1<<nbits;
181 else bigint = 0xffffffff;
182 if (xmin < xmax) factor = bigint/(xmax-xmin);
183 if (xmin >= xmax && nbits <15) xmin = nbits+0.1;
184}
185
187
188////////////////////////////////////////////////////////////////////////////////
189/// Default ctor.
190
192{
193 // clang-format off
195 fSize = 0;
197 fArrayDim = 0;
198 fArrayLength = 0;
199 fStreamer = nullptr;
200 fOffset = 0;
201 fClassObject = (TClass*)(-1);
202 fNewClass = nullptr;
203 fTObjectOffset = 0;
204 fFactor = 0;
205 fXmin = 0;
206 fXmax = 0;
207 // clang-format on
208 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
209}
210
211////////////////////////////////////////////////////////////////////////////////
212/// Create a TStreamerElement object.
213
214TStreamerElement::TStreamerElement(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
215 : TNamed(name,title)
216{
217 fOffset = offset;
218 fType = dtype;
219 fSize = 0;
220 fNewType = fType;
221 fArrayDim = 0;
222 fArrayLength = 0;
223 if (typeName && !strcmp(typeName, "BASE")) {
224 // TStreamerBase case; fTypeName should stay "BASE".
225 fTypeName = typeName;
226 } else {
227 //must protect call into the interpreter
230 }
231 fStreamer = nullptr;
232 fClassObject = (TClass*)(-1);
233 fNewClass = nullptr;
234 fTObjectOffset = 0;
235 fFactor = 0;
236 fXmin = 0;
237 fXmax = 0;
238 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
239 if (fTypeName == "Float16_t" || fTypeName == "Float16_t*") {
241 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
242 }
243 if (fTypeName == "Double32_t" || fTypeName == "Double32_t*") {
245 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
246 }
247}
248
249////////////////////////////////////////////////////////////////////////////////
250/// TStreamerElement dtor.
251
255
256
257////////////////////////////////////////////////////////////////////////////////
258/// Returns true if the element cannot be split, false otherwise.
259/// An element cannot be split if the corresponding class member has
260/// the special characters "||" as the first characters in the
261/// comment field.
262
264{
265 if (GetTitle()[0] != 0 && strspn(GetTitle(),"||") == 2) return kTRUE;
266 TClass *cl = GetClassPointer();
267 if (!cl) return kFALSE; //basic type
268
269 static TClassRef clonesArray("TClonesArray");
270 if (IsaPointer() && cl != clonesArray && !cl->GetCollectionProxy()) return kTRUE;
271
272 switch(fType) {
278 return kTRUE;
279 }
280
281 if ( !cl->CanSplit() ) return kTRUE;
282
283 return kFALSE;
284}
285
286////////////////////////////////////////////////////////////////////////////////
287/// Returns a pointer to the TClass of this element and updates fClassObject
288
290{
291 if (fClassObject!=(TClass*)(-1)) return fClassObject;
292
295 ((TStreamerElement*)this)->fClassObject = TClass::GetClass(className, kTRUE, quiet);
296 return fClassObject;
297}
298
299////////////////////////////////////////////////////////////////////////////////
300/// Returns the TExec id for the EXEC instruction in the comment field
301/// of a TRef data member.
302
304{
305 TString typeName = fTypeName;
306 if (typeName != "TRef" && typeName != "TRefArray") {
307 // It's not a ROOT standard TRef or TRefArray class, but it could be a user class
308 // inheriting from it (see ROOT-7052)
310 const auto cl = TClass::GetClass(clName, kFALSE, kTRUE);
311 if (!cl || (nullptr == cl->GetBaseClass("TRef") && nullptr == cl->GetBaseClass("TRefArray")))
312 return 0;
313 }
314
315 //if the UniqueID of this element has already been set, we assume
316 //that it contains the exec id of a TRef object.
317 if (GetUniqueID()) return GetUniqueID();
318
319 //check if an Exec is specified in the comment field
320 char *action = (char*)strstr(GetTitle(),"EXEC:");
321 if (!action) return 0;
322 Int_t nch = strlen(action)+1;
323 char *caction = new char[nch];
325 char *blank = (char*)strchr(caction,' ');
326 if (blank) *blank = 0;
327 //we have found the Exec name in the comment
328 //we register this Exec to the list of Execs.
330 delete [] caction;
331 //we save the Exec index as the uniqueid of this STreamerElement
332 const_cast<TStreamerElement*>(this)->SetUniqueID(index+1);
333 return index+1;
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Return element name including dimensions, if any
338/// Note that this function stores the name into a static array.
339/// You should copy the result.
340
342{
344 char cdim[20];
345 name = GetName();
346 for (Int_t i=0;i<fArrayDim;i++) {
347 snprintf(cdim,19,"[%d]",fMaxIndex[i]);
348 name += cdim;
349 }
350 return name;
351}
352
353////////////////////////////////////////////////////////////////////////////////
354/// Fill type with the string representation of sequence
355/// information including 'cached','repeat','write' or
356/// 'nodelete'.
357
359{
360 sequenceType.Clear();
361 auto test_bit = [this, &sequenceType](unsigned bit, const char *name) {
362 if (TestBit(bit)) {
363 if (!sequenceType.IsNull()) sequenceType += ",";
365 }
366 };
367
373}
374
375////////////////////////////////////////////////////////////////////////////////
376/// Returns size of this element in bytes.
377
379{
380 return fSize;
381}
382
383////////////////////////////////////////////////////////////////////////////////
384/// Return the local streamer object.
385
390
391////////////////////////////////////////////////////////////////////////////////
392/// Return type name of this element
393/// in case the type name is not a standard basic type, return
394/// the basic type name known to CINT.
395
397{
398 TDataType *dt = gROOT->GetType(fTypeName.Data());
399 if (fType < 1 || fType > 55) return fTypeName.Data();
400 if (dt && dt->GetType() > 0) return fTypeName.Data();
401 Int_t dtype = fType%20;
403}
404
405////////////////////////////////////////////////////////////////////////////////
406/// Initliaze the element.
407
415
416////////////////////////////////////////////////////////////////////////////////
417/// The early 3.00/00 and 3.01/01 versions used to store
418/// dm->GetTypeName instead of dm->GetFullTypename
419/// if this case is detected, the element type name is modified.
420
422{
423 //if (!IsaPointer()) return kFALSE;
424 if (!strstr(newTypeName,fTypeName.Data())) return kFALSE;
425 //if (!strstr(fTypeName.Data(),newTypeName)) return kFALSE;
427 return kTRUE;
428}
429
430////////////////////////////////////////////////////////////////////////////////
431/// Return kTRUE if the element represent a base class.
432
434{
435 return kFALSE;
436}
437
438////////////////////////////////////////////////////////////////////////////////
439/// Return kTRUE if the element represent an entity that is not written
440/// to the disk (transient members, cache allocator/deallocator, etc.)
441
443{
445 // if (((const TStreamerArtificial*)this)->GetWriteFunc() == 0)
446 return kTRUE;
447 }
453
454 return kFALSE;
455}
456
457////////////////////////////////////////////////////////////////////////////////
458/// Print the content of the element.
459
461{
462 TString temp(GetTypeName());
463 if (IsaPointer() && !fTypeName.Contains("*")) temp += "*";
464
467 if (sequenceType.Length()) {
468 sequenceType.Prepend(" (");
469 sequenceType += ") ";
470 }
471 printf(" %-14s %-15s offset=%3d type=%2d",
472 temp.Data(),GetFullName(),fOffset,fType);
474 printf(" newtype=%2d", fNewType);
475 printf(" %s%-20s\n",
476 sequenceType.Data(), GetTitle());
477}
478
479////////////////////////////////////////////////////////////////////////////////
480/// Set number of array dimensions.
481
490
491////////////////////////////////////////////////////////////////////////////////
492///set maximum index for array with dimension dim
493
495{
496 if (dim < 0 || dim > 4) return;
497 fMaxIndex[dim] = max;
498 if (fArrayLength == 0) fArrayLength = max;
499 else fArrayLength *= max;
500}
501
502////////////////////////////////////////////////////////////////////////////////
503///set pointer to Streamer function for this element
504
509
510////////////////////////////////////////////////////////////////////////////////
511/// Stream an object of class TStreamerElement.
512
514{
516 if (R__b.IsReading()) {
517 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
518 //NOTE that when reading, one cannot use Class()->ReadBuffer
519 // TBuffer::Class methods used for reading streamerinfos from SQL database
520 // Any changes of class structure should be reflected by them starting from version 4
521
522 R__b.ClassBegin(TStreamerElement::Class(), R__v);
523 R__b.ClassMember("TNamed");
525 R__b.ClassMember("fType","Int_t");
526 R__b >> fType;
527 R__b.ClassMember("fSize","Int_t");
528 R__b >> fSize;
529 R__b.ClassMember("fArrayLength","Int_t");
531 R__b.ClassMember("fArrayDim","Int_t");
532 R__b >> fArrayDim;
533 R__b.ClassMember("fMaxIndex","Int_t", 5);
534 if (R__v == 1) R__b.ReadStaticArray(fMaxIndex);
535 else R__b.ReadFastArray(fMaxIndex,5);
536 R__b.ClassMember("fTypeName","TString");
537 fTypeName.Streamer(R__b);
538 if (fType==11&&(fTypeName=="Bool_t"||fTypeName=="bool")) fType = 18;
539 if (R__v > 1) {
540 SetUniqueID(0);
541 //check if element is a TRef or TRefArray
542 GetExecID();
543 }
545 // In TStreamerElement v2, fSize was holding the size of
546 // the underlying data type. In later version it contains
547 // the full length of the data member.
548 TDataType *type = gROOT->GetType(GetTypeName());
549 if (type && fArrayLength) fSize = fArrayLength * type->Size();
550 }
551 if (R__v == 3) {
552 R__b >> fXmin;
553 R__b >> fXmax;
554 R__b >> fFactor;
555 if (fFactor > 0) SetBit(kHasRange);
556 }
557 if (R__v > 3) {
559 }
560 //R__b.CheckByteCount(R__s, R__c, TStreamerElement::IsA());
561 R__b.ClassEnd(TStreamerElement::Class());
562 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
563
566 } else {
567 R__b.WriteClassBuffer(TStreamerElement::Class(),this);
568 }
569}
570
571////////////////////////////////////////////////////////////////////////////////
572///function called by the TClass constructor when replacing an emulated class
573///by the real class
574
576{
577 if (fClassObject == oldClass) {
581 }
582 } else if (fClassObject == nullptr) {
583 // Well since some emulated class is replaced by a real class, we can
584 // assume a new library has been loaded. If this is the case, we should
585 // check whether the class now exist (this would be the case for example
586 // for reading STL containers).
587
589
590 if (classname == newClass->GetName()) {
594 }
595 } else if (TClassTable::GetDict(classname)) {
596 fClassObject = (TClass*)-1;
597 GetClassPointer(); //force fClassObject
600 }
601 }
602 }
603}
604
605//______________________________________________________________________________
606
607//////////////////////////////////////////////////////////////////////////
608// //
609// TStreamerBase implement the streamer of the base class //
610// //
611//////////////////////////////////////////////////////////////////////////
612
614
615////////////////////////////////////////////////////////////////////////////////
616
618 // Abuse TStreamerElement data member that is not used by TStreamerBase
619 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
620 fStreamerFunc(nullptr), fConvStreamerFunc(nullptr), fStreamerInfo(nullptr)
621{
622 // Default ctor.
623
624 fBaseClass = (TClass*)(-1);
625 fBaseVersion = 0;
626 fNewBaseClass = nullptr;
627}
628
629////////////////////////////////////////////////////////////////////////////////
630
632 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kBase,"BASE"),
633 // Abuse TStreamerElement data member that is not used by TStreamerBase
634 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
635 fStreamerFunc(nullptr), fConvStreamerFunc(nullptr), fStreamerInfo(nullptr)
636
637{
638 // Create a TStreamerBase object.
639
640 if (strcmp(name,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
641 if (strcmp(name,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
642 fNewType = fType;
644 if (fBaseClass) {
645 if (fBaseClass->IsVersioned()) {
647 } else {
648 fBaseVersion = -1;
649 }
651 } else {
652 fBaseVersion = 0;
653 }
654 fNewBaseClass = nullptr;
656}
657
658////////////////////////////////////////////////////////////////////////////////
659/// TStreamerBase dtor
660
664
665////////////////////////////////////////////////////////////////////////////////
666/// Returns a pointer to the TClass of this element.
667
669{
670 if (fBaseClass!=(TClass*)(-1)) return fBaseClass;
671 ((TStreamerBase*)this)->fBaseClass = TClass::GetClass(GetName());
672 return fBaseClass;
673}
674
675////////////////////////////////////////////////////////////////////////////////
676/// Returns size of baseclass in bytes.
677
679{
680 TClass *cl = GetNewClass();
681 if (!cl)
682 cl = GetClassPointer();
683 if (cl)
684 return cl->Size();
685 return 0;
686}
687
688////////////////////////////////////////////////////////////////////////////////
689/// Setup the element.
690
695
703
704////////////////////////////////////////////////////////////////////////////////
705/// Setup the fStreamerFunc and fStreamerinfo
706
731
732////////////////////////////////////////////////////////////////////////////////
733/// Return kTRUE if the element represent a base class.
734
736{
737 return kTRUE;
738}
739
740////////////////////////////////////////////////////////////////////////////////
741/// Return the proper include for this element.
742
743const char *TStreamerBase::GetInclude() const
744{
746 IncludeNameBuffer().Form("\"%s\"",fBaseClass->GetDeclFileName());
747 } else {
748 std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
749 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
750 }
751 return IncludeNameBuffer();
752}
753
754////////////////////////////////////////////////////////////////////////////////
755/// Print the content of the element.
756
758{
761 if (sequenceType.Length()) {
762 sequenceType.Prepend(" (");
763 sequenceType += ") ";
764 }
765 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
766}
767
768////////////////////////////////////////////////////////////////////////////////
769/// Read the content of the buffer.
770
772{
773 if (fConvStreamerFunc) {
774 // We have a custom Streamer member function, we must use it.
776 } else if (fStreamerFunc) {
777 // We have a custom Streamer member function, we must use it.
778 fStreamerFunc(b,pointer+fOffset);
779 } else {
780 // We don't have a custom Streamer member function. That still doesn't mean
781 // that there is no streamer - it could be an external one:
782 // If the old base class has an adopted streamer we take that
783 // one instead of the new base class:
784 if( fNewBaseClass ) {
786 if (extstrm) {
787 // The new base class has an adopted streamer:
788 extstrm->SetOnFileClass(fBaseClass);
789 (*extstrm)(b, pointer);
790 } else {
791 b.ReadClassBuffer( fNewBaseClass, pointer+fOffset, fBaseClass );
792 }
793 } else {
795 if (extstrm) {
796 // The class has an adopted streamer:
797 (*extstrm)(b, pointer);
798 } else {
799 b.ReadClassBuffer( fBaseClass, pointer+fOffset );
800 }
801 }
802 }
803 return 0;
804}
805
806////////////////////////////////////////////////////////////////////////////////
807/// Stream an object of class TStreamerBase.
808
810{
812 if (R__b.IsReading()) {
813 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
814
815 R__b.ClassBegin(TStreamerBase::Class(), R__v);
816
817 R__b.ClassMember("TStreamerElement");
819 // If the class owning the TStreamerElement and the base class are not
820 // loaded, on the file their streamer info might be in the following
821 // order (derived class,base class) and hence the base class is not
822 // yet emulated.
823 fBaseClass = (TClass*)-1;
824 fNewBaseClass = nullptr;
825 // Eventually we need a v3 that stores directly fBaseCheckSum (and
826 // a version of TStreamerElement should not stored fMaxIndex)
827 if (R__v > 2) {
828 R__b.ClassMember("fBaseVersion","Int_t");
830 } else {
831 // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
834 }
835 R__b.ClassEnd(TStreamerBase::Class());
836 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
837 } else {
838 R__b.WriteClassBuffer(TStreamerBase::Class(),this);
839 }
840}
841
842////////////////////////////////////////////////////////////////////////////////
843///Function called by the TClass constructor when replacing an emulated class
844///by the real class.
845
847{
849
850 if (fBaseClass == oldClass) {
853 } else if (fBaseClass == nullptr) {
854 if (fName == newClass->GetName()) {
857 } else if (TClassTable::GetDict(fName)) {
860 }
861 }
862}
863
864////////////////////////////////////////////////////////////////////////////////
865/// Write the base class into the buffer.
866
868{
869 if (fStreamerFunc) {
870 // We have a custom Streamer member function, we must use it.
871 fStreamerFunc(b,pointer+fOffset);
872 } else {
873 // We don't have a custom Streamer member function. That still doesn't mean
874 // that there is no streamer - it could be an external one:
875 // If the old base class has an adopted streamer we take that
876 // one instead of the new base class:
877 if (fNewBaseClass) {
879 if (extstrm) {
880 // The new base class has an adopted streamer:
881 extstrm->SetOnFileClass(fBaseClass);
882 (*extstrm)(b, pointer);
883 return 0;
884 } else {
886 return 0;
887 }
888 } else {
890 if (extstrm) {
891 (*extstrm)(b, pointer);
892 return 0;
893 } else {
895 return 0;
896 }
897 }
898 }
899 return 0;
900}
901
902//______________________________________________________________________________
903
904//////////////////////////////////////////////////////////////////////////
905// //
906// TStreamerBasicPointer implements the streamering of pointer to //
907// fundamental types. //
908// //
909//////////////////////////////////////////////////////////////////////////
910
912
913////////////////////////////////////////////////////////////////////////////////
914/// Default ctor.
915
916TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
917{
918 fCounter = nullptr;
919}
920
921////////////////////////////////////////////////////////////////////////////////
922/// Create a TStreamerBasicPointer object.
923
924TStreamerBasicPointer::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)
925 : TStreamerElement(name,title,offset,dtype,typeName)
926{
930 fCountVersion = countVersion; //currently unused
931 Init();
932// printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
933// name,countName,countClass,countVersion,fCounter);
934}
935
936////////////////////////////////////////////////////////////////////////////////
937/// TStreamerBasicPointer dtor.
938
942
943////////////////////////////////////////////////////////////////////////////////
944/// return offset of counter
945
947{
948 if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
949 if (!fCounter) return 0;
950 // FIXME: does not suport multiple inheritance for counter in base class.
951 // This is wrong in case counter is not in the same class or one of
952 // the left most (non virtual) base classes. For the other we would
953 // really need to use the object coming from the list of real data.
954 // (and even that need analysis for virtual base class).
955 return (ULongptr_t)fCounter->GetOffset();
956}
957
958////////////////////////////////////////////////////////////////////////////////
959/// Returns size of basicpointer in bytes.
960
962{
963 if (fArrayLength) return fArrayLength*sizeof(void *);
964 return sizeof(void *);
965}
966
967////////////////////////////////////////////////////////////////////////////////
968/// Setup the element.
969/// If directive is a StreamerInfo and it correspond to the
970/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
971/// for 'countClass'.
972
977
978////////////////////////////////////////////////////////////////////////////////
979/// Set number of array dimensions.
980
982{
983 fArrayDim = dim;
984 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
985 fNewType = fType;
986}
987
988////////////////////////////////////////////////////////////////////////////////
989/// Stream an object of class TStreamerBasicPointer.
990
992{
994 if (R__b.IsReading()) {
995 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
996 if (R__v > 1) {
997 R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
998 //Init();
999 //fCounter = InitCounter( fCountClass, fCountName );
1000 return;
1001 }
1002 //====process old versions before automatic schema evolution
1007 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1008 } else {
1009 R__b.WriteClassBuffer(TStreamerBasicPointer::Class(),this);
1010 }
1011}
1012
1013
1014//______________________________________________________________________________
1015
1016//////////////////////////////////////////////////////////////////////////
1017// //
1018// TStreamerLoop implement streaming of a few construct that require //
1019// looping over the data member and are not convered by other case //
1020// (most deprecated). //
1021// //
1022//////////////////////////////////////////////////////////////////////////
1023
1025
1026////////////////////////////////////////////////////////////////////////////////
1027/// Default ctor.
1028
1029TStreamerLoop::TStreamerLoop() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
1030{
1031}
1032
1033////////////////////////////////////////////////////////////////////////////////
1034/// Create a TStreamerLoop object.
1035
1036TStreamerLoop::TStreamerLoop(const char *name, const char *title, Int_t offset, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
1037 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kStreamLoop,typeName)
1038{
1041 fCountVersion = countVersion; //currently unused
1042 Init();
1043}
1044
1045////////////////////////////////////////////////////////////////////////////////
1046/// TStreamerLoop dtor.
1047
1051
1052////////////////////////////////////////////////////////////////////////////////
1053/// return address of counter
1054
1056{
1057 //if (!fCounter) {
1058 // Init();
1059 // if (!fCounter) return 0;
1060 //}
1061 if (!fCounter) return 0;
1062 return (ULongptr_t)fCounter->GetOffset();
1063}
1064
1065////////////////////////////////////////////////////////////////////////////////
1066/// Returns size of counter in bytes.
1067
1069{
1070 if (fArrayLength) return fArrayLength*sizeof(void*);
1071 return sizeof(void*);
1072}
1073
1074////////////////////////////////////////////////////////////////////////////////
1075/// Setup the element.
1076/// If directive is a StreamerInfo and it correspond to the
1077/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
1078/// for 'countClass'.
1079
1084
1085////////////////////////////////////////////////////////////////////////////////
1086/// Return the proper include for this element.
1087
1088const char *TStreamerLoop::GetInclude() const
1089{
1090 IncludeNameBuffer().Form("<%s>","TString.h"); //to be generalized
1091 return IncludeNameBuffer();
1092}
1093
1094////////////////////////////////////////////////////////////////////////////////
1095/// Stream an object of class TStreamerLoop.
1096
1098{
1099 UInt_t R__s, R__c;
1100 if (R__b.IsReading()) {
1101 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1102 if (R__v > 1) {
1103 R__b.ReadClassBuffer(TStreamerLoop::Class(), this, R__v, R__s, R__c);
1104 //Init();
1105 return;
1106 }
1107 //====process old versions before automatic schema evolution
1112 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1113 } else {
1114 R__b.WriteClassBuffer(TStreamerLoop::Class(),this);
1115 }
1116}
1117
1118
1119//______________________________________________________________________________
1120
1121//////////////////////////////////////////////////////////////////////////
1122// //
1123// TStreamerBasicType implement streaming of fundamental types (int, //
1124// float, etc.). //
1125// //
1126//////////////////////////////////////////////////////////////////////////
1127
1129
1130////////////////////////////////////////////////////////////////////////////////
1131/// Default ctor.
1132
1134{
1135}
1136
1137////////////////////////////////////////////////////////////////////////////////
1138/// Create a TStreamerBasicType object.
1139
1140TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1141 : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1142{
1143}
1144
1145////////////////////////////////////////////////////////////////////////////////
1146/// TStreamerBasicType dtor.
1147
1151
1152////////////////////////////////////////////////////////////////////////////////
1153/// return address of counter
1154
1161
1162////////////////////////////////////////////////////////////////////////////////
1163/// Returns size of this element in bytes.
1164
1166{
1167 return fSize;
1168}
1169
1170////////////////////////////////////////////////////////////////////////////////
1171/// Stream an object of class TStreamerBasicType.
1172
1174{
1175 UInt_t R__s, R__c;
1176 if (R__b.IsReading()) {
1177 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1178 if (R__v > 1) {
1179 R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1180 } else {
1181 //====process old versions before automatic schema evolution
1183 R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1184 }
1185 Int_t type = fType;
1188 }
1189 switch(type) {
1190 // basic types
1191 case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1192 case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1193 case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1194 case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1195 case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1196 case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1197 case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1198 case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1199 case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1200 case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1201 case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1202 case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1203 case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1204 case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1205 case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1206 case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1207 case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1208 case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1209 default: return; // If we don't change the size let's not remultiply it.
1210 }
1212 } else {
1213 R__b.WriteClassBuffer(TStreamerBasicType::Class(),this);
1214 }
1215}
1216
1217
1218
1219//______________________________________________________________________________
1220
1221//////////////////////////////////////////////////////////////////////////
1222// //
1223// TStreamerObject implements streaming of embedded objects whose type //
1224// inherits from TObject. //
1225// //
1226//////////////////////////////////////////////////////////////////////////
1227
1229
1230////////////////////////////////////////////////////////////////////////////////
1231/// Default ctor.
1232
1236
1237////////////////////////////////////////////////////////////////////////////////
1238/// Create a TStreamerObject object.
1239
1240TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1241 : TStreamerElement(name,title,offset,0,typeName)
1242{
1244 if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1245 if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1246 fNewType = fType;
1247 Init();
1248}
1249
1250////////////////////////////////////////////////////////////////////////////////
1251/// TStreamerObject dtor.
1252
1256
1257////////////////////////////////////////////////////////////////////////////////
1258/// Setup the element.
1259
1267
1268////////////////////////////////////////////////////////////////////////////////
1269/// Return the proper include for this element.
1270
1272{
1273 TClass *cl = GetClassPointer();
1274 if (cl && cl->HasInterpreterInfo()) {
1275 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1276 } else {
1277 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1278 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1279 }
1280 return IncludeNameBuffer();
1281}
1282
1283////////////////////////////////////////////////////////////////////////////////
1284/// Returns size of object class in bytes.
1285
1287{
1288 TClass *cl = GetNewClass();
1289 if (!cl)
1290 cl = GetClassPointer();
1291 Int_t classSize = 8;
1292 if (cl)
1293 classSize = cl->Size();
1294 if (fArrayLength)
1295 return fArrayLength * classSize;
1296 return classSize;
1297}
1298
1299////////////////////////////////////////////////////////////////////////////////
1300/// Stream an object of class TStreamerObject.
1301
1303{
1304 UInt_t R__s, R__c;
1305 if (R__b.IsReading()) {
1306 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1307 if (R__v > 1) {
1308 R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1309 return;
1310 }
1311 //====process old versions before automatic schema evolution
1313 R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1314 } else {
1315 R__b.WriteClassBuffer(TStreamerObject::Class(),this);
1316 }
1317}
1318
1319
1320//______________________________________________________________________________
1321
1322//////////////////////////////////////////////////////////////////////////
1323// //
1324// TStreamerObjectAny implement streaming of embedded object not //
1325// inheriting from TObject. //
1326// //
1327//////////////////////////////////////////////////////////////////////////
1328
1330
1331////////////////////////////////////////////////////////////////////////////////
1332/// Default ctor.
1333
1337
1338////////////////////////////////////////////////////////////////////////////////
1339/// Create a TStreamerObjectAny object.
1340
1341TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1342 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1343{
1344 Init();
1345}
1346
1347////////////////////////////////////////////////////////////////////////////////
1348/// TStreamerObjectAny dtor.
1349
1353
1354////////////////////////////////////////////////////////////////////////////////
1355/// Setup the element.
1356
1364
1365////////////////////////////////////////////////////////////////////////////////
1366/// Return the proper include for this element.
1367
1369{
1370 TClass *cl = GetClassPointer();
1371 if (cl && cl->HasInterpreterInfo()) {
1372 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1373 } else {
1374 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1375 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1376 }
1377 return IncludeNameBuffer();
1378}
1379
1380////////////////////////////////////////////////////////////////////////////////
1381/// Returns size of anyclass in bytes.
1382
1384{
1385 TClass *cl = GetNewClass();
1386 if (!cl)
1387 cl = GetClassPointer();
1388 Int_t classSize = 8;
1389 if (cl)
1390 classSize = cl->Size();
1391 if (fArrayLength)
1392 return fArrayLength * classSize;
1393 return classSize;
1394}
1395
1396////////////////////////////////////////////////////////////////////////////////
1397/// Stream an object of class TStreamerObjectAny.
1398
1400{
1401 UInt_t R__s, R__c;
1402 if (R__b.IsReading()) {
1403 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1404 if (R__v > 1) {
1405 R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1406 return;
1407 }
1408 //====process old versions before automatic schema evolution
1410 R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1411 } else {
1412 R__b.WriteClassBuffer(TStreamerObjectAny::Class(),this);
1413 }
1414}
1415
1416
1417
1418//______________________________________________________________________________
1419
1420//////////////////////////////////////////////////////////////////////////
1421// //
1422// TStreamerObjectPointer implements streaming of pointer to object //
1423// inheriting from TObject. //
1424// //
1425//////////////////////////////////////////////////////////////////////////
1426
1428
1429////////////////////////////////////////////////////////////////////////////////
1430/// Default ctor.
1431
1435
1436////////////////////////////////////////////////////////////////////////////////
1437/// Create a TStreamerObjectPointer object.
1438
1440 Int_t offset, const char *typeName)
1441 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1442{
1443 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1444 fNewType = fType;
1445 Init();
1446}
1447
1448////////////////////////////////////////////////////////////////////////////////
1449/// TStreamerObjectPointer dtor.
1450
1454
1455////////////////////////////////////////////////////////////////////////////////
1456/// Setup the element.
1457
1465
1466////////////////////////////////////////////////////////////////////////////////
1467/// Return the proper include for this element.
1468
1470{
1471 TClass *cl = GetClassPointer();
1472 if (cl && cl->HasInterpreterInfo()) {
1473 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1474 } else {
1475 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1476 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1477 }
1478
1479 return IncludeNameBuffer();
1480}
1481
1482////////////////////////////////////////////////////////////////////////////////
1483/// Returns size of objectpointer in bytes.
1484
1486{
1487 if (fArrayLength) return fArrayLength*sizeof(void *);
1488 return sizeof(void *);
1489}
1490
1491////////////////////////////////////////////////////////////////////////////////
1492/// Set number of array dimensions.
1493
1495{
1496 fArrayDim = dim;
1497 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1498 fNewType = fType;
1499}
1500
1501////////////////////////////////////////////////////////////////////////////////
1502/// Stream an object of class TStreamerObjectPointer.
1503
1505{
1506 UInt_t R__s, R__c;
1507 if (R__b.IsReading()) {
1508 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1509 if (R__v > 1) {
1510 R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1511 return;
1512 }
1513 //====process old versions before automatic schema evolution
1515 R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1516 } else {
1517 R__b.WriteClassBuffer(TStreamerObjectPointer::Class(),this);
1518 }
1519}
1520
1521
1522//______________________________________________________________________________
1523
1524//////////////////////////////////////////////////////////////////////////
1525// //
1526// TStreamerObjectPointerAny implements streaming of pointer to object //
1527// not inheriting from TObject. //
1528// //
1529//////////////////////////////////////////////////////////////////////////
1530
1532
1533////////////////////////////////////////////////////////////////////////////////
1534/// Default ctor.
1535
1539
1540////////////////////////////////////////////////////////////////////////////////
1541/// Create a TStreamerObjectAnyPointer object.
1542
1544 Int_t offset, const char *typeName)
1545 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1546{
1547 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1548 fNewType = fType;
1549 Init();
1550}
1551
1552////////////////////////////////////////////////////////////////////////////////
1553/// TStreamerObjectAnyPointer dtor.
1554
1558
1559////////////////////////////////////////////////////////////////////////////////
1560/// Setup the element.
1561
1569
1570////////////////////////////////////////////////////////////////////////////////
1571/// Return the proper include for this element.
1572
1574{
1575 TClass *cl = GetClassPointer();
1576 if (cl && cl->HasInterpreterInfo()) {
1577 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1578 } else {
1579 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1580 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1581 }
1582
1583 return IncludeNameBuffer();
1584}
1585
1586////////////////////////////////////////////////////////////////////////////////
1587/// Returns size of objectpointer in bytes.
1588
1590{
1591 if (fArrayLength) return fArrayLength*sizeof(void *);
1592 return sizeof(void *);
1593}
1594
1595////////////////////////////////////////////////////////////////////////////////
1596/// Set number of array dimensions.
1597
1599{
1600 fArrayDim = dim;
1601 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1602 fNewType = fType;
1603}
1604
1605////////////////////////////////////////////////////////////////////////////////
1606/// Stream an object of class TStreamerObjectAnyPointer.
1607
1609{
1610 if (R__b.IsReading()) {
1611 R__b.ReadClassBuffer(TStreamerObjectAnyPointer::Class(), this);
1612 } else {
1613 R__b.WriteClassBuffer(TStreamerObjectAnyPointer::Class(),this);
1614 }
1615}
1616
1617
1618//______________________________________________________________________________
1619
1620//////////////////////////////////////////////////////////////////////////
1621// //
1622// TSreamerString implements streaming of TString. //
1623// //
1624//////////////////////////////////////////////////////////////////////////
1625
1627
1628////////////////////////////////////////////////////////////////////////////////
1629/// Default ctor.
1630
1634
1635////////////////////////////////////////////////////////////////////////////////
1636/// Create a TStreamerString object.
1637
1638TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1639 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1640{
1641}
1642
1643////////////////////////////////////////////////////////////////////////////////
1644/// TStreamerString dtor.
1645
1649
1650////////////////////////////////////////////////////////////////////////////////
1651/// Return the proper include for this element.
1652
1654{
1655 IncludeNameBuffer().Form("<%s>","TString.h");
1656 return IncludeNameBuffer();
1657}
1658
1659////////////////////////////////////////////////////////////////////////////////
1660/// Returns size of anyclass in bytes.
1661
1663{
1664 if (fArrayLength) return fArrayLength*sizeof(TString);
1665 return sizeof(TString);
1666}
1667
1668////////////////////////////////////////////////////////////////////////////////
1669/// Stream an object of class TStreamerString.
1670
1672{
1673 UInt_t R__s, R__c;
1674 if (R__b.IsReading()) {
1675 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1676 if (R__v > 1) {
1677 R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1678 return;
1679 }
1680 //====process old versions before automatic schema evolution
1682 R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1683 } else {
1684 R__b.WriteClassBuffer(TStreamerString::Class(),this);
1685 }
1686}
1687
1688//______________________________________________________________________________
1689
1690//////////////////////////////////////////////////////////////////////////
1691// //
1692// TStreamerSTL implements streamer of STL container. //
1693// //
1694//////////////////////////////////////////////////////////////////////////
1695
1697
1698////////////////////////////////////////////////////////////////////////////////
1699/// Default ctor.
1700
1701TStreamerSTL::TStreamerSTL() : fSTLtype(0), fCtype(0)
1702{
1703}
1704
1705////////////////////////////////////////////////////////////////////////////////
1706/// Create a TStreamerSTL object.
1707
1708TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1709 const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1710 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1711{
1712 std::string answer;
1715 fTypeName = answer;
1716
1717 if (name==typeName /* intentional pointer comparison */
1718 || strcmp(name,typeName)==0) {
1719 // We have a base class.
1720 fName = fTypeName;
1721 }
1722 fSTLtype = proxy.GetCollectionType();
1723 fCtype = 0;
1724
1726
1727 if (fSTLtype == ROOT::kSTLbitset) {
1728 // Nothing to check
1729 } else if (proxy.GetValueClass()) {
1730 if (proxy.HasPointers()) fCtype = TVirtualStreamerInfo::kObjectp;
1732 } else {
1733 fCtype = proxy.GetType();
1734 if (proxy.HasPointers()) fCtype += TVirtualStreamerInfo::kOffsetP;
1735 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1736 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1737 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1738 }
1739 }
1742 fNewType = fType;
1743 }
1744}
1745
1746////////////////////////////////////////////////////////////////////////////////
1747/// Create a TStreamerSTL object.
1748
1749TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1750 const char *typeName, const char *trueType, Bool_t dmPointer)
1751 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1752{
1753 const char *t = trueType;
1754 if (!t || !*t) t = typeName;
1755
1756 std::string answer;
1759 fTypeName = answer;
1760
1761 if (name==typeName /* intentional pointer comparison */
1762 || strcmp(name,typeName)==0) {
1763 // We have a base class.
1764 fName = fTypeName;
1765 }
1766
1767 if (arglist.fElements.size() < 2) {
1768 Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, t);
1769 return;
1770 }
1771
1772 const std::string& inside_type = arglist.fElements[1];
1773 std::string inside = (inside_type.find("const ")==0) ? inside_type.substr(6) : inside_type;
1774
1775 // Let's treat the unique_ptr case
1777
1778 bool isPointer = false;
1779 // The incoming name is normalized (it comes from splitting the name of a TClass),
1780 // so all we need to do is drop the last trailing star (if any) and record that information.
1781 while (intype.back() == '*') {
1782 isPointer = true;
1783 intype.pop_back();
1784 }
1785
1786 fSTLtype = TClassEdit::STLKind(arglist.fElements[0]);
1787 fCtype = 0;
1788 if (fSTLtype == ROOT::kNotSTL) { return; }
1790
1791 TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(intype.c_str());
1792 if (fSTLtype == ROOT::kSTLbitset) {
1793 // Nothing to check
1794 } else if (dt) {
1795 fCtype = dt->GetType();
1797 } else {
1798 // this could also be a nested enums ... which should work ... be let's see.
1799 TClass *cl = TClass::GetClass(intype.c_str());
1800 if (cl) {
1803 } else {
1804 auto enumdesc = TEnum::GetEnum(intype.c_str());
1805 if (enumdesc || gCling->ClassInfo_IsEnum(intype.c_str())) {
1806 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1807 if (isPointer)
1809 } else {
1810 if (intype != "string") {
1811 // This case can happens when 'this' is a TStreamerElement for
1812 // a STL container containing something for which we do not have
1813 // a TVirtualStreamerInfo (This happens in particular is the collection
1814 // objects themselves are always empty) and we do not have the
1815 // dictionary/shared library for the container.
1816 if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1817 Warning("TStreamerSTL", "For %s we could not find any information about the type %s %d %s",
1818 fTypeName.Data(), arglist.fElements[1].c_str(), fSTLtype, arglist.fElements[0].c_str());
1819 }
1820 }
1821 }
1822 }
1823 }
1824
1827 fNewType = fType;
1828 }
1829}
1830
1831////////////////////////////////////////////////////////////////////////////////
1832/// TStreamerSTL dtor.
1833
1837
1838////////////////////////////////////////////////////////////////////////////////
1839/// We can not split STL's which are inside a variable size array.
1840/// At least for now.
1841
1843{
1844 if (IsaPointer()) {
1845 if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1846 return kTRUE;
1847 }
1848
1849 if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1850
1852
1853 return kFALSE;
1854}
1855
1856////////////////////////////////////////////////////////////////////////////////
1857/// Return true if the data member is a pointer.
1858
1860{
1861 const char *type_name = GetTypeName();
1862 if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1863 else return kFALSE;
1864}
1865
1866
1867////////////////////////////////////////////////////////////////////////////////
1868/// Return kTRUE if the element represent a base class.
1869
1871{
1872 TString ts(GetName());
1873
1874 if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1875 if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1876 return kFALSE;
1877}
1878
1879////////////////////////////////////////////////////////////////////////////////
1880/// Returns a pointer to the TClass of this element.
1881
1883{
1884 if (fClassObject!=(TClass*)(-1))
1885 return fClassObject;
1886
1888
1890 TClass *cl = TClass::GetClass(className, kTRUE, quiet);
1891
1892 auto proxy = cl->GetCollectionProxy();
1893 if (!fNewClass && proxy && proxy->GetValueClass() == nullptr) {
1894 // Collection of numerical type, let check if it is an enum.
1896 if ( arglist.fElements[1].size() >= 2 ) {
1897 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1898 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1899 ((TStreamerElement *)this)->fNewClass = cl;
1900 if (proxy->HasPointers())
1901 cl = TClass::GetClass("vector<Int_t*>");
1902 else
1903 cl = TClass::GetClass("vector<Int_t>");
1904 }
1905 }
1906 }
1907 ((TStreamerElement*)this)->fClassObject = cl;
1908 return fClassObject;
1909}
1910
1911////////////////////////////////////////////////////////////////////////////////
1912/// Returns size of STL container in bytes.
1913
1915{
1916 // Since the STL collection might or might not be emulated and that the
1917 // sizeof the object depends on this, let's just always retrieve the
1918 // current size!
1919 TClass *cl = GetNewClass();
1920 if (!cl)
1921 cl = GetClassPointer();
1922 UInt_t size = 0;
1923 if (cl==nullptr) {
1924 if (!TestBit(kWarned)) {
1925 Error("GetSize","Could not find the TClass for %s.\n"
1926 "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1927 const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1928 }
1929 } else {
1930 size = cl->Size();
1931 }
1932
1933 if (fArrayLength) return fArrayLength*size;
1934 return size;
1935}
1936
1937////////////////////////////////////////////////////////////////////////////////
1938/// Print the content of the element.
1939
1941{
1943 TString cdim;
1944 name = GetName();
1945 for (Int_t i=0;i<fArrayDim;i++) {
1946 cdim.Form("[%d]",fMaxIndex[i]);
1947 name += cdim;
1948 }
1951 if (sequenceType.Length()) {
1952 sequenceType.Prepend(" (");
1953 sequenceType += ") ";
1954 }
1955 printf(" %-14s %-15s offset=%3d type=%2d",
1956 GetTypeName(), name.Data(), fOffset, fType);
1958 printf(" newtype=%2d", fNewType);
1959 printf(" stl=%d ctype=%d %s%-20s\n",
1960 fSTLtype, fCtype, sequenceType.Data(), GetTitle());
1961}
1962
1963////////////////////////////////////////////////////////////////////////////////
1964/// Return the proper include for this element.
1965
1966const char *TStreamerSTL::GetInclude() const
1967{
1968 if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1969 else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1970 else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1971 else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1972 else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1973 else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1974 else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1975 else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1976 else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1977 else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1978 else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1979 else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1980 else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1981 return IncludeNameBuffer();
1982}
1983
1984////////////////////////////////////////////////////////////////////////////////
1985/// Set pointer to Streamer function for this element
1986/// NOTE: we do not take ownership
1987
1992
1993////////////////////////////////////////////////////////////////////////////////
1994/// Stream an object of class TStreamerSTL.
1995
1997{
1998 UInt_t R__s, R__c;
1999 if (R__b.IsReading()) {
2000 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2001 if (R__v > 2) {
2002 R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
2003 } else {
2004 //====process old versions before automatic schema evolution
2006 R__b >> fSTLtype;
2007 R__b >> fCtype;
2008 R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
2009 }
2010 // In old versions (prior to v6.24/02) the value of fArrayDim was not stored properly.
2011 if (fArrayDim == 0 && fArrayLength > 0) {
2012 while(fArrayDim < 5 && fMaxIndex[fArrayDim] != 0) {
2013 ++fArrayDim;
2014 }
2015 }
2017 // For a long time those where inverted in TStreamerElement
2018 // compared to the other definitions. When we moved to version '4',
2019 // this got standardized, but we now need to fix it.
2020
2021 if (fTypeName.BeginsWith("std::set") || fTypeName.BeginsWith("set")) {
2023 } else if (fTypeName.BeginsWith("std::multimap") || fTypeName.BeginsWith("multimap")) {
2025 }
2026 }
2027
2030 if (GetArrayLength() > 0) {
2032 }
2033 if (R__b.GetParent()) { // Avoid resetting during a cloning.
2035 SetBit(kDoNotDelete); // For backward compatibility
2036 } else if ( fSTLtype == ROOT::kSTLmap || fSTLtype == ROOT::kSTLmultimap) {
2037 // Here we would like to set the bit only if one of the element of the pair is a pointer,
2038 // however we have no easy to determine this short of parsing the class name.
2039 SetBit(kDoNotDelete); // For backward compatibility
2040 }
2041 }
2042 return;
2043 } else {
2044 // To enable forward compatibility we actually save with the old value
2045 TStreamerSTL tmp;
2046 // Hand coded copy constructor since the 'normal' one are intentionally
2047 // deleted.
2048 tmp.fName = fName;
2049 tmp.fTitle = fTitle;
2051 tmp.fSize = fSize;
2052 tmp.fArrayDim = fArrayDim;
2053 tmp.fArrayLength = fArrayLength;
2054 for(int i = 0; i < 5; ++i)
2055 tmp.fMaxIndex[i] = fMaxIndex[i];
2056 tmp.fTypeName = fTypeName;
2057 tmp.fSTLtype = fSTLtype;
2058 tmp.fCtype = fCtype;
2059 R__b.WriteClassBuffer(TStreamerSTL::Class(), &tmp);
2060 }
2061}
2062
2063//______________________________________________________________________________
2064
2065//////////////////////////////////////////////////////////////////////////
2066// //
2067// TStreamerSTLstring implements streaming std::string. //
2068// //
2069//////////////////////////////////////////////////////////////////////////
2070
2072
2073////////////////////////////////////////////////////////////////////////////////
2074/// Default ctor.
2075
2079
2080////////////////////////////////////////////////////////////////////////////////
2081/// Create a TStreamerSTLstring object.
2082
2084 const char *typeName, Bool_t dmPointer)
2085 : TStreamerSTL()
2086{
2087 SetName(name);
2088 SetTitle(title);
2089
2090 if (dmPointer) {
2092 } else {
2094 }
2095
2096 fNewType = fType;
2097 fOffset = offset;
2100 fTypeName= typeName;
2101
2102}
2103
2104////////////////////////////////////////////////////////////////////////////////
2105/// TStreamerSTLstring dtor.
2106
2110
2111////////////////////////////////////////////////////////////////////////////////
2112/// Return the proper include for this element.
2113
2115{
2116 IncludeNameBuffer() = "<string>";
2117 return IncludeNameBuffer();
2118}
2119
2120////////////////////////////////////////////////////////////////////////////////
2121/// Returns size of anyclass in bytes.
2122
2124{
2125 if (fArrayLength) return fArrayLength*sizeof(string);
2126 return sizeof(string);
2127}
2128
2129////////////////////////////////////////////////////////////////////////////////
2130/// Stream an object of class TStreamerSTLstring.
2131
2133{
2134 UInt_t R__s, R__c;
2135 if (R__b.IsReading()) {
2136 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2137 if (R__v > 1) {
2138 R__b.ReadClassBuffer(TStreamerSTLstring::Class(), this, R__v, R__s, R__c);
2139 return;
2140 }
2141 //====process old versions before automatic schema evolution
2143 R__b.CheckByteCount(R__s, R__c, TStreamerSTLstring::IsA());
2144 } else {
2145 R__b.WriteClassBuffer(TStreamerSTLstring::Class(),this);
2146 }
2147}
2148
2149//______________________________________________________________________________
2150
2151///////////////////////////////////////////////////////////////////////////////
2152// //
2153// TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2154// //
2155///////////////////////////////////////////////////////////////////////////////
2156
2158
2160{
2161 // Avoid streaming the synthetic/artificial streamer elements.
2162
2163 // Intentionally, nothing to do at all.
2164 return;
2165}
2166
2168{
2169 // Return the read function if any.
2170
2171 return fReadFunc;
2172}
2173
2175{
2176 // Return the raw read function if any.
2177
2178 return fReadRawFunc;
2179}
#define b(i)
Definition RSha256.hxx:100
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Definition RtypesCore.h:63
unsigned short UShort_t
Definition RtypesCore.h:40
int Int_t
Definition RtypesCore.h:45
short Version_t
Definition RtypesCore.h:65
unsigned char UChar_t
Definition RtypesCore.h:38
char Char_t
Definition RtypesCore.h:37
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
unsigned int UInt_t
Definition RtypesCore.h:46
unsigned long ULongptr_t
Definition RtypesCore.h:76
float Float_t
Definition RtypesCore.h:57
short Short_t
Definition RtypesCore.h:39
constexpr Bool_t kFALSE
Definition RtypesCore.h:94
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:69
unsigned long long ULong64_t
Definition RtypesCore.h:70
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:374
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
EDataType
Definition TDataType.h:28
const Int_t kMaxLen
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Definition TError.cxx:185
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
float xmin
float xmax
R__EXTERN TVirtualMutex * gInterpreterMutex
R__EXTERN TInterpreter * gCling
#define gROOT
Definition TROOT.h:414
static TStreamerBasicType * InitCounter(const char *countClass, const char *countName, TVirtualStreamerInfo *directive)
Helper function to initialize the 'index/counter' value of the Pointer streamerElements.
static TString & IncludeNameBuffer()
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,...
const Int_t kMaxLen
static TString ExtractClassName(const TString &type_name)
#define R__LOCKGUARD(mutex)
#define snprintf
Definition civetweb.c:1540
void(* ReadFuncPtr_t)(char *, TVirtualObject *)
Definition TSchemaRule.h:77
void(* ReadRawFuncPtr_t)(char *, TBuffer &)
Definition TSchemaRule.h:78
Buffer base class used for serializing objects.
Definition TBuffer.h:43
TClassRef is used to implement a permanent reference to a TClass object.
Definition TClassRef.h:29
static DictFuncPtr_t GetDict(const char *cname)
Given the class name returns the Dictionary() function of a class (uses hash of name).
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition TClass.cxx:6652
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Definition TClass.cxx:2424
ClassStreamerFunc_t GetStreamerFunc() const
Get a wrapper/accessor function around this class custom streamer (member function).
Definition TClass.cxx:3044
TClassStreamer * GetStreamer() const
Return the Streamer Class allowing streaming (if any).
Definition TClass.cxx:3019
Bool_t HasInterpreterInfo() const
Definition TClass.h:417
Int_t Size() const
Return size of object of this class.
Definition TClass.cxx:5843
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:6080
ClassConvStreamerFunc_t GetConvStreamerFunc() const
Get a wrapper/accessor function around this class custom conversion streamer (member function).
Definition TClass.cxx:3052
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0, Bool_t isTransient=kFALSE) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
Definition TClass.cxx:4726
Int_t GetBaseClassOffset(const TClass *toBase, void *address=nullptr, bool isDerivedObject=true)
Definition TClass.cxx:2896
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition TClass.cxx:3002
TVirtualStreamerInfo * GetConversionStreamerInfo(const char *onfile_classname, Int_t version) const
Return a Conversion StreamerInfo from the class 'classname' for version number 'version' to this clas...
Definition TClass.cxx:7240
TVirtualStreamerInfo * FindConversionStreamerInfo(const char *onfile_classname, UInt_t checksum) const
Return a Conversion StreamerInfo from the class 'classname' for the layout represented by 'checksum' ...
Definition TClass.cxx:7347
Bool_t IsVersioned() const
Definition TClass.h:529
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
Definition TClass.cxx:7220
Version_t GetClassVersion() const
Definition TClass.h:427
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition TClass.cxx:3594
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:3073
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:6926
All ROOT classes may have RTTI (run time type identification) support added.
Definition TDataMember.h:31
Basic data type descriptor (datatype information is obtained from CINT).
Definition TDataType.h:44
TString GetTypeName()
Get basic type of typedef, e,g.: "class TDirectory*" -> "TDirectory".
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
Definition TEnum.cxx:182
virtual Bool_t ClassInfo_IsEnum(const char *) const
The TNamed class is the base class for all named ROOT classes.
Definition TNamed.h:29
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition TNamed.cxx:174
const char * GetName() const override
Returns name of object.
Definition TNamed.h:49
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:50
TString fTitle
Definition TNamed.h:33
TString fName
Definition TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition TNamed.cxx:150
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:205
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition TObject.cxx:475
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:1057
static TClass * Class()
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:864
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1071
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1099
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition TObject.cxx:875
void ResetBit(UInt_t f)
Definition TObject.h:204
The TRealData class manages the effective list of all data members for a given class.
Definition TRealData.h:30
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 Streamer(TBuffer &) override
Stream an object of class TObject.
ROOT::TSchemaRule::ReadRawFuncPtr_t GetReadRawFunc()
ROOT::TSchemaRule::ReadRawFuncPtr_t fReadRawFunc
ROOT::TSchemaRule::ReadFuncPtr_t GetReadFunc()
ROOT::TSchemaRule::ReadFuncPtr_t fReadFunc
Int_t GetSize() const override
Returns size of baseclass in bytes.
void InitStreaming(Bool_t isTransient)
Error message in case of checksum/version mismatch.
Bool_t IsBase() const override
Return kTRUE if the element represent a base class.
Int_t WriteBuffer(TBuffer &b, char *pointer)
Write the base class into the buffer.
virtual ~TStreamerBase()
TStreamerBase dtor.
const char * GetInclude() const override
Return the proper include for this element.
TClass * fBaseClass
checksum of the base class (used during memberwise streaming)
TClass * GetClassPointer() const override
Returns a pointer to the TClass of this element.
void ls(Option_t *option="") const override
Print the content of the element.
void Update(const TClass *oldClass, TClass *newClass) override
Function called by the TClass constructor when replacing an emulated class by the real class.
Int_t ReadBuffer(TBuffer &b, char *pointer)
Read the content of the buffer.
ClassConvStreamerFunc_t fConvStreamerFunc
Pointer to a wrapper around a custom streamer member function.
static TClass * Class()
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
void Streamer(TBuffer &) override
Stream an object of class TStreamerBase.
TClass * fNewBaseClass
pointer to base class
TVirtualStreamerInfo * fStreamerInfo
Pointer to a wrapper around a custom convertion streamer member function.
ClassStreamerFunc_t fStreamerFunc
pointer to new base class if renamed
virtual ~TStreamerBasicPointer()
TStreamerBasicPointer dtor.
ULongptr_t GetMethod() const override
return offset of counter
static TClass * Class()
TStreamerBasicPointer()
pointer to basic type counter
void SetArrayDim(Int_t dim) override
Set number of array dimensions.
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
void Streamer(TBuffer &) override
Stream an object of class TStreamerBasicPointer.
TStreamerBasicType * fCounter
Int_t GetSize() const override
Returns size of basicpointer in bytes.
Int_t GetSize() const override
Returns size of this element in bytes.
TClass * IsA() const override
static TClass * Class()
ULongptr_t GetMethod() const override
return address of counter
TStreamerBasicType()
value of data member when referenced by an array
void Streamer(TBuffer &) override
Stream an object of class TStreamerBasicType.
virtual ~TStreamerBasicType()
TStreamerBasicType dtor.
Describe one element (data member) to be Streamed.
void Streamer(TBuffer &) override
Stream an object of class TStreamerElement.
TStreamerElement()
Default ctor.
virtual Int_t GetSize() const
Returns size of this element in bytes.
Int_t GetType() const
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...
virtual void Init(TVirtualStreamerInfo *obj=nullptr)
Initliaze the element.
virtual const char * GetFullName() const
Return element name including dimensions, if any Note that this function stores the name into a stati...
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element and updates fClassObject.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
virtual ~TStreamerElement()
TStreamerElement dtor.
Int_t GetArrayDim() const
TMemberStreamer * GetStreamer() const
Return the local streamer object.
Int_t fTObjectOffset
element offset in class
Double_t fXmax
Minimum of data member if a range is specified [xmin,xmax,nbits].
TClass * GetNewClass() const
Int_t GetArrayLength() const
virtual void SetStreamer(TMemberStreamer *streamer)
set pointer to Streamer function for this element
TMemberStreamer * fStreamer
new element class when reading
void ls(Option_t *option="") const override
Print the content of the element.
TString fTypeName
new element type when reading
virtual Bool_t IsTransient() const
Return kTRUE if the element represent an entity that is not written to the disk (transient members,...
Double_t fFactor
Maximum of data member if a range is specified [xmin,xmax,nbits].
virtual Bool_t IsaPointer() const
virtual void Update(const TClass *oldClass, TClass *newClass)
function called by the TClass constructor when replacing an emulated class by the real class
const char * GetTypeName() const
virtual Bool_t CannotSplit() const
Returns true if the element cannot be split, false otherwise.
TClass * IsA() const override
virtual void SetType(Int_t dtype)
Int_t GetOffset() const
Double_t fXmin
pointer to element Streamer
const char * GetTypeNameBasic() const
Return type name of this element in case the type name is not a standard basic type,...
virtual Bool_t IsBase() const
Return kTRUE if the element represent a base class.
virtual Int_t GetExecID() const
Returns the TExec id for the EXEC instruction in the comment field of a TRef data member.
static TClass * Class()
TClass * fNewClass
pointer to class of object
virtual void SetMaxIndex(Int_t dim, Int_t max)
set maximum index for array with dimension dim
void GetSequenceType(TString &type) const
Fill type with the string representation of sequence information including 'cached',...
Int_t fNewType
base offset for TObject if the element inherits from it
const char * GetInclude() const override
Return the proper include for this element.
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
Int_t GetSize() const override
Returns size of counter in bytes.
TStreamerBasicType * fCounter
virtual ~TStreamerLoop()
TStreamerLoop dtor.
ULongptr_t GetMethod() const override
return address of counter
void Streamer(TBuffer &) override
Stream an object of class TStreamerLoop.
static TClass * Class()
TStreamerLoop()
pointer to basic type counter
static TClass * Class()
const char * GetInclude() const override
Return the proper include for this element.
void Streamer(TBuffer &) override
Stream an object of class TStreamerObjectAnyPointer.
void SetArrayDim(Int_t dim) override
Set number of array dimensions.
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
virtual ~TStreamerObjectAnyPointer()
TStreamerObjectAnyPointer dtor.
Int_t GetSize() const override
Returns size of objectpointer in bytes.
virtual ~TStreamerObjectAny()
TStreamerObjectAny dtor.
Int_t GetSize() const override
Returns size of anyclass in bytes.
TClass * IsA() const override
static TClass * Class()
const char * GetInclude() const override
Return the proper include for this element.
TStreamerObjectAny()
Default ctor.
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
void Streamer(TBuffer &) override
Stream an object of class TStreamerObjectAny.
TClass * IsA() const override
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
TStreamerObjectPointer()
Default ctor.
virtual ~TStreamerObjectPointer()
TStreamerObjectPointer dtor.
void Streamer(TBuffer &) override
Stream an object of class TStreamerObjectPointer.
Int_t GetSize() const override
Returns size of objectpointer in bytes.
static TClass * Class()
void SetArrayDim(Int_t dim) override
Set number of array dimensions.
const char * GetInclude() const override
Return the proper include for this element.
void Init(TVirtualStreamerInfo *obj=nullptr) override
Setup the element.
TClass * IsA() const override
static TClass * Class()
void Streamer(TBuffer &) override
Stream an object of class TStreamerObject.
TStreamerObject()
Default ctor.
virtual ~TStreamerObject()
TStreamerObject dtor.
Int_t GetSize() const override
Returns size of object class in bytes.
const char * GetInclude() const override
Return the proper include for this element.
TClass * GetClassPointer() const override
Returns a pointer to the TClass of this element.
Bool_t IsaPointer() const override
Return true if the data member is a pointer.
Int_t GetSize() const override
Returns size of STL container in bytes.
const char * GetInclude() const override
Return the proper include for this element.
static TClass * Class()
TStreamerSTL()
Default ctor.
void SetStreamer(TMemberStreamer *streamer) override
Set pointer to Streamer function for this element NOTE: we do not take ownership.
Bool_t CannotSplit() const override
We can not split STL's which are inside a variable size array.
void Streamer(TBuffer &) override
Stream an object of class TStreamerSTL.
TClass * IsA() const override
virtual ~TStreamerSTL()
TStreamerSTL dtor.
void ls(Option_t *option="") const override
Print the content of the element.
Bool_t IsBase() const override
Return kTRUE if the element represent a base class.
Int_t GetSize() const override
Returns size of anyclass in bytes.
virtual ~TStreamerSTLstring()
TStreamerSTLstring dtor.
void Streamer(TBuffer &) override
Stream an object of class TStreamerSTLstring.
static TClass * Class()
TClass * IsA() const override
TStreamerSTLstring()
Default ctor.
const char * GetInclude() const override
Return the proper include for this element.
TStreamerString()
Default ctor.
const char * GetInclude() const override
Return the proper include for this element.
static TClass * Class()
TClass * IsA() const override
Int_t GetSize() const override
Returns size of anyclass in bytes.
virtual ~TStreamerString()
TStreamerString dtor.
void Streamer(TBuffer &) override
Stream an object of class TStreamerString.
Basic string class.
Definition TString.h:139
const char * Data() const
Definition TString.h:376
@ kTrailing
Definition TString.h:276
TString & Remove(Ssiz_t pos)
Definition TString.h:685
virtual void Streamer(TBuffer &)
Stream a string object.
Definition TString.cxx:1412
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:651
Defines a common interface to inspect/change the contents of an object that represents a collection.
Abstract Interface class describing Streamer information for one class.
@ kUChar
Equal to TDataType's kchar.
static TStreamerBasicType * GetElementCounter(const char *countName, TClass *cl)
Get pointer to a TStreamerBasicType in TClass *cl static function.
struct void * fTypeName
Definition cppyy.h:9
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
@ kSTLbitset
Definition ESTLType.h:37
@ kSTLmap
Definition ESTLType.h:33
@ kSTLunorderedmultiset
Definition ESTLType.h:43
@ kSTLstring
Definition ESTLType.h:49
@ kSTLset
Definition ESTLType.h:35
@ kSTLmultiset
Definition ESTLType.h:36
@ kSTLdeque
Definition ESTLType.h:32
@ kSTLvector
Definition ESTLType.h:30
@ kSTLunorderedmultimap
Definition ESTLType.h:45
@ kSTLunorderedset
Definition ESTLType.h:42
@ kSTLlist
Definition ESTLType.h:31
@ kSTLforwardlist
Definition ESTLType.h:41
@ kSTLunorderedmap
Definition ESTLType.h:44
@ kNotSTL
Definition ESTLType.h:29
@ kSTLmultimap
Definition ESTLType.h:34
ROOT::ESTLType STLKind(std::string_view type)
Converts STL container name to number.
std::string ResolveTypedef(const char *tname, bool resolveAll=false)
std::string ShortType(const char *typeDesc, int mode)
Return the absolute type of typeDesc.
std::string GetNameForIO(const std::string &templateInstanceName, TClassEdit::EModType mode=TClassEdit::kNone, bool *hasChanged=nullptr)
@ kDropStlDefault
Definition TClassEdit.h:83