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