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//////////////////////////////////////////////////////////////////////////
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
49 TTHREAD_TLS_DECL_ARG(TString,includeName,kMaxLen);
50 return includeName;
51}
52
53static TString ExtractClassName(const TString &type_name)
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
65static TStreamerBasicType *InitCounter(const char *countClass, const char *countName, TVirtualStreamerInfo *directive)
66{
67 TStreamerBasicType *counter = nullptr;
68
69 TClass *cl = TClass::GetClass(countClass);
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;
94 counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
95 }
96 } else {
97
98 if (cl==nullptr) return nullptr;
99 counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
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 }
185 UInt_t bigint;
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
259{
260}
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];
323 strlcpy(caction,action+5,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.
328 Int_t index = TRef::AddExec(caction);
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{
342 TTHREAD_TLS_DECL_ARG(TString,name,kMaxLen);
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 += ",";
363 sequenceType += name;
364 }
365 };
366
367 test_bit(TStreamerElement::kWholeObject, "wholeObject");
368 test_bit(TStreamerElement::kCache, "cached");
369 test_bit(TStreamerElement::kRepeat, "repeat");
370 test_bit(TStreamerElement::kDoNotDelete, "nodelete");
371 test_bit(TStreamerElement::kWrite, "write");
372}
373
374////////////////////////////////////////////////////////////////////////////////
375/// Returns size of this element in bytes.
376
378{
379 return fSize;
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Return the local streamer object.
384
386{
387 return fStreamer;
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Return type name of this element
392/// in case the type name is not a standard basic type, return
393/// the basic type name known to CINT.
394
396{
397 TDataType *dt = gROOT->GetType(fTypeName.Data());
398 if (fType < 1 || fType > 55) return fTypeName.Data();
399 if (dt && dt->GetType() > 0) return fTypeName.Data();
400 Int_t dtype = fType%20;
401 return TDataType::GetTypeName((EDataType)dtype);
402}
403
404////////////////////////////////////////////////////////////////////////////////
405/// Initliaze the element.
406
408{
412 }
413}
414
415////////////////////////////////////////////////////////////////////////////////
416/// The early 3.00/00 and 3.01/01 versions used to store
417/// dm->GetTypeName instead of dm->GetFullTypename
418/// if this case is detected, the element type name is modified.
419
420Bool_t TStreamerElement::IsOldFormat(const char *newTypeName)
421{
422 //if (!IsaPointer()) return kFALSE;
423 if (!strstr(newTypeName,fTypeName.Data())) return kFALSE;
424 //if (!strstr(fTypeName.Data(),newTypeName)) return kFALSE;
425 fTypeName = newTypeName;
426 return kTRUE;
427}
428
429////////////////////////////////////////////////////////////////////////////////
430/// Return kTRUE if the element represent a base class.
431
433{
434 return kFALSE;
435}
436
437////////////////////////////////////////////////////////////////////////////////
438/// Return kTRUE if the element represent an entity that is not written
439/// to the disk (transient members, cache allocator/deallocator, etc.)
440
442{
444 // if (((const TStreamerArtificial*)this)->GetWriteFunc() == 0)
445 return kTRUE;
446 }
452
453 return kFALSE;
454}
455
456////////////////////////////////////////////////////////////////////////////////
457/// Print the content of the element.
458
460{
461 TString temp(GetTypeName());
462 if (IsaPointer() && !fTypeName.Contains("*")) temp += "*";
463
464 TString sequenceType;
465 GetSequenceType(sequenceType);
466 if (sequenceType.Length()) {
467 sequenceType.Prepend(" (");
468 sequenceType += ") ";
469 }
470 printf(" %-14s %-15s offset=%3d type=%2d",
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
482{
483 fArrayDim = dim;
484 if (dim) {
487 }
488}
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
505{
506 fStreamer = streamer;
507}
508
509////////////////////////////////////////////////////////////////////////////////
510/// Stream an object of class TStreamerElement.
511
513{
514 UInt_t R__s, R__c;
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
522 R__b.ClassMember("TNamed");
523 TNamed::Streamer(R__b);
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");
529 R__b >> fArrayLength;
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 }
543 if (R__v <= 2 && this->IsA()==TStreamerBasicType::Class()) {
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());
561 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
562
565 } else {
567 }
568}
569
570////////////////////////////////////////////////////////////////////////////////
571///function called by the TClass constructor when replacing an emulated class
572///by the real class
573
574void TStreamerElement::Update(const TClass *oldClass, TClass *newClass)
575{
576 if (fClassObject == oldClass) {
577 fClassObject = newClass;
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()) {
590 fClassObject = newClass;
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
630TStreamerBase::TStreamerBase(const char *name, const char *title, Int_t offset, Bool_t isTransient)
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;
654 Init(isTransient);
655}
656
657////////////////////////////////////////////////////////////////////////////////
658/// TStreamerBase dtor
659
661{
662}
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 = GetClassPointer();
680 if (cl) return cl->Size();
681 return 0;
682}
683
684////////////////////////////////////////////////////////////////////////////////
685/// Setup the element.
686
688{
689 Init(kFALSE);
690}
691
693{
695 if (!fBaseClass) return;
696
697 InitStreaming(isTransient);
698}
699
700////////////////////////////////////////////////////////////////////////////////
701/// Setup the fStreamerFunc and fStreamerinfo
702
704{
705 if (fNewBaseClass) {
708 if (fBaseVersion > 0 || fBaseCheckSum == 0) {
710 } else {
712 }
713 } else if (fBaseClass && fBaseClass != (TClass*)-1) {
716 if (fBaseVersion >= 0 || fBaseCheckSum == 0) {
718 } else {
720 }
721 } else {
722 fStreamerFunc = nullptr;
723 fConvStreamerFunc = nullptr;
724 fStreamerInfo = nullptr;
725 }
726}
727
728////////////////////////////////////////////////////////////////////////////////
729/// Return kTRUE if the element represent a base class.
730
732{
733 return kTRUE;
734}
735
736////////////////////////////////////////////////////////////////////////////////
737/// Return the proper include for this element.
738
739const char *TStreamerBase::GetInclude() const
740{
743 } else {
744 std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
745 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
746 }
747 return IncludeNameBuffer();
748}
749
750////////////////////////////////////////////////////////////////////////////////
751/// Print the content of the element.
752
754{
755 TString sequenceType;
756 GetSequenceType(sequenceType);
757 if (sequenceType.Length()) {
758 sequenceType.Prepend(" (");
759 sequenceType += ") ";
760 }
761 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
762}
763
764////////////////////////////////////////////////////////////////////////////////
765/// Read the content of the buffer.
766
768{
769 if (fConvStreamerFunc) {
770 // We have a custom Streamer member function, we must use it.
772 } else if (fStreamerFunc) {
773 // We have a custom Streamer member function, we must use it.
774 fStreamerFunc(b,pointer+fOffset);
775 } else {
776 // We don't have a custom Streamer member function. That still doesn't mean
777 // that there is no streamer - it could be an external one:
778 // If the old base class has an adopted streamer we take that
779 // one instead of the new base class:
780 if( fNewBaseClass ) {
782 if (extstrm) {
783 // The new base class has an adopted streamer:
784 extstrm->SetOnFileClass(fBaseClass);
785 (*extstrm)(b, pointer);
786 } else {
787 b.ReadClassBuffer( fNewBaseClass, pointer+fOffset, fBaseClass );
788 }
789 } else {
791 if (extstrm) {
792 // The class has an adopted streamer:
793 (*extstrm)(b, pointer);
794 } else {
795 b.ReadClassBuffer( fBaseClass, pointer+fOffset );
796 }
797 }
798 }
799 return 0;
800}
801
802////////////////////////////////////////////////////////////////////////////////
803/// Stream an object of class TStreamerBase.
804
806{
807 UInt_t R__s, R__c;
808 if (R__b.IsReading()) {
809 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
810
811 R__b.ClassBegin(TStreamerBase::Class(), R__v);
812
813 R__b.ClassMember("TStreamerElement");
815 // If the class owning the TStreamerElement and the base class are not
816 // loaded, on the file their streamer info might be in the following
817 // order (derived class,base class) and hence the base class is not
818 // yet emulated.
819 fBaseClass = (TClass*)-1;
820 fNewBaseClass = nullptr;
821 // Eventually we need a v3 that stores directly fBaseCheckSum (and
822 // a version of TStreamerElement should not stored fMaxIndex)
823 if (R__v > 2) {
824 R__b.ClassMember("fBaseVersion","Int_t");
825 R__b >> fBaseVersion;
826 } else {
827 // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
830 }
832 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
833 } else {
835 }
836}
837
838////////////////////////////////////////////////////////////////////////////////
839///Function called by the TClass constructor when replacing an emulated class
840///by the real class.
841
842void TStreamerBase::Update(const TClass *oldClass, TClass *newClass)
843{
844 TStreamerElement::Update(oldClass, newClass);
845
846 if (fBaseClass == oldClass) {
847 fBaseClass = newClass;
849 } else if (fBaseClass == nullptr) {
850 if (fName == newClass->GetName()) {
851 fBaseClass = newClass;
853 } else if (TClassTable::GetDict(fName)) {
856 }
857 }
858}
859
860////////////////////////////////////////////////////////////////////////////////
861/// Write the base class into the buffer.
862
864{
865 if (fStreamerFunc) {
866 // We have a custom Streamer member function, we must use it.
867 fStreamerFunc(b,pointer+fOffset);
868 } else {
869 // We don't have a custom Streamer member function. That still doesn't mean
870 // that there is no streamer - it could be an external one:
871 // If the old base class has an adopted streamer we take that
872 // one instead of the new base class:
873 if (fNewBaseClass) {
875 if (extstrm) {
876 // The new base class has an adopted streamer:
877 extstrm->SetOnFileClass(fBaseClass);
878 (*extstrm)(b, pointer);
879 return 0;
880 } else {
882 return 0;
883 }
884 } else {
886 if (extstrm) {
887 (*extstrm)(b, pointer);
888 return 0;
889 } else {
891 return 0;
892 }
893 }
894 }
895 return 0;
896}
897
898//______________________________________________________________________________
899
900//////////////////////////////////////////////////////////////////////////
901// //
902// TStreamerBasicPointer implements the streamering of pointer to //
903// fundamental types. //
904// //
905//////////////////////////////////////////////////////////////////////////
906
908
909////////////////////////////////////////////////////////////////////////////////
910/// Default ctor.
911
912TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(nullptr)
913{
914 fCounter = nullptr;
915}
916
917////////////////////////////////////////////////////////////////////////////////
918/// Create a TStreamerBasicPointer object.
919
920TStreamerBasicPointer::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)
921 : TStreamerElement(name,title,offset,dtype,typeName)
922{
924 fCountName = countName;
925 fCountClass = countClass;
926 fCountVersion = countVersion; //currently unused
927 Init();
928// printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
929// name,countName,countClass,countVersion,fCounter);
930}
931
932////////////////////////////////////////////////////////////////////////////////
933/// TStreamerBasicPointer dtor.
934
936{
937}
938
939////////////////////////////////////////////////////////////////////////////////
940/// return offset of counter
941
943{
944 if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
945 if (!fCounter) return 0;
946 // FIXME: does not suport multiple inheritance for counter in base class.
947 // This is wrong in case counter is not in the same class or one of
948 // the left most (non virtual) base classes. For the other we would
949 // really need to use the object coming from the list of real data.
950 // (and even that need analysis for virtual base class).
951 return (ULongptr_t)fCounter->GetOffset();
952}
953
954////////////////////////////////////////////////////////////////////////////////
955/// Returns size of basicpointer in bytes.
956
958{
959 if (fArrayLength) return fArrayLength*sizeof(void *);
960 return sizeof(void *);
961}
962
963////////////////////////////////////////////////////////////////////////////////
964/// Setup the element.
965/// If directive is a StreamerInfo and it correspond to the
966/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
967/// for 'countClass'.
968
970{
972}
973
974////////////////////////////////////////////////////////////////////////////////
975/// Set number of array dimensions.
976
978{
979 fArrayDim = dim;
980 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
981 fNewType = fType;
982}
983
984////////////////////////////////////////////////////////////////////////////////
985/// Stream an object of class TStreamerBasicPointer.
986
988{
989 UInt_t R__s, R__c;
990 if (R__b.IsReading()) {
991 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
992 if (R__v > 1) {
993 R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
994 //Init();
995 //fCounter = InitCounter( fCountClass, fCountName );
996 return;
997 }
998 //====process old versions before automatic schema evolution
1000 R__b >> fCountVersion;
1001 fCountName.Streamer(R__b);
1002 fCountClass.Streamer(R__b);
1003 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1004 } else {
1006 }
1007}
1008
1009
1010//______________________________________________________________________________
1011
1012//////////////////////////////////////////////////////////////////////////
1013// //
1014// TStreamerLoop implement streaming of a few construct that require //
1015// looping over the data member and are not convered by other case //
1016// (most deprecated). //
1017// //
1018//////////////////////////////////////////////////////////////////////////
1019
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{
1035 fCountName = countName;
1036 fCountClass = countClass;
1037 fCountVersion = countVersion; //currently unused
1038 Init();
1039}
1040
1041////////////////////////////////////////////////////////////////////////////////
1042/// TStreamerLoop dtor.
1043
1045{
1046}
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
1077{
1078 fCounter = InitCounter( fCountClass, fCountName, directive );
1079}
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
1105 R__b >> fCountVersion;
1106 fCountName.Streamer(R__b);
1107 fCountClass.Streamer(R__b);
1108 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1109 } else {
1111 }
1112}
1113
1114
1115//______________________________________________________________________________
1116
1117//////////////////////////////////////////////////////////////////////////
1118// //
1119// TStreamerBasicType implement streaming of fundamental types (int, //
1120// float, etc.). //
1121// //
1122//////////////////////////////////////////////////////////////////////////
1123
1125
1126////////////////////////////////////////////////////////////////////////////////
1127/// Default ctor.
1128
1130{
1131}
1132
1133////////////////////////////////////////////////////////////////////////////////
1134/// Create a TStreamerBasicType object.
1135
1136TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1137 : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1138{
1139}
1140
1141////////////////////////////////////////////////////////////////////////////////
1142/// TStreamerBasicType dtor.
1143
1145{
1146}
1147
1148////////////////////////////////////////////////////////////////////////////////
1149/// return address of counter
1150
1152{
1155 return 0;
1156}
1157
1158////////////////////////////////////////////////////////////////////////////////
1159/// Returns size of this element in bytes.
1160
1162{
1163 return fSize;
1164}
1165
1166////////////////////////////////////////////////////////////////////////////////
1167/// Stream an object of class TStreamerBasicType.
1168
1170{
1171 UInt_t R__s, R__c;
1172 if (R__b.IsReading()) {
1173 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1174 if (R__v > 1) {
1175 R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1176 } else {
1177 //====process old versions before automatic schema evolution
1179 R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1180 }
1181 Int_t type = fType;
1184 }
1185 switch(type) {
1186 // basic types
1187 case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1188 case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1189 case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1190 case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1191 case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1192 case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1193 case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1194 case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1195 case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1196 case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1197 case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1198 case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1199 case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1200 case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1201 case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1202 case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1203 case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1204 case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1205 default: return; // If we don't change the size let's not remultiply it.
1206 }
1208 } else {
1210 }
1211}
1212
1213
1214
1215//______________________________________________________________________________
1216
1217//////////////////////////////////////////////////////////////////////////
1218// //
1219// TStreamerObject implements streaming of embedded objects whose type //
1220// inherits from TObject. //
1221// //
1222//////////////////////////////////////////////////////////////////////////
1223
1225
1226////////////////////////////////////////////////////////////////////////////////
1227/// Default ctor.
1228
1230{
1231}
1232
1233////////////////////////////////////////////////////////////////////////////////
1234/// Create a TStreamerObject object.
1235
1236TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1237 : TStreamerElement(name,title,offset,0,typeName)
1238{
1240 if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1241 if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1242 fNewType = fType;
1243 Init();
1244}
1245
1246////////////////////////////////////////////////////////////////////////////////
1247/// TStreamerObject dtor.
1248
1250{
1251}
1252
1253////////////////////////////////////////////////////////////////////////////////
1254/// Setup the element.
1255
1257{
1261 }
1262}
1263
1264////////////////////////////////////////////////////////////////////////////////
1265/// Return the proper include for this element.
1266
1268{
1269 TClass *cl = GetClassPointer();
1270 if (cl && cl->HasInterpreterInfo()) {
1271 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1272 } else {
1273 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1274 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1275 }
1276 return IncludeNameBuffer();
1277}
1278
1279////////////////////////////////////////////////////////////////////////////////
1280/// Returns size of object class in bytes.
1281
1283{
1284 TClass *cl = GetClassPointer();
1285 Int_t classSize = 8;
1286 if (cl) classSize = cl->Size();
1287 if (fArrayLength) return fArrayLength*classSize;
1288 return classSize;
1289}
1290
1291////////////////////////////////////////////////////////////////////////////////
1292/// Stream an object of class TStreamerObject.
1293
1295{
1296 UInt_t R__s, R__c;
1297 if (R__b.IsReading()) {
1298 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1299 if (R__v > 1) {
1300 R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1301 return;
1302 }
1303 //====process old versions before automatic schema evolution
1305 R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1306 } else {
1308 }
1309}
1310
1311
1312//______________________________________________________________________________
1313
1314//////////////////////////////////////////////////////////////////////////
1315// //
1316// TStreamerObjectAny implement streaming of embedded object not //
1317// inheriting from TObject. //
1318// //
1319//////////////////////////////////////////////////////////////////////////
1320
1322
1323////////////////////////////////////////////////////////////////////////////////
1324/// Default ctor.
1325
1327{
1328}
1329
1330////////////////////////////////////////////////////////////////////////////////
1331/// Create a TStreamerObjectAny object.
1332
1333TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1334 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1335{
1336 Init();
1337}
1338
1339////////////////////////////////////////////////////////////////////////////////
1340/// TStreamerObjectAny dtor.
1341
1343{
1344}
1345
1346////////////////////////////////////////////////////////////////////////////////
1347/// Setup the element.
1348
1350{
1354 }
1355}
1356
1357////////////////////////////////////////////////////////////////////////////////
1358/// Return the proper include for this element.
1359
1361{
1362 TClass *cl = GetClassPointer();
1363 if (cl && cl->HasInterpreterInfo()) {
1364 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1365 } else {
1366 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1367 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1368 }
1369 return IncludeNameBuffer();
1370}
1371
1372////////////////////////////////////////////////////////////////////////////////
1373/// Returns size of anyclass in bytes.
1374
1376{
1377 TClass *cl = GetClassPointer();
1378 Int_t classSize = 8;
1379 if (cl) classSize = cl->Size();
1380 if (fArrayLength) return fArrayLength*classSize;
1381 return classSize;
1382}
1383
1384////////////////////////////////////////////////////////////////////////////////
1385/// Stream an object of class TStreamerObjectAny.
1386
1388{
1389 UInt_t R__s, R__c;
1390 if (R__b.IsReading()) {
1391 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1392 if (R__v > 1) {
1393 R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1394 return;
1395 }
1396 //====process old versions before automatic schema evolution
1398 R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1399 } else {
1401 }
1402}
1403
1404
1405
1406//______________________________________________________________________________
1407
1408//////////////////////////////////////////////////////////////////////////
1409// //
1410// TStreamerObjectPointer implements streaming of pointer to object //
1411// inheriting from TObject. //
1412// //
1413//////////////////////////////////////////////////////////////////////////
1414
1416
1417////////////////////////////////////////////////////////////////////////////////
1418/// Default ctor.
1419
1421{
1422}
1423
1424////////////////////////////////////////////////////////////////////////////////
1425/// Create a TStreamerObjectPointer object.
1426
1428 Int_t offset, const char *typeName)
1429 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1430{
1431 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1432 fNewType = fType;
1433 Init();
1434}
1435
1436////////////////////////////////////////////////////////////////////////////////
1437/// TStreamerObjectPointer dtor.
1438
1440{
1441}
1442
1443////////////////////////////////////////////////////////////////////////////////
1444/// Setup the element.
1445
1447{
1451 }
1452}
1453
1454////////////////////////////////////////////////////////////////////////////////
1455/// Return the proper include for this element.
1456
1458{
1459 TClass *cl = GetClassPointer();
1460 if (cl && cl->HasInterpreterInfo()) {
1461 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1462 } else {
1463 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1464 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1465 }
1466
1467 return IncludeNameBuffer();
1468}
1469
1470////////////////////////////////////////////////////////////////////////////////
1471/// Returns size of objectpointer in bytes.
1472
1474{
1475 if (fArrayLength) return fArrayLength*sizeof(void *);
1476 return sizeof(void *);
1477}
1478
1479////////////////////////////////////////////////////////////////////////////////
1480/// Set number of array dimensions.
1481
1483{
1484 fArrayDim = dim;
1485 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1486 fNewType = fType;
1487}
1488
1489////////////////////////////////////////////////////////////////////////////////
1490/// Stream an object of class TStreamerObjectPointer.
1491
1493{
1494 UInt_t R__s, R__c;
1495 if (R__b.IsReading()) {
1496 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1497 if (R__v > 1) {
1498 R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1499 return;
1500 }
1501 //====process old versions before automatic schema evolution
1503 R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1504 } else {
1506 }
1507}
1508
1509
1510//______________________________________________________________________________
1511
1512//////////////////////////////////////////////////////////////////////////
1513// //
1514// TStreamerObjectPointerAny implements streaming of pointer to object //
1515// not inheriting from TObject. //
1516// //
1517//////////////////////////////////////////////////////////////////////////
1518
1520
1521////////////////////////////////////////////////////////////////////////////////
1522/// Default ctor.
1523
1525{
1526}
1527
1528////////////////////////////////////////////////////////////////////////////////
1529/// Create a TStreamerObjectAnyPointer object.
1530
1532 Int_t offset, const char *typeName)
1533 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1534{
1535 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1536 fNewType = fType;
1537 Init();
1538}
1539
1540////////////////////////////////////////////////////////////////////////////////
1541/// TStreamerObjectAnyPointer dtor.
1542
1544{
1545}
1546
1547////////////////////////////////////////////////////////////////////////////////
1548/// Setup the element.
1549
1551{
1555 }
1556}
1557
1558////////////////////////////////////////////////////////////////////////////////
1559/// Return the proper include for this element.
1560
1562{
1563 TClass *cl = GetClassPointer();
1564 if (cl && cl->HasInterpreterInfo()) {
1565 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1566 } else {
1567 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1568 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1569 }
1570
1571 return IncludeNameBuffer();
1572}
1573
1574////////////////////////////////////////////////////////////////////////////////
1575/// Returns size of objectpointer in bytes.
1576
1578{
1579 if (fArrayLength) return fArrayLength*sizeof(void *);
1580 return sizeof(void *);
1581}
1582
1583////////////////////////////////////////////////////////////////////////////////
1584/// Set number of array dimensions.
1585
1587{
1588 fArrayDim = dim;
1589 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1590 fNewType = fType;
1591}
1592
1593////////////////////////////////////////////////////////////////////////////////
1594/// Stream an object of class TStreamerObjectAnyPointer.
1595
1597{
1598 if (R__b.IsReading()) {
1600 } else {
1602 }
1603}
1604
1605
1606//______________________________________________________________________________
1607
1608//////////////////////////////////////////////////////////////////////////
1609// //
1610// TSreamerString implements streaming of TString. //
1611// //
1612//////////////////////////////////////////////////////////////////////////
1613
1615
1616////////////////////////////////////////////////////////////////////////////////
1617/// Default ctor.
1618
1620{
1621}
1622
1623////////////////////////////////////////////////////////////////////////////////
1624/// Create a TStreamerString object.
1625
1626TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1627 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1628{
1629}
1630
1631////////////////////////////////////////////////////////////////////////////////
1632/// TStreamerString dtor.
1633
1635{
1636}
1637
1638////////////////////////////////////////////////////////////////////////////////
1639/// Return the proper include for this element.
1640
1642{
1643 IncludeNameBuffer().Form("<%s>","TString.h");
1644 return IncludeNameBuffer();
1645}
1646
1647////////////////////////////////////////////////////////////////////////////////
1648/// Returns size of anyclass in bytes.
1649
1651{
1652 if (fArrayLength) return fArrayLength*sizeof(TString);
1653 return sizeof(TString);
1654}
1655
1656////////////////////////////////////////////////////////////////////////////////
1657/// Stream an object of class TStreamerString.
1658
1660{
1661 UInt_t R__s, R__c;
1662 if (R__b.IsReading()) {
1663 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1664 if (R__v > 1) {
1665 R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1666 return;
1667 }
1668 //====process old versions before automatic schema evolution
1670 R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1671 } else {
1673 }
1674}
1675
1676//______________________________________________________________________________
1677
1678//////////////////////////////////////////////////////////////////////////
1679// //
1680// TStreamerSTL implements streamer of STL container. //
1681// //
1682//////////////////////////////////////////////////////////////////////////
1683
1685
1686////////////////////////////////////////////////////////////////////////////////
1687/// Default ctor.
1688
1689TStreamerSTL::TStreamerSTL() : fSTLtype(0), fCtype(0)
1690{
1691}
1692
1693////////////////////////////////////////////////////////////////////////////////
1694/// Create a TStreamerSTL object.
1695
1696TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1697 const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1698 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1699{
1700 std::string answer;
1702 arglist.ShortType(answer, TClassEdit::kDropStlDefault);
1703 fTypeName = answer;
1704
1705 if (name==typeName /* intentional pointer comparison */
1706 || strcmp(name,typeName)==0) {
1707 // We have a base class.
1708 fName = fTypeName;
1709 }
1710 fSTLtype = proxy.GetCollectionType();
1711 fCtype = 0;
1712
1713 if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1714
1715 if (fSTLtype == ROOT::kSTLbitset) {
1716 // Nothing to check
1717 } else if (proxy.GetValueClass()) {
1720 } else {
1721 fCtype = proxy.GetType();
1723 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1724 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1725 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1726 }
1727 }
1730 fNewType = fType;
1731 }
1732}
1733
1734////////////////////////////////////////////////////////////////////////////////
1735/// Create a TStreamerSTL object.
1736
1737TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1738 const char *typeName, const char *trueType, Bool_t dmPointer)
1739 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1740{
1741 const char *t = trueType;
1742 if (!t || !*t) t = typeName;
1743
1744 std::string answer;
1746 arglist.ShortType(answer, TClassEdit::kDropStlDefault);
1747 fTypeName = answer;
1748
1749 if (name==typeName /* intentional pointer comparison */
1750 || strcmp(name,typeName)==0) {
1751 // We have a base class.
1752 fName = fTypeName;
1753 }
1754
1755 if (arglist.fElements.size() < 2) {
1756 Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, t);
1757 return;
1758 }
1759
1760 const std::string& inside_type = arglist.fElements[1];
1761 std::string inside = (inside_type.find("const ")==0) ? inside_type.substr(6) : inside_type;
1762
1763 // Let's treat the unique_ptr case
1764 std::string intype = TClassEdit::GetNameForIO(inside, TClassEdit::EModType::kNone);
1765
1766 bool isPointer = false;
1767 // The incoming name is normalized (it comes from splitting the name of a TClass),
1768 // so all we need to do is drop the last trailing star (if any) and record that information.
1769 while (intype.back() == '*') {
1770 isPointer = true;
1771 intype.pop_back();
1772 }
1773
1775 fCtype = 0;
1776 if (fSTLtype == ROOT::kNotSTL) { return; }
1777 if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1778
1779 TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(intype.c_str());
1780 if (fSTLtype == ROOT::kSTLbitset) {
1781 // Nothing to check
1782 } else if (dt) {
1783 fCtype = dt->GetType();
1784 if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1785 } else {
1786 // this could also be a nested enums ... which should work ... be let's see.
1787 TClass *cl = TClass::GetClass(intype.c_str());
1788 if (cl) {
1789 if (isPointer) fCtype = TVirtualStreamerInfo::kObjectp;
1791 } else {
1792 auto enumdesc = TEnum::GetEnum(intype.c_str());
1793 if (enumdesc || gCling->ClassInfo_IsEnum(intype.c_str())) {
1794 fCtype = enumdesc ? enumdesc->GetUnderlyingType() : 3;
1795 if (isPointer)
1797 } else {
1798 if (intype != "string") {
1799 // This case can happens when 'this' is a TStreamerElement for
1800 // a STL container containing something for which we do not have
1801 // a TVirtualStreamerInfo (This happens in particular is the collection
1802 // objects themselves are always empty) and we do not have the
1803 // dictionary/shared library for the container.
1804 if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1805 Warning("TStreamerSTL", "For %s we could not find any information about the type %s %d %s",
1806 fTypeName.Data(), arglist.fElements[1].c_str(), fSTLtype, arglist.fElements[0].c_str());
1807 }
1808 }
1809 }
1810 }
1811 }
1812
1815 fNewType = fType;
1816 }
1817}
1818
1819////////////////////////////////////////////////////////////////////////////////
1820/// TStreamerSTL dtor.
1821
1823{
1824}
1825
1826////////////////////////////////////////////////////////////////////////////////
1827/// We can not split STL's which are inside a variable size array.
1828/// At least for now.
1829
1831{
1832 if (IsaPointer()) {
1833 if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1834 return kTRUE;
1835 }
1836
1837 if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1838
1840
1841 return kFALSE;
1842}
1843
1844////////////////////////////////////////////////////////////////////////////////
1845/// Return true if the data member is a pointer.
1846
1848{
1849 const char *type_name = GetTypeName();
1850 if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1851 else return kFALSE;
1852}
1853
1854
1855////////////////////////////////////////////////////////////////////////////////
1856/// Return kTRUE if the element represent a base class.
1857
1859{
1860 TString ts(GetName());
1861
1862 if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1863 if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1864 return kFALSE;
1865}
1866
1867////////////////////////////////////////////////////////////////////////////////
1868/// Returns a pointer to the TClass of this element.
1869
1871{
1872 if (fClassObject!=(TClass*)(-1))
1873 return fClassObject;
1874
1875 bool quiet = (fType == TVirtualStreamerInfo::kArtificial);
1876
1878 TClass *cl = TClass::GetClass(className, kTRUE, quiet);
1879
1880 auto proxy = cl->GetCollectionProxy();
1881 if (fNewClass && proxy->GetValueClass() == nullptr) {
1882 // Collection of numerical type, let check if it is an enum.
1884 if ( arglist.fElements[1].size() >= 2 ) {
1885 auto enumdesc = TEnum::GetEnum(arglist.fElements[1].c_str());
1886 if (enumdesc || gCling->ClassInfo_IsEnum(arglist.fElements[1].c_str())) {
1887 if (fNewClass == nullptr) {
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 }
1897 ((TStreamerElement*)this)->fClassObject = cl;
1898 return fClassObject;
1899}
1900
1901////////////////////////////////////////////////////////////////////////////////
1902/// Returns size of STL container in bytes.
1903
1905{
1906 // Since the STL collection might or might not be emulated and that the
1907 // sizeof the object depends on this, let's just always retrieve the
1908 // current size!
1909 TClass *cl = GetClassPointer();
1910 UInt_t size = 0;
1911 if (cl==nullptr) {
1912 if (!TestBit(kWarned)) {
1913 Error("GetSize","Could not find the TClass for %s.\n"
1914 "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1915 const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1916 }
1917 } else {
1918 size = cl->Size();
1919 }
1920
1921 if (fArrayLength) return fArrayLength*size;
1922 return size;
1923}
1924
1925////////////////////////////////////////////////////////////////////////////////
1926/// Print the content of the element.
1927
1929{
1931 TString cdim;
1932 name = GetName();
1933 for (Int_t i=0;i<fArrayDim;i++) {
1934 cdim.Form("[%d]",fMaxIndex[i]);
1935 name += cdim;
1936 }
1937 TString sequenceType;
1938 GetSequenceType(sequenceType);
1939 if (sequenceType.Length()) {
1940 sequenceType.Prepend(" (");
1941 sequenceType += ") ";
1942 }
1943 printf(" %-14s %-15s offset=%3d type=%2d",
1944 GetTypeName(), name.Data(), fOffset, fType);
1946 printf(" newtype=%2d", fNewType);
1947 printf(" stl=%d ctype=%d %s%-20s\n",
1948 fSTLtype, fCtype, sequenceType.Data(), GetTitle());
1949}
1950
1951////////////////////////////////////////////////////////////////////////////////
1952/// Return the proper include for this element.
1953
1954const char *TStreamerSTL::GetInclude() const
1955{
1956 if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1957 else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1958 else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1959 else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1960 else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1961 else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1962 else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1963 else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1964 else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1965 else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1966 else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1967 else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1968 else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1969 return IncludeNameBuffer();
1970}
1971
1972////////////////////////////////////////////////////////////////////////////////
1973/// Set pointer to Streamer function for this element
1974/// NOTE: we do not take ownership
1975
1977{
1978 fStreamer = streamer;
1979}
1980
1981////////////////////////////////////////////////////////////////////////////////
1982/// Stream an object of class TStreamerSTL.
1983
1985{
1986 UInt_t R__s, R__c;
1987 if (R__b.IsReading()) {
1988 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1989 if (R__v > 2) {
1990 R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
1991 } else {
1992 //====process old versions before automatic schema evolution
1994 R__b >> fSTLtype;
1995 R__b >> fCtype;
1996 R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
1997 }
1998 // In old versions (prior to v6.24/02) the value of fArrayDim was not stored properly.
1999 if (fArrayDim == 0 && fArrayLength > 0) {
2000 while(fArrayDim < 5 && fMaxIndex[fArrayDim] != 0) {
2001 ++fArrayDim;
2002 }
2003 }
2005 // For a long time those where inverted in TStreamerElement
2006 // compared to the other definitions. When we moved to version '4',
2007 // this got standardized, but we now need to fix it.
2008
2009 if (fTypeName.BeginsWith("std::set") || fTypeName.BeginsWith("set")) {
2011 } else if (fTypeName.BeginsWith("std::multimap") || fTypeName.BeginsWith("multimap")) {
2013 }
2014 }
2015
2018 if (GetArrayLength() > 0) {
2020 }
2021 if (R__b.GetParent()) { // Avoid resetting during a cloning.
2023 SetBit(kDoNotDelete); // For backward compatibility
2024 } else if ( fSTLtype == ROOT::kSTLmap || fSTLtype == ROOT::kSTLmultimap) {
2025 // Here we would like to set the bit only if one of the element of the pair is a pointer,
2026 // however we have no easy to determine this short of parsing the class name.
2027 SetBit(kDoNotDelete); // For backward compatibility
2028 }
2029 }
2030 return;
2031 } else {
2032 // To enable forward compatibility we actually save with the old value
2033 TStreamerSTL tmp;
2034 // Hand coded copy constructor since the 'normal' one are intentionally
2035 // deleted.
2036 tmp.fName = fName;
2037 tmp.fTitle = fTitle;
2039 tmp.fSize = fSize;
2040 tmp.fArrayDim = fArrayDim;
2041 tmp.fArrayLength = fArrayLength;
2042 for(int i = 0; i < 5; ++i)
2043 tmp.fMaxIndex[i] = fMaxIndex[i];
2044 tmp.fTypeName = fTypeName;
2045 tmp.fSTLtype = fSTLtype;
2046 tmp.fCtype = fCtype;
2048 }
2049}
2050
2051//______________________________________________________________________________
2052
2053//////////////////////////////////////////////////////////////////////////
2054// //
2055// TStreamerSTLstring implements streaming std::string. //
2056// //
2057//////////////////////////////////////////////////////////////////////////
2058
2060
2061////////////////////////////////////////////////////////////////////////////////
2062/// Default ctor.
2063
2065{
2066}
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
2096{
2097}
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 {
2134 }
2135}
2136
2137//______________________________________________________________________________
2138
2139///////////////////////////////////////////////////////////////////////////////
2140// //
2141// TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2142// //
2143///////////////////////////////////////////////////////////////////////////////
2144
2146
2148{
2149 // Avoid streaming the synthetic/artificial streamer elements.
2150
2151 // Intentionally, nothing to do at all.
2152 return;
2153}
2154
2156{
2157 // Return the read function if any.
2158
2159 return fReadFunc;
2160}
2161
2163{
2164 // Return the raw read function if any.
2165
2166 return fReadRawFunc;
2167}
#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:382
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:40
void(* ReadRawFuncPtr_t)(char *, TBuffer &)
Definition TSchemaRule.h:41
Buffer base class used for serializing objects.
Definition TBuffer.h:43
virtual Version_t ReadVersion(UInt_t *start=nullptr, UInt_t *bcnt=nullptr, const TClass *cl=nullptr)=0
virtual void ClassBegin(const TClass *, Version_t=-1)=0
TObject * GetParent() const
Return pointer to parent of this buffer.
Definition TBuffer.cxx:262
virtual void ClassEnd(const TClass *)=0
virtual Int_t CheckByteCount(UInt_t startpos, UInt_t bcnt, const TClass *clss)=0
virtual void ReadFastArray(Bool_t *b, Int_t n)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=nullptr)=0
virtual void ClassMember(const char *, const char *=nullptr, Int_t=-1, Int_t=-1)=0
Bool_t IsReading() const
Definition TBuffer.h:86
void SetBufferOffset(Int_t offset=0)
Definition TBuffer.h:93
virtual Int_t ReadStaticArray(Bool_t *b)=0
virtual Int_t WriteClassBuffer(const TClass *cl, void *pointer)=0
TClassRef is used to implement a permanent reference to a TClass object.
Definition TClassRef.h:28
virtual void SetOnFileClass(const TClass *cl)
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:81
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition TClass.cxx:6586
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Definition TClass.cxx:2388
ClassStreamerFunc_t GetStreamerFunc() const
Get a wrapper/accessor function around this class custom streamer (member function).
Definition TClass.cxx:3008
TClassStreamer * GetStreamer() const
Return the Streamer Class allowing streaming (if any).
Definition TClass.cxx:2983
Bool_t HasInterpreterInfo() const
Definition TClass.h:411
TList * GetListOfRealData() const
Definition TClass.h:454
Int_t Size() const
Return size of object of this class.
Definition TClass.cxx:5785
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:6019
ClassConvStreamerFunc_t GetConvStreamerFunc() const
Get a wrapper/accessor function around this class custom conversion streamer (member function).
Definition TClass.cxx:3016
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:4668
Int_t GetBaseClassOffset(const TClass *toBase, void *address=nullptr, bool isDerivedObject=true)
Definition TClass.cxx:2860
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition TClass.cxx:2966
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:7167
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:7274
Bool_t IsVersioned() const
Definition TClass.h:523
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
Definition TClass.cxx:7147
Version_t GetClassVersion() const
Definition TClass.h:421
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition TClass.cxx:3532
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:3037
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:6860
All ROOT classes may have RTTI (run time type identification) support added.
Definition TDataMember.h:31
TClass * GetClass() const
Definition TDataMember.h:75
Basic data type descriptor (datatype information is obtained from CINT).
Definition TDataType.h:44
Int_t GetType() const
Definition TDataType.h:68
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:175
virtual Bool_t ClassInfo_IsEnum(const char *) const
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
Definition TList.cxx:576
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:164
const char * GetName() const override
Returns name of object.
Definition TNamed.h:47
void Streamer(TBuffer &) override
Stream an object of class TObject.
const char * GetTitle() const override
Returns title of object.
Definition TNamed.h:48
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:140
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:199
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition TObject.cxx:474
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:991
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:420
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:798
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:1005
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:1033
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition TObject.cxx:809
void ResetBit(UInt_t f)
Definition TObject.h:198
The TRealData class manages the effective list of all data members for a given class.
Definition TRealData.h:30
TDataMember * GetDataMember() const
Definition TRealData.h:53
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.
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].
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
Ssiz_t Length() const
Definition TString.h:417
void ToLower()
Change string to lower-case.
Definition TString.cxx:1182
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition TString.cxx:1163
void Clear()
Clear string without changing its capacity.
Definition TString.cxx:1235
const char * Data() const
Definition TString.h:376
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:704
@ kTrailing
Definition TString.h:276
TString & Prepend(const char *cs)
Definition TString.h:673
Bool_t IsNull() const
Definition TString.h:414
TString & Remove(Ssiz_t pos)
Definition TString.h:685
virtual void Streamer(TBuffer &)
Stream a string object.
Definition TString.cxx:1412
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2356
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:632
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.
virtual EDataType GetType() const =0
If the value type is a fundamental data type, return its type (see enumeration EDataType).
virtual TClass * GetValueClass() const =0
If the value type is a user-defined class, return a pointer to the TClass representing the value type...
virtual Int_t GetCollectionType() const =0
Return the type of the proxied collection (see enumeration TClassEdit::ESTLType)
virtual Bool_t HasPointers() const =0
Return true if the content is of type 'pointer to'.
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.
virtual TObjArray * GetElements() const =0
virtual TClass * GetClass() const =0
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
std::vector< std::string > fElements
Definition TClassEdit.h:141
void ShortType(std::string &answer, int mode)
Return the absolute type of typeDesc into the string answ.