Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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//////////////////////////////////////////////////////////////////////////
13// //
14// //
15//////////////////////////////////////////////////////////////////////////
16
17
18#include "TROOT.h"
19#include "TStreamerElement.h"
21#include "TBuffer.h"
22#include "TClass.h"
23#include "TClassEdit.h"
24#include "TClassStreamer.h"
25#include "TClassTable.h"
26#include "TBaseClass.h"
27#include "TDataMember.h"
28#include "TDataType.h"
29#include "TEnum.h"
30#include "TRealData.h"
31#include "ThreadLocalStorage.h"
32#include "TList.h"
33#include "TRef.h"
34#include "TInterpreter.h"
35#include "TError.h"
36#include "TObjArray.h"
37#include "TVirtualMutex.h"
39#include "strlcpy.h"
40#include "snprintf.h"
41
42#include <string>
43
44using std::string;
45
46const Int_t kMaxLen = 1024;
47
52
54{
55 TString className = type_name.Strip(TString::kTrailing, '*');
56 if (className.Index("const ")==0) className.Remove(0,6);
57 return className;
58}
59////////////////////////////////////////////////////////////////////////////////
60/// Helper function to initialize the 'index/counter' value of
61/// the Pointer streamerElements. If directive is a StreamerInfo and it correspond to the
62/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
63/// for 'countClass'.
64
66{
67 TStreamerBasicType *counter = nullptr;
68
70
71 if (directive) {
72
73 if (directive->GetClass() == cl) {
74 // The info we have been passed is indeed describing the counter holder, just look there.
75
76 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
77 if (!element) return nullptr;
78 if (element->IsA() != TStreamerBasicType::Class()) return nullptr;
79 counter = (TStreamerBasicType*)element;
80
81 } else {
82 if (directive->GetClass()->GetListOfRealData()) {
83 TRealData* rdCounter = (TRealData*) directive->GetClass()->GetListOfRealData()->FindObject(countName);
84 if (!rdCounter) return nullptr;
85 TDataMember *dmCounter = rdCounter->GetDataMember();
86 cl = dmCounter->GetClass();
87 } else {
88 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
89 if (!element) return nullptr;
90 if (element->IsA() != TStreamerBasicType::Class()) return nullptr;
91 cl = directive->GetClass();
92 }
93 if (cl==nullptr) return nullptr;
95 }
96 } else {
97
98 if (cl==nullptr) return nullptr;
100 }
101
102 //at this point the counter may be declared to be skipped
103 if (counter) {
105 }
106 return counter;
107}
108
109////////////////////////////////////////////////////////////////////////////////
110/// Parse comments to search for a range specifier of the style:
111/// [xmin,xmax] or [xmin,xmax,nbits]
112/// [0,1]
113/// [-10,100];
114/// [-pi,pi], [-pi/2,pi/4],[-2pi,2*pi]
115/// [-10,100,16]
116/// [0,0,8]
117/// if nbits is not specified, or nbits <2 or nbits>32 it is set to 32
118/// if (xmin==0 and xmax==0 and nbits <=16) the double word will be converted
119/// to a float and its mantissa truncated to nbits significative bits.
120///
121/// see comments in TBufferFile::WriteDouble32.
122
123static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
124{
125 const Double_t kPi =3.14159265358979323846 ;
126 factor = xmin = xmax = 0;
127 if (!comments) return;
128 const char *left = strstr(comments,"[");
129 if (!left) return;
130 const char *right = strstr(left,"]");
131 if (!right) return;
132 const char *comma = strstr(left,",");
133 if (!comma || comma > right) {
134 //may be first bracket was a dimension specifier
135 left = strstr(right,"[");
136 if (!left) return;
137 right = strstr(left,"]");
138 if (!right) return;
139 comma = strstr(left,",");
140 if (!comma || comma >right) return;
141 }
142 //search if nbits is specified
143 const char *comma2 = nullptr;
144 if (comma) comma2 = strstr(comma+1,",");
145 if (comma2 > right) comma2 = nullptr;
146 Int_t nbits = 32;
147 if (comma2) {
148 TString sbits(comma2+1,right-comma2-1);
149 sscanf(sbits.Data(),"%d",&nbits);
150 if (nbits < 2 || nbits > 32) {
151 ::Error("GetRange","Illegal specification for the number of bits; %d. reset to 32.",nbits);
152 nbits = 32;
153 }
154 right = comma2;
155 }
156 TString range(left+1,right-left-1);
157 TString sxmin(left+1,comma-left-1);
158 sxmin.ToLower();
159 sxmin.ReplaceAll(" ","");
160 if (sxmin.Contains("pi")) {
161 if (sxmin.Contains("2pi")) xmin = 2*kPi;
162 else if (sxmin.Contains("2*pi")) xmin = 2*kPi;
163 else if (sxmin.Contains("twopi")) xmin = 2*kPi;
164 else if (sxmin.Contains("pi/2")) xmin = kPi/2;
165 else if (sxmin.Contains("pi/4")) xmin = kPi/4;
166 else if (sxmin.Contains("pi")) xmin = kPi;
167 if (sxmin.Contains("-")) xmin = -xmin;
168 } else {
169 sscanf(sxmin.Data(),"%lg",&xmin);
170 }
171 TString sxmax(comma+1,right-comma-1);
172 sxmax.ToLower();
173 sxmax.ReplaceAll(" ","");
174 if (sxmax.Contains("pi")) {
175 if (sxmax.Contains("2pi")) xmax = 2*kPi;
176 else if (sxmax.Contains("2*pi")) xmax = 2*kPi;
177 else if (sxmax.Contains("twopi")) xmax = 2*kPi;
178 else if (sxmax.Contains("pi/2")) xmax = kPi/2;
179 else if (sxmax.Contains("pi/4")) xmax = kPi/4;
180 else if (sxmax.Contains("pi")) xmax = kPi;
181 if (sxmax.Contains("-")) xmax = -xmax;
182 } else {
183 sscanf(sxmax.Data(),"%lg",&xmax);
184 }
186 if (nbits < 32) bigint = 1<<nbits;
187 else bigint = 0xffffffff;
188 if (xmin < xmax) factor = bigint/(xmax-xmin);
189 if (xmin >= xmax && nbits <15) xmin = nbits+0.1;
190}
191
193
194////////////////////////////////////////////////////////////////////////////////
195/// Default ctor.
196
198{
199 // clang-format off
201 fSize = 0;
203 fArrayDim = 0;
204 fArrayLength = 0;
205 fStreamer = nullptr;
206 fOffset = 0;
207 fClassObject = (TClass*)(-1);
208 fNewClass = nullptr;
209 fTObjectOffset = 0;
210 fFactor = 0;
211 fXmin = 0;
212 fXmax = 0;
213 // clang-format on
214 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
215}
216
217////////////////////////////////////////////////////////////////////////////////
218/// Create a TStreamerElement object.
219
220TStreamerElement::TStreamerElement(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
221 : TNamed(name,title)
222{
223 fOffset = offset;
224 fType = dtype;
225 fSize = 0;
226 fNewType = fType;
227 fArrayDim = 0;
228 fArrayLength = 0;
229 if (typeName && !strcmp(typeName, "BASE")) {
230 // TStreamerBase case; fTypeName should stay "BASE".
231 fTypeName = typeName;
232 } else {
233 //must protect call into the interpreter
236 }
237 fStreamer = nullptr;
238 fClassObject = (TClass*)(-1);
239 fNewClass = nullptr;
240 fTObjectOffset = 0;
241 fFactor = 0;
242 fXmin = 0;
243 fXmax = 0;
244 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
245 if (fTypeName == "Float16_t" || fTypeName == "Float16_t*") {
247 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
248 }
249 if (fTypeName == "Double32_t" || fTypeName == "Double32_t*") {
251 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
252 }
253}
254
255////////////////////////////////////////////////////////////////////////////////
256/// TStreamerElement dtor.
257
261
262
263////////////////////////////////////////////////////////////////////////////////
264/// Returns true if the element cannot be split, false otherwise.
265/// An element cannot be split if the corresponding class member has
266/// the special characters "||" as the first characters in the
267/// comment field.
268
270{
271 if (GetTitle()[0] != 0 && strspn(GetTitle(),"||") == 2) return kTRUE;
272 TClass *cl = GetClassPointer();
273 if (!cl) return kFALSE; //basic type
274
275 static TClassRef clonesArray("TClonesArray");
276 if (IsaPointer() && cl != clonesArray && !cl->GetCollectionProxy()) return kTRUE;
277
278 switch(fType) {
284 return kTRUE;
285 }
286
287 if ( !cl->CanSplit() ) return kTRUE;
288
289 return kFALSE;
290}
291
292////////////////////////////////////////////////////////////////////////////////
293/// Returns a pointer to the TClass of this element.
294
296{
297 if (fClassObject!=(TClass*)(-1)) return fClassObject;
298
301 ((TStreamerElement*)this)->fClassObject = TClass::GetClass(className, kTRUE, quiet);
302 return fClassObject;
303}
304
305////////////////////////////////////////////////////////////////////////////////
306/// Returns the TExec id for the EXEC instruction in the comment field
307/// of a TRef data member.
308
310{
311 //check if element is a TRef or TRefArray
312 if (strncmp(fTypeName.Data(),"TRef",4) != 0) return 0;
313
314 //if the UniqueID of this element has already been set, we assume
315 //that it contains the exec id of a TRef object.
316 if (GetUniqueID()) return GetUniqueID();
317
318 //check if an Exec is specified in the comment field
319 char *action = (char*)strstr(GetTitle(),"EXEC:");
320 if (!action) return 0;
321 Int_t nch = strlen(action)+1;
322 char *caction = new char[nch];
324 char *blank = (char*)strchr(caction,' ');
325 if (blank) *blank = 0;
326 //we have found the Exec name in the comment
327 //we register this Exec to the list of Execs.
329 delete [] caction;
330 //we save the Exec index as the uniqueid of this STreamerElement
331 const_cast<TStreamerElement*>(this)->SetUniqueID(index+1);
332 return index+1;
333}
334
335////////////////////////////////////////////////////////////////////////////////
336/// Return element name including dimensions, if any
337/// Note that this function stores the name into a static array.
338/// You should copy the result.
339
341{
343 char cdim[20];
344 name = GetName();
345 for (Int_t i=0;i<fArrayDim;i++) {
346 snprintf(cdim,19,"[%d]",fMaxIndex[i]);
347 name += cdim;
348 }
349 return name;
350}
351
352////////////////////////////////////////////////////////////////////////////////
353/// Fill type with the string representation of sequence
354/// information including 'cached','repeat','write' or
355/// 'nodelete'.
356
358{
359 sequenceType.Clear();
360 auto test_bit = [this, &sequenceType](unsigned bit, const char *name) {
361 if (TestBit(bit)) {
362 if (!sequenceType.IsNull()) sequenceType += ",";
364 }
365 };
366
372}
373
374////////////////////////////////////////////////////////////////////////////////
375/// Returns size of this element in bytes.
376
378{
379 return fSize;
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Return the local streamer object.
384
389
390////////////////////////////////////////////////////////////////////////////////
391/// Return type name of this element
392/// in case the type name is not a standard basic type, return
393/// the basic type name known to CINT.
394
396{
397 TDataType *dt = gROOT->GetType(fTypeName.Data());
398 if (fType < 1 || fType > 55) return fTypeName.Data();
399 if (dt && dt->GetType() > 0) return fTypeName.Data();
400 Int_t dtype = fType%20;
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Initliaze the element.
406
414
415////////////////////////////////////////////////////////////////////////////////
416/// The early 3.00/00 and 3.01/01 versions used to store
417/// dm->GetTypeName instead of dm->GetFullTypename
418/// if this case is detected, the element type name is modified.
419
421{
422 //if (!IsaPointer()) return kFALSE;
423 if (!strstr(newTypeName,fTypeName.Data())) return kFALSE;
424 //if (!strstr(fTypeName.Data(),newTypeName)) return kFALSE;
426 return kTRUE;
427}
428
429////////////////////////////////////////////////////////////////////////////////
430/// Return kTRUE if the element represent a base class.
431
433{
434 return kFALSE;
435}
436
437////////////////////////////////////////////////////////////////////////////////
438/// Return kTRUE if the element represent an entity that is not written
439/// to the disk (transient members, cache allocator/deallocator, etc.)
440
442{
444 // if (((const TStreamerArtificial*)this)->GetWriteFunc() == 0)
445 return kTRUE;
446 }
452
453 return kFALSE;
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// Print the content of the element.
458
460{
461 TString temp(GetTypeName());
462 if (IsaPointer() && !fTypeName.Contains("*")) temp += "*";
463
466 if (sequenceType.Length()) {
467 sequenceType.Prepend(" (");
468 sequenceType += ") ";
469 }
470 printf(" %-14s %-15s offset=%3d type=%2d",
471 temp.Data(),GetFullName(),fOffset,fType);
473 printf(" newtype=%2d", fNewType);
474 printf(" %s%-20s\n",
475 sequenceType.Data(), GetTitle());
476}
477
478////////////////////////////////////////////////////////////////////////////////
479/// Set number of array dimensions.
480
489
490////////////////////////////////////////////////////////////////////////////////
491///set maximum index for array with dimension dim
492
494{
495 if (dim < 0 || dim > 4) return;
496 fMaxIndex[dim] = max;
497 if (fArrayLength == 0) fArrayLength = max;
498 else fArrayLength *= max;
499}
500
501////////////////////////////////////////////////////////////////////////////////
502///set pointer to Streamer function for this element
503
508
509////////////////////////////////////////////////////////////////////////////////
510/// Stream an object of class TStreamerElement.
511
513{
515 if (R__b.IsReading()) {
516 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
517 //NOTE that when reading, one cannot use Class()->ReadBuffer
518 // TBuffer::Class methods used for reading streamerinfos from SQL database
519 // Any changes of class structure should be reflected by them starting from version 4
520
521 R__b.ClassBegin(TStreamerElement::Class(), R__v);
522 R__b.ClassMember("TNamed");
524 R__b.ClassMember("fType","Int_t");
525 R__b >> fType;
526 R__b.ClassMember("fSize","Int_t");
527 R__b >> fSize;
528 R__b.ClassMember("fArrayLength","Int_t");
530 R__b.ClassMember("fArrayDim","Int_t");
531 R__b >> fArrayDim;
532 R__b.ClassMember("fMaxIndex","Int_t", 5);
533 if (R__v == 1) R__b.ReadStaticArray(fMaxIndex);
534 else R__b.ReadFastArray(fMaxIndex,5);
535 R__b.ClassMember("fTypeName","TString");
536 fTypeName.Streamer(R__b);
537 if (fType==11&&(fTypeName=="Bool_t"||fTypeName=="bool")) fType = 18;
538 if (R__v > 1) {
539 SetUniqueID(0);
540 //check if element is a TRef or TRefArray
541 GetExecID();
542 }
544 // In TStreamerElement v2, fSize was holding the size of
545 // the underlying data type. In later version it contains
546 // the full length of the data member.
547 TDataType *type = gROOT->GetType(GetTypeName());
548 if (type && fArrayLength) fSize = fArrayLength * type->Size();
549 }
550 if (R__v == 3) {
551 R__b >> fXmin;
552 R__b >> fXmax;
553 R__b >> fFactor;
554 if (fFactor > 0) SetBit(kHasRange);
555 }
556 if (R__v > 3) {
558 }
559 //R__b.CheckByteCount(R__s, R__c, TStreamerElement::IsA());
560 R__b.ClassEnd(TStreamerElement::Class());
561 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
562
565 } else {
566 R__b.WriteClassBuffer(TStreamerElement::Class(),this);
567 }
568}
569
570////////////////////////////////////////////////////////////////////////////////
571///function called by the TClass constructor when replacing an emulated class
572///by the real class
573
575{
576 if (fClassObject == oldClass) {
580 }
581 } else if (fClassObject == nullptr) {
582 // Well since some emulated class is replaced by a real class, we can
583 // assume a new library has been loaded. If this is the case, we should
584 // check whether the class now exist (this would be the case for example
585 // for reading STL containers).
586
588
589 if (classname == newClass->GetName()) {
593 }
594 } else if (TClassTable::GetDict(classname)) {
595 fClassObject = (TClass*)-1;
596 GetClassPointer(); //force fClassObject
599 }
600 }
601 }
602}
603
604//______________________________________________________________________________
605
606//////////////////////////////////////////////////////////////////////////
607// //
608// TStreamerBase implement the streamer of the base class //
609// //
610//////////////////////////////////////////////////////////////////////////
611
613
614////////////////////////////////////////////////////////////////////////////////
615
617 // Abuse TStreamerElement data member that is not used by TStreamerBase
618 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
619 fStreamerFunc(nullptr), fConvStreamerFunc(nullptr), fStreamerInfo(nullptr)
620{
621 // Default ctor.
622
623 fBaseClass = (TClass*)(-1);
624 fBaseVersion = 0;
625 fNewBaseClass = nullptr;
626}
627
628////////////////////////////////////////////////////////////////////////////////
629
631 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kBase,"BASE"),
632 // Abuse TStreamerElement data member that is not used by TStreamerBase
633 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
634 fStreamerFunc(nullptr), fConvStreamerFunc(nullptr), fStreamerInfo(nullptr)
635
636{
637 // Create a TStreamerBase object.
638
639 if (strcmp(name,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
640 if (strcmp(name,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
641 fNewType = fType;
643 if (fBaseClass) {
644 if (fBaseClass->IsVersioned()) {
646 } else {
647 fBaseVersion = -1;
648 }
650 } else {
651 fBaseVersion = 0;
652 }
653 fNewBaseClass = nullptr;
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// TStreamerBase dtor
659
663
664////////////////////////////////////////////////////////////////////////////////
665/// Returns a pointer to the TClass of this element.
666
668{
669 if (fBaseClass!=(TClass*)(-1)) return fBaseClass;
670 ((TStreamerBase*)this)->fBaseClass = TClass::GetClass(GetName());
671 return fBaseClass;
672}
673
674////////////////////////////////////////////////////////////////////////////////
675/// Returns size of baseclass in bytes.
676
678{
679 TClass *cl = GetNewClass();
680 if (!cl)
681 cl = GetClassPointer();
682 if (cl)
683 return cl->Size();
684 return 0;
685}
686
687////////////////////////////////////////////////////////////////////////////////
688/// Setup the element.
689
694
702
703////////////////////////////////////////////////////////////////////////////////
704/// Setup the fStreamerFunc and fStreamerinfo
705
730
731////////////////////////////////////////////////////////////////////////////////
732/// Return kTRUE if the element represent a base class.
733
735{
736 return kTRUE;
737}
738
739////////////////////////////////////////////////////////////////////////////////
740/// Return the proper include for this element.
741
742const char *TStreamerBase::GetInclude() const
743{
745 IncludeNameBuffer().Form("\"%s\"",fBaseClass->GetDeclFileName());
746 } else {
747 std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
748 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
749 }
750 return IncludeNameBuffer();
751}
752
753////////////////////////////////////////////////////////////////////////////////
754/// Print the content of the element.
755
757{
760 if (sequenceType.Length()) {
761 sequenceType.Prepend(" (");
762 sequenceType += ") ";
763 }
764 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
765}
766
767////////////////////////////////////////////////////////////////////////////////
768/// Read the content of the buffer.
769
771{
772 if (fConvStreamerFunc) {
773 // We have a custom Streamer member function, we must use it.
775 } else if (fStreamerFunc) {
776 // We have a custom Streamer member function, we must use it.
777 fStreamerFunc(b,pointer+fOffset);
778 } else {
779 // We don't have a custom Streamer member function. That still doesn't mean
780 // that there is no streamer - it could be an external one:
781 // If the old base class has an adopted streamer we take that
782 // one instead of the new base class:
783 if( fNewBaseClass ) {
785 if (extstrm) {
786 // The new base class has an adopted streamer:
787 extstrm->SetOnFileClass(fBaseClass);
788 (*extstrm)(b, pointer);
789 } else {
790 b.ReadClassBuffer( fNewBaseClass, pointer+fOffset, fBaseClass );
791 }
792 } else {
794 if (extstrm) {
795 // The class has an adopted streamer:
796 (*extstrm)(b, pointer);
797 } else {
798 b.ReadClassBuffer( fBaseClass, pointer+fOffset );
799 }
800 }
801 }
802 return 0;
803}
804
805////////////////////////////////////////////////////////////////////////////////
806/// Stream an object of class TStreamerBase.
807
809{
811 if (R__b.IsReading()) {
812 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
813
814 R__b.ClassBegin(TStreamerBase::Class(), R__v);
815
816 R__b.ClassMember("TStreamerElement");
818 // If the class owning the TStreamerElement and the base class are not
819 // loaded, on the file their streamer info might be in the following
820 // order (derived class,base class) and hence the base class is not
821 // yet emulated.
822 fBaseClass = (TClass*)-1;
823 fNewBaseClass = nullptr;
824 // Eventually we need a v3 that stores directly fBaseCheckSum (and
825 // a version of TStreamerElement should not stored fMaxIndex)
826 if (R__v > 2) {
827 R__b.ClassMember("fBaseVersion","Int_t");
829 } else {
830 // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
833 }
834 R__b.ClassEnd(TStreamerBase::Class());
835 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
836 } else {
837 R__b.WriteClassBuffer(TStreamerBase::Class(),this);
838 }
839}
840
841////////////////////////////////////////////////////////////////////////////////
842///Function called by the TClass constructor when replacing an emulated class
843///by the real class.
844
846{
848
849 if (fBaseClass == oldClass) {
852 } else if (fBaseClass == nullptr) {
853 if (fName == newClass->GetName()) {
856 } else if (TClassTable::GetDict(fName)) {
859 }
860 }
861}
862
863////////////////////////////////////////////////////////////////////////////////
864/// Write the base class into the buffer.
865
867{
868 if (fStreamerFunc) {
869 // We have a custom Streamer member function, we must use it.
870 fStreamerFunc(b,pointer+fOffset);
871 } else {
872 // We don't have a custom Streamer member function. That still doesn't mean
873 // that there is no streamer - it could be an external one:
874 // If the old base class has an adopted streamer we take that
875 // one instead of the new base class:
876 if (fNewBaseClass) {
878 if (extstrm) {
879 // The new base class has an adopted streamer:
880 extstrm->SetOnFileClass(fBaseClass);
881 (*extstrm)(b, pointer);
882 return 0;
883 } else {
885 return 0;
886 }
887 } else {
889 if (extstrm) {
890 (*extstrm)(b, pointer);
891 return 0;
892 } else {
894 return 0;
895 }
896 }
897 }
898 return 0;
899}
900
901//______________________________________________________________________________
902
903//////////////////////////////////////////////////////////////////////////
904// //
905// TStreamerBasicPointer implements the streamering of pointer to //
906// fundamental types. //
907// //
908//////////////////////////////////////////////////////////////////////////
909
911
912////////////////////////////////////////////////////////////////////////////////
913/// Default ctor.
914
915TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
916{
917 fCounter = nullptr;
918}
919
920////////////////////////////////////////////////////////////////////////////////
921/// Create a TStreamerBasicPointer object.
922
923TStreamerBasicPointer::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)
924 : TStreamerElement(name,title,offset,dtype,typeName)
925{
929 fCountVersion = countVersion; //currently unused
930 Init();
931// printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
932// name,countName,countClass,countVersion,fCounter);
933}
934
935////////////////////////////////////////////////////////////////////////////////
936/// TStreamerBasicPointer dtor.
937
941
942////////////////////////////////////////////////////////////////////////////////
943/// return offset of counter
944
946{
947 if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
948 if (!fCounter) return 0;
949 // FIXME: does not suport multiple inheritance for counter in base class.
950 // This is wrong in case counter is not in the same class or one of
951 // the left most (non virtual) base classes. For the other we would
952 // really need to use the object coming from the list of real data.
953 // (and even that need analysis for virtual base class).
954 return (ULongptr_t)fCounter->GetOffset();
955}
956
957////////////////////////////////////////////////////////////////////////////////
958/// Returns size of basicpointer in bytes.
959
961{
962 if (fArrayLength) return fArrayLength*sizeof(void *);
963 return sizeof(void *);
964}
965
966////////////////////////////////////////////////////////////////////////////////
967/// Setup the element.
968/// If directive is a StreamerInfo and it correspond to the
969/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
970/// for 'countClass'.
971
976
977////////////////////////////////////////////////////////////////////////////////
978/// Set number of array dimensions.
979
981{
982 fArrayDim = dim;
983 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
984 fNewType = fType;
985}
986
987////////////////////////////////////////////////////////////////////////////////
988/// Stream an object of class TStreamerBasicPointer.
989
991{
993 if (R__b.IsReading()) {
994 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
995 if (R__v > 1) {
996 R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
997 //Init();
998 //fCounter = InitCounter( fCountClass, fCountName );
999 return;
1000 }
1001 //====process old versions before automatic schema evolution
1006 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1007 } else {
1008 R__b.WriteClassBuffer(TStreamerBasicPointer::Class(),this);
1009 }
1010}
1011
1012
1013//______________________________________________________________________________
1014
1015//////////////////////////////////////////////////////////////////////////
1016// //
1017// TStreamerLoop implement streaming of a few construct that require //
1018// looping over the data member and are not convered by other case //
1019// (most deprecated). //
1020// //
1021//////////////////////////////////////////////////////////////////////////
1022
1024
1025////////////////////////////////////////////////////////////////////////////////
1026/// Default ctor.
1027
1028TStreamerLoop::TStreamerLoop() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
1029{
1030}
1031
1032////////////////////////////////////////////////////////////////////////////////
1033/// Create a TStreamerLoop object.
1034
1035TStreamerLoop::TStreamerLoop(const char *name, const char *title, Int_t offset, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
1036 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kStreamLoop,typeName)
1037{
1040 fCountVersion = countVersion; //currently unused
1041 Init();
1042}
1043
1044////////////////////////////////////////////////////////////////////////////////
1045/// TStreamerLoop dtor.
1046
1050
1051////////////////////////////////////////////////////////////////////////////////
1052/// return address of counter
1053
1055{
1056 //if (!fCounter) {
1057 // Init();
1058 // if (!fCounter) return 0;
1059 //}
1060 if (!fCounter) return 0;
1061 return (ULongptr_t)fCounter->GetOffset();
1062}
1063
1064////////////////////////////////////////////////////////////////////////////////
1065/// Returns size of counter in bytes.
1066
1068{
1069 if (fArrayLength) return fArrayLength*sizeof(void*);
1070 return sizeof(void*);
1071}
1072
1073////////////////////////////////////////////////////////////////////////////////
1074/// Setup the element.
1075/// If directive is a StreamerInfo and it correspond to the
1076/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
1077/// for 'countClass'.
1078
1083
1084////////////////////////////////////////////////////////////////////////////////
1085/// Return the proper include for this element.
1086
1087const char *TStreamerLoop::GetInclude() const
1088{
1089 IncludeNameBuffer().Form("<%s>","TString.h"); //to be generalized
1090 return IncludeNameBuffer();
1091}
1092
1093////////////////////////////////////////////////////////////////////////////////
1094/// Stream an object of class TStreamerLoop.
1095
1097{
1098 UInt_t R__s, R__c;
1099 if (R__b.IsReading()) {
1100 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1101 if (R__v > 1) {
1102 R__b.ReadClassBuffer(TStreamerLoop::Class(), this, R__v, R__s, R__c);
1103 //Init();
1104 return;
1105 }
1106 //====process old versions before automatic schema evolution
1111 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1112 } else {
1113 R__b.WriteClassBuffer(TStreamerLoop::Class(),this);
1114 }
1115}
1116
1117
1118//______________________________________________________________________________
1119
1120//////////////////////////////////////////////////////////////////////////
1121// //
1122// TStreamerBasicType implement streaming of fundamental types (int, //
1123// float, etc.). //
1124// //
1125//////////////////////////////////////////////////////////////////////////
1126
1128
1129////////////////////////////////////////////////////////////////////////////////
1130/// Default ctor.
1131
1133{
1134}
1135
1136////////////////////////////////////////////////////////////////////////////////
1137/// Create a TStreamerBasicType object.
1138
1139TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1140 : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1141{
1142}
1143
1144////////////////////////////////////////////////////////////////////////////////
1145/// TStreamerBasicType dtor.
1146
1150
1151////////////////////////////////////////////////////////////////////////////////
1152/// return address of counter
1153
1160
1161////////////////////////////////////////////////////////////////////////////////
1162/// Returns size of this element in bytes.
1163
1165{
1166 return fSize;
1167}
1168
1169////////////////////////////////////////////////////////////////////////////////
1170/// Stream an object of class TStreamerBasicType.
1171
1173{
1174 UInt_t R__s, R__c;
1175 if (R__b.IsReading()) {
1176 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1177 if (R__v > 1) {
1178 R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1179 } else {
1180 //====process old versions before automatic schema evolution
1182 R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1183 }
1184 Int_t type = fType;
1187 }
1188 switch(type) {
1189 // basic types
1190 case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1191 case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1192 case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1193 case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1194 case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1195 case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1196 case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1197 case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1198 case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1199 case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1200 case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1201 case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1202 case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1203 case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1204 case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1205 case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1206 case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1207 case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1208 default: return; // If we don't change the size let's not remultiply it.
1209 }
1211 } else {
1212 R__b.WriteClassBuffer(TStreamerBasicType::Class(),this);
1213 }
1214}
1215
1216
1217
1218//______________________________________________________________________________
1219
1220//////////////////////////////////////////////////////////////////////////
1221// //
1222// TStreamerObject implements streaming of embedded objects whose type //
1223// inherits from TObject. //
1224// //
1225//////////////////////////////////////////////////////////////////////////
1226
1228
1229////////////////////////////////////////////////////////////////////////////////
1230/// Default ctor.
1231
1235
1236////////////////////////////////////////////////////////////////////////////////
1237/// Create a TStreamerObject object.
1238
1239TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1240 : TStreamerElement(name,title,offset,0,typeName)
1241{
1243 if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1244 if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1245 fNewType = fType;
1246 Init();
1247}
1248
1249////////////////////////////////////////////////////////////////////////////////
1250/// TStreamerObject dtor.
1251
1255
1256////////////////////////////////////////////////////////////////////////////////
1257/// Setup the element.
1258
1266
1267////////////////////////////////////////////////////////////////////////////////
1268/// Return the proper include for this element.
1269
1271{
1272 TClass *cl = GetClassPointer();
1273 if (cl && cl->HasInterpreterInfo()) {
1274 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1275 } else {
1276 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1277 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1278 }
1279 return IncludeNameBuffer();
1280}
1281
1282////////////////////////////////////////////////////////////////////////////////
1283/// Returns size of object class in bytes.
1284
1286{
1287 TClass *cl = GetNewClass();
1288 if (!cl)
1289 cl = GetClassPointer();
1290 Int_t classSize = 8;
1291 if (cl)
1292 classSize = cl->Size();
1293 if (fArrayLength)
1294 return fArrayLength * classSize;
1295 return classSize;
1296}
1297
1298////////////////////////////////////////////////////////////////////////////////
1299/// Stream an object of class TStreamerObject.
1300
1302{
1303 UInt_t R__s, R__c;
1304 if (R__b.IsReading()) {
1305 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1306 if (R__v > 1) {
1307 R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1308 return;
1309 }
1310 //====process old versions before automatic schema evolution
1312 R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1313 } else {
1314 R__b.WriteClassBuffer(TStreamerObject::Class(),this);
1315 }
1316}
1317
1318
1319//______________________________________________________________________________
1320
1321//////////////////////////////////////////////////////////////////////////
1322// //
1323// TStreamerObjectAny implement streaming of embedded object not //
1324// inheriting from TObject. //
1325// //
1326//////////////////////////////////////////////////////////////////////////
1327
1329
1330////////////////////////////////////////////////////////////////////////////////
1331/// Default ctor.
1332
1336
1337////////////////////////////////////////////////////////////////////////////////
1338/// Create a TStreamerObjectAny object.
1339
1340TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1341 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1342{
1343 Init();
1344}
1345
1346////////////////////////////////////////////////////////////////////////////////
1347/// TStreamerObjectAny dtor.
1348
1352
1353////////////////////////////////////////////////////////////////////////////////
1354/// Setup the element.
1355
1363
1364////////////////////////////////////////////////////////////////////////////////
1365/// Return the proper include for this element.
1366
1368{
1369 TClass *cl = GetClassPointer();
1370 if (cl && cl->HasInterpreterInfo()) {
1371 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1372 } else {
1373 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1374 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1375 }
1376 return IncludeNameBuffer();
1377}
1378
1379////////////////////////////////////////////////////////////////////////////////
1380/// Returns size of anyclass in bytes.
1381
1383{
1384 TClass *cl = GetNewClass();
1385 if (!cl)
1386 cl = GetClassPointer();
1387 Int_t classSize = 8;
1388 if (cl)
1389 classSize = cl->Size();
1390 if (fArrayLength)
1391 return fArrayLength * classSize;
1392 return classSize;
1393}
1394
1395////////////////////////////////////////////////////////////////////////////////
1396/// Stream an object of class TStreamerObjectAny.
1397
1399{
1400 UInt_t R__s, R__c;
1401 if (R__b.IsReading()) {
1402 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1403 if (R__v > 1) {
1404 R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1405 return;
1406 }
1407 //====process old versions before automatic schema evolution
1409 R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1410 } else {
1411 R__b.WriteClassBuffer(TStreamerObjectAny::Class(),this);
1412 }
1413}
1414
1415
1416
1417//______________________________________________________________________________
1418
1419//////////////////////////////////////////////////////////////////////////
1420// //
1421// TStreamerObjectPointer implements streaming of pointer to object //
1422// inheriting from TObject. //
1423// //
1424//////////////////////////////////////////////////////////////////////////
1425
1427
1428////////////////////////////////////////////////////////////////////////////////
1429/// Default ctor.
1430
1434
1435////////////////////////////////////////////////////////////////////////////////
1436/// Create a TStreamerObjectPointer object.
1437
1439 Int_t offset, const char *typeName)
1440 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1441{
1442 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1443 fNewType = fType;
1444 Init();
1445}
1446
1447////////////////////////////////////////////////////////////////////////////////
1448/// TStreamerObjectPointer dtor.
1449
1453
1454////////////////////////////////////////////////////////////////////////////////
1455/// Setup the element.
1456
1464
1465////////////////////////////////////////////////////////////////////////////////
1466/// Return the proper include for this element.
1467
1469{
1470 TClass *cl = GetClassPointer();
1471 if (cl && cl->HasInterpreterInfo()) {
1472 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1473 } else {
1474 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1475 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1476 }
1477
1478 return IncludeNameBuffer();
1479}
1480
1481////////////////////////////////////////////////////////////////////////////////
1482/// Returns size of objectpointer in bytes.
1483
1485{
1486 if (fArrayLength) return fArrayLength*sizeof(void *);
1487 return sizeof(void *);
1488}
1489
1490////////////////////////////////////////////////////////////////////////////////
1491/// Set number of array dimensions.
1492
1494{
1495 fArrayDim = dim;
1496 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1497 fNewType = fType;
1498}
1499
1500////////////////////////////////////////////////////////////////////////////////
1501/// Stream an object of class TStreamerObjectPointer.
1502
1504{
1505 UInt_t R__s, R__c;
1506 if (R__b.IsReading()) {
1507 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1508 if (R__v > 1) {
1509 R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1510 return;
1511 }
1512 //====process old versions before automatic schema evolution
1514 R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1515 } else {
1516 R__b.WriteClassBuffer(TStreamerObjectPointer::Class(),this);
1517 }
1518}
1519
1520
1521//______________________________________________________________________________
1522
1523//////////////////////////////////////////////////////////////////////////
1524// //
1525// TStreamerObjectPointerAny implements streaming of pointer to object //
1526// not inheriting from TObject. //
1527// //
1528//////////////////////////////////////////////////////////////////////////
1529
1531
1532////////////////////////////////////////////////////////////////////////////////
1533/// Default ctor.
1534
1538
1539////////////////////////////////////////////////////////////////////////////////
1540/// Create a TStreamerObjectAnyPointer object.
1541
1543 Int_t offset, const char *typeName)
1544 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1545{
1546 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1547 fNewType = fType;
1548 Init();
1549}
1550
1551////////////////////////////////////////////////////////////////////////////////
1552/// TStreamerObjectAnyPointer dtor.
1553
1557
1558////////////////////////////////////////////////////////////////////////////////
1559/// Setup the element.
1560
1568
1569////////////////////////////////////////////////////////////////////////////////
1570/// Return the proper include for this element.
1571
1573{
1574 TClass *cl = GetClassPointer();
1575 if (cl && cl->HasInterpreterInfo()) {
1576 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1577 } else {
1578 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1579 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1580 }
1581
1582 return IncludeNameBuffer();
1583}
1584
1585////////////////////////////////////////////////////////////////////////////////
1586/// Returns size of objectpointer in bytes.
1587
1589{
1590 if (fArrayLength) return fArrayLength*sizeof(void *);
1591 return sizeof(void *);
1592}
1593
1594////////////////////////////////////////////////////////////////////////////////
1595/// Set number of array dimensions.
1596
1598{
1599 fArrayDim = dim;
1600 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1601 fNewType = fType;
1602}
1603
1604////////////////////////////////////////////////////////////////////////////////
1605/// Stream an object of class TStreamerObjectAnyPointer.
1606
1608{
1609 if (R__b.IsReading()) {
1610 R__b.ReadClassBuffer(TStreamerObjectAnyPointer::Class(), this);
1611 } else {
1612 R__b.WriteClassBuffer(TStreamerObjectAnyPointer::Class(),this);
1613 }
1614}
1615
1616
1617//______________________________________________________________________________
1618
1619//////////////////////////////////////////////////////////////////////////
1620// //
1621// TSreamerString implements streaming of TString. //
1622// //
1623//////////////////////////////////////////////////////////////////////////
1624
1626
1627////////////////////////////////////////////////////////////////////////////////
1628/// Default ctor.
1629
1633
1634////////////////////////////////////////////////////////////////////////////////
1635/// Create a TStreamerString object.
1636
1637TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1638 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1639{
1640}
1641
1642////////////////////////////////////////////////////////////////////////////////
1643/// TStreamerString dtor.
1644
1648
1649////////////////////////////////////////////////////////////////////////////////
1650/// Return the proper include for this element.
1651
1653{
1654 IncludeNameBuffer().Form("<%s>","TString.h");
1655 return IncludeNameBuffer();
1656}
1657
1658////////////////////////////////////////////////////////////////////////////////
1659/// Returns size of anyclass in bytes.
1660
1662{
1663 if (fArrayLength) return fArrayLength*sizeof(TString);
1664 return sizeof(TString);
1665}
1666
1667////////////////////////////////////////////////////////////////////////////////
1668/// Stream an object of class TStreamerString.
1669
1671{
1672 UInt_t R__s, R__c;
1673 if (R__b.IsReading()) {
1674 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1675 if (R__v > 1) {
1676 R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1677 return;
1678 }
1679 //====process old versions before automatic schema evolution
1681 R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1682 } else {
1683 R__b.WriteClassBuffer(TStreamerString::Class(),this);
1684 }
1685}
1686
1687//______________________________________________________________________________
1688
1689//////////////////////////////////////////////////////////////////////////
1690// //
1691// TStreamerSTL implements streamer of STL container. //
1692// //
1693//////////////////////////////////////////////////////////////////////////
1694
1696
1697////////////////////////////////////////////////////////////////////////////////
1698/// Default ctor.
1699
1700TStreamerSTL::TStreamerSTL() : fSTLtype(0), fCtype(0)
1701{
1702}
1703
1704////////////////////////////////////////////////////////////////////////////////
1705/// Create a TStreamerSTL object.
1706
1707TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1708 const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1709 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1710{
1711 std::string answer;
1714 fTypeName = answer;
1715
1716 if (name==typeName /* intentional pointer comparison */
1717 || strcmp(name,typeName)==0) {
1718 // We have a base class.
1719 fName = fTypeName;
1720 }
1721 fSTLtype = proxy.GetCollectionType();
1722 fCtype = 0;
1723
1725
1726 if (fSTLtype == ROOT::kSTLbitset) {
1727 // Nothing to check
1728 } else if (proxy.GetValueClass()) {
1729 if (proxy.HasPointers()) fCtype = TVirtualStreamerInfo::kObjectp;
1731 } else {
1732 fCtype = proxy.GetType();
1733 if (proxy.HasPointers()) fCtype += TVirtualStreamerInfo::kOffsetP;
1734 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1735 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1736 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1737 }
1738 }
1741 fNewType = fType;
1742 }
1743}
1744
1745////////////////////////////////////////////////////////////////////////////////
1746/// Create a TStreamerSTL object.
1747
1748TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1749 const char *typeName, const char *trueType, Bool_t dmPointer)
1750 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1751{
1752 const char *t = trueType;
1753 if (!t || !*t) t = typeName;
1754
1755 std::string answer;
1758 fTypeName = answer;
1759
1760 if (name==typeName /* intentional pointer comparison */
1761 || strcmp(name,typeName)==0) {
1762 // We have a base class.
1763 fName = fTypeName;
1764 }
1765
1766 if (arglist.fElements.size() < 2) {
1767 Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, t);
1768 return;
1769 }
1770
1771 const std::string& inside_type = arglist.fElements[1];
1772 std::string inside = (inside_type.find("const ")==0) ? inside_type.substr(6) : inside_type;
1773
1774 // Let's treat the unique_ptr case
1776
1777 bool isPointer = false;
1778 // The incoming name is normalized (it comes from splitting the name of a TClass),
1779 // so all we need to do is drop the last trailing star (if any) and record that information.
1780 while (intype.back() == '*') {
1781 isPointer = true;
1782 intype.pop_back();
1783 }
1784
1785 fSTLtype = TClassEdit::STLKind(arglist.fElements[0]);
1786 fCtype = 0;
1787 if (fSTLtype == ROOT::kNotSTL) { return; }
1789
1790 TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(intype.c_str());
1791 if (fSTLtype == ROOT::kSTLbitset) {
1792 // Nothing to check
1793 } else if (dt) {
1794 fCtype = dt->GetType();
1796 } else {
1797 // this could also be a nested enums ... which should work ... be let's see.
1798 TClass *cl = TClass::GetClass(intype.c_str());
1799 if (cl) {
1802 } else {
1803 auto enumdesc = TEnum::GetEnum(intype.c_str());
1804 if (enumdesc || gCling->ClassInfo_IsEnum(intype.c_str())) {
1805 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1806 if (isPointer)
1808 } else {
1809 if (intype != "string") {
1810 // This case can happens when 'this' is a TStreamerElement for
1811 // a STL container containing something for which we do not have
1812 // a TVirtualStreamerInfo (This happens in particular is the collection
1813 // objects themselves are always empty) and we do not have the
1814 // dictionary/shared library for the container.
1815 if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1816 Warning("TStreamerSTL", "For %s we could not find any information about the type %s %d %s",
1817 fTypeName.Data(), arglist.fElements[1].c_str(), fSTLtype, arglist.fElements[0].c_str());
1818 }
1819 }
1820 }
1821 }
1822 }
1823
1826 fNewType = fType;
1827 }
1828}
1829
1830////////////////////////////////////////////////////////////////////////////////
1831/// TStreamerSTL dtor.
1832
1836
1837////////////////////////////////////////////////////////////////////////////////
1838/// We can not split STL's which are inside a variable size array.
1839/// At least for now.
1840
1842{
1843 if (IsaPointer()) {
1844 if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1845 return kTRUE;
1846 }
1847
1848 if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1849
1851
1852 return kFALSE;
1853}
1854
1855////////////////////////////////////////////////////////////////////////////////
1856/// Return true if the data member is a pointer.
1857
1859{
1860 const char *type_name = GetTypeName();
1861 if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1862 else return kFALSE;
1863}
1864
1865
1866////////////////////////////////////////////////////////////////////////////////
1867/// Return kTRUE if the element represent a base class.
1868
1870{
1871 TString ts(GetName());
1872
1873 if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1874 if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1875 return kFALSE;
1876}
1877
1878////////////////////////////////////////////////////////////////////////////////
1879/// Returns a pointer to the TClass of this element.
1880
1882{
1883 if (fClassObject!=(TClass*)(-1))
1884 return fClassObject;
1885
1887
1889 TClass *cl = TClass::GetClass(className, kTRUE, quiet);
1890
1891 auto proxy = cl->GetCollectionProxy();
1892 if (!fNewClass && proxy && proxy->GetValueClass() == nullptr) {
1893 // Collection of numerical type, let check if it is an enum.
1895 if ( arglist.fElements[1].size() >= 2 ) {
1896 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1897 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1898 ((TStreamerElement *)this)->fNewClass = cl;
1899 if (proxy->HasPointers())
1900 cl = TClass::GetClass("vector<Int_t*>");
1901 else
1902 cl = TClass::GetClass("vector<Int_t>");
1903 }
1904 }
1905 }
1906 ((TStreamerElement*)this)->fClassObject = cl;
1907 return fClassObject;
1908}
1909
1910////////////////////////////////////////////////////////////////////////////////
1911/// Returns size of STL container in bytes.
1912
1914{
1915 // Since the STL collection might or might not be emulated and that the
1916 // sizeof the object depends on this, let's just always retrieve the
1917 // current size!
1918 TClass *cl = GetNewClass();
1919 if (!cl)
1920 cl = GetClassPointer();
1921 UInt_t size = 0;
1922 if (cl==nullptr) {
1923 if (!TestBit(kWarned)) {
1924 Error("GetSize","Could not find the TClass for %s.\n"
1925 "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1926 const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1927 }
1928 } else {
1929 size = cl->Size();
1930 }
1931
1932 if (fArrayLength) return fArrayLength*size;
1933 return size;
1934}
1935
1936////////////////////////////////////////////////////////////////////////////////
1937/// Print the content of the element.
1938
1940{
1942 TString cdim;
1943 name = GetName();
1944 for (Int_t i=0;i<fArrayDim;i++) {
1945 cdim.Form("[%d]",fMaxIndex[i]);
1946 name += cdim;
1947 }
1950 if (sequenceType.Length()) {
1951 sequenceType.Prepend(" (");
1952 sequenceType += ") ";
1953 }
1954 printf(" %-14s %-15s offset=%3d type=%2d",
1955 GetTypeName(), name.Data(), fOffset, fType);
1957 printf(" newtype=%2d", fNewType);
1958 printf(" stl=%d ctype=%d %s%-20s\n",
1959 fSTLtype, fCtype, sequenceType.Data(), GetTitle());
1960}
1961
1962////////////////////////////////////////////////////////////////////////////////
1963/// Return the proper include for this element.
1964
1965const char *TStreamerSTL::GetInclude() const
1966{
1967 if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1968 else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1969 else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1970 else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1971 else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1972 else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1973 else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1974 else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1975 else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1976 else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1977 else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1978 else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1979 else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1980 return IncludeNameBuffer();
1981}
1982
1983////////////////////////////////////////////////////////////////////////////////
1984/// Set pointer to Streamer function for this element
1985/// NOTE: we do not take ownership
1986
1991
1992////////////////////////////////////////////////////////////////////////////////
1993/// Stream an object of class TStreamerSTL.
1994
1996{
1997 UInt_t R__s, R__c;
1998 if (R__b.IsReading()) {
1999 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2000 if (R__v > 2) {
2001 R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
2002 } else {
2003 //====process old versions before automatic schema evolution
2005 R__b >> fSTLtype;
2006 R__b >> fCtype;
2007 R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
2008 }
2009 // In old versions (prior to v6.24/02) the value of fArrayDim was not stored properly.
2010 if (fArrayDim == 0 && fArrayLength > 0) {
2011 while(fArrayDim < 5 && fMaxIndex[fArrayDim] != 0) {
2012 ++fArrayDim;
2013 }
2014 }
2016 // For a long time those where inverted in TStreamerElement
2017 // compared to the other definitions. When we moved to version '4',
2018 // this got standardized, but we now need to fix it.
2019
2020 if (fTypeName.BeginsWith("std::set") || fTypeName.BeginsWith("set")) {
2022 } else if (fTypeName.BeginsWith("std::multimap") || fTypeName.BeginsWith("multimap")) {
2024 }
2025 }
2026
2029 if (GetArrayLength() > 0) {
2031 }
2032 if (R__b.GetParent()) { // Avoid resetting during a cloning.
2034 SetBit(kDoNotDelete); // For backward compatibility
2035 } else if ( fSTLtype == ROOT::kSTLmap || fSTLtype == ROOT::kSTLmultimap) {
2036 // Here we would like to set the bit only if one of the element of the pair is a pointer,
2037 // however we have no easy to determine this short of parsing the class name.
2038 SetBit(kDoNotDelete); // For backward compatibility
2039 }
2040 }
2041 return;
2042 } else {
2043 // To enable forward compatibility we actually save with the old value
2044 TStreamerSTL tmp;
2045 // Hand coded copy constructor since the 'normal' one are intentionally
2046 // deleted.
2047 tmp.fName = fName;
2048 tmp.fTitle = fTitle;
2050 tmp.fSize = fSize;
2051 tmp.fArrayDim = fArrayDim;
2052 tmp.fArrayLength = fArrayLength;
2053 for(int i = 0; i < 5; ++i)
2054 tmp.fMaxIndex[i] = fMaxIndex[i];
2055 tmp.fTypeName = fTypeName;
2056 tmp.fSTLtype = fSTLtype;
2057 tmp.fCtype = fCtype;
2058 R__b.WriteClassBuffer(TStreamerSTL::Class(), &tmp);
2059 }
2060}
2061
2062//______________________________________________________________________________
2063
2064//////////////////////////////////////////////////////////////////////////
2065// //
2066// TStreamerSTLstring implements streaming std::string. //
2067// //
2068//////////////////////////////////////////////////////////////////////////
2069
2071
2072////////////////////////////////////////////////////////////////////////////////
2073/// Default ctor.
2074
2078
2079////////////////////////////////////////////////////////////////////////////////
2080/// Create a TStreamerSTLstring object.
2081
2083 const char *typeName, Bool_t dmPointer)
2084 : TStreamerSTL()
2085{
2086 SetName(name);
2087 SetTitle(title);
2088
2089 if (dmPointer) {
2091 } else {
2093 }
2094
2095 fNewType = fType;
2096 fOffset = offset;
2099 fTypeName= typeName;
2100
2101}
2102
2103////////////////////////////////////////////////////////////////////////////////
2104/// TStreamerSTLstring dtor.
2105
2109
2110////////////////////////////////////////////////////////////////////////////////
2111/// Return the proper include for this element.
2112
2114{
2115 IncludeNameBuffer() = "<string>";
2116 return IncludeNameBuffer();
2117}
2118
2119////////////////////////////////////////////////////////////////////////////////
2120/// Returns size of anyclass in bytes.
2121
2123{
2124 if (fArrayLength) return fArrayLength*sizeof(string);
2125 return sizeof(string);
2126}
2127
2128////////////////////////////////////////////////////////////////////////////////
2129/// Stream an object of class TStreamerSTLstring.
2130
2132{
2133 UInt_t R__s, R__c;
2134 if (R__b.IsReading()) {
2135 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2136 if (R__v > 1) {
2137 R__b.ReadClassBuffer(TStreamerSTLstring::Class(), this, R__v, R__s, R__c);
2138 return;
2139 }
2140 //====process old versions before automatic schema evolution
2142 R__b.CheckByteCount(R__s, R__c, TStreamerSTLstring::IsA());
2143 } else {
2144 R__b.WriteClassBuffer(TStreamerSTLstring::Class(),this);
2145 }
2146}
2147
2148//______________________________________________________________________________
2149
2150///////////////////////////////////////////////////////////////////////////////
2151// //
2152// TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2153// //
2154///////////////////////////////////////////////////////////////////////////////
2155
2157
2159{
2160 // Avoid streaming the synthetic/artificial streamer elements.
2161
2162 // Intentionally, nothing to do at all.
2163 return;
2164}
2165
2167{
2168 // Return the read function if any.
2169
2170 return fReadFunc;
2171}
2172
2174{
2175 // Return the raw read function if any.
2176
2177 return fReadRawFunc;
2178}
#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:406
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:6636
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:5830
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:6064
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:4713
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:7224
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:7331
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:7204
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:3581
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:6910
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.
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:82