Logo ROOT   6.18/05
Reference Guide
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 "TClass.h"
22#include "TClassEdit.h"
23#include "TClassStreamer.h"
24#include "TClassTable.h"
25#include "TBaseClass.h"
26#include "TDataMember.h"
27#include "TDataType.h"
28#include "TMethod.h"
29#include "TMethodCall.h"
30#include "TRealData.h"
31#include "TFolder.h"
32#include "TRef.h"
33#include "TInterpreter.h"
34#include "TError.h"
35#include "TDataType.h"
36#include "TVirtualMutex.h"
38#include <iostream>
39
40#include <string>
41namespace std {} using namespace std;
42
43const Int_t kMaxLen = 1024;
44
46 TTHREAD_TLS_DECL_ARG(TString,includeName,kMaxLen);
47 return includeName;
48}
49
50static TString ExtractClassName(const TString &type_name)
51{
52 TString className = type_name.Strip(TString::kTrailing, '*');
53 if (className.Index("const ")==0) className.Remove(0,6);
54 return className;
55}
56////////////////////////////////////////////////////////////////////////////////
57/// Helper function to initialize the 'index/counter' value of
58/// the Pointer streamerElements. If directive is a StreamerInfo and it correspond to the
59/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
60/// for 'countClass'.
61
62static TStreamerBasicType *InitCounter(const char *countClass, const char *countName, TVirtualStreamerInfo *directive)
63{
64 TStreamerBasicType *counter = 0;
65
66 TClass *cl = TClass::GetClass(countClass);
67
68 if (directive) {
69
70 if (directive->GetClass() == cl) {
71 // The info we have been passed is indeed describing the counter holder, just look there.
72
73 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
74 if (!element) return 0;
75 if (element->IsA() != TStreamerBasicType::Class()) return 0;
76 counter = (TStreamerBasicType*)element;
77
78 } else {
79 if (directive->GetClass()->GetListOfRealData()) {
80 TRealData* rdCounter = (TRealData*) directive->GetClass()->GetListOfRealData()->FindObject(countName);
81 if (!rdCounter) return 0;
82 TDataMember *dmCounter = rdCounter->GetDataMember();
83 cl = dmCounter->GetClass();
84 } else {
85 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
86 if (!element) return 0;
87 if (element->IsA() != TStreamerBasicType::Class()) return 0;
88 cl = directive->GetClass();
89 }
90 if (cl==0) return 0;
91 counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
92 }
93 } else {
94
95 if (cl==0) return 0;
96 counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
97 }
98
99 //at this point the counter may be declared to be skipped
100 if (counter) {
102 }
103 return counter;
104}
105
106////////////////////////////////////////////////////////////////////////////////
107/// Parse comments to search for a range specifier of the style:
108/// [xmin,xmax] or [xmin,xmax,nbits]
109/// [0,1]
110/// [-10,100];
111/// [-pi,pi], [-pi/2,pi/4],[-2pi,2*pi]
112/// [-10,100,16]
113/// [0,0,8]
114/// if nbits is not specified, or nbits <2 or nbits>32 it is set to 32
115/// if (xmin==0 and xmax==0 and nbits <=16) the double word will be converted
116/// to a float and its mantissa truncated to nbits significative bits.
117///
118/// see comments in TBufferFile::WriteDouble32.
119
120static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
121{
122 const Double_t kPi =3.14159265358979323846 ;
123 factor = xmin = xmax = 0;
124 if (!comments) return;
125 const char *left = strstr(comments,"[");
126 if (!left) return;
127 const char *right = strstr(left,"]");
128 if (!right) return;
129 const char *comma = strstr(left,",");
130 if (!comma || comma > right) {
131 //may be first bracket was a dimension specifier
132 left = strstr(right,"[");
133 if (!left) return;
134 right = strstr(left,"]");
135 if (!right) return;
136 comma = strstr(left,",");
137 if (!comma || comma >right) return;
138 }
139 //search if nbits is specified
140 const char *comma2 = 0;
141 if (comma) comma2 = strstr(comma+1,",");
142 if (comma2 > right) comma2 = 0;
143 Int_t nbits = 32;
144 if (comma2) {
145 TString sbits(comma2+1,right-comma2-1);
146 sscanf(sbits.Data(),"%d",&nbits);
147 if (nbits < 2 || nbits > 32) {
148 ::Error("GetRange","Illegal specification for the number of bits; %d. reset to 32.",nbits);
149 nbits = 32;
150 }
151 right = comma2;
152 }
153 TString range(left+1,right-left-1);
154 TString sxmin(left+1,comma-left-1);
155 sxmin.ToLower();
156 sxmin.ReplaceAll(" ","");
157 if (sxmin.Contains("pi")) {
158 if (sxmin.Contains("2pi")) xmin = 2*kPi;
159 else if (sxmin.Contains("2*pi")) xmin = 2*kPi;
160 else if (sxmin.Contains("twopi")) xmin = 2*kPi;
161 else if (sxmin.Contains("pi/2")) xmin = kPi/2;
162 else if (sxmin.Contains("pi/4")) xmin = kPi/4;
163 else if (sxmin.Contains("pi")) xmin = kPi;
164 if (sxmin.Contains("-")) xmin = -xmin;
165 } else {
166 sscanf(sxmin.Data(),"%lg",&xmin);
167 }
168 TString sxmax(comma+1,right-comma-1);
169 sxmax.ToLower();
170 sxmax.ReplaceAll(" ","");
171 if (sxmax.Contains("pi")) {
172 if (sxmax.Contains("2pi")) xmax = 2*kPi;
173 else if (sxmax.Contains("2*pi")) xmax = 2*kPi;
174 else if (sxmax.Contains("twopi")) xmax = 2*kPi;
175 else if (sxmax.Contains("pi/2")) xmax = kPi/2;
176 else if (sxmax.Contains("pi/4")) xmax = kPi/4;
177 else if (sxmax.Contains("pi")) xmax = kPi;
178 if (sxmax.Contains("-")) xmax = -xmax;
179 } else {
180 sscanf(sxmax.Data(),"%lg",&xmax);
181 }
182 UInt_t bigint;
183 if (nbits < 32) bigint = 1<<nbits;
184 else bigint = 0xffffffff;
185 if (xmin < xmax) factor = bigint/(xmax-xmin);
186 if (xmin >= xmax && nbits <15) xmin = nbits+0.1;
187}
188
190
191////////////////////////////////////////////////////////////////////////////////
192/// Default ctor.
193
195{
196 fType = 0;
197 fSize = 0;
198 fNewType = 0;
199 fArrayDim = 0;
200 fArrayLength = 0;
201 fStreamer = 0;
202 fOffset = 0;
203 fClassObject = (TClass*)(-1);
204 fNewClass = 0;
205 fTObjectOffset = 0;
206 fFactor = 0;
207 fXmin = 0;
208 fXmax = 0;
209 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
210}
211
212////////////////////////////////////////////////////////////////////////////////
213/// Create a TStreamerElement object.
214
215TStreamerElement::TStreamerElement(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
216 : TNamed(name,title)
217{
218 fOffset = offset;
219 fType = dtype;
220 fSize = 0;
221 fNewType = fType;
222 fArrayDim = 0;
223 fArrayLength = 0;
224 if (typeName && !strcmp(typeName, "BASE")) {
225 // TStreamerBase case; fTypeName should stay "BASE".
226 fTypeName = typeName;
227 } else {
228 //must protect call into the interpreter
231 }
232 fStreamer = 0;
233 fClassObject = (TClass*)(-1);
234 fNewClass = 0;
235 fTObjectOffset = 0;
236 fFactor = 0;
237 fXmin = 0;
238 fXmax = 0;
239 for (Int_t i=0;i<5;i++) fMaxIndex[i] = 0;
240 if (fTypeName == "Float16_t" || fTypeName == "Float16_t*") {
242 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
243 }
244 if (fTypeName == "Double32_t" || fTypeName == "Double32_t*") {
246 if (fFactor > 0 || fXmin > 0) SetBit(kHasRange);
247 }
248}
249
250////////////////////////////////////////////////////////////////////////////////
251/// TStreamerElement dtor.
252
254{
255}
256
257
258////////////////////////////////////////////////////////////////////////////////
259/// Returns true if the element cannot be split, false otherwise.
260/// An element cannot be split if the corresponding class member has
261/// the special characters "||" as the first characters in the
262/// comment field.
263
265{
266 if (GetTitle()[0] != 0 && strspn(GetTitle(),"||") == 2) return kTRUE;
267 TClass *cl = GetClassPointer();
268 if (!cl) return kFALSE; //basic type
269
270 static TClassRef clonesArray("TClonesArray");
271 if (IsaPointer() && cl != clonesArray && !cl->GetCollectionProxy()) return kTRUE;
272
273 switch(fType) {
279 return kTRUE;
280 }
281
282 if ( !cl->CanSplit() ) return kTRUE;
283
284 return kFALSE;
285}
286
287////////////////////////////////////////////////////////////////////////////////
288/// Returns a pointer to the TClass of this element.
289
291{
292 if (fClassObject!=(TClass*)(-1)) return fClassObject;
293
296 ((TStreamerElement*)this)->fClassObject = TClass::GetClass(className, kTRUE, quiet);
297 return fClassObject;
298}
299
300////////////////////////////////////////////////////////////////////////////////
301/// Returns the TExec id for the EXEC instruction in the comment field
302/// of a TRef data member.
303
305{
306 //check if element is a TRef or TRefArray
307 if (strncmp(fTypeName.Data(),"TRef",4) != 0) return 0;
308
309 //if the UniqueID of this element has already been set, we assume
310 //that it contains the exec id of a TRef object.
311 if (GetUniqueID()) return GetUniqueID();
312
313 //check if an Exec is specified in the comment field
314 char *action = (char*)strstr(GetTitle(),"EXEC:");
315 if (!action) return 0;
316 Int_t nch = strlen(action)+1;
317 char *caction = new char[nch];
318 strlcpy(caction,action+5,nch);
319 char *blank = (char*)strchr(caction,' ');
320 if (blank) *blank = 0;
321 //we have found the Exec name in the comment
322 //we register this Exec to the list of Execs.
323 Int_t index = TRef::AddExec(caction);
324 delete [] caction;
325 //we save the Exec index as the uniqueid of this STreamerElement
326 const_cast<TStreamerElement*>(this)->SetUniqueID(index+1);
327 return index+1;
328}
329
330////////////////////////////////////////////////////////////////////////////////
331/// Return element name including dimensions, if any
332/// Note that this function stores the name into a static array.
333/// You should copy the result.
334
336{
337 TTHREAD_TLS_DECL_ARG(TString,name,kMaxLen);
338 char cdim[20];
339 name = GetName();
340 for (Int_t i=0;i<fArrayDim;i++) {
341 snprintf(cdim,19,"[%d]",fMaxIndex[i]);
342 name += cdim;
343 }
344 return name;
345}
346
347////////////////////////////////////////////////////////////////////////////////
348/// Fill type with the string representation of sequence
349/// information including 'cached','repeat','write' or
350/// 'nodelete'.
351
353{
354 sequenceType.Clear();
357 if (!first) sequenceType += ",";
358 first = kFALSE;
359 sequenceType += "wholeObject";
360 }
362 first = kFALSE;
363 sequenceType += "cached";
364 }
366 if (!first) sequenceType += ",";
367 first = kFALSE;
368 sequenceType += "repeat";
369 }
371 if (!first) sequenceType += ",";
372 first = kFALSE;
373 sequenceType += "nodelete";
374 }
376 if (!first) sequenceType += ",";
377 first = kFALSE;
378 sequenceType += "write";
379 }
380}
381
382////////////////////////////////////////////////////////////////////////////////
383/// Returns size of this element in bytes.
384
386{
387 return fSize;
388}
389
390////////////////////////////////////////////////////////////////////////////////
391/// Return the local streamer object.
392
394{
395 return fStreamer;
396}
397
398////////////////////////////////////////////////////////////////////////////////
399/// Return type name of this element
400/// in case the type name is not a standard basic type, return
401/// the basic type name known to CINT.
402
404{
405 TDataType *dt = gROOT->GetType(fTypeName.Data());
406 if (fType < 1 || fType > 55) return fTypeName.Data();
407 if (dt && dt->GetType() > 0) return fTypeName.Data();
408 Int_t dtype = fType%20;
409 return TDataType::GetTypeName((EDataType)dtype);
410}
411
412////////////////////////////////////////////////////////////////////////////////
413/// Initliaze the element.
414
416{
420 }
421}
422
423////////////////////////////////////////////////////////////////////////////////
424/// The early 3.00/00 and 3.01/01 versions used to store
425/// dm->GetTypeName instead of dm->GetFullTypename
426/// if this case is detected, the element type name is modified.
427
428Bool_t TStreamerElement::IsOldFormat(const char *newTypeName)
429{
430 //if (!IsaPointer()) return kFALSE;
431 if (!strstr(newTypeName,fTypeName.Data())) return kFALSE;
432 //if (!strstr(fTypeName.Data(),newTypeName)) return kFALSE;
433 fTypeName = newTypeName;
434 return kTRUE;
435}
436
437////////////////////////////////////////////////////////////////////////////////
438/// Return kTRUE if the element represent a base class.
439
441{
442 return kFALSE;
443}
444
445////////////////////////////////////////////////////////////////////////////////
446/// Return kTRUE if the element represent an entity that is not written
447/// to the disk (transient members, cache allocator/deallocator, etc.)
448
450{
452 // if (((const TStreamerArtificial*)this)->GetWriteFunc() == 0)
453 return kTRUE;
454 }
460
461 return kFALSE;
462}
463
464////////////////////////////////////////////////////////////////////////////////
465/// Print the content of the element.
466
468{
469 TString temp(GetTypeName());
470 if (IsaPointer() && !fTypeName.Contains("*")) temp += "*";
471
472 TString sequenceType;
473 GetSequenceType(sequenceType);
474 if (sequenceType.Length()) {
475 sequenceType.Prepend(" (");
476 sequenceType += ") ";
477 }
478 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",
479 temp.Data(),GetFullName(),fOffset,fType,sequenceType.Data(),
480 GetTitle());
481}
482
483////////////////////////////////////////////////////////////////////////////////
484/// Set number of array dimensions.
485
487{
488 fArrayDim = dim;
490 fNewType = fType;
491}
492
493////////////////////////////////////////////////////////////////////////////////
494///set maximum index for array with dimension dim
495
497{
498 if (dim < 0 || dim > 4) return;
499 fMaxIndex[dim] = max;
500 if (fArrayLength == 0) fArrayLength = max;
501 else fArrayLength *= max;
502}
503
504////////////////////////////////////////////////////////////////////////////////
505///set pointer to Streamer function for this element
506
508{
509 fStreamer = streamer;
510}
511
512////////////////////////////////////////////////////////////////////////////////
513/// Stream an object of class TStreamerElement.
514
515void TStreamerElement::Streamer(TBuffer &R__b)
516{
517 UInt_t R__s, R__c;
518 if (R__b.IsReading()) {
519 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
520 //NOTE that when reading, one cannot use Class()->ReadBuffer
521 // TBuffer::Class methods used for reading streamerinfos from SQL database
522 // Any changes of class structure should be reflected by them starting from version 4
523
525 R__b.ClassMember("TNamed");
526 TNamed::Streamer(R__b);
527 R__b.ClassMember("fType","Int_t");
528 R__b >> fType;
529 R__b.ClassMember("fSize","Int_t");
530 R__b >> fSize;
531 R__b.ClassMember("fArrayLength","Int_t");
532 R__b >> fArrayLength;
533 R__b.ClassMember("fArrayDim","Int_t");
534 R__b >> fArrayDim;
535 R__b.ClassMember("fMaxIndex","Int_t", 5);
536 if (R__v == 1) R__b.ReadStaticArray(fMaxIndex);
537 else R__b.ReadFastArray(fMaxIndex,5);
538 R__b.ClassMember("fTypeName","TString");
539 fTypeName.Streamer(R__b);
540 if (fType==11&&(fTypeName=="Bool_t"||fTypeName=="bool")) fType = 18;
541 if (R__v > 1) {
542 SetUniqueID(0);
543 //check if element is a TRef or TRefArray
544 GetExecID();
545 }
546 if (R__v <= 2 && this->IsA()==TStreamerBasicType::Class()) {
547 // In TStreamerElement v2, fSize was holding the size of
548 // the underlying data type. In later version it contains
549 // the full length of the data member.
550 TDataType *type = gROOT->GetType(GetTypeName());
551 if (type && fArrayLength) fSize = fArrayLength * type->Size();
552 }
553 if (R__v == 3) {
554 R__b >> fXmin;
555 R__b >> fXmax;
556 R__b >> fFactor;
557 if (fFactor > 0) SetBit(kHasRange);
558 }
559 if (R__v > 3) {
561 }
562 //R__b.CheckByteCount(R__s, R__c, TStreamerElement::IsA());
564 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
565
568 } else {
570 }
571}
572
573////////////////////////////////////////////////////////////////////////////////
574///function called by the TClass constructor when replacing an emulated class
575///by the real class
576
577void TStreamerElement::Update(const TClass *oldClass, TClass *newClass)
578{
579 if (fClassObject == oldClass) {
580 fClassObject = newClass;
583 }
584 } else if (fClassObject == nullptr) {
585 // Well since some emulated class is replaced by a real class, we can
586 // assume a new library has been loaded. If this is the case, we should
587 // check whether the class now exist (this would be the case for example
588 // for reading STL containers).
589
591
592 if (classname == newClass->GetName()) {
593 fClassObject = newClass;
596 }
597 } else if (TClassTable::GetDict(classname)) {
598 fClassObject = (TClass*)-1;
599 GetClassPointer(); //force fClassObject
602 }
603 }
604 }
605}
606
607//______________________________________________________________________________
608
609//////////////////////////////////////////////////////////////////////////
610// //
611// TStreamerBase implement the streamer of the base class //
612// //
613//////////////////////////////////////////////////////////////////////////
614
616
617////////////////////////////////////////////////////////////////////////////////
618
620 // Abuse TStreamerElement data member that is not used by TStreamerBase
621 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
622 fStreamerFunc(0), fConvStreamerFunc(0), fStreamerInfo(0)
623{
624 // Default ctor.
625
626 fBaseClass = (TClass*)(-1);
627 fBaseVersion = 0;
628 fNewBaseClass = 0;
629}
630
631////////////////////////////////////////////////////////////////////////////////
632
633TStreamerBase::TStreamerBase(const char *name, const char *title, Int_t offset)
634 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kBase,"BASE"),
635 // Abuse TStreamerElement data member that is not used by TStreamerBase
636 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
637 fStreamerFunc(0), fConvStreamerFunc(0), fStreamerInfo(0)
638
639{
640 // Create a TStreamerBase object.
641
642 if (strcmp(name,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
643 if (strcmp(name,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
644 fNewType = fType;
646 if (fBaseClass) {
647 if (fBaseClass->IsVersioned()) {
649 } else {
650 fBaseVersion = -1;
651 }
653 } else {
654 fBaseVersion = 0;
655 }
656 fNewBaseClass = 0;
657 Init();
658}
659
660////////////////////////////////////////////////////////////////////////////////
661/// TStreamerBase dtor
662
664{
665}
666
667////////////////////////////////////////////////////////////////////////////////
668/// Returns a pointer to the TClass of this element.
669
671{
672 if (fBaseClass!=(TClass*)(-1)) return fBaseClass;
673 ((TStreamerBase*)this)->fBaseClass = TClass::GetClass(GetName());
674 return fBaseClass;
675}
676
677////////////////////////////////////////////////////////////////////////////////
678/// Returns size of baseclass in bytes.
679
681{
682 TClass *cl = GetClassPointer();
683 if (cl) return cl->Size();
684 return 0;
685}
686
687////////////////////////////////////////////////////////////////////////////////
688/// Setup the element.
689
691{
693 if (!fBaseClass) return;
694
696}
697
698////////////////////////////////////////////////////////////////////////////////
699/// Setup the fStreamerFunc and fStreamerinfo
700
702{
703 if (fNewBaseClass) {
706 if (fBaseVersion > 0 || fBaseCheckSum == 0) {
708 } else {
710 }
711 } else if (fBaseClass && fBaseClass != (TClass*)-1) {
714 if (fBaseVersion >= 0 || fBaseCheckSum == 0) {
716 } else {
718 }
719 } else {
720 fStreamerFunc = 0;
722 fStreamerInfo = 0;
723 }
724}
725
726////////////////////////////////////////////////////////////////////////////////
727/// Return kTRUE if the element represent a base class.
728
730{
731 return kTRUE;
732}
733
734////////////////////////////////////////////////////////////////////////////////
735/// Return the proper include for this element.
736
737const char *TStreamerBase::GetInclude() const
738{
741 } else {
742 std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
743 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
744 }
745 return IncludeNameBuffer();
746}
747
748////////////////////////////////////////////////////////////////////////////////
749/// Print the content of the element.
750
752{
753 TString sequenceType;
754 GetSequenceType(sequenceType);
755 if (sequenceType.Length()) {
756 sequenceType.Prepend(" (");
757 sequenceType += ") ";
758 }
759 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
760}
761
762////////////////////////////////////////////////////////////////////////////////
763/// Read the content of the buffer.
764
766{
767 if (fConvStreamerFunc) {
768 // We have a custom Streamer member function, we must use it.
770 } else if (fStreamerFunc) {
771 // We have a custom Streamer member function, we must use it.
772 fStreamerFunc(b,pointer+fOffset);
773 } else {
774 // We don't have a custom Streamer member function. That still doesn't mean
775 // that there is no streamer - it could be an external one:
776 // If the old base class has an adopted streamer we take that
777 // one instead of the new base class:
778 if( fNewBaseClass ) {
780 if (extstrm) {
781 // The new base class has an adopted streamer:
782 extstrm->SetOnFileClass(fBaseClass);
783 (*extstrm)(b, pointer);
784 } else {
785 b.ReadClassBuffer( fNewBaseClass, pointer+fOffset, fBaseClass );
786 }
787 } else {
789 if (extstrm) {
790 // The class has an adopted streamer:
791 (*extstrm)(b, pointer);
792 } else {
793 b.ReadClassBuffer( fBaseClass, pointer+fOffset );
794 }
795 }
796 }
797 return 0;
798}
799
800////////////////////////////////////////////////////////////////////////////////
801/// Stream an object of class TStreamerBase.
802
803void TStreamerBase::Streamer(TBuffer &R__b)
804{
805 UInt_t R__s, R__c;
806 if (R__b.IsReading()) {
807 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
808
809 R__b.ClassBegin(TStreamerBase::Class(), R__v);
810
811 R__b.ClassMember("TStreamerElement");
812 TStreamerElement::Streamer(R__b);
813 // If the class owning the TStreamerElement and the base class are not
814 // loaded, on the file their streamer info might be in the following
815 // order (derived class,base class) and hence the base class is not
816 // yet emulated.
817 fBaseClass = (TClass*)-1;
818 fNewBaseClass = 0;
819 // Eventually we need a v3 that stores directly fBaseCheckSum (and
820 // a version of TStreamerElement should not stored fMaxIndex)
821 if (R__v > 2) {
822 R__b.ClassMember("fBaseVersion","Int_t");
823 R__b >> fBaseVersion;
824 } else {
825 // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
828 }
830 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
831 } else {
833 }
834}
835
836////////////////////////////////////////////////////////////////////////////////
837///Function called by the TClass constructor when replacing an emulated class
838///by the real class.
839
840void TStreamerBase::Update(const TClass *oldClass, TClass *newClass)
841{
842 TStreamerElement::Update(oldClass, newClass);
843
844 if (fBaseClass == oldClass) {
845 fBaseClass = newClass;
847 } else if (fBaseClass == nullptr) {
848 if (fName == newClass->GetName()) {
849 fBaseClass = newClass;
851 } else if (TClassTable::GetDict(fName)) {
854 }
855 }
856}
857
858////////////////////////////////////////////////////////////////////////////////
859/// Write the base class into the buffer.
860
862{
863 if (fStreamerFunc) {
864 // We have a custom Streamer member function, we must use it.
865 fStreamerFunc(b,pointer+fOffset);
866 } else {
867 // We don't have a custom Streamer member function. That still doesn't mean
868 // that there is no streamer - it could be an external one:
869 // If the old base class has an adopted streamer we take that
870 // one instead of the new base class:
871 if (fNewBaseClass) {
873 if (extstrm) {
874 // The new base class has an adopted streamer:
875 extstrm->SetOnFileClass(fBaseClass);
876 (*extstrm)(b, pointer);
877 return 0;
878 } else {
880 return 0;
881 }
882 } else {
884 if (extstrm) {
885 (*extstrm)(b, pointer);
886 return 0;
887 } else {
889 return 0;
890 }
891 }
892 }
893 return 0;
894}
895
896//______________________________________________________________________________
897
898//////////////////////////////////////////////////////////////////////////
899// //
900// TStreamerBasicPointer implements the streamering of pointer to //
901// fundamental types. //
902// //
903//////////////////////////////////////////////////////////////////////////
904
906
907////////////////////////////////////////////////////////////////////////////////
908/// Default ctor.
909
910TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(0)
911{
912 fCounter = 0;
913}
914
915////////////////////////////////////////////////////////////////////////////////
916/// Create a TStreamerBasicPointer object.
917
918TStreamerBasicPointer::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)
919 : TStreamerElement(name,title,offset,dtype,typeName)
920{
922 fCountName = countName;
923 fCountClass = countClass;
924 fCountVersion = countVersion; //currently unused
925 Init();
926// printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
927// name,countName,countClass,countVersion,fCounter);
928}
929
930////////////////////////////////////////////////////////////////////////////////
931/// TStreamerBasicPointer dtor.
932
934{
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// return offset of counter
939
941{
942 if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
943 if (!fCounter) return 0;
944 // FIXME: does not suport multiple inheritance for counter in base class.
945 // This is wrong in case counter is not in the same class or one of
946 // the left most (non virtual) base classes. For the other we would
947 // really need to use the object coming from the list of real data.
948 // (and even that need analysis for virtual base class).
949 return (ULong_t)fCounter->GetOffset();
950}
951
952////////////////////////////////////////////////////////////////////////////////
953/// Returns size of basicpointer in bytes.
954
956{
957 if (fArrayLength) return fArrayLength*sizeof(void *);
958 return sizeof(void *);
959}
960
961////////////////////////////////////////////////////////////////////////////////
962/// Setup the element.
963/// If directive is a StreamerInfo and it correspond to the
964/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
965/// for 'countClass'.
966
968{
970}
971
972////////////////////////////////////////////////////////////////////////////////
973/// Set number of array dimensions.
974
976{
977 fArrayDim = dim;
978 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
979 fNewType = fType;
980}
981
982////////////////////////////////////////////////////////////////////////////////
983/// Stream an object of class TStreamerBasicPointer.
984
985void TStreamerBasicPointer::Streamer(TBuffer &R__b)
986{
987 UInt_t R__s, R__c;
988 if (R__b.IsReading()) {
989 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
990 if (R__v > 1) {
991 R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
992 //Init();
993 //fCounter = InitCounter( fCountClass, fCountName );
994 return;
995 }
996 //====process old versions before automatic schema evolution
997 TStreamerElement::Streamer(R__b);
998 R__b >> fCountVersion;
999 fCountName.Streamer(R__b);
1000 fCountClass.Streamer(R__b);
1001 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1002 } else {
1004 }
1005}
1006
1007
1008//______________________________________________________________________________
1009
1010//////////////////////////////////////////////////////////////////////////
1011// //
1012// TStreamerLoop implement streaming of a few construct that require //
1013// looping over the data member and are not convered by other case //
1014// (most deprecated). //
1015// //
1016//////////////////////////////////////////////////////////////////////////
1017
1019
1020////////////////////////////////////////////////////////////////////////////////
1021/// Default ctor.
1022
1023TStreamerLoop::TStreamerLoop() : fCountVersion(0),fCountName(),fCountClass(),fCounter(0)
1024{
1025}
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Create a TStreamerLoop object.
1029
1030TStreamerLoop::TStreamerLoop(const char *name, const char *title, Int_t offset, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
1031 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kStreamLoop,typeName)
1032{
1033 fCountName = countName;
1034 fCountClass = countClass;
1035 fCountVersion = countVersion; //currently unused
1036 Init();
1037}
1038
1039////////////////////////////////////////////////////////////////////////////////
1040/// TStreamerLoop dtor.
1041
1043{
1044}
1045
1046////////////////////////////////////////////////////////////////////////////////
1047/// return address of counter
1048
1050{
1051 //if (!fCounter) {
1052 // Init();
1053 // if (!fCounter) return 0;
1054 //}
1055 if (!fCounter) return 0;
1056 return (ULong_t)fCounter->GetOffset();
1057}
1058
1059////////////////////////////////////////////////////////////////////////////////
1060/// Returns size of counter in bytes.
1061
1063{
1064 if (fArrayLength) return fArrayLength*sizeof(void*);
1065 return sizeof(void*);
1066}
1067
1068////////////////////////////////////////////////////////////////////////////////
1069/// Setup the element.
1070/// If directive is a StreamerInfo and it correspond to the
1071/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
1072/// for 'countClass'.
1073
1075{
1076 fCounter = InitCounter( fCountClass, fCountName, directive );
1077}
1078
1079////////////////////////////////////////////////////////////////////////////////
1080/// Return the proper include for this element.
1081
1082const char *TStreamerLoop::GetInclude() const
1083{
1084 IncludeNameBuffer().Form("<%s>","TString.h"); //to be generalized
1085 return IncludeNameBuffer();
1086}
1087
1088////////////////////////////////////////////////////////////////////////////////
1089/// Stream an object of class TStreamerLoop.
1090
1091void TStreamerLoop::Streamer(TBuffer &R__b)
1092{
1093 UInt_t R__s, R__c;
1094 if (R__b.IsReading()) {
1095 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1096 if (R__v > 1) {
1097 R__b.ReadClassBuffer(TStreamerLoop::Class(), this, R__v, R__s, R__c);
1098 //Init();
1099 return;
1100 }
1101 //====process old versions before automatic schema evolution
1102 TStreamerElement::Streamer(R__b);
1103 R__b >> fCountVersion;
1104 fCountName.Streamer(R__b);
1105 fCountClass.Streamer(R__b);
1106 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1107 } else {
1109 }
1110}
1111
1112
1113//______________________________________________________________________________
1114
1115//////////////////////////////////////////////////////////////////////////
1116// //
1117// TStreamerBasicType implement streaming of fundamental types (int, //
1118// float, etc.). //
1119// //
1120//////////////////////////////////////////////////////////////////////////
1121
1123
1124////////////////////////////////////////////////////////////////////////////////
1125/// Default ctor.
1126
1128{
1129}
1130
1131////////////////////////////////////////////////////////////////////////////////
1132/// Create a TStreamerBasicType object.
1133
1134TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1135 : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1136{
1137}
1138
1139////////////////////////////////////////////////////////////////////////////////
1140/// TStreamerBasicType dtor.
1141
1143{
1144}
1145
1146////////////////////////////////////////////////////////////////////////////////
1147/// return address of counter
1148
1150{
1153 return 0;
1154}
1155
1156////////////////////////////////////////////////////////////////////////////////
1157/// Returns size of this element in bytes.
1158
1160{
1161 return fSize;
1162}
1163
1164////////////////////////////////////////////////////////////////////////////////
1165/// Stream an object of class TStreamerBasicType.
1166
1167void TStreamerBasicType::Streamer(TBuffer &R__b)
1168{
1169 UInt_t R__s, R__c;
1170 if (R__b.IsReading()) {
1171 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1172 if (R__v > 1) {
1173 R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1174 } else {
1175 //====process old versions before automatic schema evolution
1176 TStreamerElement::Streamer(R__b);
1177 R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1178 }
1179 Int_t type = fType;
1182 }
1183 switch(type) {
1184 // basic types
1185 case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1186 case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1187 case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1188 case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1189 case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1190 case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1191 case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1192 case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1193 case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1194 case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1195 case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1196 case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1197 case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1198 case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1199 case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1200 case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1201 case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1202 case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1203 default: return; // If we don't change the size let's not remultiply it.
1204 }
1206 } else {
1208 }
1209}
1210
1211
1212
1213//______________________________________________________________________________
1214
1215//////////////////////////////////////////////////////////////////////////
1216// //
1217// TStreamerObject implements streaming of embedded objects whose type //
1218// inherits from TObject. //
1219// //
1220//////////////////////////////////////////////////////////////////////////
1221
1223
1224////////////////////////////////////////////////////////////////////////////////
1225/// Default ctor.
1226
1228{
1229}
1230
1231////////////////////////////////////////////////////////////////////////////////
1232/// Create a TStreamerObject object.
1233
1234TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1235 : TStreamerElement(name,title,offset,0,typeName)
1236{
1238 if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1239 if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1240 fNewType = fType;
1241 Init();
1242}
1243
1244////////////////////////////////////////////////////////////////////////////////
1245/// TStreamerObject dtor.
1246
1248{
1249}
1250
1251////////////////////////////////////////////////////////////////////////////////
1252/// Setup the element.
1253
1255{
1259 }
1260}
1261
1262////////////////////////////////////////////////////////////////////////////////
1263/// Return the proper include for this element.
1264
1266{
1267 TClass *cl = GetClassPointer();
1268 if (cl && cl->HasInterpreterInfo()) {
1269 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1270 } else {
1271 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1272 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1273 }
1274 return IncludeNameBuffer();
1275}
1276
1277////////////////////////////////////////////////////////////////////////////////
1278/// Returns size of object class in bytes.
1279
1281{
1282 TClass *cl = GetClassPointer();
1283 Int_t classSize = 8;
1284 if (cl) classSize = cl->Size();
1285 if (fArrayLength) return fArrayLength*classSize;
1286 return classSize;
1287}
1288
1289////////////////////////////////////////////////////////////////////////////////
1290/// Stream an object of class TStreamerObject.
1291
1292void TStreamerObject::Streamer(TBuffer &R__b)
1293{
1294 UInt_t R__s, R__c;
1295 if (R__b.IsReading()) {
1296 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1297 if (R__v > 1) {
1298 R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1299 return;
1300 }
1301 //====process old versions before automatic schema evolution
1302 TStreamerElement::Streamer(R__b);
1303 R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1304 } else {
1306 }
1307}
1308
1309
1310//______________________________________________________________________________
1311
1312//////////////////////////////////////////////////////////////////////////
1313// //
1314// TStreamerObjectAny implement streaming of embedded object not //
1315// inheriting from TObject. //
1316// //
1317//////////////////////////////////////////////////////////////////////////
1318
1320
1321////////////////////////////////////////////////////////////////////////////////
1322/// Default ctor.
1323
1325{
1326}
1327
1328////////////////////////////////////////////////////////////////////////////////
1329/// Create a TStreamerObjectAny object.
1330
1331TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1332 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1333{
1334 Init();
1335}
1336
1337////////////////////////////////////////////////////////////////////////////////
1338/// TStreamerObjectAny dtor.
1339
1341{
1342}
1343
1344////////////////////////////////////////////////////////////////////////////////
1345/// Setup the element.
1346
1348{
1352 }
1353}
1354
1355////////////////////////////////////////////////////////////////////////////////
1356/// Return the proper include for this element.
1357
1359{
1360 TClass *cl = GetClassPointer();
1361 if (cl && cl->HasInterpreterInfo()) {
1362 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1363 } else {
1364 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1365 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1366 }
1367 return IncludeNameBuffer();
1368}
1369
1370////////////////////////////////////////////////////////////////////////////////
1371/// Returns size of anyclass in bytes.
1372
1374{
1375 TClass *cl = GetClassPointer();
1376 Int_t classSize = 8;
1377 if (cl) classSize = cl->Size();
1378 if (fArrayLength) return fArrayLength*classSize;
1379 return classSize;
1380}
1381
1382////////////////////////////////////////////////////////////////////////////////
1383/// Stream an object of class TStreamerObjectAny.
1384
1385void TStreamerObjectAny::Streamer(TBuffer &R__b)
1386{
1387 UInt_t R__s, R__c;
1388 if (R__b.IsReading()) {
1389 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1390 if (R__v > 1) {
1391 R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1392 return;
1393 }
1394 //====process old versions before automatic schema evolution
1395 TStreamerElement::Streamer(R__b);
1396 R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1397 } else {
1399 }
1400}
1401
1402
1403
1404//______________________________________________________________________________
1405
1406//////////////////////////////////////////////////////////////////////////
1407// //
1408// TStreamerObjectPointer implements streaming of pointer to object //
1409// inheriting from TObject. //
1410// //
1411//////////////////////////////////////////////////////////////////////////
1412
1414
1415////////////////////////////////////////////////////////////////////////////////
1416/// Default ctor.
1417
1419{
1420}
1421
1422////////////////////////////////////////////////////////////////////////////////
1423/// Create a TStreamerObjectPointer object.
1424
1426 Int_t offset, const char *typeName)
1427 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1428{
1429 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1430 fNewType = fType;
1431 Init();
1432}
1433
1434////////////////////////////////////////////////////////////////////////////////
1435/// TStreamerObjectPointer dtor.
1436
1438{
1439}
1440
1441////////////////////////////////////////////////////////////////////////////////
1442/// Setup the element.
1443
1445{
1449 }
1450}
1451
1452////////////////////////////////////////////////////////////////////////////////
1453/// Return the proper include for this element.
1454
1456{
1457 TClass *cl = GetClassPointer();
1458 if (cl && cl->HasInterpreterInfo()) {
1459 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1460 } else {
1461 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1462 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1463 }
1464
1465 return IncludeNameBuffer();
1466}
1467
1468////////////////////////////////////////////////////////////////////////////////
1469/// Returns size of objectpointer in bytes.
1470
1472{
1473 if (fArrayLength) return fArrayLength*sizeof(void *);
1474 return sizeof(void *);
1475}
1476
1477////////////////////////////////////////////////////////////////////////////////
1478/// Set number of array dimensions.
1479
1481{
1482 fArrayDim = dim;
1483 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1484 fNewType = fType;
1485}
1486
1487////////////////////////////////////////////////////////////////////////////////
1488/// Stream an object of class TStreamerObjectPointer.
1489
1490void TStreamerObjectPointer::Streamer(TBuffer &R__b)
1491{
1492 UInt_t R__s, R__c;
1493 if (R__b.IsReading()) {
1494 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1495 if (R__v > 1) {
1496 R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1497 return;
1498 }
1499 //====process old versions before automatic schema evolution
1500 TStreamerElement::Streamer(R__b);
1501 R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1502 } else {
1504 }
1505}
1506
1507
1508//______________________________________________________________________________
1509
1510//////////////////////////////////////////////////////////////////////////
1511// //
1512// TStreamerObjectPointerAny implements streaming of pointer to object //
1513// not inheriting from TObject. //
1514// //
1515//////////////////////////////////////////////////////////////////////////
1516
1518
1519////////////////////////////////////////////////////////////////////////////////
1520/// Default ctor.
1521
1523{
1524}
1525
1526////////////////////////////////////////////////////////////////////////////////
1527/// Create a TStreamerObjectAnyPointer object.
1528
1530 Int_t offset, const char *typeName)
1531 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1532{
1533 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1534 fNewType = fType;
1535 Init();
1536}
1537
1538////////////////////////////////////////////////////////////////////////////////
1539/// TStreamerObjectAnyPointer dtor.
1540
1542{
1543}
1544
1545////////////////////////////////////////////////////////////////////////////////
1546/// Setup the element.
1547
1549{
1553 }
1554}
1555
1556////////////////////////////////////////////////////////////////////////////////
1557/// Return the proper include for this element.
1558
1560{
1561 TClass *cl = GetClassPointer();
1562 if (cl && cl->HasInterpreterInfo()) {
1563 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1564 } else {
1565 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1566 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1567 }
1568
1569 return IncludeNameBuffer();
1570}
1571
1572////////////////////////////////////////////////////////////////////////////////
1573/// Returns size of objectpointer in bytes.
1574
1576{
1577 if (fArrayLength) return fArrayLength*sizeof(void *);
1578 return sizeof(void *);
1579}
1580
1581////////////////////////////////////////////////////////////////////////////////
1582/// Set number of array dimensions.
1583
1585{
1586 fArrayDim = dim;
1587 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1588 fNewType = fType;
1589}
1590
1591////////////////////////////////////////////////////////////////////////////////
1592/// Stream an object of class TStreamerObjectAnyPointer.
1593
1594void TStreamerObjectAnyPointer::Streamer(TBuffer &R__b)
1595{
1596 if (R__b.IsReading()) {
1598 } else {
1600 }
1601}
1602
1603
1604//______________________________________________________________________________
1605
1606//////////////////////////////////////////////////////////////////////////
1607// //
1608// TSreamerString implements streaming of TString. //
1609// //
1610//////////////////////////////////////////////////////////////////////////
1611
1613
1614////////////////////////////////////////////////////////////////////////////////
1615/// Default ctor.
1616
1618{
1619}
1620
1621////////////////////////////////////////////////////////////////////////////////
1622/// Create a TStreamerString object.
1623
1624TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1625 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1626{
1627}
1628
1629////////////////////////////////////////////////////////////////////////////////
1630/// TStreamerString dtor.
1631
1633{
1634}
1635
1636////////////////////////////////////////////////////////////////////////////////
1637/// Return the proper include for this element.
1638
1640{
1641 IncludeNameBuffer().Form("<%s>","TString.h");
1642 return IncludeNameBuffer();
1643}
1644
1645////////////////////////////////////////////////////////////////////////////////
1646/// Returns size of anyclass in bytes.
1647
1649{
1650 if (fArrayLength) return fArrayLength*sizeof(TString);
1651 return sizeof(TString);
1652}
1653
1654////////////////////////////////////////////////////////////////////////////////
1655/// Stream an object of class TStreamerString.
1656
1657void TStreamerString::Streamer(TBuffer &R__b)
1658{
1659 UInt_t R__s, R__c;
1660 if (R__b.IsReading()) {
1661 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1662 if (R__v > 1) {
1663 R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1664 return;
1665 }
1666 //====process old versions before automatic schema evolution
1667 TStreamerElement::Streamer(R__b);
1668 R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1669 } else {
1671 }
1672}
1673
1674//______________________________________________________________________________
1675
1676//////////////////////////////////////////////////////////////////////////
1677// //
1678// TStreamerSTL implements streamer of STL container. //
1679// //
1680//////////////////////////////////////////////////////////////////////////
1681
1683
1684////////////////////////////////////////////////////////////////////////////////
1685/// Default ctor.
1686
1687TStreamerSTL::TStreamerSTL() : fSTLtype(0),fCtype(0)
1688{
1689}
1690
1691////////////////////////////////////////////////////////////////////////////////
1692/// Create a TStreamerSTL object.
1693
1694TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1695 const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1696 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1697{
1699
1700 if (name==typeName /* intentional pointer comparison */
1701 || strcmp(name,typeName)==0) {
1702 // We have a base class.
1703 fName = fTypeName;
1704 }
1705 fSTLtype = proxy.GetCollectionType();
1706 fCtype = 0;
1707
1708 if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1709
1710 if (fSTLtype == ROOT::kSTLbitset) {
1711 // Nothing to check
1712 } else if (proxy.GetValueClass()) {
1715 } else {
1716 fCtype = proxy.GetType();
1718 }
1720}
1721
1722////////////////////////////////////////////////////////////////////////////////
1723/// Create a TStreamerSTL object.
1724
1725TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1726 const char *typeName, const char *trueType, Bool_t dmPointer)
1727 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1728{
1729 const char *t = trueType;
1730 if (!t || !*t) t = typeName;
1731
1733
1734 if (name==typeName /* intentional pointer comparison */
1735 || strcmp(name,typeName)==0) {
1736 // We have a base class.
1737 fName = fTypeName;
1738 }
1739
1740 Int_t nch = strlen(t);
1741 char *s = new char[nch+1];
1742 strlcpy(s,t,nch+1);
1743 char *sopen = strchr(s,'<');
1744 if (sopen == 0) {
1745 Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, s);
1746 return;
1747 }
1748 *sopen = 0; sopen++;
1749 // We are looking for the first arguments of the STL container, because
1750 // this arguments can be a templates we need to count the < and >
1751 char* current=sopen;
1752 for(int count = 0; *current!='\0'; current++) {
1753 if (*current=='<') count++;
1754 if (*current=='>') {
1755 if (count==0) break;
1756 count--;
1757 }
1758 if (*current==',' && count==0) break;
1759 }
1760 char *sclose = current; *sclose = 0; sclose--;
1761 char *sconst = strstr(sopen,"const ");
1762 char *sbracket = strstr(sopen,"<");
1763 if (sconst && (sbracket==0 || sconst < sbracket)) {
1764 // the string "const" may be part of the classname!
1765 char *pconst = sconst-1;
1766 if (*pconst == ' ' || *pconst == '<' || *pconst == '*' || *pconst == '\0') sopen = sconst + 5;
1767 }
1769 fCtype = 0;
1770 if (fSTLtype == ROOT::kNotSTL) { delete [] s; return;}
1771 if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1772
1773 // find STL contained type
1774 while (*sopen==' ') sopen++;
1775 Bool_t isPointer = kFALSE;
1776 // Find stars outside of any template definitions in the
1777 // first template argument.
1778 char *star = strrchr(sopen,'>');
1779 if (star) star = strchr(star,'*');
1780 else star = strchr(sopen,'*');
1781 if (star) {
1782 isPointer = kTRUE;
1783 *star = 0;
1784 sclose = star - 1;
1785 }
1786 while (*sclose == ' ') {*sclose = 0; sclose--;}
1787
1788
1789 TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(sopen);
1790 if (fSTLtype == ROOT::kSTLbitset) {
1791 // Nothing to check
1792 } else if (dt) {
1793 fCtype = dt->GetType();
1794 if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1795 } else {
1796 // this could also be a nested enums ... which should work ... be let's see.
1797 TClass *cl = TClass::GetClass(sopen);
1798 if (cl) {
1799 if (isPointer) fCtype = TVirtualStreamerInfo::kObjectp;
1801 } else {
1802 if (gCling->ClassInfo_IsEnum(sopen)) {
1803 if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1804 } else {
1805 if(strcmp(sopen,"string")) {
1806 // This case can happens when 'this' is a TStreamerElement for
1807 // a STL container containing something for which we do not have
1808 // a TVirtualStreamerInfo (This happens in particular is the collection
1809 // objects themselves are always empty) and we do not have the
1810 // dictionary/shared library for the container.
1811 if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1812 Warning("TStreamerSTL","For %s we could not find any information about the type %s %d %s",fTypeName.Data(),sopen,fSTLtype,s);
1813 }
1814 }
1815 }
1816 }
1817 }
1818 delete [] s;
1819
1821}
1822
1823////////////////////////////////////////////////////////////////////////////////
1824/// TStreamerSTL dtor.
1825
1827{
1828}
1829
1830////////////////////////////////////////////////////////////////////////////////
1831/// We can not split STL's which are inside a variable size array.
1832/// At least for now.
1833
1835{
1836 if (IsaPointer()) {
1837 if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1838 return kTRUE;
1839 }
1840
1841 if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1842
1844
1845 return kFALSE;
1846}
1847
1848////////////////////////////////////////////////////////////////////////////////
1849/// Return true if the data member is a pointer.
1850
1852{
1853 const char *type_name = GetTypeName();
1854 if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1855 else return kFALSE;
1856}
1857
1858
1859////////////////////////////////////////////////////////////////////////////////
1860/// Return kTRUE if the element represent a base class.
1861
1863{
1864 TString ts(GetName());
1865
1866 if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1867 if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1868 return kFALSE;
1869}
1870////////////////////////////////////////////////////////////////////////////////
1871/// Returns size of STL container in bytes.
1872
1874{
1875 // Since the STL collection might or might not be emulated and that the
1876 // sizeof the object depends on this, let's just always retrieve the
1877 // current size!
1878 TClass *cl = GetClassPointer();
1879 UInt_t size = 0;
1880 if (cl==0) {
1881 if (!TestBit(kWarned)) {
1882 Error("GetSize","Could not find the TClass for %s.\n"
1883 "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1884 const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1885 }
1886 } else {
1887 size = cl->Size();
1888 }
1889
1890 if (fArrayLength) return fArrayLength*size;
1891 return size;
1892}
1893
1894////////////////////////////////////////////////////////////////////////////////
1895/// Print the content of the element.
1896
1898{
1900 TString cdim;
1901 name = GetName();
1902 for (Int_t i=0;i<fArrayDim;i++) {
1903 cdim.Form("[%d]",fMaxIndex[i]);
1904 name += cdim;
1905 }
1906 TString sequenceType;
1907 GetSequenceType(sequenceType);
1908 if (sequenceType.Length()) {
1909 sequenceType.Prepend(" (");
1910 sequenceType += ") ";
1911 }
1912 printf(" %-14s %-15s offset=%3d type=%2d %s,stl=%d, ctype=%d, %-20s\n",
1913 GetTypeName(),name.Data(),fOffset,fType,sequenceType.Data(),
1915}
1916
1917////////////////////////////////////////////////////////////////////////////////
1918/// Return the proper include for this element.
1919
1920const char *TStreamerSTL::GetInclude() const
1921{
1922 if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1923 else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1924 else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1925 else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1926 else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1927 else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1928 else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1929 else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1930 else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1931 else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1932 else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1933 else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1934 else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1935 return IncludeNameBuffer();
1936}
1937
1938////////////////////////////////////////////////////////////////////////////////
1939/// Set pointer to Streamer function for this element
1940/// NOTE: we do not take ownership
1941
1943{
1944 fStreamer = streamer;
1945}
1946
1947////////////////////////////////////////////////////////////////////////////////
1948/// Stream an object of class TStreamerSTL.
1949
1950void TStreamerSTL::Streamer(TBuffer &R__b)
1951{
1952 UInt_t R__s, R__c;
1953 if (R__b.IsReading()) {
1954 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1955 if (R__v > 2) {
1956 R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
1957 } else {
1958 //====process old versions before automatic schema evolution
1959 TStreamerElement::Streamer(R__b);
1960 R__b >> fSTLtype;
1961 R__b >> fCtype;
1962 R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
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 Int_t tmp = fType;
1996 fType = tmp;
1997 }
1998}
1999
2000//______________________________________________________________________________
2001
2002//////////////////////////////////////////////////////////////////////////
2003// //
2004// TStreamerSTLstring implements streaming std::string. //
2005// //
2006//////////////////////////////////////////////////////////////////////////
2007
2009
2010////////////////////////////////////////////////////////////////////////////////
2011/// Default ctor.
2012
2014{
2015}
2016
2017////////////////////////////////////////////////////////////////////////////////
2018/// Create a TStreamerSTLstring object.
2019
2020TStreamerSTLstring::TStreamerSTLstring(const char *name, const char *title, Int_t offset,
2021 const char *typeName, Bool_t dmPointer)
2022 : TStreamerSTL()
2023{
2024 SetName(name);
2025 SetTitle(title);
2026
2027 if (dmPointer) {
2029 } else {
2031 }
2032
2033 fNewType = fType;
2034 fOffset = offset;
2037 fTypeName= typeName;
2038
2039}
2040
2041////////////////////////////////////////////////////////////////////////////////
2042/// TStreamerSTLstring dtor.
2043
2045{
2046}
2047
2048////////////////////////////////////////////////////////////////////////////////
2049/// Return the proper include for this element.
2050
2052{
2053 IncludeNameBuffer() = "<string>";
2054 return IncludeNameBuffer();
2055}
2056
2057////////////////////////////////////////////////////////////////////////////////
2058/// Returns size of anyclass in bytes.
2059
2061{
2062 if (fArrayLength) return fArrayLength*sizeof(string);
2063 return sizeof(string);
2064}
2065
2066////////////////////////////////////////////////////////////////////////////////
2067/// Stream an object of class TStreamerSTLstring.
2068
2069void TStreamerSTLstring::Streamer(TBuffer &R__b)
2070{
2071 UInt_t R__s, R__c;
2072 if (R__b.IsReading()) {
2073 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2074 if (R__v > 1) {
2075 R__b.ReadClassBuffer(TStreamerSTLstring::Class(), this, R__v, R__s, R__c);
2076 return;
2077 }
2078 //====process old versions before automatic schema evolution
2079 TStreamerSTL::Streamer(R__b);
2080 R__b.CheckByteCount(R__s, R__c, TStreamerSTLstring::IsA());
2081 } else {
2083 }
2084}
2085
2086//______________________________________________________________________________
2087
2088///////////////////////////////////////////////////////////////////////////////
2089// //
2090// TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2091// //
2092///////////////////////////////////////////////////////////////////////////////
2093
2095
2096void TStreamerArtificial::Streamer(TBuffer& /* R__b */)
2097{
2098 // Avoid streaming the synthetic/artificial streamer elements.
2099
2100 // Intentionally, nothing to do at all.
2101 return;
2102}
2103
2105{
2106 // Return the read function if any.
2107
2108 return fReadFunc;
2109}
2110
2112{
2113 // Return the raw read function if any.
2114
2115 return fReadRawFunc;
2116}
void Class()
Definition: Class.C:29
#define b(i)
Definition: RSha256.hxx:100
unsigned short UShort_t
Definition: RtypesCore.h:36
int Int_t
Definition: RtypesCore.h:41
short Version_t
Definition: RtypesCore.h:61
unsigned char UChar_t
Definition: RtypesCore.h:34
char Char_t
Definition: RtypesCore.h:29
unsigned int UInt_t
Definition: RtypesCore.h:42
const Bool_t kFALSE
Definition: RtypesCore.h:88
unsigned long ULong_t
Definition: RtypesCore.h:51
long Long_t
Definition: RtypesCore.h:50
bool Bool_t
Definition: RtypesCore.h:59
short Short_t
Definition: RtypesCore.h:35
double Double_t
Definition: RtypesCore.h:55
long long Long64_t
Definition: RtypesCore.h:69
unsigned long long ULong64_t
Definition: RtypesCore.h:70
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:365
EDataType
Definition: TDataType.h:28
void Error(const char *location, const char *msgfmt,...)
char name[80]
Definition: TGX11.cxx:109
int type
Definition: TGX11.cxx:120
float xmin
Definition: THbookFile.cxx:93
float xmax
Definition: THbookFile.cxx:93
R__EXTERN TVirtualMutex * gInterpreterMutex
Definition: TInterpreter.h:40
R__EXTERN TInterpreter * gCling
Definition: TInterpreter.h:554
#define gROOT
Definition: TROOT.h:414
static TStreamerBasicType * InitCounter(const char *countClass, const char *countName, TVirtualStreamerInfo *directive)
Helper function to initialize the 'index/counter' value of the Pointer streamerElements.
static TString & IncludeNameBuffer()
static void GetRange(const char *comments, Double_t &xmin, Double_t &xmax, Double_t &factor)
Parse comments to search for a range specifier of the style: [xmin,xmax] or [xmin,...
const Int_t kMaxLen
static TString ExtractClassName(const TString &type_name)
#define R__LOCKGUARD(mutex)
#define snprintf
Definition: civetweb.c:1540
void(* ReadFuncPtr_t)(char *, TVirtualObject *)
Definition: TSchemaRule.h:42
void(* ReadRawFuncPtr_t)(char *, TBuffer &)
Definition: TSchemaRule.h:43
Buffer base class used for serializing objects.
Definition: TBuffer.h:42
virtual void ClassBegin(const TClass *, Version_t=-1)=0
virtual void ClassMember(const char *, const char *=0, Int_t=-1, Int_t=-1)=0
virtual Int_t ReadClassBuffer(const TClass *cl, void *pointer, const TClass *onfile_class=0)=0
TObject * GetParent() const
Return pointer to parent of this buffer.
Definition: TBuffer.cxx:262
virtual Version_t ReadVersion(UInt_t *start=0, UInt_t *bcnt=0, const TClass *cl=0)=0
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
Bool_t IsReading() const
Definition: TBuffer.h:85
void SetBufferOffset(Int_t offset=0)
Definition: TBuffer.h:92
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:29
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:75
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition: TClass.cxx:6233
TVirtualStreamerInfo * GetStreamerInfo(Int_t version=0) const
returns a pointer to the TVirtualStreamerInfo object for version If the object does not exist,...
Definition: TClass.cxx:4469
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Definition: TClass.cxx:2239
ClassStreamerFunc_t GetStreamerFunc() const
Get a wrapper/accessor function around this class custom streamer (member function).
Definition: TClass.cxx:2866
TClassStreamer * GetStreamer() const
Return the Streamer Class allowing streaming (if any).
Definition: TClass.cxx:2841
Bool_t HasInterpreterInfo() const
Definition: TClass.h:381
TList * GetListOfRealData() const
Definition: TClass.h:423
Int_t Size() const
Return size of object of this class.
Definition: TClass.cxx:5483
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition: TClass.cxx:5717
ClassConvStreamerFunc_t GetConvStreamerFunc() const
Get a wrapper/accessor function around this class custom conversion streamer (member function).
Definition: TClass.cxx:2874
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
Definition: TClass.cxx:2718
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition: TClass.cxx:2824
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:6809
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:6906
Bool_t IsVersioned() const
Definition: TClass.h:489
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
Definition: TClass.cxx:6789
Version_t GetClassVersion() const
Definition: TClass.h:391
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition: TClass.cxx:3312
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:2895
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:6504
All ROOT classes may have RTTI (run time type identification) support added.
Definition: TDataMember.h:31
TClass * GetClass() const
Definition: TDataMember.h:73
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.
Definition: TDataType.cxx:149
virtual Bool_t ClassInfo_IsEnum(const char *) const
Definition: TInterpreter.h:410
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition: TList.cxx:575
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
TString fName
Definition: TNamed.h:32
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:47
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:414
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition: TObject.cxx:375
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:866
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:880
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition: TObject.cxx:908
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition: TObject.cxx:705
void ResetBit(UInt_t f)
Definition: TObject.h:171
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
ROOT::TSchemaRule::ReadRawFuncPtr_t GetReadRawFunc()
ROOT::TSchemaRule::ReadRawFuncPtr_t fReadRawFunc
ROOT::TSchemaRule::ReadFuncPtr_t GetReadFunc()
ROOT::TSchemaRule::ReadFuncPtr_t fReadFunc
void InitStreaming()
Error message in case of checksum/version mismatch.
UInt_t & fBaseCheckSum
Bool_t IsBase() const
Return kTRUE if the element represent a base class.
Int_t WriteBuffer(TBuffer &b, char *pointer)
Write the base class into the buffer.
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
const char * GetInclude() const
Return the proper include for this element.
virtual ~TStreamerBase()
TStreamerBase dtor.
TClass * fBaseClass
checksum of the base class (used during memberwise streaming)
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.
TClass * fNewBaseClass
pointer to base class
Int_t GetSize() const
Returns size of baseclass in bytes.
TVirtualStreamerInfo * fStreamerInfo
Pointer to a wrapper around a custom convertion streamer member function.
virtual void Update(const TClass *oldClass, TClass *newClass)
Function called by the TClass constructor when replacing an emulated class by the real class.
ClassStreamerFunc_t fStreamerFunc
pointer to new base class if renamed
virtual void ls(Option_t *option="") const
Print the content of the element.
virtual TClass * GetClassPointer() const
Returns a pointer to the TClass of this element.
virtual ~TStreamerBasicPointer()
TStreamerBasicPointer dtor.
void SetArrayDim(Int_t dim)
Set number of array dimensions.
Int_t GetSize() const
Returns size of basicpointer in bytes.
ULong_t GetMethod() const
return offset of counter
TStreamerBasicPointer()
pointer to basic type counter
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
TStreamerBasicType * fCounter
Int_t GetSize() const
Returns size of this element in bytes.
ULong_t GetMethod() const
return address of counter
TStreamerBasicType()
value of data member when referenced by an array
virtual ~TStreamerBasicType()
TStreamerBasicType dtor.
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 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
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.
virtual void SetType(Int_t dtype)
Int_t GetOffset() const
virtual void Init(TVirtualStreamerInfo *obj=0)
Initliaze the element.
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.
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
virtual void ls(Option_t *option="") const
Print the content of the element.
TStreamerBasicType * fCounter
virtual ~TStreamerLoop()
TStreamerLoop dtor.
ULong_t GetMethod() const
return address of counter
const char * GetInclude() const
Return the proper include for this element.
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
Int_t GetSize() const
Returns size of counter in bytes.
TStreamerLoop()
pointer to basic type counter
Int_t GetSize() const
Returns size of objectpointer in bytes.
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
const char * GetInclude() const
Return the proper include for this element.
virtual ~TStreamerObjectAnyPointer()
TStreamerObjectAnyPointer dtor.
TStreamerObjectAnyPointer()
Default ctor.
virtual ~TStreamerObjectAny()
TStreamerObjectAny dtor.
Int_t GetSize() const
Returns size of anyclass in bytes.
TStreamerObjectAny()
Default ctor.
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
const char * GetInclude() const
Return the proper include for this element.
virtual void SetArrayDim(Int_t dim)
Set number of array dimensions.
TStreamerObjectPointer()
Default ctor.
const char * GetInclude() const
Return the proper include for this element.
virtual ~TStreamerObjectPointer()
TStreamerObjectPointer dtor.
Int_t GetSize() const
Returns size of objectpointer in bytes.
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
const char * GetInclude() const
Return the proper include for this element.
TStreamerObject()
Default ctor.
virtual void Init(TVirtualStreamerInfo *obj=0)
Setup the element.
virtual ~TStreamerObject()
TStreamerObject dtor.
Int_t GetSize() const
Returns size of object class in bytes.
const char * GetInclude() const
Return the proper include for this element.
Int_t GetSize() const
Returns size of STL container in bytes.
Bool_t CannotSplit() const
We can not split STL's which are inside a variable size array.
TStreamerSTL()
Default ctor.
virtual void ls(Option_t *option="") const
Print the content of the element.
Bool_t IsBase() const
Return kTRUE if the element represent a base class.
virtual ~TStreamerSTL()
TStreamerSTL dtor.
virtual void SetStreamer(TMemberStreamer *streamer)
Set pointer to Streamer function for this element NOTE: we do not take ownership.
Bool_t IsaPointer() const
Return true if the data member is a pointer.
const char * GetInclude() const
Return the proper include for this element.
virtual ~TStreamerSTLstring()
TStreamerSTLstring dtor.
Int_t GetSize() const
Returns size of anyclass in bytes.
TStreamerSTLstring()
Default ctor.
TStreamerString()
Default ctor.
Int_t GetSize() const
Returns size of anyclass in bytes.
const char * GetInclude() const
Return the proper include for this element.
virtual ~TStreamerString()
TStreamerString dtor.
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
void ToLower()
Change string to lower-case.
Definition: TString.cxx:1125
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition: TString.cxx:1106
void Clear()
Clear string without changing its capacity.
Definition: TString.cxx:1176
const char * Data() const
Definition: TString.h:364
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition: TString.h:687
@ kTrailing
Definition: TString.h:262
Bool_t BeginsWith(const char *s, ECaseCompare cmp=kExact) const
Definition: TString.h:610
TString & Prepend(const char *cs)
Definition: TString.h:656
TString & Remove(Ssiz_t pos)
Definition: TString.h:668
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition: TString.cxx:2289
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition: TString.h:619
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition: TString.h:634
virtual EDataType GetType() const =0
virtual TClass * GetValueClass() const =0
virtual Int_t GetCollectionType() const =0
virtual Bool_t HasPointers() const =0
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
Namespace for new ROOT classes and functions.
Definition: StringConv.hxx:21
@ kSTLbitset
Definition: ESTLType.h:37
@ kSTLmap
Definition: ESTLType.h:33
@ kSTLunorderedmultiset
Definition: ESTLType.h:43
@ kSTLstring
Definition: ESTLType.h:48
@ kSTLset
Definition: ESTLType.h:35
@ kSTLmultiset
Definition: ESTLType.h:36
@ kSTLdeque
Definition: ESTLType.h:32
@ kSTLvector
Definition: ESTLType.h:30
@ kSTLany
Definition: ESTLType.h:47
@ 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.
Definition: TClassEdit.cxx:501
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:81
static constexpr double s
Definition: first.py:1