88 Int_t last = arr->GetLast();
89 arr->AddAtAndExpand(arr->At(last),last+1);
90 for(
Int_t ind = last-1; ind >= at; --ind) {
91 arr->AddAt( arr->At(ind), ind+1);
99 Int_t offset = objs.size();
102 for(
Int_t ind = last-1; ind >= at; --ind) {
103 arr->
AddAt( arr->
At(ind), ind+offset);
105 for(
size_t ins = 0; ins < objs.size(); ++ins) {
106 arr->
AddAt(objs[ins], at+ins);
115 while (at<last && arr->At(at) != oldobj) {
127 while (at<last && arr->At(at) != oldobj) {
157 fOnFileClassVersion = 0;
158 fOldVersion =
Class()->GetClassVersion();
159 fNVirtualInfoLoc = 0;
165 fReadMemberWiseVecPtr = 0;
166 fWriteObjectWise = 0;
167 fWriteMemberWise = 0;
168 fWriteMemberWiseVecPtr = 0;
231 struct TPreventRecursiveBuildGuard {
232 TPreventRecursiveBuildGuard(
TStreamerInfo* info): fInfo(info) {
236 ~TPreventRecursiveBuildGuard() {
267 TPreventRecursiveBuildGuard buildGuard(
this);
293 ROOT::TSchemaRuleSet::TMatches rules;
309 Int_t offset = base->GetDelta();
314 Error(
"Build()",
"Cannot stream virtual base %s of class %s",
318 const char* bname = base->GetName();
319 const char* btitle = base->GetTitle();
321 if (!strcmp(bname,
"string")) {
323 }
else if (base->IsSTLContainer()) {
329 Error(
"Build",
"The class \"%s\" is compiled and its base class \"%s\" is a collection and we do not have a dictionary for it, we will not be able to read or write this base class.",
GetName(),bname);
343 Warning(
"Build",
"%s: base class %s has no streamer or dictionary it will not be saved",
GetName(), clm->
GetName());
359 if (!clm->
IsLoaded() && !(isCollection || isString)) {
362 Warning(
"Build",
"%s: base class %s has no streamer or dictionary it will not be saved",
GetName(), clm->
GetName());
377 std::string typeNameBuf;
378 std::string trueTypeNameBuf;
396 const char* dmName = dm->
GetName();
397 const char* dmTitle = dm->
GetTitle();
403 std::array<Int_t, 5> maxIndices;
413 while(typeNameBuf.back() ==
'*') typeNameBuf.pop_back();
414 dmFull = trueTypeNameBuf.c_str();
415 dmType = typeNameBuf.c_str();
422 trueTypeNameBuf = typeNameBuf;
423 while(typeNameBuf.back() ==
'*') typeNameBuf.pop_back();
424 dmFull = dmType = typeNameBuf.c_str();
425 dt =
gROOT->GetType(dmType);
438 const char* rbracket = ::strchr(dmTitle,
']');
439 if (lbracket && rbracket) {
443 Error(
"Build",
"%s, discarding: %s %s, illegal %s\n",
GetName(), dmFull, dmName, dmTitle);
449 if (!dtCounter || !isInteger) {
450 Error(
"Build",
"%s, discarding: %s %s, illegal [%s] (must be Int_t)\n",
GetName(), dmFull, dmName, counterName);
458 Error(
"Build",
"%s, discarding: %s %s, illegal [%s] must be placed before \n",
GetName(), dmFull, dmName, counterName);
468 if (!dmCounter && (strstr(dmFull,
"char*") || strstr(dmFull,
"Char_t*"))) {
470 dsize =
sizeof(
char*);
473 Error(
"Build",
"%s, unknown type: %s %s",
GetName(), dmFull, dmName);
475 }
else if (dmIsPtr && (dtype !=
kCharStar)) {
480 if ((
fName ==
"TString") || (
fName ==
"TClass")) {
483 Error(
"Build",
"%s, discarding: %s %s, no [dimension]\n",
GetName(), dmFull, dmName);
497 static const char* full_string_name =
"basic_string<char,char_traits<char>,allocator<char> >";
498 if (!strcmp(dmType,
"string") || !strcmp(dmType,
"std::string") || !strcmp(dmType, full_string_name)) {
502 if (proxy) element =
new TStreamerSTL(dmName, dmTitle, offset, dmFull, *proxy, dmIsPtr);
503 else element =
new TStreamerSTL(dmName, dmTitle, offset, dmFull, dmFull, dmIsPtr);
505 auto printErrorMsg = [&](
const char* category)
507 Error(
"Build",
"The class \"%s\" is %s and for its data member \"%s\" we do not have a dictionary for the collection \"%s\". Because of this, we will not be able to read or write this data member.",
GetName(), category, dmName, dmType);
511 printErrorMsg(
"compiled");
517 printErrorMsg(
"interpreted");
526 Error(
"Build",
"%s, unknown type: %s %s\n",
GetName(), dmFull, dmName);
544 Error(
"Build",
"%s: %s has no streamer or dictionary, data member %s will not be saved",
GetName(), dmFull, dmName);
555 Warning(
"Build",
"%s: %s has no streamer or dictionary, data member \"%s\" will not be saved",
GetName(), dmFull, dmName);
567 for (
Int_t i = 0; i < ndim; ++i) {
569 if (isStdArray) maxIndex = maxIndices[i];
589 if ( !wasCompiled && (rules && rules.HasRuleWithSource( element->
GetName(),
kTRUE )) ) {
590 needAllocClass =
kTRUE;
599 && rules && !rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) )
627 if (needAllocClass) {
697 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
699 if (element->
GetTitle()[0] ==
'<') {
704 if (content[
c] ==
'<') ++level;
705 else if (content[
c] ==
'>') --level;
716 "Update the collection proxy of the class \"%s\" \n" 717 "\tto be similar to \"%s\".",
722 The class %s had a collection proxy when written but it is not an STL\n \ 723 collection and we did not record the type of the content of the collection.\n \ 724 We will claim the content is a bool (i.e. no data will be read).",
748 ::Warning(
"TClass::TClass",
"no dictionary for class %s is available",
GetName());
755 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
757 if (element->
GetTitle()[0] ==
'<') {
762 if (content[
c] ==
'<') ++level;
763 else if (content[
c] ==
'>') --level;
774 "Update the collection proxy of the class \"%s\" \n" 775 "\tto be similar to \"%s\".",
780 The class %s had a collection proxy when written but it is not an STL\n \ 781 collection and we did not record the type of the content of the collection.\n \ 782 We will claim the content is a bool (i.e. no data will be read).",
804 searchOnChecksum =
kFALSE;
810 searchOnChecksum =
kTRUE;
817 searchOnChecksum =
kFALSE;
823 searchOnChecksum =
kTRUE;
833 searchOnChecksum =
kFALSE;
839 searchOnChecksum =
kTRUE;
850 if (!searchOnChecksum) {
856 for (
Int_t i = -1; i < ninfos; ++i) {
873 while ((slot < ninfos) && (array->
UncheckedAt(slot) != 0)) {
919 #ifdef TEST_FOR_BACKWARD_COMPATIBILITY_ABSTRACT_CLASSES 980 for (
Int_t i = 0; i < nel; ++i) {
998 if (oldIsNonVersioned) {
1001 The class %s transitioned from not having a specified class version\n\ 1002 to having a specified class version (the current class version is %d).\n\ 1003 However too many different non-versioned layouts of the class have been\n\ 1004 loaded so far. This prevent the proper reading of objects written with\n\ 1005 the class layout version %d, in particular from the file:\n\ 1007 To work around this issue, load fewer 'old' files in the same ROOT session.",
1011 The class %s transitioned from not having a specified class version\n\ 1012 to having a specified class version (the current class version is %d).\n\ 1013 However too many different non-versioned layouts of the class have been\n\ 1014 loaded so far. This prevent the proper reading of objects written with\n\ 1015 the class layout version %d.\n\ 1016 To work around this issue, load fewer 'old' files in the same ROOT session.",
1023 The StreamerInfo for version %d of class %s read from the file %s\n\ 1024 has a different checksum than the previously loaded StreamerInfo.\n\ 1025 Reading objects of type %s from the file %s \n\ 1026 (and potentially other files) might not work correctly.\n\ 1027 Most likely the version number of the class was not properly\n\ 1028 updated [See ClassDef(%s,%d)].",
1032 The StreamerInfo from %s does not match existing one (%s:%d)\n\ 1033 The existing one has not been used yet and will be discarded.\n\ 1034 Reading the file %s will work properly, however writing object of\n\ 1035 type %s will not work properly. Most likely the version number\n\ 1036 of the class was not properly updated [See ClassDef(%s,%d)].",
1042 The StreamerInfo for version %d of class %s\n\ 1043 has a different checksum than the previously loaded StreamerInfo.\n\ 1044 Reading objects of type %s\n\ 1045 (and potentially other files) might not work correctly.\n\ 1046 Most likely the version number of the class was not properly\n\ 1047 updated [See ClassDef(%s,%d)].",
1051 The StreamerInfo from %s does not match existing one (%s:%d)\n\ 1052 The existing one has not been used yet and will be discarded.\n\ 1053 Reading should work properly, however writing object of\n\ 1054 type %s will not work properly. Most likely the version number\n\ 1055 of the class was not properly updated [See ClassDef(%s,%d)].",
1087 #ifdef TEST_FOR_BACKWARD_COMPATIBILITY_ABSTRACT_CLASSES 1108 #endif // TEST_FOR_BACKWARD_COMPATIBILITY 1115 if (bc->GetClassPointer()->GetCollectionType()) {
1123 The StreamerInfo of class %s read from file %s\n\ 1124 has the same version (=%d) as the active class but a different checksum.\n\ 1125 You should update the version to ClassDef(%s,%d).\n\ 1126 Do not try to write objects with the current class definition,\n\ 1130 The StreamerInfo of class %s \n\ 1131 has the same version (=%d) as the active class but a different checksum.\n\ 1132 You should update the version to ClassDef(%s,%d).\n\ 1133 Do not try to write objects with the current class definition,\n\ 1141 Fatal(
"BuildCheck",
"\n\ 1142 The StreamerInfo of unversioned class %s \n\ 1143 has the same version (=%d) as the active class but an old checksum.\n\ 1206 if (!element)
break;
1213 if (ty <=
kULong)
continue;
1217 {
for (
int j=ndata-1;j>=i;j--) {elements->
AddAtAndExpand(elements->
At(j),j+1);}}
1218 elements->
AddAt(bt,i);
1240 Warning(
"BuildFor",
"The build of %s streamer info for %s has been requested, but no matching conversion rules were specified",
GetName(), in_memory_cl->
GetName() );
1258 if (oldClass == 0 || newClass == 0)
return kFALSE;
1263 const char *oldname = oldClass->
GetName();
1264 for (
UInt_t i = oldlen, done =
false, nest = 0; (i>0) && !done ; --i) {
1265 switch (oldClass->
GetName()[i-1]) {
1266 case '>' : ++nest;
break;
1267 case '<' :
if (nest==0)
return kFALSE;
1269 case ':' :
if (nest == 0) oldname= &(oldClass->
GetName()[i]); done =
kTRUE;
break;
1272 oldlen = strlen(oldname);
1273 if (!(strlen(newClass->
GetName()) > strlen(oldClass->
GetName()))) {
1277 const char* newEnd = & (newClass->
GetName()[newlen-oldlen]);
1279 if (0 != strcmp(newEnd, oldname)) {
1307 Error(
"ImportStreamerInfo",
"Unable to clone the StreamerInfo for %s.",(*next)->GetName());
1309 info->SetClass(newClass);
1310 Int_t oldv = info->GetClassVersion();
1353 if (oldContent == newContent) {
1354 contentMatch =
kTRUE;
1355 }
else if (newContent) {
1358 if (oldFlatContent == newFlatContent) {
1359 contentMatch =
kTRUE;
1365 contentMatch = (newContent==0);
1369 if ((oldContent==0 && oldProxy->
GetType() == newProxy->
GetType())
1446 TClass *FindAlternate(
TClass *context,
const std::string &i_name, std::string& newName)
1452 std::string
name(i_name);
1454 if (name.compare(0,6,
"const ")==0) {
1460 while(name[name.length()-nstars-1]==
'*') {
1465 name.erase(name.length()-nstars,nstars);
1468 std::string alternate(context->
GetName());
1469 alternate.append(
"::");
1470 alternate.append(name);
1474 newName.append(altcl->
GetName());
1475 newName.append(suffix);
1479 size_t ctxt_cursor = strlen(context->
GetName());
1480 for (
size_t level = 0; ctxt_cursor != 0; --ctxt_cursor) {
1481 switch (context->
GetName()[ctxt_cursor]) {
1482 case '<': --level;
break;
1483 case '>': ++level;
break;
1484 case ':':
if (level == 0) {
1488 alternate.append(context->
GetName(),ctxt_cursor+1);
1489 alternate.append(name);
1492 newName.append(altcl->
GetName());
1493 newName.append(suffix);
1503 bool HasScope(
const std::string &
name)
1507 for(
size_t i = 0, level = 0; i<name.length(); ++i) {
1509 case '<': ++level;
break;
1510 case '>': --level;
break;
1511 case ':':
if (level == 0) {
1538 info = old->GetValueClass()->GetStreamerInfo();
1549 if ((firstNewCl && !firstOldCl) || (secondNewCl && !secondOldCl))
1551 std::vector<std::string> inside;
1555 TClass *firstAltCl = firstOldCl;
1556 TClass *secondAltCl = secondOldCl;
1557 std::string firstNewName;
1558 std::string secondNewName;
1559 if (firstNewCl && !HasScope(inside[1])) {
1560 firstAltCl = FindAlternate(context, inside[1], firstNewName);
1562 if (secondNewCl && !HasScope(inside[2])) {
1563 secondAltCl = FindAlternate(context, inside[2], secondNewName);
1565 if ((firstNewCl && firstAltCl != firstOldCl) ||
1566 (secondNewCl && secondAltCl != secondOldCl) ) {
1569 std::string alternate = inside[0];
1570 alternate.append(
"<");
1571 alternate.append(firstAltCl ? firstNewName : inside[1]);
1572 alternate.append(
",");
1573 alternate.append(secondAltCl? secondNewName : inside[2]);
1577 if (alternate[alternate.length()-1]==
'>') {
1578 alternate.append(
" ");
1580 alternate.append(
">");
1585 }
else if (current->
GetValueClass() && !old->GetValueClass()
1586 && old->GetType() ==
kInt_t) {
1593 std::vector<std::string> inside;
1599 if (HasScope(inside[1])) {
1604 std::string newName;
1605 TClass *altcl = FindAlternate(context, inside[1], newName);
1608 std::string alternate = inside[0];
1609 alternate.append(
"<");
1610 alternate.append(newName);
1614 if (alternate[alternate.length()-1]==
'>') {
1615 alternate.append(
" ");
1617 alternate.append(
">");
1625 struct TBuildOldGuard {
1651 TBuildOldGuard buildOldGuard(
this);
1654 printf(
"\n====>Rebuilding TStreamerInfo for class: %s, version: %d\n",
GetName(),
fClassVersion);
1698 constexpr
size_t kSizeOfPtr =
sizeof(
void*);
1725 ROOT::TSchemaRuleSet::TMatches rules;
1731 Int_t virtualInfoLocAlloc = 0;
1756 #if defined(PROPER_IMPLEMEMANTION_OF_BASE_CLASS_RENAMING) 1777 Error(
"BuildOld",
"Could not find base class: %s for %s and could not find any matching rename rule\n", base->
GetName(),
GetName());
1787 Error(
"BuildOld",
"Could not find base class: %s for %s, renaming rule was found but is malformed\n", base->
GetName(),
GetName());
1797 else if( !baseclass ) {
1800 Warning(
"BuildOld",
"Missing base class: %s skipped", base->
GetName());
1802 baseclass =
new TClass(element->
GetName(), 1, 0, 0, -1, -1);
1803 element->
Update(0, baseclass);
1813 if (baseOffset < 0) {
1825 if (!baserule.empty()) {
1836 element->
Init(
this);
1848 if (infobase) baseclass = infobase->
GetClass();
1854 if (infobase && infobase->
fComp == 0) {
1876 if (baseOffset < 0) {
1881 offset += baseclass->
Size();
1888 Int_t baseOffset = -1;
1896 if (strchr(bc->
GetName(),
'<') || !strcmp(bc->
GetName(),
"string")) {
1899 if (bcName == elName) {
1914 Error(
"BuildOld",
"The class \"%s\" is compiled and its base class \"%s\" is a collection and we do not have a dictionary for it, we will not be able to read or write this base class.",
GetName(),bc->
GetName());
1927 if (newInfo ==
this) {
1928 baseOffset = offset;
1930 }
else if (newInfo) {
1934 const char *newElName = newElement->
GetName();
1935 if (newElement->IsBase() && (strchr(newElName,
'<') || !strcmp(newElName,
"string")) ) {
1938 if (bcName == elName) {
1944 Error(
"BuildOld",
"Could not find STL base class: %s for %s\n", element->
GetName(),
GetName());
1947 baseOffset = newElement->GetOffset();
1948 asize = newElement->GetSize();
1951 if (baseOffset == -1) {
1962 if (baseOffset < 0) {
1968 element->
Init(
this);
1983 std::string typeNameBuf;
1984 const char* dmType =
nullptr;
1986 Bool_t isUniquePtr =
false;
1989 std::array<Int_t, 5> maxIndices;
2000 element->
Init(
this);
2014 element->
Init(
this);
2023 dmType = typeNameBuf.c_str();
2030 dmType = typeNameBuf.c_str();
2031 dt =
gROOT->GetType(dmType);
2038 if (dmClassName.
Index(
"const ")==0) dmClassName.
Remove(0,6);
2043 Error(
"BuildOld",
"The class \"%s\" is compiled and for its data member \"%s\", we do not have a dictionary for the collection \"%s\", we will not be able to read or write this data member.",
GetName(),dm->
GetName(),elemDm->
GetName());
2060 element->
Init(
this);
2079 auto theType = isStdArray ? dt : dm->
GetDataType();
2091 if ((newType == ::
kChar_t) && dmIsPtr && !isArray && !hasCount) {
2093 }
else if (dmIsPtr) {
2095 }
else if (isArray) {
2099 if (newType == -1) {
2106 if (newInfo && (newInfo !=
this)) {
2109 if (newClass == 0) {
2110 newType = newElems ? newElems->
GetType() : -1;
2134 }
else if (element->
GetType() != newType) {
2147 if (oldClass == newClass.
GetClass()) {
2149 }
else if (ClassWasMovedToNamespace(oldClass, newClass.
GetClass())) {
2151 if (0 != (oldv = ImportStreamerInfo(oldClass, newClass.
GetClass()))) {
2152 Warning(
"BuildOld",
"Can not properly load the TStreamerInfo from %s into %s due to a conflict for the class version %d", oldClass->
GetName(), newClass->
GetName(), oldv);
2160 if (ContainerMatchTClonesArray(newClass.
GetClass())) {
2183 TClass *oldFixedClass = FixCollectionV5(
GetClass(),oldClass,newClass);
2184 if (oldFixedClass && oldFixedClass != oldClass) {
2185 element->
Update(oldClass,oldFixedClass);
2186 oldClass = oldFixedClass;
2189 if (CollectionMatch(oldClass, newClass)) {
2204 switch( element->
GetType() ) {
2230 }
else if (CollectionMatchFloat16(oldClass,newClass)) {
2232 }
else if (CollectionMatchDouble32(oldClass,newClass)) {
2234 }
else if (CollectionMatchLong64(oldClass,newClass)) {
2237 }
else if (CollectionMatchULong64(oldClass,newClass)) {
2250 }
else if(oldClass &&
2267 if (isUniquePtr || strncmp(dm->
GetTitle(),
"->",2)==0) {
2300 if ((!dmIsPtr || newType==
kSTLp) && (isStdArray ? ndim : dm->
GetArrayDim()) > 0) {
2305 if (newInfo && (newInfo !=
this)) {
2308 newType = newElems->
GetType();
2339 if (newType != -1) {
2347 cannotConvert =
kTRUE;
2351 printf(
"%s We have no clue\n", dm->
GetName());
2352 cannotConvert =
kTRUE;
2355 if (newType != -1) {
2359 cannotConvert =
kTRUE;
2363 cannotConvert =
kTRUE;
2367 if (cannotConvert) {
2390 strcmp(element->
GetName(),
"This") == 0 &&
2396 asize =
sizeof(std::vector<int>);
2402 if ((offset % kSizeOfPtr) != 0) {
2403 offset = offset - (offset % kSizeOfPtr) + kSizeOfPtr;
2409 if (!wasCompiled && rules) {
2410 if (rules.HasRuleWithSource( element->
GetName(),
kTRUE ) ) {
2412 if (allocClass == 0) {
2420 allocClass = infoalloc->
GetClass();
2426 && !rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2449 }
else if (rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2461 }
else if (rules && rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2497 for (iel = 0; iel < narr; ++iel) {
2500 tai[kel++] = element;
2502 arr[jel++] = element;
2505 for (kel = 0; jel < narr;) {
2506 arr[jel++] = tai[kel++];
2513 if (!wasCompiled && allocClass) {
2568 TMemberInfo(
TClass *parent) : fParent(parent) {};
2570 void SetDataType(
Int_t datatype) {
2571 fDataType = datatype;
2577 void SetClassName(
const char *name) {
2580 void SetComment(
const char *title) {
2581 const char *left = strstr(title,
"[");
2583 const char *right = strstr(left,
"]");
2586 fComment.
Append(left,right-left);
2604 if (fName != other.fName)
return kTRUE;
2607 if (fDataType != other.fDataType) {
2608 if ( (fDataType == 4 && other.fDataType == 16)
2609 || (fDataType == 16 && other.fDataType == 4) ) {
2611 }
else if ( (fDataType == 14 && other.fDataType == 17)
2612 || (fDataType == 17 && other.fDataType == 14) ) {
2614 }
else if ( (fDataType == 3 && other.fDataType == 6)
2615 ||(fDataType == 6 && other.fDataType == 3) ){
2624 }
else if (fClassName != other.fClassName) {
2625 if ( (fClassName ==
"long" && (other.fClassName ==
"long long" || other.fClassName ==
"Long64_t"))
2626 || ( (fClassName ==
"long long" || fClassName ==
"Long64_t") && other.fClassName ==
"long") ) {
2628 }
else if ( (fClassName ==
"unsigned long" && (other.fClassName ==
"unsigned long long" || other.fClassName ==
"ULong64_t"))
2629 || ( (fClassName ==
"unsigned long long" || fClassName ==
"ULong64_t") && other.fClassName ==
"unsigned long") ) {
2634 if (name != othername) {
2637 if (!CollectionMatch(cl,otherCl)) {
2638 TClass *oldFixedClass = FixCollectionV5(fParent,cl,otherCl);
2639 if (!oldFixedClass || !CollectionMatch(oldFixedClass,otherCl)) {
2648 return fComment != other.fComment;
2670 char* eaddr = ((
char*)obj) + element->
GetOffset();
2689 if (ecl && (
fClass!=ecl )) {
2708 char* eaddr = ((
char*)obj) + element->
GetOffset();
2725 if (newname && newname[0] &&
fName != newname) {
2759 R__ASSERT( (cl==0 || info==0) && (cl!=0 || info!=0) );
2792 if (el && el->
IsBase()) {
2807 if (infoel && infoel->
IsBase()) {
2808 otherClass = infoel->
GetName();
2819 if (localClass != otherClass) {
2823 "The in-memory layout version %d for class '%s' has a base class (%s) that the on-file layout version %d does not have.",
2825 }
else if (otherClass.
Length()==0) {
2827 "The on-file layout version %d for class '%s' has a base class (%s) that the in-memory layout version %d does not have",
2831 "One base class of the on-file layout version %d and of the in memory layout version %d for '%s' is different: '%s' vs '%s'",
2835 if (!complete)
return kFALSE;
2836 result = result &&
kFALSE;
2840 if (!localBase)
continue;
2843 if (!otherBaseClass)
continue;
2846 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n" 2847 " has the same version (=%d) as the active class but a different checksum.\n" 2848 " You should update the version to ClassDef(%s,%d).\n" 2849 " The objects on this file might not be readable because:\n" 2850 " The in-memory layout version %d for class '%s' has a base class (%s) with version %d but the on-file layout version %d recorded the version number %d for this base class (%s).",
2859 if (!localBaseInfo) {
2866 if (!localBaseInfo) {
2868 msg.
Form(
" The StreamerInfo of the base class %s (of class %s) read from %s%s\n" 2869 " refers to a checksum (%x) that can not be found neither in memory nor in the file.\n",
2871 file ?
"file " :
"", file ? file->
GetName() :
"",
2883 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n" 2884 " has the same version (=%d) as the active class but a different checksum.\n" 2885 " You should update the version to ClassDef(%s,%d).\n" 2886 " The objects on this file might not be readable because:\n" 2887 " The in-memory layout version %d for class '%s' has a base class (%s) with checksum %x but the on-file layout version %d recorded the checksum value %x for this base class (%s).",
2897 if (!localBase || !otherBase)
continue;
2903 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n" 2904 " has the same version (=%d) as the active class but a different checksum.\n" 2905 " You should update the version to ClassDef(%s,%d).\n" 2906 " The objects on this file might not be readable because:\n" 2907 " The in-memory layout version %d for class '%s' has a base class (%s) with version %d but the on-file layout version %d recorded the version number %d for this base class (%s).",
2917 if (localBaseInfo == otherBaseInfo ||
2923 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n" 2924 " has the same version (=%d) as the active class but a different checksum.\n" 2925 " You should update the version to ClassDef(%s,%d).\n" 2926 " The objects on this file might not be readable because:\n" 2927 " The in-memory layout version %d for class '%s' has a base class (%s) with checksum %x but the on-file layout version %d recorded the checksum value %x for this base class (%s).",
2935 if (!result && !complete) {
2944 TMemberInfo other(cl ? cl : info->
GetClass());
2955 local.SetName( el->
GetName() );
2957 local.SetComment( el->
GetTitle() );
2958 local.SetDataType( el->
GetType() );
2966 other.SetName( tdm->
GetName() );
2968 other.SetComment( tdm->
GetTitle() );
2995 other.SetName( infoel->
GetName() );
2997 other.SetComment( infoel->
GetTitle() );
2998 other.SetDataType( infoel->
GetType() );
3007 Warning(
"CompareContent",
"The following data member of\nthe in-memory layout version %d of class '%s' is missing from \nthe on-file layout version %d:\n" 3010 ,other.fClassName.Data(),other.fName.Data(),other.fComment.Data());
3012 }
else if (other.fName.Length()==0) {
3013 Warning(
"CompareContent",
"The following data member of\nthe in-memory layout version %d of class '%s' is missing from \nthe on-file layout version %d:\n" 3016 ,local.fClassName.Data(),local.fName.Data(),local.fComment.Data());
3018 Warning(
"CompareContent",
"The following data member of\nthe on-file layout version %d of class '%s' differs from \nthe in-memory layout version %d:\n" 3023 ,local.fClassName.Data(),local.fName.Data(),local.fComment.Data()
3024 ,other.fClassName.Data(),other.fName.Data(),other.fComment.Data());
3027 result = result &&
kFALSE;
3028 if (!complete)
return result;
3052 constexpr
size_t kSizeOfPtr =
sizeof(
void*);
3053 if ((fSize % kSizeOfPtr) != 0) {
3054 fSize = fSize - (fSize % kSizeOfPtr) + kSizeOfPtr;
3090 static TClassRef string_classref(
"string");
3091 if (
fClass == string_classref) {
3150 if (allocator)
return allocator->
GetClass();
3200 for (
int i=0; i<il; i++)
id =
id*3+name[i];
3208 for (
int i=0; i<il; i++)
id =
id*3+name[i];
3218 if (el->
IsBase())
continue;
3233 for (i=0; i<il; i++)
id =
id*3+name[i];
3255 type.
ReplaceAll(
"ULong64_t",
"unsigned long long");
3260 if (type==
"signed char") type =
"char";
3264 for (i=0; i<il; i++)
id =
id*3+type[i];
3279 const char *right = strstr(left,
"]");
3282 while (left != right) {
3305 fprintf(file,
" %s = 0;\n",element->
GetName());
3307 fprintf(file,
" memset(%s,0,%d);\n",element->
GetName(),element->
GetSize());
3311 fprintf(file,
" %s = 0;\n",element->
GetName());
3326 if (atstart) { fprintf(file,
" : "); atstart =
kFALSE; }
3327 else fprintf(file,
" , ");
3328 fprintf(file,
"%s(const_cast<%s &>( rhs ))\n", element->
GetName(),protoname.
Data());
3331 if (atstart) { fprintf(file,
" : "); atstart =
kFALSE; }
3332 else fprintf(file,
" , ");
3333 fprintf(file,
"%s(const_cast<%s &>( rhs ).%s)\n",element->
GetName(),protoname.
Data(),element->
GetName());
3337 fprintf(file,
"{\n");
3338 fprintf(file,
" // This is NOT a copy constructor. This is actually a move constructor (for stl container's sake).\n");
3339 fprintf(file,
" // Use at your own risk!\n");
3340 fprintf(file,
" (void)rhs; // avoid warning about unused parameter\n");
3348 if (!defMod) { fprintf(file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE; };
3349 const char *ename = element->
GetName();
3350 const char *colon2 = strstr(ename,
"::");
3351 if (colon2) ename = colon2+2;
3353 fprintf(file,
" modrhs.%s = 0;\n",ename);
3355 fprintf(file,
" memset(modrhs.%s,0,%d);\n",ename,element->
GetSize());
3358 const char *ename = element->
GetName();
3361 fprintf(file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3363 fprintf(file,
" modrhs.%s = 0;\n",ename);
3366 fprintf(file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3368 fprintf(file,
" modrhs.%s = 0;\n",ename);
3372 fprintf(file,
" for (Int_t i=0;i<%d;i++) %s[i] = rhs.%s[i];\n",element->
GetArrayLength(),ename,ename);
3374 fprintf(file,
" for (Int_t i=0;i<%d;i++) (&(%s",element->
GetArrayLength(),ename);
3376 fprintf(file,
"[0]");
3378 fprintf(file,
"))[i] = (&(rhs.%s",ename);
3380 fprintf(file,
"[0]");
3382 fprintf(file,
"))[i];\n");
3385 if (!defMod) { fprintf(file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE; };
3386 fprintf(file,
" modrhs.%s = 0;\n",ename);
3389 fprintf(file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3393 std::string method_name =
"clear";
3395 method_name =
"reset";
3397 if (element->IsBase()) {
3398 fprintf(file,
" modrhs.%s();\n", method_name.c_str());
3400 fprintf(file,
" modrhs.%s.%s();\n",ename, method_name.c_str());
3418 const char *ename = element->
GetName();
3419 const char *colon2 = strstr(ename,
"::");
3420 if (colon2) ename = colon2+2;
3423 fprintf(file,
" %s = 0;\n",ename);
3425 fprintf(file,
" memset(%s,0,%d);\n",ename,element->
GetSize());
3429 fprintf(file,
" delete %s; %s = 0;\n",ename,ename);
3431 fprintf(file,
" for (Int_t i=0;i<%d;i++) delete %s[i]; memset(%s,0,%d);\n",element->
GetArrayLength(),ename,ename,element->
GetSize());
3436 const char *ename = element->
GetName();
3438 fprintf(file,
" %s = 0;\n",ename);
3440 fprintf(file,
" delete [] %s; %s = 0;\n",ename,ename);
3444 const char *ename = element->
GetName();
3446 fprintf(file,
" %s = 0;\n",ename);
3448 fprintf(file,
" delete %s; %s = 0;\n",ename,ename);
3450 fprintf(file,
" delete [] %s; %s = 0;\n",ename,ename);
3454 const char *ename = element->
GetName();
3455 const char *prefix =
"";
3458 }
else if ( element->
IsBase() ) {
3467 fprintf(file,
" std::for_each( (%s %s).rbegin(), (%s %s).rend(), DeleteObjectFunctor() );\n",prefix,ename,prefix,ename);
3475 std::vector<std::string> inside;
3478 if (inside[1][inside[1].size()-1]==
'*' || inside[2][inside[2].size()-1]==
'*') {
3479 fprintf(file,
" std::for_each( (%s %s).rbegin(), (%s %s).rend(), DeleteObjectFunctor() );\n",prefix,ename,prefix,ename);
3485 fprintf(file,
" delete %s; %s = 0;\n",ename,ename);
3502 const char *clname =
GetName();
3504 if (strchr(clname,
':')) {
3506 Int_t len = strlen(clname);
3507 const char *
name = clname;
3510 for (
Int_t cur = 0; cur < len; ++cur) {
3511 switch (clname[cur]) {
3518 if (nest == 0) { cur = len;
continue; }
3522 if (nest == 0 && clname[cur+1] ==
':') {
3525 name = clname + cur + 2;
3532 template_protoname.
Append(clname,pr_pos);
3536 const char *where = strstr(clname,
"<");
3537 isTemplate = where != 0;
3539 template_protoname.
Append(clname,where-clname);
3543 if (needGenericTemplate && isTemplate) {
3545 fprintf(fp,
"#ifndef %s_h\n", templateName.
Data());
3546 fprintf(fp,
"#define %s_h\n", templateName.
Data());
3557 if (!element->
IsBase())
continue;
3559 const char *ename = element->
GetName();
3560 if (nbase == 1) fprintf(fp,
" : public %s",ename);
3561 else fprintf(fp,
" , public %s",ename);
3566 if (subClasses && subClasses->
GetEntries()) {
3567 Bool_t needheader =
true;
3569 TIter subnext(subClasses);
3574 if (subinfo->
GetName()[len+1]==
':' && strstr(subinfo->
GetName()+len+2,
":")==0) {
3576 fprintf(fp,
"\npublic:\n");
3577 fprintf(fp,
"// Nested classes forward declaration.\n");
3581 UInt_t sub_numberOfClasses = 0;
3582 UInt_t sub_numberOfNamespaces;
3590 for (
UInt_t i = 0;i < sub_numberOfClasses;++i) {
3591 fprintf(fp,
"}; // end of class.\n");
3593 if (sub_numberOfNamespaces > 0) {
3594 Error(
"GenerateDeclaration",
"Nested classes %s thought to be inside a namespace inside the class %s",subinfo->
GetName(),
GetName());
3601 fprintf(fp,
"\npublic:\n");
3602 fprintf(fp,
"// Nested classes declaration.\n");
3605 if (subClasses && subClasses->
GetEntries()) {
3611 if (subinfo->
GetName()[len+1]==
':' && strstr(subinfo->
GetName()+len+2,
":")==0) {
3618 fprintf(fp,
"\npublic:\n");
3619 fprintf(fp,
"// Data Members.\n");
3632 if (element->
IsBase())
continue;
3633 const char *ename = element->
GetName();
3665 lt = enamebasic.
Length();
3669 if (lt>=ltype) ltype = lt+1;
3671 for (is = 3+lt; is < (3+ltype); ++is) line +=
' ';
3674 if (element->
IsaPointer() && !strchr(line,
'*')) line[2+ltype] =
'*';
3676 if (ld>=ldata) ldata = ld+1;
3677 for (is = 3+ltype+ld; is < (3+ltype+ldata); ++is) line +=
' ';
3681 fprintf(fp,
"%s\n",line.
Data());
3684 if (needGenericTemplate && isTemplate) {
3686 fprintf(fp,
"\n %s() {\n",protoname.Data());
3689 fprintf(fp,
" %s(const %s & rhs )\n",protoname.Data(),protoname.Data());
3692 fprintf(fp,
" virtual ~%s() {\n",protoname.Data());
3694 fprintf(fp,
" }\n\n");
3698 fprintf(fp,
"\n %s();\n",protoname.Data());
3699 fprintf(fp,
" %s(const %s & );\n",protoname.Data(),protoname.Data());
3700 fprintf(fp,
" virtual ~%s();\n\n",protoname.Data());
3704 fprintf(sfp,
"#ifndef %s_cxx\n",guard.Data());
3705 fprintf(sfp,
"#define %s_cxx\n",guard.Data());
3706 fprintf(sfp,
"%s::%s() {\n",
GetName(),protoname.Data());
3710 fprintf(sfp,
"%s::%s(const %s & rhs)\n",
GetName(),protoname.Data(),protoname.Data());
3714 fprintf(sfp,
"%s::~%s() {\n",
GetName(),protoname.Data());
3717 fprintf(sfp,
"#endif // %s_cxx\n\n",guard.Data());
3725 fprintf(fp,
" ClassDef(%s,%d); // Generated by MakeProject.\n",protoname.Data(),0);
3727 fprintf(fp,
" ClassDef(%s,%d); // Generated by MakeProject.\n",protoname.Data(),
fClassVersion + 1);
3732 for(
UInt_t i=0;i<numberOfNamespaces;++i) {
3733 fprintf(fp,
"} // namespace\n");
3736 if (needGenericTemplate && isTemplate) {
3737 fprintf(fp,
"#endif // generic template declaration\n");
3746 if (inclist[0]==0) {
3752 const char *clname =
GetName();
3753 if (strchr(clname,
'<')) {
3768 const char *ename = element->
GetName();
3769 const char *colon2 = strstr(ename,
"::");
3770 if (colon2) ename = colon2+2;
3777 if (ltype < lt) ltype = lt;
3778 if (ldata < ld) ldata = ld;
3782 incRiostream =
kTRUE;
3788 if (!include[0])
continue;
3790 Bool_t greater = (include[0]==
'<');
3793 if (strncmp(include,
"include/",8)==0) {
3796 if (strncmp(include,
"include\\",9)==0) {
3799 if (strncmp(element->
GetTypeName(),
"pair<",strlen(
"pair<"))==0) {
3801 }
else if (strncmp(element->
GetTypeName(),
"auto_ptr<",strlen(
"auto_ptr<"))==0) {
3804 TString incName( include, strlen(include)-1 );
3825 if (strncmp(
GetName(),
"pair<",strlen(
"pair<"))==0)
return 0;
3826 if (strncmp(
GetName(),
"auto_ptr<",strlen(
"auto_ptr<"))==0)
return 0;
3837 for(
UInt_t i=len; i>0; --i) {
3839 case '>': ++nest;
if (scope==0) { isTemplate =
kTRUE; }
break;
3840 case '<': --nest;
break;
3842 if (nest==0 &&
GetName()[i-1]==
':') {
3845 cl =
gROOT->GetClass(nsname);
3849 }
else if (cl == 0 && extrainfos != 0) {
3864 if (
gDebug) printf(
"generating code for class %s\n",
GetName());
3870 filename.
Form(
"%s/%s.h",dirname,headername.
Data());
3872 FILE *fp = fopen(filename.
Data(),
"w");
3874 Error(
"MakeProject",
"Cannot open output file:%s\n",filename.
Data());
3879 FILE *allfp = fopen(filename.
Data(),
"a");
3881 Error(
"MakeProject",
"Cannot open output file:%s\n",filename.
Data());
3885 fprintf(allfp,
"#include \"%s.h\"\n", headername.
Data());
3888 char *inclist =
new char[50000];
3893 fprintf(fp,
"//////////////////////////////////////////////////////////\n");
3894 fprintf(fp,
"// This class has been generated by TFile::MakeProject\n");
3895 fprintf(fp,
"// (%s by ROOT version %s)\n",td.
AsString(),
gROOT->GetVersion());
3896 fprintf(fp,
"// from the StreamerInfo in file %s\n",
gDirectory->GetFile()->GetName());
3897 fprintf(fp,
"//////////////////////////////////////////////////////////\n");
3900 fprintf(fp,
"#ifndef %s_h\n",headername.
Data());
3901 fprintf(fp,
"#define %s_h\n",headername.
Data());
3908 TIter subnext(subClasses);
3917 FILE *sfp = fopen( sourcename.
Data(),
"a" );
3921 Error(
"GenerateHeaderFile",
"Could not open %s for appending",sourcename.
Data());
3925 fprintf(fp,
"#endif\n");
3929 if (sfp) fclose(sfp);
3940 char dmbracket[256];
3954 char *rdmc = (
char*)rdm->
GetName();
3957 if (dm->
IsaPointer() && rdmc[0] ==
'*') rdmc++;
3960 if (strcmp(rdmc,dm->
GetName()) == 0) {
3972 if (strstr(rdm->
GetName(),dmbracket)) {
3986 if (elementName == 0)
return 0;
4048 Int_t base_offset = 0;
4049 Int_t local_offset = 0;
4055 if (!base_cl || !base_element) {
4058 base_offset = base_element->GetOffset();
4061 offset = base_offset + local_offset;
4076 Int_t local_offset = 0;
4085 offset = base_offset + local_offset;
4133 ::Obsolete(
"TStreamerInfo::GetStreamerElementReal",
"v5-34-20",
"v6-00-02");
4135 if (i < 0 || i >=
fNdata)
return 0;
4136 if (j < 0)
return 0;
4141 for (
Int_t ise=0;ise < nelems;ise++) {
4143 if (ise+j >= nelems)
return 0;
4152 template <
typename T>
4174 #if defined(_MSC_VER) && (_MSC_VER <= 1200) 4196 #if defined(_MSC_VER) && (_MSC_VER <= 1200) 4202 #define READ_ARRAY(TYPE_t) \ 4204 Int_t sub_instance, index; \ 4205 Int_t instance = k; \ 4207 index = instance / len; \ 4208 sub_instance = instance % len; \ 4213 TYPE_t **val =(TYPE_t**)(ladd); \ 4214 return T((val[sub_instance])[index]); \ 4232 #if defined(_MSC_VER) && (_MSC_VER <= 1200) 4256 template <
typename T>
4265 if (i < 0)
return 0;
4269 if (atype ==
kSTL) {
4271 if (newClass == 0) {
4283 if (j >= nc)
return 0;
4284 char *element_ptr = (
char*)proxy->
At(j);
4285 return GetTypedValueAux<T>(atype,element_ptr,0,1);
4289 return GetTypedValueAux<T>(atype,ladd,j,len);
4298 template <
typename T>
4305 if (j >= nc)
return 0;
4320 template <
typename T>
4324 if (j >= nc)
return 0;
4326 char *pointer = (
char*)cont->
At(j);
4339 template <
typename T>
4344 if (j >= nc)
return 0;
4346 char **ptr = (
char**)cont->
At(j);
4347 char *pointer = *ptr;
4358 if (rules.empty())
return;
4363 for(
auto rule : rules) {
4364 if( rule->IsRenameRule() || rule->IsAliasRule() )
4369 if ( rule->HasTarget( element->
GetName() ) ) {
4372 if ( rule->GetAttributes()[0] != 0 ) {
4373 TString attr( rule->GetAttributes() );
4375 if (attr.Contains(
"owner")) {
4376 if (attr.Contains(
"notowner")) {
4390 const TObjArray *sources = rule->GetSource();
4391 TIter input(sources);
4393 while((src = input())) {
4396 #if 0 // Don't warn about not activating the rule. If don't warn the user can 4402 rule->AsString(ruleStr);
4403 Warning(
"InsertArtificialElements",
"For class %s in StreamerInfo %d is missing the source data member %s when trying to apply the rule:\n %s",
4411 if (!rule)
continue;
4414 typedef std::vector<TStreamerArtificial*> vec_t;
4417 if (rule->GetTarget()==0) {
4425 newel->
SetReadFunc( rule->GetReadFunctionPointer() );
4427 toAdd.push_back(newel);
4429 toAdd.reserve(rule->GetTarget()->GetEntries());
4440 newel->
SetReadFunc( rule->GetReadFunctionPointer() );
4442 toAdd.push_back(newel);
4447 for(
Int_t other = 1; other < rule->GetTarget()->GetEntries(); ++other) {
4448 objstr = (
TObjString*)(rule->GetTarget()->At(other));
4450 newName = objstr->
String();
4457 toAdd.push_back(newel);
4464 TIter s_iter(rule->GetSource());
4469 if (loc == -1 || (i+1)>loc) {
4485 for(vec_t::iterator iter = toAdd.begin(); iter != toAdd.end(); ++iter) {
4518 while ((obj = next()))
4521 if (strstr(option,
"full") != 0) {
4527 if (sequenceType.
Length()) {
4529 sequenceType +=
"]";
4531 Printf(
" i=%2d, %-15s type=%3d, offset=%3d, len=%d, method=%ld%s",
4533 sequenceType.
Data());
4537 Bool_t wantOrig = strstr(option,
"incOrig") != 0;
4547 if (sequenceType.
Length() != 0) {
4548 sequenceType +=
',';
4550 sequenceType +=
"optimized";
4552 if (sequenceType.
Length()) {
4554 sequenceType +=
"]";
4556 Printf(
" i=%2d, %-15s type=%3d, offset=%3d, len=%d, method=%ld%s",
4558 sequenceType.
Data());
4559 if (optimized && wantOrig) {
4564 if (sequenceType.
Length()) {
4566 sequenceType +=
"]";
4568 Printf(
" j=%2d, %-15s type=%3d, offset=%3d, len=%d, method=%ld%s",
4570 sequenceType.
Data());
4588 char* p = (
char*) obj;
4594 p =
new char[
fSize];
4595 memset(p, 0,
fSize);
4627 char**
r = (
char**) eaddr;
4629 for (
Int_t i = 0; i < len; ++i) {
4642 void**
r = (
void**) eaddr;
4649 const char* title = element->
GetTitle();
4650 const char* bracket1 = strrchr(title,
'(');
4651 const char* bracket2 = strrchr(title,
')');
4652 if (bracket1 && bracket2 && (bracket2 != (bracket1 + 1))) {
4653 Int_t len = bracket2 - (bracket1 + 1);
4654 char* clonesClass =
new char[len+1];
4655 clonesClass[0] =
'\0';
4656 strncat(clonesClass, bracket1 + 1, len);
4657 void**
r = (
void**) eaddr;
4659 delete[] clonesClass;
4662 void**
r = (
void**) eaddr;
4673 if (einfo) einfo->
New(eaddr);
4691 if (strcmp(element->
GetName(),
"This")==0 &&
4711 for (
Int_t i = 0; i < len; ++i, r += size) {
4734 Error(
"NewArray",
"TClass pointer is null!");
4740 char* p = (
char*) ary;
4752 char* dataBegin = (
char*) &r[2];
4765 #define DeleteBasicPointer(addr,element,name) \ 4767 name **f = (name**)(addr); \ 4768 int n = element->GetArrayLength() ? element->GetArrayLength() : 1;\ 4769 for(int j=0;j<n;j++) { \ 4784 char *p = (
char*)obj;
4788 for (
Int_t elenum = nelements - 1; elenum >= 0; --elenum) {
4827 void**
r = (
void**) eaddr;
4828 for (
Int_t j = len - 1; j >= 0; --j) {
4842 void**
r = (
void**) eaddr;
4843 for (
Int_t j = len - 1; j >= 0; --j) {
4851 if (etype ==
kBase) {