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 namespace std;
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 = 0;
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 0;
77 if (element->IsA() != TStreamerBasicType::Class()) return 0;
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 0;
84 TDataMember *dmCounter = rdCounter->GetDataMember();
85 cl = dmCounter->GetClass();
86 } else {
87 TStreamerElement *element = (TStreamerElement *)directive->GetElements()->FindObject(countName);
88 if (!element) return 0;
89 if (element->IsA() != TStreamerBasicType::Class()) return 0;
90 cl = directive->GetClass();
91 }
92 if (cl==0) return 0;
93 counter = TVirtualStreamerInfo::GetElementCounter(countName,cl);
94 }
95 } else {
96
97 if (cl==0) return 0;
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 = 0;
143 if (comma) comma2 = strstr(comma+1,",");
144 if (comma2 > right) comma2 = 0;
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 = 0;
204 fOffset = 0;
205 fClassObject = (TClass*)(-1);
206 fNewClass = 0;
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 = 0;
235 fClassObject = (TClass*)(-1);
236 fNewClass = 0;
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();
359 if (!first) sequenceType += ",";
360 first = kFALSE;
361 sequenceType += "wholeObject";
362 }
364 first = kFALSE;
365 sequenceType += "cached";
366 }
368 if (!first) sequenceType += ",";
369 first = kFALSE;
370 sequenceType += "repeat";
371 }
373 if (!first) sequenceType += ",";
374 first = kFALSE;
375 sequenceType += "nodelete";
376 }
378 if (!first) sequenceType += ",";
379 first = kFALSE;
380 sequenceType += "write";
381 }
382}
383
384////////////////////////////////////////////////////////////////////////////////
385/// Returns size of this element in bytes.
386
388{
389 return fSize;
390}
391
392////////////////////////////////////////////////////////////////////////////////
393/// Return the local streamer object.
394
396{
397 return fStreamer;
398}
399
400////////////////////////////////////////////////////////////////////////////////
401/// Return type name of this element
402/// in case the type name is not a standard basic type, return
403/// the basic type name known to CINT.
404
406{
407 TDataType *dt = gROOT->GetType(fTypeName.Data());
408 if (fType < 1 || fType > 55) return fTypeName.Data();
409 if (dt && dt->GetType() > 0) return fTypeName.Data();
410 Int_t dtype = fType%20;
411 return TDataType::GetTypeName((EDataType)dtype);
412}
413
414////////////////////////////////////////////////////////////////////////////////
415/// Initliaze the element.
416
418{
422 }
423}
424
425////////////////////////////////////////////////////////////////////////////////
426/// The early 3.00/00 and 3.01/01 versions used to store
427/// dm->GetTypeName instead of dm->GetFullTypename
428/// if this case is detected, the element type name is modified.
429
430Bool_t TStreamerElement::IsOldFormat(const char *newTypeName)
431{
432 //if (!IsaPointer()) return kFALSE;
433 if (!strstr(newTypeName,fTypeName.Data())) return kFALSE;
434 //if (!strstr(fTypeName.Data(),newTypeName)) return kFALSE;
435 fTypeName = newTypeName;
436 return kTRUE;
437}
438
439////////////////////////////////////////////////////////////////////////////////
440/// Return kTRUE if the element represent a base class.
441
443{
444 return kFALSE;
445}
446
447////////////////////////////////////////////////////////////////////////////////
448/// Return kTRUE if the element represent an entity that is not written
449/// to the disk (transient members, cache allocator/deallocator, etc.)
450
452{
454 // if (((const TStreamerArtificial*)this)->GetWriteFunc() == 0)
455 return kTRUE;
456 }
462
463 return kFALSE;
464}
465
466////////////////////////////////////////////////////////////////////////////////
467/// Print the content of the element.
468
470{
471 TString temp(GetTypeName());
472 if (IsaPointer() && !fTypeName.Contains("*")) temp += "*";
473
474 TString sequenceType;
475 GetSequenceType(sequenceType);
476 if (sequenceType.Length()) {
477 sequenceType.Prepend(" (");
478 sequenceType += ") ";
479 }
480 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",
481 temp.Data(),GetFullName(),fOffset,fType,sequenceType.Data(),
482 GetTitle());
483}
484
485////////////////////////////////////////////////////////////////////////////////
486/// Set number of array dimensions.
487
489{
490 fArrayDim = dim;
492 fNewType = fType;
493}
494
495////////////////////////////////////////////////////////////////////////////////
496///set maximum index for array with dimension dim
497
499{
500 if (dim < 0 || dim > 4) return;
501 fMaxIndex[dim] = max;
502 if (fArrayLength == 0) fArrayLength = max;
503 else fArrayLength *= max;
504}
505
506////////////////////////////////////////////////////////////////////////////////
507///set pointer to Streamer function for this element
508
510{
511 fStreamer = streamer;
512}
513
514////////////////////////////////////////////////////////////////////////////////
515/// Stream an object of class TStreamerElement.
516
517void TStreamerElement::Streamer(TBuffer &R__b)
518{
519 UInt_t R__s, R__c;
520 if (R__b.IsReading()) {
521 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
522 //NOTE that when reading, one cannot use Class()->ReadBuffer
523 // TBuffer::Class methods used for reading streamerinfos from SQL database
524 // Any changes of class structure should be reflected by them starting from version 4
525
526 R__b.ClassBegin(TStreamerElement::Class(), R__v);
527 R__b.ClassMember("TNamed");
528 TNamed::Streamer(R__b);
529 R__b.ClassMember("fType","Int_t");
530 R__b >> fType;
531 R__b.ClassMember("fSize","Int_t");
532 R__b >> fSize;
533 R__b.ClassMember("fArrayLength","Int_t");
534 R__b >> fArrayLength;
535 R__b.ClassMember("fArrayDim","Int_t");
536 R__b >> fArrayDim;
537 R__b.ClassMember("fMaxIndex","Int_t", 5);
538 if (R__v == 1) R__b.ReadStaticArray(fMaxIndex);
539 else R__b.ReadFastArray(fMaxIndex,5);
540 R__b.ClassMember("fTypeName","TString");
541 fTypeName.Streamer(R__b);
542 if (fType==11&&(fTypeName=="Bool_t"||fTypeName=="bool")) fType = 18;
543 if (R__v > 1) {
544 SetUniqueID(0);
545 //check if element is a TRef or TRefArray
546 GetExecID();
547 }
548 if (R__v <= 2 && this->IsA()==TStreamerBasicType::Class()) {
549 // In TStreamerElement v2, fSize was holding the size of
550 // the underlying data type. In later version it contains
551 // the full length of the data member.
552 TDataType *type = gROOT->GetType(GetTypeName());
553 if (type && fArrayLength) fSize = fArrayLength * type->Size();
554 }
555 if (R__v == 3) {
556 R__b >> fXmin;
557 R__b >> fXmax;
558 R__b >> fFactor;
559 if (fFactor > 0) SetBit(kHasRange);
560 }
561 if (R__v > 3) {
563 }
564 //R__b.CheckByteCount(R__s, R__c, TStreamerElement::IsA());
565 R__b.ClassEnd(TStreamerElement::Class());
566 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
567
570 } else {
571 R__b.WriteClassBuffer(TStreamerElement::Class(),this);
572 }
573}
574
575////////////////////////////////////////////////////////////////////////////////
576///function called by the TClass constructor when replacing an emulated class
577///by the real class
578
579void TStreamerElement::Update(const TClass *oldClass, TClass *newClass)
580{
581 if (fClassObject == oldClass) {
582 fClassObject = newClass;
585 }
586 } else if (fClassObject == nullptr) {
587 // Well since some emulated class is replaced by a real class, we can
588 // assume a new library has been loaded. If this is the case, we should
589 // check whether the class now exist (this would be the case for example
590 // for reading STL containers).
591
593
594 if (classname == newClass->GetName()) {
595 fClassObject = newClass;
598 }
599 } else if (TClassTable::GetDict(classname)) {
600 fClassObject = (TClass*)-1;
601 GetClassPointer(); //force fClassObject
604 }
605 }
606 }
607}
608
609//______________________________________________________________________________
610
611//////////////////////////////////////////////////////////////////////////
612// //
613// TStreamerBase implement the streamer of the base class //
614// //
615//////////////////////////////////////////////////////////////////////////
616
618
619////////////////////////////////////////////////////////////////////////////////
620
622 // Abuse TStreamerElement data member that is not used by TStreamerBase
623 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
624 fStreamerFunc(0), fConvStreamerFunc(0), fStreamerInfo(0)
625{
626 // Default ctor.
627
628 fBaseClass = (TClass*)(-1);
629 fBaseVersion = 0;
630 fNewBaseClass = 0;
631}
632
633////////////////////////////////////////////////////////////////////////////////
634
635TStreamerBase::TStreamerBase(const char *name, const char *title, Int_t offset, Bool_t isTransient)
636 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kBase,"BASE"),
637 // Abuse TStreamerElement data member that is not used by TStreamerBase
638 fBaseCheckSum( *( (UInt_t*)&(fMaxIndex[1]) ) ),
639 fStreamerFunc(0), fConvStreamerFunc(0), fStreamerInfo(0)
640
641{
642 // Create a TStreamerBase object.
643
644 if (strcmp(name,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
645 if (strcmp(name,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
646 fNewType = fType;
648 if (fBaseClass) {
649 if (fBaseClass->IsVersioned()) {
651 } else {
652 fBaseVersion = -1;
653 }
655 } else {
656 fBaseVersion = 0;
657 }
658 fNewBaseClass = 0;
659 Init(isTransient);
660}
661
662////////////////////////////////////////////////////////////////////////////////
663/// TStreamerBase dtor
664
666{
667}
668
669////////////////////////////////////////////////////////////////////////////////
670/// Returns a pointer to the TClass of this element.
671
673{
674 if (fBaseClass!=(TClass*)(-1)) return fBaseClass;
675 ((TStreamerBase*)this)->fBaseClass = TClass::GetClass(GetName());
676 return fBaseClass;
677}
678
679////////////////////////////////////////////////////////////////////////////////
680/// Returns size of baseclass in bytes.
681
683{
684 TClass *cl = GetClassPointer();
685 if (cl) return cl->Size();
686 return 0;
687}
688
689////////////////////////////////////////////////////////////////////////////////
690/// Setup the element.
691
693{
694 Init(kFALSE);
695}
696
698{
700 if (!fBaseClass) return;
701
702 InitStreaming(isTransient);
703}
704
705////////////////////////////////////////////////////////////////////////////////
706/// Setup the fStreamerFunc and fStreamerinfo
707
709{
710 if (fNewBaseClass) {
713 if (fBaseVersion > 0 || fBaseCheckSum == 0) {
715 } else {
717 }
718 } else if (fBaseClass && fBaseClass != (TClass*)-1) {
721 if (fBaseVersion >= 0 || fBaseCheckSum == 0) {
723 } else {
725 }
726 } else {
727 fStreamerFunc = 0;
729 fStreamerInfo = 0;
730 }
731}
732
733////////////////////////////////////////////////////////////////////////////////
734/// Return kTRUE if the element represent a base class.
735
737{
738 return kTRUE;
739}
740
741////////////////////////////////////////////////////////////////////////////////
742/// Return the proper include for this element.
743
744const char *TStreamerBase::GetInclude() const
745{
748 } else {
749 std::string shortname( TClassEdit::ShortType( GetName(), 1 ) );
750 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
751 }
752 return IncludeNameBuffer();
753}
754
755////////////////////////////////////////////////////////////////////////////////
756/// Print the content of the element.
757
759{
760 TString sequenceType;
761 GetSequenceType(sequenceType);
762 if (sequenceType.Length()) {
763 sequenceType.Prepend(" (");
764 sequenceType += ") ";
765 }
766 printf(" %-14s %-15s offset=%3d type=%2d %s%-20s\n",GetFullName(),GetTypeName(),fOffset,fType,sequenceType.Data(),GetTitle());
767}
768
769////////////////////////////////////////////////////////////////////////////////
770/// Read the content of the buffer.
771
773{
774 if (fConvStreamerFunc) {
775 // We have a custom Streamer member function, we must use it.
777 } else if (fStreamerFunc) {
778 // We have a custom Streamer member function, we must use it.
779 fStreamerFunc(b,pointer+fOffset);
780 } else {
781 // We don't have a custom Streamer member function. That still doesn't mean
782 // that there is no streamer - it could be an external one:
783 // If the old base class has an adopted streamer we take that
784 // one instead of the new base class:
785 if( fNewBaseClass ) {
787 if (extstrm) {
788 // The new base class has an adopted streamer:
789 extstrm->SetOnFileClass(fBaseClass);
790 (*extstrm)(b, pointer);
791 } else {
792 b.ReadClassBuffer( fNewBaseClass, pointer+fOffset, fBaseClass );
793 }
794 } else {
796 if (extstrm) {
797 // The class has an adopted streamer:
798 (*extstrm)(b, pointer);
799 } else {
800 b.ReadClassBuffer( fBaseClass, pointer+fOffset );
801 }
802 }
803 }
804 return 0;
805}
806
807////////////////////////////////////////////////////////////////////////////////
808/// Stream an object of class TStreamerBase.
809
810void TStreamerBase::Streamer(TBuffer &R__b)
811{
812 UInt_t R__s, R__c;
813 if (R__b.IsReading()) {
814 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
815
816 R__b.ClassBegin(TStreamerBase::Class(), R__v);
817
818 R__b.ClassMember("TStreamerElement");
819 TStreamerElement::Streamer(R__b);
820 // If the class owning the TStreamerElement and the base class are not
821 // loaded, on the file their streamer info might be in the following
822 // order (derived class,base class) and hence the base class is not
823 // yet emulated.
824 fBaseClass = (TClass*)-1;
825 fNewBaseClass = 0;
826 // Eventually we need a v3 that stores directly fBaseCheckSum (and
827 // a version of TStreamerElement should not stored fMaxIndex)
828 if (R__v > 2) {
829 R__b.ClassMember("fBaseVersion","Int_t");
830 R__b >> fBaseVersion;
831 } else {
832 // could have been: fBaseVersion = GetClassPointer()->GetClassVersion();
835 }
836 R__b.ClassEnd(TStreamerBase::Class());
837 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
838 } else {
839 R__b.WriteClassBuffer(TStreamerBase::Class(),this);
840 }
841}
842
843////////////////////////////////////////////////////////////////////////////////
844///Function called by the TClass constructor when replacing an emulated class
845///by the real class.
846
847void TStreamerBase::Update(const TClass *oldClass, TClass *newClass)
848{
849 TStreamerElement::Update(oldClass, newClass);
850
851 if (fBaseClass == oldClass) {
852 fBaseClass = newClass;
854 } else if (fBaseClass == nullptr) {
855 if (fName == newClass->GetName()) {
856 fBaseClass = newClass;
858 } else if (TClassTable::GetDict(fName)) {
861 }
862 }
863}
864
865////////////////////////////////////////////////////////////////////////////////
866/// Write the base class into the buffer.
867
869{
870 if (fStreamerFunc) {
871 // We have a custom Streamer member function, we must use it.
872 fStreamerFunc(b,pointer+fOffset);
873 } else {
874 // We don't have a custom Streamer member function. That still doesn't mean
875 // that there is no streamer - it could be an external one:
876 // If the old base class has an adopted streamer we take that
877 // one instead of the new base class:
878 if (fNewBaseClass) {
880 if (extstrm) {
881 // The new base class has an adopted streamer:
882 extstrm->SetOnFileClass(fBaseClass);
883 (*extstrm)(b, pointer);
884 return 0;
885 } else {
887 return 0;
888 }
889 } else {
891 if (extstrm) {
892 (*extstrm)(b, pointer);
893 return 0;
894 } else {
896 return 0;
897 }
898 }
899 }
900 return 0;
901}
902
903//______________________________________________________________________________
904
905//////////////////////////////////////////////////////////////////////////
906// //
907// TStreamerBasicPointer implements the streamering of pointer to //
908// fundamental types. //
909// //
910//////////////////////////////////////////////////////////////////////////
911
913
914////////////////////////////////////////////////////////////////////////////////
915/// Default ctor.
916
917TStreamerBasicPointer::TStreamerBasicPointer() : fCountVersion(0),fCountName(),fCountClass(),fCounter(0)
918{
919 fCounter = 0;
920}
921
922////////////////////////////////////////////////////////////////////////////////
923/// Create a TStreamerBasicPointer object.
924
925TStreamerBasicPointer::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)
926 : TStreamerElement(name,title,offset,dtype,typeName)
927{
929 fCountName = countName;
930 fCountClass = countClass;
931 fCountVersion = countVersion; //currently unused
932 Init();
933// printf("BasicPointer Init:%s, countName=%s, countClass=%s, countVersion=%d, fCounter=%x\n",
934// name,countName,countClass,countVersion,fCounter);
935}
936
937////////////////////////////////////////////////////////////////////////////////
938/// TStreamerBasicPointer dtor.
939
941{
942}
943
944////////////////////////////////////////////////////////////////////////////////
945/// return offset of counter
946
948{
949 if (!fCounter) ((TStreamerBasicPointer*)this)->Init();
950 if (!fCounter) return 0;
951 // FIXME: does not suport multiple inheritance for counter in base class.
952 // This is wrong in case counter is not in the same class or one of
953 // the left most (non virtual) base classes. For the other we would
954 // really need to use the object coming from the list of real data.
955 // (and even that need analysis for virtual base class).
956 return (ULong_t)fCounter->GetOffset();
957}
958
959////////////////////////////////////////////////////////////////////////////////
960/// Returns size of basicpointer in bytes.
961
963{
964 if (fArrayLength) return fArrayLength*sizeof(void *);
965 return sizeof(void *);
966}
967
968////////////////////////////////////////////////////////////////////////////////
969/// Setup the element.
970/// If directive is a StreamerInfo and it correspond to the
971/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
972/// for 'countClass'.
973
975{
977}
978
979////////////////////////////////////////////////////////////////////////////////
980/// Set number of array dimensions.
981
983{
984 fArrayDim = dim;
985 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
986 fNewType = fType;
987}
988
989////////////////////////////////////////////////////////////////////////////////
990/// Stream an object of class TStreamerBasicPointer.
991
992void TStreamerBasicPointer::Streamer(TBuffer &R__b)
993{
994 UInt_t R__s, R__c;
995 if (R__b.IsReading()) {
996 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
997 if (R__v > 1) {
998 R__b.ReadClassBuffer(TStreamerBasicPointer::Class(), this, R__v, R__s, R__c);
999 //Init();
1000 //fCounter = InitCounter( fCountClass, fCountName );
1001 return;
1002 }
1003 //====process old versions before automatic schema evolution
1004 TStreamerElement::Streamer(R__b);
1005 R__b >> fCountVersion;
1006 fCountName.Streamer(R__b);
1007 fCountClass.Streamer(R__b);
1008 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1009 } else {
1010 R__b.WriteClassBuffer(TStreamerBasicPointer::Class(),this);
1011 }
1012}
1013
1014
1015//______________________________________________________________________________
1016
1017//////////////////////////////////////////////////////////////////////////
1018// //
1019// TStreamerLoop implement streaming of a few construct that require //
1020// looping over the data member and are not convered by other case //
1021// (most deprecated). //
1022// //
1023//////////////////////////////////////////////////////////////////////////
1024
1026
1027////////////////////////////////////////////////////////////////////////////////
1028/// Default ctor.
1029
1030TStreamerLoop::TStreamerLoop() : fCountVersion(0),fCountName(),fCountClass(),fCounter(0)
1031{
1032}
1033
1034////////////////////////////////////////////////////////////////////////////////
1035/// Create a TStreamerLoop object.
1036
1037TStreamerLoop::TStreamerLoop(const char *name, const char *title, Int_t offset, const char *countName, const char *countClass, Int_t countVersion, const char *typeName)
1038 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kStreamLoop,typeName)
1039{
1040 fCountName = countName;
1041 fCountClass = countClass;
1042 fCountVersion = countVersion; //currently unused
1043 Init();
1044}
1045
1046////////////////////////////////////////////////////////////////////////////////
1047/// TStreamerLoop dtor.
1048
1050{
1051}
1052
1053////////////////////////////////////////////////////////////////////////////////
1054/// return address of counter
1055
1057{
1058 //if (!fCounter) {
1059 // Init();
1060 // if (!fCounter) return 0;
1061 //}
1062 if (!fCounter) return 0;
1063 return (ULong_t)fCounter->GetOffset();
1064}
1065
1066////////////////////////////////////////////////////////////////////////////////
1067/// Returns size of counter in bytes.
1068
1070{
1071 if (fArrayLength) return fArrayLength*sizeof(void*);
1072 return sizeof(void*);
1073}
1074
1075////////////////////////////////////////////////////////////////////////////////
1076/// Setup the element.
1077/// If directive is a StreamerInfo and it correspond to the
1078/// same class a 'countClass' the streamerInfo is used instead of the current StreamerInfo of the TClass
1079/// for 'countClass'.
1080
1082{
1083 fCounter = InitCounter( fCountClass, fCountName, directive );
1084}
1085
1086////////////////////////////////////////////////////////////////////////////////
1087/// Return the proper include for this element.
1088
1089const char *TStreamerLoop::GetInclude() const
1090{
1091 IncludeNameBuffer().Form("<%s>","TString.h"); //to be generalized
1092 return IncludeNameBuffer();
1093}
1094
1095////////////////////////////////////////////////////////////////////////////////
1096/// Stream an object of class TStreamerLoop.
1097
1098void TStreamerLoop::Streamer(TBuffer &R__b)
1099{
1100 UInt_t R__s, R__c;
1101 if (R__b.IsReading()) {
1102 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1103 if (R__v > 1) {
1104 R__b.ReadClassBuffer(TStreamerLoop::Class(), this, R__v, R__s, R__c);
1105 //Init();
1106 return;
1107 }
1108 //====process old versions before automatic schema evolution
1109 TStreamerElement::Streamer(R__b);
1110 R__b >> fCountVersion;
1111 fCountName.Streamer(R__b);
1112 fCountClass.Streamer(R__b);
1113 R__b.SetBufferOffset(R__s+R__c+sizeof(UInt_t));
1114 } else {
1115 R__b.WriteClassBuffer(TStreamerLoop::Class(),this);
1116 }
1117}
1118
1119
1120//______________________________________________________________________________
1121
1122//////////////////////////////////////////////////////////////////////////
1123// //
1124// TStreamerBasicType implement streaming of fundamental types (int, //
1125// float, etc.). //
1126// //
1127//////////////////////////////////////////////////////////////////////////
1128
1130
1131////////////////////////////////////////////////////////////////////////////////
1132/// Default ctor.
1133
1135{
1136}
1137
1138////////////////////////////////////////////////////////////////////////////////
1139/// Create a TStreamerBasicType object.
1140
1141TStreamerBasicType::TStreamerBasicType(const char *name, const char *title, Int_t offset, Int_t dtype, const char *typeName)
1142 : TStreamerElement(name,title,offset,dtype,typeName),fCounter(0)
1143{
1144}
1145
1146////////////////////////////////////////////////////////////////////////////////
1147/// TStreamerBasicType dtor.
1148
1150{
1151}
1152
1153////////////////////////////////////////////////////////////////////////////////
1154/// return address of counter
1155
1157{
1160 return 0;
1161}
1162
1163////////////////////////////////////////////////////////////////////////////////
1164/// Returns size of this element in bytes.
1165
1167{
1168 return fSize;
1169}
1170
1171////////////////////////////////////////////////////////////////////////////////
1172/// Stream an object of class TStreamerBasicType.
1173
1174void TStreamerBasicType::Streamer(TBuffer &R__b)
1175{
1176 UInt_t R__s, R__c;
1177 if (R__b.IsReading()) {
1178 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1179 if (R__v > 1) {
1180 R__b.ReadClassBuffer(TStreamerBasicType::Class(), this, R__v, R__s, R__c);
1181 } else {
1182 //====process old versions before automatic schema evolution
1183 TStreamerElement::Streamer(R__b);
1184 R__b.CheckByteCount(R__s, R__c, TStreamerBasicType::IsA());
1185 }
1186 Int_t type = fType;
1189 }
1190 switch(type) {
1191 // basic types
1192 case TVirtualStreamerInfo::kBool: fSize = sizeof(Bool_t); break;
1193 case TVirtualStreamerInfo::kShort: fSize = sizeof(Short_t); break;
1194 case TVirtualStreamerInfo::kInt: fSize = sizeof(Int_t); break;
1195 case TVirtualStreamerInfo::kLong: fSize = sizeof(Long_t); break;
1196 case TVirtualStreamerInfo::kLong64: fSize = sizeof(Long64_t); break;
1197 case TVirtualStreamerInfo::kFloat: fSize = sizeof(Float_t); break;
1198 case TVirtualStreamerInfo::kFloat16: fSize = sizeof(Float_t); break;
1199 case TVirtualStreamerInfo::kDouble: fSize = sizeof(Double_t); break;
1200 case TVirtualStreamerInfo::kDouble32: fSize = sizeof(Double_t); break;
1201 case TVirtualStreamerInfo::kUChar: fSize = sizeof(UChar_t); break;
1202 case TVirtualStreamerInfo::kUShort: fSize = sizeof(UShort_t); break;
1203 case TVirtualStreamerInfo::kUInt: fSize = sizeof(UInt_t); break;
1204 case TVirtualStreamerInfo::kULong: fSize = sizeof(ULong_t); break;
1205 case TVirtualStreamerInfo::kULong64: fSize = sizeof(ULong64_t); break;
1206 case TVirtualStreamerInfo::kBits: fSize = sizeof(UInt_t); break;
1207 case TVirtualStreamerInfo::kCounter: fSize = sizeof(Int_t); break;
1208 case TVirtualStreamerInfo::kChar: fSize = sizeof(Char_t); break;
1209 case TVirtualStreamerInfo::kCharStar: fSize = sizeof(Char_t*); break;
1210 default: return; // If we don't change the size let's not remultiply it.
1211 }
1213 } else {
1214 R__b.WriteClassBuffer(TStreamerBasicType::Class(),this);
1215 }
1216}
1217
1218
1219
1220//______________________________________________________________________________
1221
1222//////////////////////////////////////////////////////////////////////////
1223// //
1224// TStreamerObject implements streaming of embedded objects whose type //
1225// inherits from TObject. //
1226// //
1227//////////////////////////////////////////////////////////////////////////
1228
1230
1231////////////////////////////////////////////////////////////////////////////////
1232/// Default ctor.
1233
1235{
1236}
1237
1238////////////////////////////////////////////////////////////////////////////////
1239/// Create a TStreamerObject object.
1240
1241TStreamerObject::TStreamerObject(const char *name, const char *title, Int_t offset, const char *typeName)
1242 : TStreamerElement(name,title,offset,0,typeName)
1243{
1245 if (strcmp(typeName,"TObject") == 0) fType = TVirtualStreamerInfo::kTObject;
1246 if (strcmp(typeName,"TNamed") == 0) fType = TVirtualStreamerInfo::kTNamed;
1247 fNewType = fType;
1248 Init();
1249}
1250
1251////////////////////////////////////////////////////////////////////////////////
1252/// TStreamerObject dtor.
1253
1255{
1256}
1257
1258////////////////////////////////////////////////////////////////////////////////
1259/// Setup the element.
1260
1262{
1265 fTObjectOffset = fClassObject->GetBaseClassOffset(TObject::Class());
1266 }
1267}
1268
1269////////////////////////////////////////////////////////////////////////////////
1270/// Return the proper include for this element.
1271
1273{
1274 TClass *cl = GetClassPointer();
1275 if (cl && cl->HasInterpreterInfo()) {
1276 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1277 } else {
1278 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1279 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1280 }
1281 return IncludeNameBuffer();
1282}
1283
1284////////////////////////////////////////////////////////////////////////////////
1285/// Returns size of object class in bytes.
1286
1288{
1289 TClass *cl = GetClassPointer();
1290 Int_t classSize = 8;
1291 if (cl) classSize = cl->Size();
1292 if (fArrayLength) return fArrayLength*classSize;
1293 return classSize;
1294}
1295
1296////////////////////////////////////////////////////////////////////////////////
1297/// Stream an object of class TStreamerObject.
1298
1299void TStreamerObject::Streamer(TBuffer &R__b)
1300{
1301 UInt_t R__s, R__c;
1302 if (R__b.IsReading()) {
1303 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1304 if (R__v > 1) {
1305 R__b.ReadClassBuffer(TStreamerObject::Class(), this, R__v, R__s, R__c);
1306 return;
1307 }
1308 //====process old versions before automatic schema evolution
1309 TStreamerElement::Streamer(R__b);
1310 R__b.CheckByteCount(R__s, R__c, TStreamerObject::IsA());
1311 } else {
1312 R__b.WriteClassBuffer(TStreamerObject::Class(),this);
1313 }
1314}
1315
1316
1317//______________________________________________________________________________
1318
1319//////////////////////////////////////////////////////////////////////////
1320// //
1321// TStreamerObjectAny implement streaming of embedded object not //
1322// inheriting from TObject. //
1323// //
1324//////////////////////////////////////////////////////////////////////////
1325
1327
1328////////////////////////////////////////////////////////////////////////////////
1329/// Default ctor.
1330
1332{
1333}
1334
1335////////////////////////////////////////////////////////////////////////////////
1336/// Create a TStreamerObjectAny object.
1337
1338TStreamerObjectAny::TStreamerObjectAny(const char *name, const char *title, Int_t offset, const char *typeName)
1339 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAny,typeName)
1340{
1341 Init();
1342}
1343
1344////////////////////////////////////////////////////////////////////////////////
1345/// TStreamerObjectAny dtor.
1346
1348{
1349}
1350
1351////////////////////////////////////////////////////////////////////////////////
1352/// Setup the element.
1353
1355{
1358 fTObjectOffset = fClassObject->GetBaseClassOffset(TObject::Class());
1359 }
1360}
1361
1362////////////////////////////////////////////////////////////////////////////////
1363/// Return the proper include for this element.
1364
1366{
1367 TClass *cl = GetClassPointer();
1368 if (cl && cl->HasInterpreterInfo()) {
1369 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1370 } else {
1371 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1372 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1373 }
1374 return IncludeNameBuffer();
1375}
1376
1377////////////////////////////////////////////////////////////////////////////////
1378/// Returns size of anyclass in bytes.
1379
1381{
1382 TClass *cl = GetClassPointer();
1383 Int_t classSize = 8;
1384 if (cl) classSize = cl->Size();
1385 if (fArrayLength) return fArrayLength*classSize;
1386 return classSize;
1387}
1388
1389////////////////////////////////////////////////////////////////////////////////
1390/// Stream an object of class TStreamerObjectAny.
1391
1392void TStreamerObjectAny::Streamer(TBuffer &R__b)
1393{
1394 UInt_t R__s, R__c;
1395 if (R__b.IsReading()) {
1396 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1397 if (R__v > 1) {
1398 R__b.ReadClassBuffer(TStreamerObjectAny::Class(), this, R__v, R__s, R__c);
1399 return;
1400 }
1401 //====process old versions before automatic schema evolution
1402 TStreamerElement::Streamer(R__b);
1403 R__b.CheckByteCount(R__s, R__c, TStreamerObjectAny::IsA());
1404 } else {
1405 R__b.WriteClassBuffer(TStreamerObjectAny::Class(),this);
1406 }
1407}
1408
1409
1410
1411//______________________________________________________________________________
1412
1413//////////////////////////////////////////////////////////////////////////
1414// //
1415// TStreamerObjectPointer implements streaming of pointer to object //
1416// inheriting from TObject. //
1417// //
1418//////////////////////////////////////////////////////////////////////////
1419
1421
1422////////////////////////////////////////////////////////////////////////////////
1423/// Default ctor.
1424
1426{
1427}
1428
1429////////////////////////////////////////////////////////////////////////////////
1430/// Create a TStreamerObjectPointer object.
1431
1433 Int_t offset, const char *typeName)
1434 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kObjectP,typeName)
1435{
1436 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kObjectp;
1437 fNewType = fType;
1438 Init();
1439}
1440
1441////////////////////////////////////////////////////////////////////////////////
1442/// TStreamerObjectPointer dtor.
1443
1445{
1446}
1447
1448////////////////////////////////////////////////////////////////////////////////
1449/// Setup the element.
1450
1452{
1455 fTObjectOffset = fClassObject->GetBaseClassOffset(TObject::Class());
1456 }
1457}
1458
1459////////////////////////////////////////////////////////////////////////////////
1460/// Return the proper include for this element.
1461
1463{
1464 TClass *cl = GetClassPointer();
1465 if (cl && cl->HasInterpreterInfo()) {
1466 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1467 } else {
1468 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1469 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1470 }
1471
1472 return IncludeNameBuffer();
1473}
1474
1475////////////////////////////////////////////////////////////////////////////////
1476/// Returns size of objectpointer in bytes.
1477
1479{
1480 if (fArrayLength) return fArrayLength*sizeof(void *);
1481 return sizeof(void *);
1482}
1483
1484////////////////////////////////////////////////////////////////////////////////
1485/// Set number of array dimensions.
1486
1488{
1489 fArrayDim = dim;
1490 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1491 fNewType = fType;
1492}
1493
1494////////////////////////////////////////////////////////////////////////////////
1495/// Stream an object of class TStreamerObjectPointer.
1496
1497void TStreamerObjectPointer::Streamer(TBuffer &R__b)
1498{
1499 UInt_t R__s, R__c;
1500 if (R__b.IsReading()) {
1501 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1502 if (R__v > 1) {
1503 R__b.ReadClassBuffer(TStreamerObjectPointer::Class(), this, R__v, R__s, R__c);
1504 return;
1505 }
1506 //====process old versions before automatic schema evolution
1507 TStreamerElement::Streamer(R__b);
1508 R__b.CheckByteCount(R__s, R__c, TStreamerObjectPointer::IsA());
1509 } else {
1510 R__b.WriteClassBuffer(TStreamerObjectPointer::Class(),this);
1511 }
1512}
1513
1514
1515//______________________________________________________________________________
1516
1517//////////////////////////////////////////////////////////////////////////
1518// //
1519// TStreamerObjectPointerAny implements streaming of pointer to object //
1520// not inheriting from TObject. //
1521// //
1522//////////////////////////////////////////////////////////////////////////
1523
1525
1526////////////////////////////////////////////////////////////////////////////////
1527/// Default ctor.
1528
1530{
1531}
1532
1533////////////////////////////////////////////////////////////////////////////////
1534/// Create a TStreamerObjectAnyPointer object.
1535
1537 Int_t offset, const char *typeName)
1538 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kAnyP,typeName)
1539{
1540 if (strncmp(title,"->",2) == 0) fType = TVirtualStreamerInfo::kAnyp;
1541 fNewType = fType;
1542 Init();
1543}
1544
1545////////////////////////////////////////////////////////////////////////////////
1546/// TStreamerObjectAnyPointer dtor.
1547
1549{
1550}
1551
1552////////////////////////////////////////////////////////////////////////////////
1553/// Setup the element.
1554
1556{
1559 fTObjectOffset = fClassObject->GetBaseClassOffset(TObject::Class());
1560 }
1561}
1562
1563////////////////////////////////////////////////////////////////////////////////
1564/// Return the proper include for this element.
1565
1567{
1568 TClass *cl = GetClassPointer();
1569 if (cl && cl->HasInterpreterInfo()) {
1570 IncludeNameBuffer().Form("\"%s\"",cl->GetDeclFileName());
1571 } else {
1572 std::string shortname( TClassEdit::ShortType( GetTypeName(), 1 ) );
1573 IncludeNameBuffer().Form("\"%s.h\"",shortname.c_str());
1574 }
1575
1576 return IncludeNameBuffer();
1577}
1578
1579////////////////////////////////////////////////////////////////////////////////
1580/// Returns size of objectpointer in bytes.
1581
1583{
1584 if (fArrayLength) return fArrayLength*sizeof(void *);
1585 return sizeof(void *);
1586}
1587
1588////////////////////////////////////////////////////////////////////////////////
1589/// Set number of array dimensions.
1590
1592{
1593 fArrayDim = dim;
1594 //if (dim) fType += TVirtualStreamerInfo::kOffsetL;
1595 fNewType = fType;
1596}
1597
1598////////////////////////////////////////////////////////////////////////////////
1599/// Stream an object of class TStreamerObjectAnyPointer.
1600
1601void TStreamerObjectAnyPointer::Streamer(TBuffer &R__b)
1602{
1603 if (R__b.IsReading()) {
1604 R__b.ReadClassBuffer(TStreamerObjectAnyPointer::Class(), this);
1605 } else {
1606 R__b.WriteClassBuffer(TStreamerObjectAnyPointer::Class(),this);
1607 }
1608}
1609
1610
1611//______________________________________________________________________________
1612
1613//////////////////////////////////////////////////////////////////////////
1614// //
1615// TSreamerString implements streaming of TString. //
1616// //
1617//////////////////////////////////////////////////////////////////////////
1618
1620
1621////////////////////////////////////////////////////////////////////////////////
1622/// Default ctor.
1623
1625{
1626}
1627
1628////////////////////////////////////////////////////////////////////////////////
1629/// Create a TStreamerString object.
1630
1631TStreamerString::TStreamerString(const char *name, const char *title, Int_t offset)
1632 : TStreamerElement(name,title,offset,TVirtualStreamerInfo::kTString,"TString")
1633{
1634}
1635
1636////////////////////////////////////////////////////////////////////////////////
1637/// TStreamerString dtor.
1638
1640{
1641}
1642
1643////////////////////////////////////////////////////////////////////////////////
1644/// Return the proper include for this element.
1645
1647{
1648 IncludeNameBuffer().Form("<%s>","TString.h");
1649 return IncludeNameBuffer();
1650}
1651
1652////////////////////////////////////////////////////////////////////////////////
1653/// Returns size of anyclass in bytes.
1654
1656{
1657 if (fArrayLength) return fArrayLength*sizeof(TString);
1658 return sizeof(TString);
1659}
1660
1661////////////////////////////////////////////////////////////////////////////////
1662/// Stream an object of class TStreamerString.
1663
1664void TStreamerString::Streamer(TBuffer &R__b)
1665{
1666 UInt_t R__s, R__c;
1667 if (R__b.IsReading()) {
1668 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1669 if (R__v > 1) {
1670 R__b.ReadClassBuffer(TStreamerString::Class(), this, R__v, R__s, R__c);
1671 return;
1672 }
1673 //====process old versions before automatic schema evolution
1674 TStreamerElement::Streamer(R__b);
1675 R__b.CheckByteCount(R__s, R__c, TStreamerString::IsA());
1676 } else {
1677 R__b.WriteClassBuffer(TStreamerString::Class(),this);
1678 }
1679}
1680
1681//______________________________________________________________________________
1682
1683//////////////////////////////////////////////////////////////////////////
1684// //
1685// TStreamerSTL implements streamer of STL container. //
1686// //
1687//////////////////////////////////////////////////////////////////////////
1688
1690
1691////////////////////////////////////////////////////////////////////////////////
1692/// Default ctor.
1693
1694TStreamerSTL::TStreamerSTL() : fSTLtype(0),fCtype(0)
1695{
1696}
1697
1698////////////////////////////////////////////////////////////////////////////////
1699/// Create a TStreamerSTL object.
1700
1701TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1702 const char *typeName, const TVirtualCollectionProxy &proxy, Bool_t dmPointer)
1703 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1704{
1706
1707 if (name==typeName /* intentional pointer comparison */
1708 || strcmp(name,typeName)==0) {
1709 // We have a base class.
1710 fName = fTypeName;
1711 }
1712 fSTLtype = proxy.GetCollectionType();
1713 fCtype = 0;
1714
1715 if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1716
1717 if (fSTLtype == ROOT::kSTLbitset) {
1718 // Nothing to check
1719 } else if (proxy.GetValueClass()) {
1722 } else {
1723 fCtype = proxy.GetType();
1725 }
1727}
1728
1729////////////////////////////////////////////////////////////////////////////////
1730/// Create a TStreamerSTL object.
1731
1732TStreamerSTL::TStreamerSTL(const char *name, const char *title, Int_t offset,
1733 const char *typeName, const char *trueType, Bool_t dmPointer)
1734 : TStreamerElement(name,title,offset,ROOT::kSTLany,typeName)
1735{
1736 const char *t = trueType;
1737 if (!t || !*t) t = typeName;
1738
1740
1741 if (name==typeName /* intentional pointer comparison */
1742 || strcmp(name,typeName)==0) {
1743 // We have a base class.
1744 fName = fTypeName;
1745 }
1746
1747 Int_t nch = strlen(t);
1748 char *s = new char[nch+1];
1749 strlcpy(s,t,nch+1);
1750 char *sopen = strchr(s,'<');
1751 if (sopen == 0) {
1752 Fatal("TStreamerSTL","For %s, the type name (%s) is seemingly not a template (template argument not found)", name, s);
1753 return;
1754 }
1755 *sopen = 0; sopen++;
1756 // We are looking for the first arguments of the STL container, because
1757 // this arguments can be a templates we need to count the < and >
1758 char* current=sopen;
1759 for(int count = 0; *current!='\0'; current++) {
1760 if (*current=='<') count++;
1761 if (*current=='>') {
1762 if (count==0) break;
1763 count--;
1764 }
1765 if (*current==',' && count==0) break;
1766 }
1767 char *sclose = current; *sclose = 0; sclose--;
1768 char *sconst = strstr(sopen,"const ");
1769 char *sbracket = strstr(sopen,"<");
1770 if (sconst && (sbracket==0 || sconst < sbracket)) {
1771 // the string "const" may be part of the classname!
1772 char *pconst = sconst-1;
1773 if (*pconst == ' ' || *pconst == '<' || *pconst == '*' || *pconst == '\0') sopen = sconst + 5;
1774 }
1776 fCtype = 0;
1777 if (fSTLtype == ROOT::kNotSTL) { delete [] s; return;}
1778 if (dmPointer) fSTLtype += TVirtualStreamerInfo::kOffsetP;
1779
1780 // find STL contained type
1781 while (*sopen==' ') sopen++;
1782 Bool_t isPointer = kFALSE;
1783 // Find stars outside of any template definitions in the
1784 // first template argument.
1785 char *star = strrchr(sopen,'>');
1786 if (star) star = strchr(star,'*');
1787 else star = strchr(sopen,'*');
1788 if (star) {
1789 isPointer = kTRUE;
1790 *star = 0;
1791 sclose = star - 1;
1792 }
1793 while (*sclose == ' ') {*sclose = 0; sclose--;}
1794
1795
1796 TDataType *dt = (TDataType*)gROOT->GetListOfTypes()->FindObject(sopen);
1797 if (fSTLtype == ROOT::kSTLbitset) {
1798 // Nothing to check
1799 } else if (dt) {
1800 fCtype = dt->GetType();
1801 if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1802 } else {
1803 // this could also be a nested enums ... which should work ... be let's see.
1804 TClass *cl = TClass::GetClass(sopen);
1805 if (cl) {
1806 if (isPointer) fCtype = TVirtualStreamerInfo::kObjectp;
1808 } else {
1809 if (gCling->ClassInfo_IsEnum(sopen)) {
1810 if (isPointer) fCtype += TVirtualStreamerInfo::kOffsetP;
1811 } else {
1812 if(strcmp(sopen,"string")) {
1813 // This case can happens when 'this' is a TStreamerElement for
1814 // a STL container containing something for which we do not have
1815 // a TVirtualStreamerInfo (This happens in particular is the collection
1816 // objects themselves are always empty) and we do not have the
1817 // dictionary/shared library for the container.
1818 if (GetClassPointer() && GetClassPointer()->IsLoaded()) {
1819 Warning("TStreamerSTL","For %s we could not find any information about the type %s %d %s",fTypeName.Data(),sopen,fSTLtype,s);
1820 }
1821 }
1822 }
1823 }
1824 }
1825 delete [] s;
1826
1828}
1829
1830////////////////////////////////////////////////////////////////////////////////
1831/// TStreamerSTL dtor.
1832
1834{
1835}
1836
1837////////////////////////////////////////////////////////////////////////////////
1838/// We can not split STL's which are inside a variable size array.
1839/// At least for now.
1840
1842{
1843 if (IsaPointer()) {
1844 if (GetTitle()[0]=='[') return kTRUE; // can not split variable size array
1845 return kTRUE;
1846 }
1847
1848 if (GetArrayDim()>=1 && GetArrayLength()>1) return kTRUE;
1849
1851
1852 return kFALSE;
1853}
1854
1855////////////////////////////////////////////////////////////////////////////////
1856/// Return true if the data member is a pointer.
1857
1859{
1860 const char *type_name = GetTypeName();
1861 if ( type_name[strlen(type_name)-1]=='*' ) return kTRUE;
1862 else return kFALSE;
1863}
1864
1865
1866////////////////////////////////////////////////////////////////////////////////
1867/// Return kTRUE if the element represent a base class.
1868
1870{
1871 TString ts(GetName());
1872
1873 if (strcmp(ts.Data(),GetTypeName())==0) return kTRUE;
1874 if (strcmp(ts.Data(),GetTypeNameBasic())==0) return kTRUE;
1875 return kFALSE;
1876}
1877////////////////////////////////////////////////////////////////////////////////
1878/// Returns size of STL container in bytes.
1879
1881{
1882 // Since the STL collection might or might not be emulated and that the
1883 // sizeof the object depends on this, let's just always retrieve the
1884 // current size!
1885 TClass *cl = GetClassPointer();
1886 UInt_t size = 0;
1887 if (cl==0) {
1888 if (!TestBit(kWarned)) {
1889 Error("GetSize","Could not find the TClass for %s.\n"
1890 "This is likely to have been a typedef, if possible please declare it in CINT to work around the issue\n",fTypeName.Data());
1891 const_cast<TStreamerSTL*>(this)->SetBit(kWarned);
1892 }
1893 } else {
1894 size = cl->Size();
1895 }
1896
1897 if (fArrayLength) return fArrayLength*size;
1898 return size;
1899}
1900
1901////////////////////////////////////////////////////////////////////////////////
1902/// Print the content of the element.
1903
1905{
1907 TString cdim;
1908 name = GetName();
1909 for (Int_t i=0;i<fArrayDim;i++) {
1910 cdim.Form("[%d]",fMaxIndex[i]);
1911 name += cdim;
1912 }
1913 TString sequenceType;
1914 GetSequenceType(sequenceType);
1915 if (sequenceType.Length()) {
1916 sequenceType.Prepend(" (");
1917 sequenceType += ") ";
1918 }
1919 printf(" %-14s %-15s offset=%3d type=%2d %s,stl=%d, ctype=%d, %-20s\n",
1920 GetTypeName(),name.Data(),fOffset,fType,sequenceType.Data(),
1922}
1923
1924////////////////////////////////////////////////////////////////////////////////
1925/// Return the proper include for this element.
1926
1927const char *TStreamerSTL::GetInclude() const
1928{
1929 if (fSTLtype == ROOT::kSTLvector) IncludeNameBuffer().Form("<%s>","vector");
1930 else if (fSTLtype == ROOT::kSTLlist) IncludeNameBuffer().Form("<%s>","list");
1931 else if (fSTLtype == ROOT::kSTLforwardlist) IncludeNameBuffer().Form("<%s>","forward_list");
1932 else if (fSTLtype == ROOT::kSTLdeque) IncludeNameBuffer().Form("<%s>","deque");
1933 else if (fSTLtype == ROOT::kSTLmap) IncludeNameBuffer().Form("<%s>","map");
1934 else if (fSTLtype == ROOT::kSTLmultimap) IncludeNameBuffer().Form("<%s>","map");
1935 else if (fSTLtype == ROOT::kSTLset) IncludeNameBuffer().Form("<%s>","set");
1936 else if (fSTLtype == ROOT::kSTLmultiset) IncludeNameBuffer().Form("<%s>","set");
1937 else if (fSTLtype == ROOT::kSTLunorderedset) IncludeNameBuffer().Form("<%s>","unordered_set");
1938 else if (fSTLtype == ROOT::kSTLunorderedmultiset) IncludeNameBuffer().Form("<%s>","unordered_set");
1939 else if (fSTLtype == ROOT::kSTLunorderedmap) IncludeNameBuffer().Form("<%s>","unordered_map");
1940 else if (fSTLtype == ROOT::kSTLunorderedmultimap) IncludeNameBuffer().Form("<%s>","unordered_map");
1941 else if (fSTLtype == ROOT::kSTLbitset) IncludeNameBuffer().Form("<%s>","bitset");
1942 return IncludeNameBuffer();
1943}
1944
1945////////////////////////////////////////////////////////////////////////////////
1946/// Set pointer to Streamer function for this element
1947/// NOTE: we do not take ownership
1948
1950{
1951 fStreamer = streamer;
1952}
1953
1954////////////////////////////////////////////////////////////////////////////////
1955/// Stream an object of class TStreamerSTL.
1956
1957void TStreamerSTL::Streamer(TBuffer &R__b)
1958{
1959 UInt_t R__s, R__c;
1960 if (R__b.IsReading()) {
1961 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
1962 if (R__v > 2) {
1963 R__b.ReadClassBuffer(TStreamerSTL::Class(), this, R__v, R__s, R__c);
1964 } else {
1965 //====process old versions before automatic schema evolution
1966 TStreamerElement::Streamer(R__b);
1967 R__b >> fSTLtype;
1968 R__b >> fCtype;
1969 R__b.CheckByteCount(R__s, R__c, TStreamerSTL::IsA());
1970 }
1971 // In old versions (prior to v6.24/02) the value of fArrayDim was not stored properly.
1972 if (fArrayDim == 0 && fArrayLength > 0) {
1973 while(fArrayDim < 5 && fMaxIndex[fArrayDim] != 0) {
1974 ++fArrayDim;
1975 }
1976 }
1978 // For a long time those where inverted in TStreamerElement
1979 // compared to the other definitions. When we moved to version '4',
1980 // this got standardized, but we now need to fix it.
1981
1982 if (fTypeName.BeginsWith("std::set") || fTypeName.BeginsWith("set")) {
1984 } else if (fTypeName.BeginsWith("std::multimap") || fTypeName.BeginsWith("multimap")) {
1986 }
1987 }
1988
1991 if (GetArrayLength() > 0) {
1993 }
1994 if (R__b.GetParent()) { // Avoid resetting during a cloning.
1996 SetBit(kDoNotDelete); // For backward compatibility
1997 } else if ( fSTLtype == ROOT::kSTLmap || fSTLtype == ROOT::kSTLmultimap) {
1998 // Here we would like to set the bit only if one of the element of the pair is a pointer,
1999 // however we have no easy to determine this short of parsing the class name.
2000 SetBit(kDoNotDelete); // For backward compatibility
2001 }
2002 }
2003 return;
2004 } else {
2005 // To enable forward compatibility we actually save with the old value
2006 TStreamerSTL tmp;
2007 // Hand coded copy constructor since the 'normal' one are intentionally
2008 // deleted.
2009 tmp.fName = fName;
2010 tmp.fTitle = fTitle;
2012 tmp.fSize = fSize;
2013 tmp.fArrayDim = fArrayDim;
2015 for(int i = 0; i < 5; ++i)
2016 tmp.fMaxIndex[i] = fMaxIndex[i];
2017 tmp.fTypeName = fTypeName;
2018 tmp.fSTLtype = fSTLtype;
2019 tmp.fCtype = fCtype;
2020 R__b.WriteClassBuffer(TStreamerSTL::Class(), &tmp);
2021 }
2022}
2023
2024//______________________________________________________________________________
2025
2026//////////////////////////////////////////////////////////////////////////
2027// //
2028// TStreamerSTLstring implements streaming std::string. //
2029// //
2030//////////////////////////////////////////////////////////////////////////
2031
2033
2034////////////////////////////////////////////////////////////////////////////////
2035/// Default ctor.
2036
2038{
2039}
2040
2041////////////////////////////////////////////////////////////////////////////////
2042/// Create a TStreamerSTLstring object.
2043
2044TStreamerSTLstring::TStreamerSTLstring(const char *name, const char *title, Int_t offset,
2045 const char *typeName, Bool_t dmPointer)
2046 : TStreamerSTL()
2047{
2048 SetName(name);
2049 SetTitle(title);
2050
2051 if (dmPointer) {
2053 } else {
2055 }
2056
2057 fNewType = fType;
2058 fOffset = offset;
2061 fTypeName= typeName;
2062
2063}
2064
2065////////////////////////////////////////////////////////////////////////////////
2066/// TStreamerSTLstring dtor.
2067
2069{
2070}
2071
2072////////////////////////////////////////////////////////////////////////////////
2073/// Return the proper include for this element.
2074
2076{
2077 IncludeNameBuffer() = "<string>";
2078 return IncludeNameBuffer();
2079}
2080
2081////////////////////////////////////////////////////////////////////////////////
2082/// Returns size of anyclass in bytes.
2083
2085{
2086 if (fArrayLength) return fArrayLength*sizeof(string);
2087 return sizeof(string);
2088}
2089
2090////////////////////////////////////////////////////////////////////////////////
2091/// Stream an object of class TStreamerSTLstring.
2092
2093void TStreamerSTLstring::Streamer(TBuffer &R__b)
2094{
2095 UInt_t R__s, R__c;
2096 if (R__b.IsReading()) {
2097 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
2098 if (R__v > 1) {
2099 R__b.ReadClassBuffer(TStreamerSTLstring::Class(), this, R__v, R__s, R__c);
2100 return;
2101 }
2102 //====process old versions before automatic schema evolution
2103 TStreamerSTL::Streamer(R__b);
2104 R__b.CheckByteCount(R__s, R__c, TStreamerSTLstring::IsA());
2105 } else {
2106 R__b.WriteClassBuffer(TStreamerSTLstring::Class(),this);
2107 }
2108}
2109
2110//______________________________________________________________________________
2111
2112///////////////////////////////////////////////////////////////////////////////
2113// //
2114// TStreamerArtificial implements StreamerElement injected by a TSchemaRule. //
2115// //
2116///////////////////////////////////////////////////////////////////////////////
2117
2119
2120void TStreamerArtificial::Streamer(TBuffer& /* R__b */)
2121{
2122 // Avoid streaming the synthetic/artificial streamer elements.
2123
2124 // Intentionally, nothing to do at all.
2125 return;
2126}
2127
2129{
2130 // Return the read function if any.
2131
2132 return fReadFunc;
2133}
2134
2136{
2137 // Return the raw read function if any.
2138
2139 return fReadRawFunc;
2140}
#define b(i)
Definition RSha256.hxx:100
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 int UInt_t
Definition RtypesCore.h:46
const Bool_t kFALSE
Definition RtypesCore.h:92
unsigned long ULong_t
Definition RtypesCore.h:55
long Long_t
Definition RtypesCore.h:54
bool Bool_t
Definition RtypesCore.h:63
short Short_t
Definition RtypesCore.h:39
double Double_t
Definition RtypesCore.h:59
long long Long64_t
Definition RtypesCore.h:73
unsigned long long ULong64_t
Definition RtypesCore.h:74
float Float_t
Definition RtypesCore.h:57
const Bool_t kTRUE
Definition RtypesCore.h:91
const char Option_t
Definition RtypesCore.h:66
#define ClassImp(name)
Definition Rtypes.h:364
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:187
char name[80]
Definition TGX11.cxx:110
int type
Definition TGX11.cxx:121
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 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: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:80
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Definition TClass.cxx:6482
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
Definition TClass.cxx:2309
ClassStreamerFunc_t GetStreamerFunc() const
Get a wrapper/accessor function around this class custom streamer (member function).
Definition TClass.cxx:2928
TClassStreamer * GetStreamer() const
Return the Streamer Class allowing streaming (if any).
Definition TClass.cxx:2903
Bool_t HasInterpreterInfo() const
Definition TClass.h:407
TList * GetListOfRealData() const
Definition TClass.h:450
Int_t Size() const
Return size of object of this class.
Definition TClass.cxx:5681
Bool_t IsTObject() const
Return kTRUE is the class inherits from TObject.
Definition TClass.cxx:5915
ClassConvStreamerFunc_t GetConvStreamerFunc() const
Get a wrapper/accessor function around this class custom conversion streamer (member function).
Definition TClass.cxx:2936
Int_t GetBaseClassOffset(const TClass *toBase, void *address=0, bool isDerivedObject=true)
Definition TClass.cxx:2780
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:4576
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Definition TClass.cxx:2886
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:7060
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:7167
Bool_t IsVersioned() const
Definition TClass.h:517
TVirtualStreamerInfo * FindStreamerInfo(TObjArray *arr, UInt_t checksum) const
Find the TVirtualStreamerInfo in the StreamerInfos corresponding to checksum.
Definition TClass.cxx:7040
Version_t GetClassVersion() const
Definition TClass.h:417
const char * GetDeclFileName() const
Return name of the file containing the declaration of this class.
Definition TClass.cxx:3440
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:2957
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:6753
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
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
Definition TList.cxx:578
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 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
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.
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition TObject.h:187
virtual UInt_t GetUniqueID() const
Return the unique object id.
Definition TObject.cxx:377
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition TObject.cxx:879
virtual TObject * FindObject(const char *name) const
Must be redefined in derived classes.
Definition TObject.cxx:323
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition TObject.cxx:696
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition TObject.cxx:893
virtual void Fatal(const char *method, const char *msgfmt,...) const
Issue fatal error message.
Definition TObject.cxx:921
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Definition TObject.cxx:707
void ResetBit(UInt_t f)
Definition TObject.h:186
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(Bool_t isTransient)
Error message in case of checksum/version mismatch.
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.
Int_t GetSize() const
Returns size of counter in bytes.
TStreamerLoop()
pointer to basic type counter
virtual void Init(TVirtualStreamerInfo *obj=nullptr)
Setup the element.
virtual void Init(TVirtualStreamerInfo *obj=nullptr)
Setup the element.
Int_t GetSize() const
Returns size of objectpointer in bytes.
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.
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=nullptr)
Setup the element.
const char * GetInclude() const
Return the proper include for this element.
virtual void Init(TVirtualStreamerInfo *obj=nullptr)
Setup the element.
TStreamerObject()
Default ctor.
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:136
Ssiz_t Length() const
Definition TString.h:410
void ToLower()
Change string to lower-case.
Definition TString.cxx:1145
TSubString Strip(EStripType s=kTrailing, char c=' ') const
Return a substring of self stripped at beginning and/or end.
Definition TString.cxx:1126
void Clear()
Clear string without changing its capacity.
Definition TString.cxx:1196
const char * Data() const
Definition TString.h:369
TString & ReplaceAll(const TString &s1, const TString &s2)
Definition TString.h:692
@ kTrailing
Definition TString.h:267
TString & Prepend(const char *cs)
Definition TString.h:661
TString & Remove(Ssiz_t pos)
Definition TString.h:673
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
Definition TString.cxx:2309
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Definition TString.h:624
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
Definition TString.h:639
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
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:48
@ 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:81
Definition first.py:1