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
186
187////////////////////////////////////////////////////////////////////////////////
188/// Default ctor.
189
191{
192 // clang-format off
194 fSize = 0;
196 fArrayDim = 0;
197 fArrayLength = 0;
198 fStreamer = nullptr;
199 fOffset = 0;
200 fClassObject = (TClass*)(-1);
201 fNewClass = nullptr;
202 fTObjectOffset = 0;
203 fFactor = 0;
204 fXmin = 0;
205 fXmax = 0;
206 // clang-format on
207 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
208}
209
210////////////////////////////////////////////////////////////////////////////////
211/// Create a TStreamerElement object.
212
213TStreamerElement::TStreamerElement(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
214 : TNamed(name,title)
215{
216 fOffset = offset;
217 fType = dtype;
218 fSize = 0;
219 fNewType = fType;
220 fArrayDim = 0;
221 fArrayLength = 0;
222 if (typeName && !strcmp(typeName, "BASE")) {
223 // TStreamerBase case; fTypeName should stay "BASE".
224 fTypeName = typeName;
225 } else {
226 //must protect call into the interpreter
229 }
230 fStreamer = nullptr;
231 fClassObject = (TClass*)(-1);
232 fNewClass = nullptr;
233 fTObjectOffset = 0;
234 fFactor = 0;
235 fXmin = 0;
236 fXmax = 0;
237 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
238 if (fTypeName == "Float16_t" || fTypeName == "Float16_t*") {
240 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
241 }
242 if (fTypeName == "Double32_t" || fTypeName == "Double32_t*") {
244 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
245 }
246}
247
248////////////////////////////////////////////////////////////////////////////////
249/// TStreamerElement dtor.
250
254
255
256////////////////////////////////////////////////////////////////////////////////
257/// Returns true if the element cannot be split, false otherwise.
258/// An element cannot be split if the corresponding class member has
259/// the special characters "||" as the first characters in the
260/// comment field.
261
263{
264 if (GetTitle()[0] != 0 && strspn(GetTitle(),"||") == 2) return kTRUE;
265 TClass *cl = GetClassPointer();
266 if (!cl) return kFALSE; //basic type
267
268 static TClassRef clonesArray("TClonesArray");
269 if (IsaPointer() && cl != clonesArray && !cl->GetCollectionProxy()) return kTRUE;
270
271 switch(fType) {
277 return kTRUE;
278 }
279
280 if ( !cl->CanSplit() ) return kTRUE;
281
282 return kFALSE;
283}
284
285////////////////////////////////////////////////////////////////////////////////
286/// Returns a pointer to the TClass of this element and updates fClassObject
287
289{
290 if (fClassObject!=(TClass*)(-1)) return fClassObject;
291
294 ((TStreamerElement*)this)->fClassObject = TClass::GetClass(className, kTRUE, quiet);
295 return fClassObject;
296}
297
298////////////////////////////////////////////////////////////////////////////////
299/// Returns the TExec id for the EXEC instruction in the comment field
300/// of a TRef data member.
301
303{
304 TString typeName = fTypeName;
305 if (typeName != "TRef" && typeName != "TRefArray") {
306 // It's not a ROOT standard TRef or TRefArray class, but it could be a user class
307 // inheriting from it (see ROOT-7052)
309 const auto cl = TClass::GetClass(clName, kFALSE, kTRUE);
310 if (!cl || (nullptr == cl->GetBaseClass("TRef") && nullptr == cl->GetBaseClass("TRefArray")))
311 return 0;
312 }
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");
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
612
613////////////////////////////////////////////////////////////////////////////////
614
616 // Abuse TStreamerElement data member that is not used by TStreamerBase
617 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
618 fStreamerFunc(nullptr), fConvStreamerFunc(nullptr), fStreamerInfo(nullptr)
619{
620 // Default ctor.
621
622 fBaseClass = (TClass*)(-1);
623 fBaseVersion = 0;
624 fNewBaseClass = nullptr;
625}
626
627////////////////////////////////////////////////////////////////////////////////
628
630 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kBase,"BASE"),
631 // Abuse TStreamerElement data member that is not used by TStreamerBase
632 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
633 fStreamerFunc(nullptr), fConvStreamerFunc(nullptr), fStreamerInfo(nullptr)
634
635{
636 // Create a TStreamerBase object.
637
638 if (strcmp(name,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
639 if (strcmp(name,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
640 fNewType = fType;
642 if (fBaseClass) {
643 if (fBaseClass->IsVersioned()) {
645 } else {
646 fBaseVersion = -1;
647 }
649 } else {
650 fBaseVersion = 0;
651 }
652 fNewBaseClass = nullptr;
654}
655
656////////////////////////////////////////////////////////////////////////////////
657/// TStreamerBase dtor
658
662
663////////////////////////////////////////////////////////////////////////////////
664/// Returns a pointer to the TClass of this element.
665
667{
668 if (fBaseClass!=(TClass*)(-1)) return fBaseClass;
669 ((TStreamerBase*)this)->fBaseClass = TClass::GetClass(GetName());
670 return fBaseClass;
671}
672
673////////////////////////////////////////////////////////////////////////////////
674/// Returns size of baseclass in bytes.
675
677{
678 TClass *cl = GetNewClass();
679 if (!cl)
680 cl = GetClassPointer();
681 if (cl)
682 return cl->Size();
683 return 0;
684}
685
686////////////////////////////////////////////////////////////////////////////////
687/// Setup the element.
688
693
701
702////////////////////////////////////////////////////////////////////////////////
703/// Setup the fStreamerFunc and fStreamerinfo
704
729
730////////////////////////////////////////////////////////////////////////////////
731/// Return kTRUE if the element represent a base class.
732
734{
735 return kTRUE;
736}
737
738////////////////////////////////////////////////////////////////////////////////
739/// Return the proper include for this element.
740
741const char *TStreamerBase::GetInclude() const
742{
744 IncludeNameBuffer().Form("\"%s\"",fBaseClass->GetDeclFileName());
745 } else {
746 std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
747 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
748 }
749 return IncludeNameBuffer();
750}
751
752////////////////////////////////////////////////////////////////////////////////
753/// Print the content of the element.
754
756{
759 if (sequenceType.Length()) {
760 sequenceType.Prepend(" (");
761 sequenceType += ") ";
762 }
763 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
764}
765
766////////////////////////////////////////////////////////////////////////////////
767/// Read the content of the buffer.
768
770{
771 if (fConvStreamerFunc) {
772 // We have a custom Streamer member function, we must use it.
774 } else if (fStreamerFunc) {
775 // We have a custom Streamer member function, we must use it.
776 fStreamerFunc(b,pointer+fOffset);
777 } else {
778 // We don't have a custom Streamer member function. That still doesn't mean
779 // that there is no streamer - it could be an external one:
780 // If the old base class has an adopted streamer we take that
781 // one instead of the new base class:
782 if( fNewBaseClass ) {
784 if (extstrm) {
785 // The new base class has an adopted streamer:
786 extstrm->SetOnFileClass(fBaseClass);
787 (*extstrm)(b, pointer);
788 } else {
789 b.ReadClassBuffer( fNewBaseClass, pointer+fOffset, fBaseClass );
790 }
791 } else {
793 if (extstrm) {
794 // The class has an adopted streamer:
795 (*extstrm)(b, pointer);
796 } else {
797 b.ReadClassBuffer( fBaseClass, pointer+fOffset );
798 }
799 }
800 }
801 return 0;
802}
803
804////////////////////////////////////////////////////////////////////////////////
805/// Stream an object of class TStreamerBase.
806
808{
810 if (R__b.IsReading()) {
811 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
812
813 R__b.ClassBegin(TStreamerBase::Class(), R__v);
814
815 R__b.ClassMember("TStreamerElement");
817 // If the class owning the TStreamerElement and the base class are not
818 // loaded, on the file their streamer info might be in the following
819 // order (derived class,base class) and hence the base class is not
820 // yet emulated.
821 fBaseClass = (TClass*)-1;
822 fNewBaseClass = nullptr;
823 // Eventually we need a v3 that stores directly fBaseCheckSum (and
824 // a version of TStreamerElement should not stored fMaxIndex)
825 if (R__v > 2) {
826 R__b.ClassMember("fBaseVersion","Int_t");
828 } else {
829 // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
832 }
833 R__b.ClassEnd(TStreamerBase::Class());
834 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
835 } else {
836 R__b.WriteClassBuffer(TStreamerBase::Class(),this);
837 }
838}
839
840////////////////////////////////////////////////////////////////////////////////
841///Function called by the TClass constructor when replacing an emulated class
842///by the real class.
843
845{
847
848 if (fBaseClass == oldClass) {
851 } else if (fBaseClass == nullptr) {
852 if (fName == newClass->GetName()) {
855 } else if (TClassTable::GetDict(fName)) {
858 }
859 }
860}
861
862////////////////////////////////////////////////////////////////////////////////
863/// Write the base class into the buffer.
864
866{
867 if (fStreamerFunc) {
868 // We have a custom Streamer member function, we must use it.
869 fStreamerFunc(b,pointer+fOffset);
870 } else {
871 // We don't have a custom Streamer member function. That still doesn't mean
872 // that there is no streamer - it could be an external one:
873 // If the old base class has an adopted streamer we take that
874 // one instead of the new base class:
875 if (fNewBaseClass) {
877 if (extstrm) {
878 // The new base class has an adopted streamer:
879 extstrm->SetOnFileClass(fBaseClass);
880 (*extstrm)(b, pointer);
881 return 0;
882 } else {
884 return 0;
885 }
886 } else {
888 if (extstrm) {
889 (*extstrm)(b, pointer);
890 return 0;
891 } else {
893 return 0;
894 }
895 }
896 }
897 return 0;
898}
899
900//______________________________________________________________________________
901
902//////////////////////////////////////////////////////////////////////////
903// //
904// TStreamerBasicPointer implements the streamering of pointer to //
905// fundamental types. //
906// //
907//////////////////////////////////////////////////////////////////////////
908
909
910////////////////////////////////////////////////////////////////////////////////
911/// Default ctor.
912
913TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
914{
915 fCounter = nullptr;
916}
917
918////////////////////////////////////////////////////////////////////////////////
919/// Create a TStreamerBasicPointer object.
920
921TStreamerBasicPointer::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)
922 : TStreamerElement(name,title,offset,dtype,typeName)
923{
927 fCountVersion = countVersion; //currently unused
928 Init();
929// printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
930// name,countName,countClass,countVersion,fCounter);
931}
932
933////////////////////////////////////////////////////////////////////////////////
934/// TStreamerBasicPointer dtor.
935
939
940////////////////////////////////////////////////////////////////////////////////
941/// return offset of counter
942
944{
945 if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
946 if (!fCounter) return 0;
947 // FIXME: does not suport multiple inheritance for counter in base class.
948 // This is wrong in case counter is not in the same class or one of
949 // the left most (non virtual) base classes. For the other we would
950 // really need to use the object coming from the list of real data.
951 // (and even that need analysis for virtual base class).
952 return (ULongptr_t)fCounter->GetOffset();
953}
954
955////////////////////////////////////////////////////////////////////////////////
956/// Returns size of basicpointer in bytes.
957
959{
960 if (fArrayLength) return fArrayLength*sizeof(void *);
961 return sizeof(void *);
962}
963
964////////////////////////////////////////////////////////////////////////////////
965/// Setup the element.
966/// If directive is a StreamerInfo and it correspond to the
967/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
968/// for 'countClass'.
969
974
975////////////////////////////////////////////////////////////////////////////////
976/// Set number of array dimensions.
977
979{
980 fArrayDim = dim;
981 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
982 fNewType = fType;
983}
984
985////////////////////////////////////////////////////////////////////////////////
986/// Stream an object of class TStreamerBasicPointer.
987
989{
991 if (R__b.IsReading()) {
992 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
993 if (R__v > 1) {
994 R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
995 //Init();
996 //fCounter = InitCounter( fCountClass, fCountName );
997 return;
998 }
999 //====process old versions before automatic schema evolution
1004 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1005 } else {
1006 R__b.WriteClassBuffer(TStreamerBasicPointer::Class(),this);
1007 }
1008}
1009
1010
1011//______________________________________________________________________________
1012
1013//////////////////////////////////////////////////////////////////////////
1014// //
1015// TStreamerLoop implement streaming of a few construct that require //
1016// looping over the data member and are not convered by other case //
1017// (most deprecated). //
1018// //
1019//////////////////////////////////////////////////////////////////////////
1020
1021
1022////////////////////////////////////////////////////////////////////////////////
1023/// Default ctor.
1024
1025TStreamerLoop::TStreamerLoop() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
1026{
1027}
1028
1029////////////////////////////////////////////////////////////////////////////////
1030/// Create a TStreamerLoop object.
1031
1032TStreamerLoop::TStreamerLoop(const char *name, const char *title, Int_t offset, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
1033 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kStreamLoop,typeName)
1034{
1037 fCountVersion = countVersion; //currently unused
1038 Init();
1039}
1040
1041////////////////////////////////////////////////////////////////////////////////
1042/// TStreamerLoop dtor.
1043
1047
1048////////////////////////////////////////////////////////////////////////////////
1049/// return address of counter
1050
1052{
1053 //if (!fCounter) {
1054 // Init();
1055 // if (!fCounter) return 0;
1056 //}
1057 if (!fCounter) return 0;
1058 return (ULongptr_t)fCounter->GetOffset();
1059}
1060
1061////////////////////////////////////////////////////////////////////////////////
1062/// Returns size of counter in bytes.
1063
1065{
1066 if (fArrayLength) return fArrayLength*sizeof(void*);
1067 return sizeof(void*);
1068}
1069
1070////////////////////////////////////////////////////////////////////////////////
1071/// Setup the element.
1072/// If directive is a StreamerInfo and it correspond to the
1073/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
1074/// for 'countClass'.
1075
1080
1081////////////////////////////////////////////////////////////////////////////////
1082/// Return the proper include for this element.
1083
1084const char *TStreamerLoop::GetInclude() const
1085{
1086 IncludeNameBuffer().Form("<%s>","TString.h"); //to be generalized
1087 return IncludeNameBuffer();
1088}
1089
1090////////////////////////////////////////////////////////////////////////////////
1091/// Stream an object of class TStreamerLoop.
1092
1094{
1095 UInt_t R__s, R__c;
1096 if (R__b.IsReading()) {
1097 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1098 if (R__v > 1) {
1099 R__b.ReadClassBuffer(TStreamerLoop::Class(), this, R__v, R__s, R__c);
1100 //Init();
1101 return;
1102 }
1103 //====process old versions before automatic schema evolution
1108 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1109 } else {
1110 R__b.WriteClassBuffer(TStreamerLoop::Class(),this);
1111 }
1112}
1113
1114
1115//______________________________________________________________________________
1116
1117//////////////////////////////////////////////////////////////////////////
1118// //
1119// TStreamerBasicType implement streaming of fundamental types (int, //
1120// float, etc.). //
1121// //
1122//////////////////////////////////////////////////////////////////////////
1123
1124
1125////////////////////////////////////////////////////////////////////////////////
1126/// Default ctor.
1127
1129{
1130}
1131
1132////////////////////////////////////////////////////////////////////////////////
1133/// Create a TStreamerBasicType object.
1134
1135TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1136 : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1137{
1138}
1139
1140////////////////////////////////////////////////////////////////////////////////
1141/// TStreamerBasicType dtor.
1142
1146
1147////////////////////////////////////////////////////////////////////////////////
1148/// return address of counter
1149
1156
1157////////////////////////////////////////////////////////////////////////////////
1158/// Returns size of this element in bytes.
1159
1161{
1162 return fSize;
1163}
1164
1165////////////////////////////////////////////////////////////////////////////////
1166/// Stream an object of class TStreamerBasicType.
1167
1169{
1170 UInt_t R__s, R__c;
1171 if (R__b.IsReading()) {
1172 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1173 if (R__v > 1) {
1174 R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1175 } else {
1176 //====process old versions before automatic schema evolution
1178 R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1179 }
1180 Int_t type = fType;
1183 }
1184 switch(type) {
1185 // basic types
1186 case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1187 case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1188 case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1189 case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1190 case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1191 case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1192 case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1193 case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1194 case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1195 case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1196 case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1197 case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1198 case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1199 case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1200 case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1201 case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1202 case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1203 case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1204 default: return; // If we don't change the size let's not remultiply it.
1205 }
1207 } else {
1208 R__b.WriteClassBuffer(TStreamerBasicType::Class(),this);
1209 }
1210}
1211
1212
1213
1214//______________________________________________________________________________
1215
1216//////////////////////////////////////////////////////////////////////////
1217// //
1218// TStreamerObject implements streaming of embedded objects whose type //
1219// inherits from TObject. //
1220// //
1221//////////////////////////////////////////////////////////////////////////
1222
1223
1224////////////////////////////////////////////////////////////////////////////////
1225/// Default ctor.
1226
1230
1231////////////////////////////////////////////////////////////////////////////////
1232/// Create a TStreamerObject object.
1233
1234TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1235 : TStreamerElement(name,title,offset,0,typeName)
1236{
1238 if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1239 if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1240 fNewType = fType;
1241 Init();
1242}
1243
1244////////////////////////////////////////////////////////////////////////////////
1245/// TStreamerObject dtor.
1246
1250
1251////////////////////////////////////////////////////////////////////////////////
1252/// Setup the element.
1253
1261
1262////////////////////////////////////////////////////////////////////////////////
1263/// Return the proper include for this element.
1264
1266{
1267 TClass *cl = GetClassPointer();
1268 if (cl && cl->HasInterpreterInfo()) {
1269 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1270 } else {
1271 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1272 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1273 }
1274 return IncludeNameBuffer();
1275}
1276
1277////////////////////////////////////////////////////////////////////////////////
1278/// Returns size of object class in bytes.
1279
1281{
1282 TClass *cl = GetNewClass();
1283 if (!cl)
1284 cl = GetClassPointer();
1285 Int_t classSize = 8;
1286 if (cl)
1287 classSize = cl->Size();
1288 if (fArrayLength)
1289 return fArrayLength * classSize;
1290 return classSize;
1291}
1292
1293////////////////////////////////////////////////////////////////////////////////
1294/// Stream an object of class TStreamerObject.
1295
1297{
1298 UInt_t R__s, R__c;
1299 if (R__b.IsReading()) {
1300 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1301 if (R__v > 1) {
1302 R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1303 return;
1304 }
1305 //====process old versions before automatic schema evolution
1307 R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1308 } else {
1309 R__b.WriteClassBuffer(TStreamerObject::Class(),this);
1310 }
1311}
1312
1313
1314//______________________________________________________________________________
1315
1316//////////////////////////////////////////////////////////////////////////
1317// //
1318// TStreamerObjectAny implement streaming of embedded object not //
1319// inheriting from TObject. //
1320// //
1321//////////////////////////////////////////////////////////////////////////
1322
1323
1324////////////////////////////////////////////////////////////////////////////////
1325/// Default ctor.
1326
1330
1331////////////////////////////////////////////////////////////////////////////////
1332/// Create a TStreamerObjectAny object.
1333
1334TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1335 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1336{
1337 Init();
1338}
1339
1340////////////////////////////////////////////////////////////////////////////////
1341/// TStreamerObjectAny dtor.
1342
1346
1347////////////////////////////////////////////////////////////////////////////////
1348/// Setup the element.
1349
1357
1358////////////////////////////////////////////////////////////////////////////////
1359/// Return the proper include for this element.
1360
1362{
1363 TClass *cl = GetClassPointer();
1364 if (cl && cl->HasInterpreterInfo()) {
1365 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1366 } else {
1367 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1368 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1369 }
1370 return IncludeNameBuffer();
1371}
1372
1373////////////////////////////////////////////////////////////////////////////////
1374/// Returns size of anyclass in bytes.
1375
1377{
1378 TClass *cl = GetNewClass();
1379 if (!cl)
1380 cl = GetClassPointer();
1381 Int_t classSize = 8;
1382 if (cl)
1383 classSize = cl->Size();
1384 if (fArrayLength)
1385 return fArrayLength * classSize;
1386 return classSize;
1387}
1388
1389////////////////////////////////////////////////////////////////////////////////
1390/// Stream an object of class TStreamerObjectAny.
1391
1393{
1394 UInt_t R__s, R__c;
1395 if (R__b.IsReading()) {
1396 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1397 if (R__v > 1) {
1398 R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1399 return;
1400 }
1401 //====process old versions before automatic schema evolution
1403 R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1404 } else {
1405 R__b.WriteClassBuffer(TStreamerObjectAny::Class(),this);
1406 }
1407}
1408
1409
1410
1411//______________________________________________________________________________
1412
1413//////////////////////////////////////////////////////////////////////////
1414// //
1415// TStreamerObjectPointer implements streaming of pointer to object //
1416// inheriting from TObject. //
1417// //
1418//////////////////////////////////////////////////////////////////////////
1419
1420
1421////////////////////////////////////////////////////////////////////////////////
1422/// Default ctor.
1423
1427
1428////////////////////////////////////////////////////////////////////////////////
1429/// Create a TStreamerObjectPointer object.
1430
1432 Int_t offset, const char *typeName)
1433 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1434{
1435 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1436 fNewType = fType;
1437 Init();
1438}
1439
1440////////////////////////////////////////////////////////////////////////////////
1441/// TStreamerObjectPointer dtor.
1442
1446
1447////////////////////////////////////////////////////////////////////////////////
1448/// Setup the element.
1449
1457
1458////////////////////////////////////////////////////////////////////////////////
1459/// Return the proper include for this element.
1460
1462{
1463 TClass *cl = GetClassPointer();
1464 if (cl && cl->HasInterpreterInfo()) {
1465 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1466 } else {
1467 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1468 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1469 }
1470
1471 return IncludeNameBuffer();
1472}
1473
1474////////////////////////////////////////////////////////////////////////////////
1475/// Returns size of objectpointer in bytes.
1476
1478{
1479 if (fArrayLength) return fArrayLength*sizeof(void *);
1480 return sizeof(void *);
1481}
1482
1483////////////////////////////////////////////////////////////////////////////////
1484/// Set number of array dimensions.
1485
1487{
1488 fArrayDim = dim;
1489 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1490 fNewType = fType;
1491}
1492
1493////////////////////////////////////////////////////////////////////////////////
1494/// Stream an object of class TStreamerObjectPointer.
1495
1497{
1498 UInt_t R__s, R__c;
1499 if (R__b.IsReading()) {
1500 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1501 if (R__v > 1) {
1502 R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1503 return;
1504 }
1505 //====process old versions before automatic schema evolution
1507 R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1508 } else {
1509 R__b.WriteClassBuffer(TStreamerObjectPointer::Class(),this);
1510 }
1511}
1512
1513
1514//______________________________________________________________________________
1515
1516//////////////////////////////////////////////////////////////////////////
1517// //
1518// TStreamerObjectPointerAny implements streaming of pointer to object //
1519// not inheriting from TObject. //
1520// //
1521//////////////////////////////////////////////////////////////////////////
1522
1523
1524////////////////////////////////////////////////////////////////////////////////
1525/// Default ctor.
1526
1530
1531////////////////////////////////////////////////////////////////////////////////
1532/// Create a TStreamerObjectAnyPointer object.
1533
1535 Int_t offset, const char *typeName)
1536 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1537{
1538 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1539 fNewType = fType;
1540 Init();
1541}
1542
1543////////////////////////////////////////////////////////////////////////////////
1544/// TStreamerObjectAnyPointer dtor.
1545
1549
1550////////////////////////////////////////////////////////////////////////////////
1551/// Setup the element.
1552
1560
1561////////////////////////////////////////////////////////////////////////////////
1562/// Return the proper include for this element.
1563
1565{
1566 TClass *cl = GetClassPointer();
1567 if (cl && cl->HasInterpreterInfo()) {
1568 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1569 } else {
1570 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1571 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1572 }
1573
1574 return IncludeNameBuffer();
1575}
1576
1577////////////////////////////////////////////////////////////////////////////////
1578/// Returns size of objectpointer in bytes.
1579
1581{
1582 if (fArrayLength) return fArrayLength*sizeof(void *);
1583 return sizeof(void *);
1584}
1585
1586////////////////////////////////////////////////////////////////////////////////
1587/// Set number of array dimensions.
1588
1590{
1591 fArrayDim = dim;
1592 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1593 fNewType = fType;
1594}
1595
1596////////////////////////////////////////////////////////////////////////////////
1597/// Stream an object of class TStreamerObjectAnyPointer.
1598
1600{
1601 if (R__b.IsReading()) {
1602 R__b.ReadClassBuffer(TStreamerObjectAnyPointer::Class(), this);
1603 } else {
1604 R__b.WriteClassBuffer(TStreamerObjectAnyPointer::Class(),this);
1605 }
1606}
1607
1608
1609//______________________________________________________________________________
1610
1611//////////////////////////////////////////////////////////////////////////
1612// //
1613// TSreamerString implements streaming of TString. //
1614// //
1615//////////////////////////////////////////////////////////////////////////
1616
1617
1618////////////////////////////////////////////////////////////////////////////////
1619/// Default ctor.
1620
1624
1625////////////////////////////////////////////////////////////////////////////////
1626/// Create a TStreamerString object.
1627
1628TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1629 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1630{
1631}
1632
1633////////////////////////////////////////////////////////////////////////////////
1634/// TStreamerString dtor.
1635
1639
1640////////////////////////////////////////////////////////////////////////////////
1641/// Return the proper include for this element.
1642
1644{
1645 IncludeNameBuffer().Form("<%s>","TString.h");
1646 return IncludeNameBuffer();
1647}
1648
1649////////////////////////////////////////////////////////////////////////////////
1650/// Returns size of anyclass in bytes.
1651
1653{
1654 if (fArrayLength) return fArrayLength*sizeof(TString);
1655 return sizeof(TString);
1656}
1657
1658////////////////////////////////////////////////////////////////////////////////
1659/// Stream an object of class TStreamerString.
1660
1662{
1663 UInt_t R__s, R__c;
1664 if (R__b.IsReading()) {
1665 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1666 if (R__v > 1) {
1667 R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1668 return;
1669 }
1670 //====process old versions before automatic schema evolution
1672 R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1673 } else {
1674 R__b.WriteClassBuffer(TStreamerString::Class(),this);
1675 }
1676}
1677
1678//______________________________________________________________________________
1679
1680//////////////////////////////////////////////////////////////////////////
1681// //
1682// TStreamerSTL implements streamer of STL container. //
1683// //
1684//////////////////////////////////////////////////////////////////////////
1685
1686
1687////////////////////////////////////////////////////////////////////////////////
1688/// Default ctor.
1689
1690TStreamerSTL::TStreamerSTL() : fSTLtype(0), fCtype(0)
1691{
1692}
1693
1694////////////////////////////////////////////////////////////////////////////////
1695/// Create a TStreamerSTL object.
1696
1697TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1698 const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1699 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1700{
1701 std::string answer;
1704 fTypeName = answer;
1705
1706 if (name==typeName /* intentional pointer comparison */
1707 || strcmp(name,typeName)==0) {
1708 // We have a base class.
1709 fName = fTypeName;
1710 }
1711 fSTLtype = proxy.GetCollectionType();
1712 fCtype = 0;
1713
1715
1716 if (fSTLtype == ROOT::kSTLbitset) {
1717 // Nothing to check
1718 } else if (proxy.GetValueClass()) {
1719 if (proxy.HasPointers()) fCtype = TVirtualStreamerInfo::kObjectp;
1721 } else {
1722 fCtype = proxy.GetType();
1723 if (proxy.HasPointers()) fCtype += TVirtualStreamerInfo::kOffsetP;
1724 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1725 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1726 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1727 }
1728 }
1731 fNewType = fType;
1732 }
1733}
1734
1735////////////////////////////////////////////////////////////////////////////////
1736/// Create a TStreamerSTL object.
1737
1738TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1739 const char *typeName, const char *trueType, Bool_t dmPointer)
1740 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1741{
1742 const char *t = trueType;
1743 if (!t || !*t) t = typeName;
1744
1745 std::string answer;
1748 fTypeName = answer;
1749
1750 if (name==typeName /* intentional pointer comparison */
1751 || strcmp(name,typeName)==0) {
1752 // We have a base class.
1753 fName = fTypeName;
1754 }
1755
1756 if (arglist.fElements.size() < 2) {
1757 Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, t);
1758 return;
1759 }
1760
1761 const std::string& inside_type = arglist.fElements[1];
1762 std::string inside = (inside_type.find("const ")==0) ? inside_type.substr(6) : inside_type;
1763
1764 // Let's treat the unique_ptr case
1766
1767 bool isPointer = false;
1768 // The incoming name is normalized (it comes from splitting the name of a TClass),
1769 // so all we need to do is drop the last trailing star (if any) and record that information.
1770 while (intype.back() == '*') {
1771 isPointer = true;
1772 intype.pop_back();
1773 }
1774
1775 fSTLtype = TClassEdit::STLKind(arglist.fElements[0]);
1776 fCtype = 0;
1777 if (fSTLtype == ROOT::kNotSTL) { return; }
1779
1780 TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(intype.c_str());
1781 if (fSTLtype == ROOT::kSTLbitset) {
1782 // Nothing to check
1783 } else if (dt) {
1784 fCtype = dt->GetType();
1786 } else {
1787 // this could also be a nested enums ... which should work ... be let's see.
1788 TClass *cl = TClass::GetClass(intype.c_str());
1789 if (cl) {
1792 } else {
1793 auto enumdesc = TEnum::GetEnum(intype.c_str());
1794 if (enumdesc || gCling->ClassInfo_IsEnum(intype.c_str())) {
1795 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1796 if (isPointer)
1798 } else {
1799 if (intype != "string") {
1800 // This case can happens when 'this' is a TStreamerElement for
1801 // a STL container containing something for which we do not have
1802 // a TVirtualStreamerInfo (This happens in particular is the collection
1803 // objects themselves are always empty) and we do not have the
1804 // dictionary/shared library for the container.
1805 if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1806 Warning("TStreamerSTL", "For %s we could not find any information about the type %s %d %s",
1807 fTypeName.Data(), arglist.fElements[1].c_str(), fSTLtype, arglist.fElements[0].c_str());
1808 }
1809 }
1810 }
1811 }
1812 }
1813
1816 fNewType = fType;
1817 }
1818}
1819
1820////////////////////////////////////////////////////////////////////////////////
1821/// TStreamerSTL dtor.
1822
1826
1827////////////////////////////////////////////////////////////////////////////////
1828/// We can not split STL's which are inside a variable size array.
1829/// At least for now.
1830
1832{
1833 if (IsaPointer()) {
1834 if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1835 return kTRUE;
1836 }
1837
1838 if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1839
1841
1842 return kFALSE;
1843}
1844
1845////////////////////////////////////////////////////////////////////////////////
1846/// Return true if the data member is a pointer.
1847
1849{
1850 const char *type_name = GetTypeName();
1851 if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1852 else return kFALSE;
1853}
1854
1855
1856////////////////////////////////////////////////////////////////////////////////
1857/// Return kTRUE if the element represent a base class.
1858
1860{
1861 TString ts(GetName());
1862
1863 if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1864 if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1865 return kFALSE;
1866}
1867
1868////////////////////////////////////////////////////////////////////////////////
1869/// Returns a pointer to the TClass of this element.
1870
1872{
1873 if (fClassObject!=(TClass*)(-1))
1874 return fClassObject;
1875
1877
1879 TClass *cl = TClass::GetClass(className, kTRUE, quiet);
1880
1881 auto proxy = cl->GetCollectionProxy();
1882 if (!fNewClass && proxy && proxy->GetValueClass() == nullptr) {
1883 // Collection of numerical type, let check if it is an enum.
1885 if ( arglist.fElements[1].size() >= 2 ) {
1886 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1887 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1888 ((TStreamerElement *)this)->fNewClass = cl;
1889 if (proxy->HasPointers())
1890 cl = TClass::GetClass("vector<Int_t*>");
1891 else
1892 cl = TClass::GetClass("vector<Int_t>");
1893 }
1894 }
1895 }
1896 ((TStreamerElement*)this)->fClassObject = cl;
1897 return fClassObject;
1898}
1899
1900////////////////////////////////////////////////////////////////////////////////
1901/// Returns size of STL container in bytes.
1902
1904{
1905 // Since the STL collection might or might not be emulated and that the
1906 // sizeof the object depends on this, let's just always retrieve the
1907 // current size!
1908 TClass *cl = GetNewClass();
1909 if (!cl)
1910 cl = GetClassPointer();
1911 UInt_t size = 0;
1912 if (cl==nullptr) {
1913 if (!TestBit(kWarned)) {
1914 Error("GetSize","Could not find the TClass for %s.\n"
1915 "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1916 const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1917 }
1918 } else {
1919 size = cl->Size();
1920 }
1921
1922 if (fArrayLength) return fArrayLength*size;
1923 return size;
1924}
1925
1926////////////////////////////////////////////////////////////////////////////////
1927/// Print the content of the element.
1928
1930{
1932 TString cdim;
1933 name = GetName();
1934 for (Int_t i=0;i<fArrayDim;i++) {
1935 cdim.Form("[%d]",fMaxIndex[i]);
1936 name += cdim;
1937 }
1940 if (sequenceType.Length()) {
1941 sequenceType.Prepend(" (");
1942 sequenceType += ") ";
1943 }
1944 printf(" %-14s %-15s offset=%3d type=%2d",
1945 GetTypeName(), name.Data(), fOffset, fType);
1947 printf(" newtype=%2d", fNewType);
1948 printf(" stl=%d ctype=%d %s%-20s\n",
1949 fSTLtype, fCtype, sequenceType.Data(), GetTitle());
1950}
1951
1952////////////////////////////////////////////////////////////////////////////////
1953/// Return the proper include for this element.
1954
1955const char *TStreamerSTL::GetInclude() const
1956{
1957 if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1958 else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1959 else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1960 else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1961 else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1962 else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1963 else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1964 else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1965 else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1966 else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1967 else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1968 else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1969 else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1970 return IncludeNameBuffer();
1971}
1972
1973////////////////////////////////////////////////////////////////////////////////
1974/// Set pointer to Streamer function for this element
1975/// NOTE: we do not take ownership
1976
1981
1982////////////////////////////////////////////////////////////////////////////////
1983/// Stream an object of class TStreamerSTL.
1984
1986{
1987 UInt_t R__s, R__c;
1988 if (R__b.IsReading()) {
1989 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1990 if (R__v > 2) {
1991 R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
1992 } else {
1993 //====process old versions before automatic schema evolution
1995 R__b >> fSTLtype;
1996 R__b >> fCtype;
1997 R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
1998 }
1999 // In old versions (prior to v6.24/02) the value of fArrayDim was not stored properly.
2000 if (fArrayDim == 0 && fArrayLength > 0) {
2001 while(fArrayDim < 5 && fMaxIndex[fArrayDim] != 0) {
2002 ++fArrayDim;
2003 }
2004 }
2006 // For a long time those where inverted in TStreamerElement
2007 // compared to the other definitions. When we moved to version '4',
2008 // this got standardized, but we now need to fix it.
2009
2010 if (fTypeName.BeginsWith("std::set") || fTypeName.BeginsWith("set")) {
2012 } else if (fTypeName.BeginsWith("std::multimap") || fTypeName.BeginsWith("multimap")) {
2014 }
2015 }
2016
2019 if (GetArrayLength() > 0) {
2021 }
2022 if (R__b.GetParent()) { // Avoid resetting during a cloning.
2024 SetBit(kDoNotDelete); // For backward compatibility
2025 } else if ( fSTLtype == ROOT::kSTLmap || fSTLtype == ROOT::kSTLmultimap) {
2026 // Here we would like to set the bit only if one of the element of the pair is a pointer,
2027 // however we have no easy to determine this short of parsing the class name.
2028 SetBit(kDoNotDelete); // For backward compatibility
2029 }
2030 }
2031 return;
2032 } else {
2033 // To enable forward compatibility we actually save with the old value
2034 TStreamerSTL tmp;
2035 // Hand coded copy constructor since the 'normal' one are intentionally
2036 // deleted.
2037 tmp.fName = fName;
2038 tmp.fTitle = fTitle;
2040 tmp.fSize = fSize;
2041 tmp.fArrayDim = fArrayDim;
2042 tmp.fArrayLength = fArrayLength;
2043 for(int i = 0; i < 5; ++i)
2044 tmp.fMaxIndex[i] = fMaxIndex[i];
2045 tmp.fTypeName = fTypeName;
2046 tmp.fSTLtype = fSTLtype;
2047 tmp.fCtype = fCtype;
2048 R__b.WriteClassBuffer(TStreamerSTL::Class(), &tmp);
2049 }
2050}
2051
2052//______________________________________________________________________________
2053
2054//////////////////////////////////////////////////////////////////////////
2055// //
2056// TStreamerSTLstring implements streaming std::string. //
2057// //
2058//////////////////////////////////////////////////////////////////////////
2059
2060
2061////////////////////////////////////////////////////////////////////////////////
2062/// Default ctor.
2063
2067
2068////////////////////////////////////////////////////////////////////////////////
2069/// Create a TStreamerSTLstring object.
2070
2072 const char *typeName, Bool_t dmPointer)
2073 : TStreamerSTL()
2074{
2075 SetName(name);
2076 SetTitle(title);
2077
2078 if (dmPointer) {
2080 } else {
2082 }
2083
2084 fNewType = fType;
2085 fOffset = offset;
2088 fTypeName= typeName;
2089
2090}
2091
2092////////////////////////////////////////////////////////////////////////////////
2093/// TStreamerSTLstring dtor.
2094
2098
2099////////////////////////////////////////////////////////////////////////////////
2100/// Return the proper include for this element.
2101
2103{
2104 IncludeNameBuffer() = "<string>";
2105 return IncludeNameBuffer();
2106}
2107
2108////////////////////////////////////////////////////////////////////////////////
2109/// Returns size of anyclass in bytes.
2110
2112{
2113 if (fArrayLength) return fArrayLength*sizeof(string);
2114 return sizeof(string);
2115}
2116
2117////////////////////////////////////////////////////////////////////////////////
2118/// Stream an object of class TStreamerSTLstring.
2119
2121{
2122 UInt_t R__s, R__c;
2123 if (R__b.IsReading()) {
2124 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2125 if (R__v > 1) {
2126 R__b.ReadClassBuffer(TStreamerSTLstring::Class(), this, R__v, R__s, R__c);
2127 return;
2128 }
2129 //====process old versions before automatic schema evolution
2131 R__b.CheckByteCount(R__s, R__c, TStreamerSTLstring::IsA());
2132 } else {
2133 R__b.WriteClassBuffer(TStreamerSTLstring::Class(),this);
2134 }
2135}
2136
2137//______________________________________________________________________________
2138
2139///////////////////////////////////////////////////////////////////////////////
2140// //
2141// TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2142// //
2143///////////////////////////////////////////////////////////////////////////////
2144
2145
2147{
2148 // Avoid streaming the synthetic/artificial streamer elements.
2149
2150 // Intentionally, nothing to do at all.
2151 return;
2152}
2153
2155{
2156 // Return the read function if any.
2157
2158 return fReadFunc;
2159}
2160
2162{
2163 // Return the raw read function if any.
2164
2165 return fReadRawFunc;
2166}
#define b(i)
Definition RSha256.hxx:100
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
unsigned short UShort_t
Unsigned Short integer 2 bytes (unsigned short)
Definition RtypesCore.h:54
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
short Version_t
Class version identifier (short)
Definition RtypesCore.h:79
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char)
Definition RtypesCore.h:52
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
unsigned long ULong_t
Unsigned long integer 4 bytes (unsigned long). Size depends on architecture.
Definition RtypesCore.h:69
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
Definition RtypesCore.h:68
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
unsigned long ULongptr_t
Unsigned integer large enough to hold a pointer (platform-dependent)
Definition RtypesCore.h:90
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
short Short_t
Signed Short integer 2 bytes (short)
Definition RtypesCore.h:53
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
double Double_t
Double 8 bytes.
Definition RtypesCore.h:73
long long Long64_t
Portable signed long integer 8 bytes.
Definition RtypesCore.h:83
unsigned long long ULong64_t
Portable unsigned long integer 8 bytes.
Definition RtypesCore.h:84
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
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:208
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:411
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:1579
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:6553
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Definition TClass.cxx:2324
ClassStreamerFunc_t GetStreamerFunc() const
Get a wrapper/accessor function around this class custom streamer (member function).
Definition TClass.cxx:2944
TClassStreamer * GetStreamer() const
Return the Streamer Class allowing streaming (if any).
Definition TClass.cxx:2919
Bool_t HasInterpreterInfo() const
Definition TClass.h:422
Int_t Size() const
Return size of object of this class.
Definition TClass.cxx:5743
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5980
ClassConvStreamerFunc_t GetConvStreamerFunc() const
Get a wrapper/accessor function around this class custom conversion streamer (member function).
Definition TClass.cxx:2952
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:4626
Int_t GetBaseClassOffset(const TClass *toBase, void *address=nullptr, bool isDerivedObject=true)
Definition TClass.cxx:2796
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition TClass.cxx:2902
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:7149
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:7256
Bool_t IsVersioned() const
Definition TClass.h:535
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
Definition TClass.cxx:7129
Version_t GetClassVersion() const
Definition TClass.h:432
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition TClass.cxx:3494
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:2973
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:6827
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:181
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:173
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:149
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:202
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:201
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:338
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:138
const char * Data() const
Definition TString.h:384
@ kTrailing
Definition TString.h:284
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition TString.h:631
TString & Remove(Ssiz_t pos)
Definition TString.h:693
virtual void Streamer(TBuffer &)
Stream a string object.
Definition TString.cxx:1418
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:640
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:659
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.
@ 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