92 for(
Int_t ind = last-1; ind >= at; --ind) {
93 arr->
AddAt( arr->
At(ind), ind+1);
104 for(
Int_t ind = last-1; ind >= at; --ind) {
107 for(
size_t ins = 0; ins < objs.size(); ++ins) {
108 arr->
AddAt(objs[ins], at+ins);
117 while (at<last && arr->At(at) != oldobj) {
129 while (at<last && arr->At(at) != oldobj) {
244 struct TPreventRecursiveBuildGuard {
245 TPreventRecursiveBuildGuard(
TStreamerInfo* info): fInfo(info) {
249 ~TPreventRecursiveBuildGuard() {
280 TPreventRecursiveBuildGuard buildGuard(
this);
299 if (strncmp(
GetName(),
"ROOT::VecOps::RVec<", 19) == 0) {
300 Warning(
"Build",
"Due to some major, backward-incompatible improvements planned for ROOT::RVec, direct I/O of "
301 "ROOT::RVec objects will break between v6.24 and v6.26. Please use std::vectors instead. See "
302 "the release notes of v6.24 for more information.");
313 ROOT::TSchemaRuleSet::TMatches rules;
339 Error(
"Build()",
"Cannot stream virtual base %s of class %s",
343 const char* bname = base->
GetName();
344 const char* btitle = base->
GetTitle();
346 if (!strcmp(bname,
"string")) {
355 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);
369 Warning(
"Build",
"%s: base class %s has no streamer or dictionary it will not be saved",
GetName(), clm->
GetName());
385 if (!isTransient && !clm->
IsLoaded() && !(isCollection || isString)) {
388 Warning(
"Build",
"%s: base class %s has no streamer or dictionary it will not be saved",
GetName(), clm->
GetName());
404 std::string typeNameBuf;
405 std::string trueTypeNameBuf;
426 const char* dmName = dm->
GetName();
427 const char* dmTitle = dm->
GetTitle();
433 std::array<Int_t, 5> maxIndices;
443 while(typeNameBuf.back() ==
'*') typeNameBuf.pop_back();
444 dmFull = trueTypeNameBuf.c_str();
445 dmType = typeNameBuf.c_str();
452 trueTypeNameBuf = typeNameBuf;
453 while(typeNameBuf.back() ==
'*') typeNameBuf.pop_back();
454 dmFull = dmType = typeNameBuf.c_str();
468 const char* rbracket = ::strchr(dmTitle,
']');
469 if (lbracket && rbracket) {
474 Error(
"Build",
"%s, discarding: %s %s, illegal %s\n",
GetName(), dmFull, dmName, dmTitle);
480 if (!dtCounter || !isInteger) {
482 Error(
"Build",
"%s, discarding: %s %s, illegal [%s] (must be Int_t)\n",
GetName(), dmFull, dmName, counterName);
491 Error(
"Build",
"%s, discarding: %s %s, illegal [%s] must be placed before \n",
GetName(), dmFull, dmName, counterName);
501 if (!dmCounter && (strstr(dmFull,
"char*") || strstr(dmFull,
"Char_t*"))) {
503 dsize =
sizeof(
char*);
507 Error(
"Build",
"%s, unknown type: %s %s",
GetName(), dmFull, dmName);
509 }
else if (dmIsPtr && (dtype !=
kCharStar)) {
514 if ((
fName ==
"TString") || (
fName ==
"TClass")) {
518 Error(
"Build",
"%s, discarding: %s %s, no [dimension]\n",
GetName(), dmFull, dmName);
532 static const char* full_string_name =
"basic_string<char,char_traits<char>,allocator<char> >";
533 if (!strcmp(dmType,
"string") || !strcmp(dmType,
"std::string") || !strcmp(dmType, full_string_name)) {
537 if (proxy) element =
new TStreamerSTL(dmName, dmTitle,
offset, dmFull, *proxy, dmIsPtr);
541 auto printErrorMsg = [&](
const char* category)
544 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);
548 printErrorMsg(
"compiled");
554 printErrorMsg(
"interpreted");
564 Error(
"Build",
"%s, unknown type: %s %s\n",
GetName(), dmFull, dmName);
582 Error(
"Build",
"%s: %s has no streamer or dictionary, data member %s will not be saved",
594 Warning(
"Build",
"%s: %s has no streamer or dictionary, data member \"%s\" will not be saved",
607 for (
Int_t i = 0; i < ndim; ++i) {
609 if (isStdArray) maxIndex = maxIndices[i];
629 if ( !wasCompiled && (rules && rules.HasRuleWithSource( element->
GetName(),
kTRUE )) ) {
630 needAllocClass =
kTRUE;
639 && rules && !rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) )
668 if (needAllocClass) {
743 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
745 if (element->
GetTitle()[0] ==
'<') {
750 if (content[
c] ==
'<') ++level;
751 else if (content[
c] ==
'>') --level;
762 "Update the collection proxy of the class \"%s\" \n"
763 "\tto be similar to \"%s\".",
768 The class %s had a collection proxy when written but it is not an STL\n \
769 collection and we did not record the type of the content of the collection.\n \
770 We will claim the content is a bool (i.e. no data will be read).",
804 ::Warning(
"TClass::TClass",
"no dictionary for class %s is available",
GetName());
811 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
813 if (element->
GetTitle()[0] ==
'<') {
818 if (content[
c] ==
'<') ++level;
819 else if (content[
c] ==
'>') --level;
830 "Update the collection proxy of the class \"%s\" \n"
831 "\tto be similar to \"%s\".",
836 The class %s had a collection proxy when written but it is not an STL\n \
837 collection and we did not record the type of the content of the collection.\n \
838 We will claim the content is a bool (i.e. no data will be read).",
860 searchOnChecksum =
kFALSE;
866 searchOnChecksum =
kTRUE;
873 searchOnChecksum =
kFALSE;
879 searchOnChecksum =
kTRUE;
889 searchOnChecksum =
kFALSE;
895 searchOnChecksum =
kTRUE;
906 if (!searchOnChecksum) {
912 for (
Int_t i = -1; i < ninfos; ++i) {
929 while ((slot < ninfos) && (array->
UncheckedAt(slot) != 0)) {
975#ifdef TEST_FOR_BACKWARD_COMPATIBILITY_ABSTRACT_CLASSES
1036 for (
Int_t i = 0; i < nel; ++i) {
1054 if (oldIsNonVersioned) {
1057 The class %s transitioned from not having a specified class version\n\
1058 to having a specified class version (the current class version is %d).\n\
1059 However too many different non-versioned layouts of the class have been\n\
1060 loaded so far. This prevent the proper reading of objects written with\n\
1061 the class layout version %d, in particular from the file:\n\
1063 To work around this issue, load fewer 'old' files in the same ROOT session.",
1067 The class %s transitioned from not having a specified class version\n\
1068 to having a specified class version (the current class version is %d).\n\
1069 However too many different non-versioned layouts of the class have been\n\
1070 loaded so far. This prevent the proper reading of objects written with\n\
1071 the class layout version %d.\n\
1072 To work around this issue, load fewer 'old' files in the same ROOT session.",
1079 The StreamerInfo for version %d of class %s read from the file %s\n\
1080 has a different checksum than the previously loaded StreamerInfo.\n\
1081 Reading objects of type %s from the file %s \n\
1082 (and potentially other files) might not work correctly.\n\
1083 Most likely the version number of the class was not properly\n\
1084 updated [See ClassDef(%s,%d)].",
1088 The StreamerInfo from %s does not match existing one (%s:%d)\n\
1089 The existing one has not been used yet and will be discarded.\n\
1090 Reading the file %s will work properly, however writing object of\n\
1091 type %s will not work properly. Most likely the version number\n\
1092 of the class was not properly updated [See ClassDef(%s,%d)].",
1098 The StreamerInfo for version %d of class %s\n\
1099 has a different checksum than the previously loaded StreamerInfo.\n\
1100 Reading objects of type %s\n\
1101 (and potentially other files) might not work correctly.\n\
1102 Most likely the version number of the class was not properly\n\
1103 updated [See ClassDef(%s,%d)].",
1107 The StreamerInfo does not match existing one (%s:%d)\n\
1108 The existing one has not been used yet and will be discarded.\n\
1109 Reading should work properly, however writing object of\n\
1110 type %s will not work properly. Most likely the version number\n\
1111 of the class was not properly updated [See ClassDef(%s,%d)].",
1143#ifdef TEST_FOR_BACKWARD_COMPATIBILITY_ABSTRACT_CLASSES
1179 The StreamerInfo of class %s read from file %s\n\
1180 has the same version (=%d) as the active class but a different checksum.\n\
1181 You should update the version to ClassDef(%s,%d).\n\
1182 Do not try to write objects with the current class definition,\n\
1186 The StreamerInfo of class %s \n\
1187 has the same version (=%d) as the active class but a different checksum.\n\
1188 You should update the version to ClassDef(%s,%d).\n\
1189 Do not try to write objects with the current class definition,\n\
1197 Fatal(
"BuildCheck",
"\n\
1198 The StreamerInfo of unversioned class %s \n\
1199 has the same version (=%d) as the active class but an old checksum.\n\
1231 fNumber = maininfo->GetNumber();
1264 for (
Int_t i=0;i < ndata;i++) {
1266 if (!element)
break;
1273 if (ty <=
kULong)
continue;
1277 {
for (
int j=ndata-1;j>=i;j--) {elements->
AddAtAndExpand(elements->
At(j),j+1);}}
1278 elements->
AddAt(bt,i);
1300 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() );
1318 if (oldClass == 0 || newClass == 0)
return kFALSE;
1323 const char *oldname = oldClass->
GetName();
1324 for (
UInt_t i = oldlen, done =
false, nest = 0; (i>0) && !done ; --i) {
1325 switch (oldClass->
GetName()[i-1]) {
1326 case '>' : ++nest;
break;
1327 case '<' :
if (nest==0)
return kFALSE;
1329 case ':' :
if (nest == 0) oldname= &(oldClass->
GetName()[i]); done =
kTRUE;
break;
1332 oldlen = strlen(oldname);
1333 if (!(strlen(newClass->
GetName()) > strlen(oldClass->
GetName()))) {
1337 const char* newEnd = & (newClass->
GetName()[newlen-oldlen]);
1339 if (0 != strcmp(newEnd, oldname)) {
1367 Error(
"ImportStreamerInfo",
"Unable to clone the StreamerInfo for %s.",(*next)->GetName());
1413 if (oldContent == newContent) {
1414 contentMatch =
kTRUE;
1415 }
else if (newContent) {
1418 if (oldFlatContent == newFlatContent) {
1419 contentMatch =
kTRUE;
1425 contentMatch = (newContent==0);
1429 if ((oldContent==0 && oldProxy->
GetType() == newProxy->
GetType())
1506 TClass *FindAlternate(
TClass *context,
const std::string &i_name, std::string& newName)
1512 std::string
name(i_name);
1514 if (
name.compare(0,6,
"const ")==0) {
1520 while(
name[
name.length()-nstars-1]==
'*') {
1525 name.erase(
name.length()-nstars,nstars);
1528 std::string alternate(context->
GetName());
1529 alternate.append(
"::");
1530 alternate.append(
name);
1534 newName.append(altcl->
GetName());
1535 newName.append(suffix);
1539 size_t ctxt_cursor = strlen(context->
GetName());
1540 for (
size_t level = 0; ctxt_cursor != 0; --ctxt_cursor) {
1541 switch (context->
GetName()[ctxt_cursor]) {
1542 case '<': --level;
break;
1543 case '>': ++level;
break;
1544 case ':':
if (level == 0) {
1548 alternate.append(context->
GetName(),ctxt_cursor+1);
1549 alternate.append(
name);
1552 newName.append(altcl->
GetName());
1553 newName.append(suffix);
1604 if ((firstNewCl && !firstOldCl) || (secondNewCl && !secondOldCl))
1606 std::vector<std::string> inside;
1610 TClass *firstAltCl = firstOldCl;
1611 TClass *secondAltCl = secondOldCl;
1612 std::string firstNewName;
1613 std::string secondNewName;
1614 if (!info && !firstOldCl) {
1617 if (!info && !secondOldCl) {
1620 if (firstNewCl && !firstOldCl) {
1621 firstAltCl = FindAlternate(context, inside[1], firstNewName);
1622 }
else if (firstAltCl) {
1623 firstNewName = firstAltCl->
GetName();
1625 firstNewName = inside[1];
1627 if (secondNewCl && !secondOldCl) {
1628 secondAltCl = FindAlternate(context, inside[2], secondNewName);
1629 }
else if (secondAltCl) {
1630 secondNewName = secondAltCl->
GetName();
1632 secondNewName = inside[2];
1634 if ((firstNewCl && firstAltCl != firstOldCl) ||
1635 (secondNewCl && secondAltCl != secondOldCl) ) {
1638 std::string alternate = inside[0];
1639 alternate.append(
"<");
1640 alternate.append(firstNewName);
1641 alternate.append(
",");
1642 alternate.append(secondNewName);
1646 if (alternate[alternate.length()-1]==
'>') {
1647 alternate.append(
" ");
1649 alternate.append(
">");
1662 std::vector<std::string> inside;
1667 std::string newName;
1668 TClass *altcl = FindAlternate(context, inside[1], newName);
1671 std::string alternate = inside[0];
1672 alternate.append(
"<");
1673 alternate.append(newName);
1677 if (alternate[alternate.length()-1]==
'>') {
1678 alternate.append(
" ");
1680 alternate.append(
">");
1688 struct TBuildOldGuard {
1714 TBuildOldGuard buildOldGuard(
this);
1717 printf(
"\n====>Rebuilding TStreamerInfo for class: %s, version: %d\n",
GetName(),
fClassVersion);
1761 constexpr size_t kSizeOfPtr =
sizeof(
void*);
1788 ROOT::TSchemaRuleSet::TMatches rules;
1794 Int_t virtualInfoLocAlloc = 0;
1819#if defined(PROPER_IMPLEMEMANTION_OF_BASE_CLASS_RENAMING)
1842 Error(
"BuildOld",
"Could not find base class: %s for %s and could not find any matching rename rule\n", base->
GetName(),
GetName());
1852 Error(
"BuildOld",
"Could not find base class: %s for %s, renaming rule was found but is malformed\n", base->
GetName(),
GetName());
1862 else if( !baseclass ) {
1865 Warning(
"BuildOld",
"Missing base class: %s skipped", base->
GetName());
1867 baseclass =
new TClass(element->
GetName(), 1, 0, 0, -1, -1);
1868 element->
Update(0, baseclass);
1878 if (baseOffset < 0) {
1890 if (!baserule.empty()) {
1901 element->
Init(
this);
1913 if (infobase) baseclass = infobase->
GetClass();
1919 if (infobase && infobase->
fComp == 0) {
1941 if (baseOffset < 0) {
1953 Int_t baseOffset = -1;
1961 if (strchr(bc->
GetName(),
'<') || !strcmp(bc->
GetName(),
"string")) {
1964 if (bcName == elName) {
1979 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());
1992 if (newInfo ==
this) {
1995 }
else if (newInfo) {
1999 const char *newElName = newElement->
GetName();
2000 if (newElement->
IsBase() && (strchr(newElName,
'<') || !strcmp(newElName,
"string")) ) {
2003 if (bcName == elName) {
2009 Error(
"BuildOld",
"Could not find STL base class: %s for %s\n", element->
GetName(),
GetName());
2013 asize = newElement->
GetSize();
2016 if (baseOffset == -1) {
2027 if (baseOffset < 0) {
2033 element->
Init(
this);
2048 std::string typeNameBuf;
2049 const char* dmType =
nullptr;
2053 std::array<Int_t, 5> maxIndices;
2064 element->
Init(
this);
2078 element->
Init(
this);
2087 dmType = typeNameBuf.c_str();
2094 dmType = typeNameBuf.c_str();
2102 if (dmClassName.
Index(
"const ")==0) dmClassName.
Remove(0,6);
2107 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());
2124 element->
Init(
this);
2137 element->
Init(
this);
2138 if (pattern && pattern !=
this && pattern->IsBuilt()) {
2139 int pair_element_offset =
kMissing;
2140 pattern->GetStreamerElement(element->
GetName(), pair_element_offset);
2141 if (pair_element_offset !=
kMissing) {
2142 element->
SetOffset(pair_element_offset);
2145 }
else if (strcmp(element->
GetName(),
"fData") == 0 && strncmp(
GetName(),
"ROOT::VecOps::RVec", 18) == 0) {
2146 Error(
"BuildCheck",
"Reading RVecs that were written directly to file before ROOT v6.24 is not "
2147 "supported, the program will likely crash.");
2149 element->
Init(
this);
2161 auto theType = isStdArray ? dt : dm->
GetDataType();
2173 if ((newType ==
::kChar_t) && dmIsPtr && !isArray && !hasCount) {
2175 }
else if (dmIsPtr) {
2177 }
else if (isArray) {
2181 if (newType == -1) {
2188 if (newInfo && (newInfo !=
this)) {
2191 if (newClass == 0) {
2192 newType = newElems ? newElems->
GetType() : -1;
2216 }
else if (element->
GetType() != newType) {
2229 if (oldClass == newClass.
GetClass()) {
2231 }
else if (ClassWasMovedToNamespace(oldClass, newClass.
GetClass())) {
2233 if (0 != (oldv = ImportStreamerInfo(oldClass, newClass.
GetClass()))) {
2234 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);
2242 if (ContainerMatchTClonesArray(newClass.
GetClass())) {
2265 TClass *oldFixedClass = FixCollectionV5(
GetClass(),oldClass,newClass);
2266 if (oldFixedClass && oldFixedClass != oldClass) {
2267 element->
Update(oldClass,oldFixedClass);
2268 oldClass = oldFixedClass;
2271 if (CollectionMatch(oldClass, newClass)) {
2286 switch( element->
GetType() ) {
2312 }
else if (CollectionMatchFloat16(oldClass,newClass)) {
2314 }
else if (CollectionMatchDouble32(oldClass,newClass)) {
2316 }
else if (CollectionMatchLong64(oldClass,newClass)) {
2319 }
else if (CollectionMatchULong64(oldClass,newClass)) {
2332 }
else if(oldClass &&
2349 if (strncmp(dm->
GetTitle(),
"->",2)==0) {
2382 if ((!dmIsPtr || newType==
kSTLp) && (isStdArray ? ndim : dm->
GetArrayDim()) > 0) {
2387 if (newInfo && (newInfo !=
this)) {
2390 newType = newElems->
GetType();
2421 if (newType != -1) {
2429 cannotConvert =
kTRUE;
2433 printf(
"%s We have no clue\n", dm->
GetName());
2434 cannotConvert =
kTRUE;
2437 if (newType != -1) {
2441 cannotConvert =
kTRUE;
2445 cannotConvert =
kTRUE;
2449 if (cannotConvert) {
2472 strcmp(element->
GetName(),
"This") == 0 &&
2478 asize =
sizeof(std::vector<int>);
2484 if ((
offset % kSizeOfPtr) != 0) {
2491 if (!wasCompiled && rules) {
2492 if (rules.HasRuleWithSource( element->
GetName(),
kTRUE ) ) {
2494 if (allocClass == 0) {
2502 allocClass = infoalloc->
GetClass();
2508 && !rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2530 }
else if (rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2542 }
else if (rules && rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2578 for (iel = 0; iel < narr; ++iel) {
2581 tai[kel++] = element;
2583 arr[jel++] = element;
2586 for (kel = 0; jel < narr;) {
2587 arr[jel++] = tai[kel++];
2594 if (!wasCompiled && allocClass) {
2632 element->SetOffset(0);
2658 TMemberInfo(
TClass *parent) : fParent(parent) {};
2660 void SetDataType(
Int_t datatype) {
2661 fDataType = datatype;
2667 void SetClassName(
const char *
name) {
2670 void SetComment(
const char *title) {
2671 const char *left = strstr(title,
"[");
2673 const char *right = strstr(left,
"]");
2676 fComment.
Append(left,right-left);
2694 if (fName != other.fName)
return kTRUE;
2697 if (fDataType != other.fDataType) {
2698 if ( (fDataType == 4 && other.fDataType == 16)
2699 || (fDataType == 16 && other.fDataType == 4) ) {
2701 }
else if ( (fDataType == 14 && other.fDataType == 17)
2702 || (fDataType == 17 && other.fDataType == 14) ) {
2704 }
else if ( (fDataType == 3 && other.fDataType == 6)
2705 ||(fDataType == 6 && other.fDataType == 3) ){
2714 }
else if (fClassName != other.fClassName) {
2715 if ( (fClassName ==
"long" && (other.fClassName ==
"long long" || other.fClassName ==
"Long64_t"))
2716 || ( (fClassName ==
"long long" || fClassName ==
"Long64_t") && other.fClassName ==
"long") ) {
2718 }
else if ( (fClassName ==
"unsigned long" && (other.fClassName ==
"unsigned long long" || other.fClassName ==
"ULong64_t"))
2719 || ( (fClassName ==
"unsigned long long" || fClassName ==
"ULong64_t") && other.fClassName ==
"unsigned long") ) {
2724 if (
name != othername) {
2727 if (!CollectionMatch(cl,otherCl)) {
2728 TClass *oldFixedClass = FixCollectionV5(fParent,cl,otherCl);
2729 if (!oldFixedClass || !CollectionMatch(oldFixedClass,otherCl)) {
2738 return fComment != other.fComment;
2760 char* eaddr = ((
char*)obj) + element->
GetOffset();
2779 if (ecl && (
fClass!=ecl )) {
2798 char* eaddr = ((
char*)obj) + element->
GetOffset();
2815 if (newname && newname[0] &&
fName != newname) {
2818 for(
Int_t i = 0; i < ndata; ++i) {
2851 R__ASSERT( (cl==0 || info==0) && (cl!=0 || info!=0) );
2884 if (el && el->
IsBase()) {
2899 if (infoel && infoel->
IsBase()) {
2900 otherClass = infoel->
GetName();
2911 if (localClass != otherClass) {
2915 "The in-memory layout version %d for class '%s' has a base class (%s) that the on-file layout version %d does not have.",
2917 }
else if (otherClass.
Length()==0) {
2919 "The on-file layout version %d for class '%s' has a base class (%s) that the in-memory layout version %d does not have",
2923 "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'",
2927 if (!complete)
return kFALSE;
2932 if (!localBase)
continue;
2935 if (!otherBaseClass)
continue;
2938 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2939 " has the same version (=%d) as the active class but a different checksum.\n"
2940 " You should update the version to ClassDef(%s,%d).\n"
2941 " The objects on this file might not be readable because:\n"
2942 " 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).",
2951 if (!localBaseInfo) {
2955 const TList *list =
file->GetStreamerInfoCache();
2958 if (!localBaseInfo) {
2960 msg.
Form(
" The StreamerInfo of the base class %s (of class %s) read from %s%s\n"
2961 " refers to a checksum (%x) that can not be found neither in memory nor in the file.\n",
2975 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2976 " has the same version (=%d) as the active class but a different checksum.\n"
2977 " You should update the version to ClassDef(%s,%d).\n"
2978 " The objects on this file might not be readable because:\n"
2979 " 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).",
2989 if (!localBase || !otherBase)
continue;
2995 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2996 " has the same version (=%d) as the active class but a different checksum.\n"
2997 " You should update the version to ClassDef(%s,%d).\n"
2998 " The objects on this file might not be readable because:\n"
2999 " 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).",
3009 if (localBaseInfo == otherBaseInfo ||
3015 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
3016 " has the same version (=%d) as the active class but a different checksum.\n"
3017 " You should update the version to ClassDef(%s,%d).\n"
3018 " The objects on this file might not be readable because:\n"
3019 " 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).",
3027 if (!
result && !complete) {
3036 TMemberInfo other(cl ? cl : info->
GetClass());
3045 local.SetName( el->
GetName() );
3047 local.SetComment( el->
GetTitle() );
3048 local.SetDataType( el->
GetType() );
3056 other.SetName( tdm->
GetName() );
3058 other.SetComment( tdm->
GetTitle() );
3085 other.SetName( infoel->
GetName() );
3087 other.SetComment( infoel->
GetTitle() );
3088 other.SetDataType( infoel->
GetType() );
3097 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"
3100 ,other.fClassName.Data(),other.fName.Data(),other.fComment.Data());
3102 }
else if (other.fName.Length()==0) {
3103 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"
3106 ,local.fClassName.Data(),local.fName.Data(),local.fComment.Data());
3108 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"
3113 ,local.fClassName.Data(),local.fName.Data(),local.fComment.Data()
3114 ,other.fClassName.Data(),other.fName.Data(),other.fComment.Data());
3118 if (!complete)
return result;
3148 constexpr size_t kSizeOfPtr =
sizeof(
void*);
3185 auto recurseIntoContent = [
file, force](
TClass *contentClass)
3193 si = contentClass->GetCurrentStreamerInfo();
3195 si = contentClass->GetStreamerInfo();
3204 static TClassRef string_classref(
"string");
3205 if (
fClass == string_classref) {
3220 recurseIntoContent(valueClass);
3236 recurseIntoContent(cl);
3255 if (allocator)
return allocator->
GetClass();
3305 for (
int i=0; i<il; i++)
id =
id*3+
name[i];
3317 for (
int i=0; i<il; i++)
id =
id*3+
name[i];
3328 if (el->
IsBase())
continue;
3343 for (i=0; i<il; i++)
id =
id*3+
name[i];
3365 type.ReplaceAll(
"ULong64_t",
"unsigned long long");
3366 type.ReplaceAll(
"Long64_t",
"long long");
3367 type.ReplaceAll(
"signed char",
"char");
3368 type.ReplaceAll(
"<signed char",
"<char");
3369 type.ReplaceAll(
",signed char",
",char");
3370 if (
type==
"signed char")
type =
"char";
3374 for (i=0; i<il; i++)
id =
id*3+
type[i];
3389 const char *right = strstr(left,
"]");
3392 while (left != right) {
3436 constexpr auto auto_ptr_len =
str_length(
"auto_ptr<");
3437 constexpr auto unique_ptr_len =
str_length(
"unique_ptr<");
3441 return ((strncmp(
name,
"auto_ptr<", auto_ptr_len) == 0)
3442 || (strncmp(
name,
"unique_ptr<", unique_ptr_len) == 0));
3458 if (!defMod) { fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE; };
3459 const char *ename = element->
GetName();
3460 const char *colon2 = strstr(ename,
"::");
3461 if (colon2) ename = colon2+2;
3463 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3465 fprintf(
file,
" memset(modrhs.%s,0,%d);\n",ename,element->
GetSize());
3468 const char *ename = element->
GetName();
3471 fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3473 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3476 fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3478 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3482 fprintf(
file,
" for (Int_t i=0;i<%d;i++) %s[i] = rhs.%s[i];\n",element->
GetArrayLength(),ename,ename);
3485 fprintf(
file,
")[i] = reinterpret_cast<%s const *>(rhs.%s)[i];\n", element->
GetTypeName(), ename);
3488 if (!defMod) { fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE; };
3489 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3492 fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3496 std::string method_name =
"clear";
3498 method_name =
"reset";
3501 fprintf(
file,
" modrhs.%s();\n", method_name.c_str());
3503 fprintf(
file,
" modrhs.%s.%s();\n",ename, method_name.c_str());
3520 if (atstart) { fprintf(
file,
" : "); atstart =
kFALSE; }
3521 else fprintf(
file,
" , ");
3522 fprintf(
file,
"%s(const_cast<%s &>( rhs ))\n", element->
GetName(),protoname.
Data());
3525 if (atstart) { fprintf(
file,
" : "); atstart =
kFALSE; }
3526 else fprintf(
file,
" , ");
3528 fprintf(
file,
"%s(const_cast<%s &>( rhs ).%s.release() )\n",element->
GetName(),protoname.
Data(),element->
GetName());
3530 fprintf(
file,
"%s(const_cast<%s &>( rhs ).%s)\n",element->
GetName(),protoname.
Data(),element->
GetName());
3535 fprintf(
file,
"{\n");
3536 fprintf(
file,
" // This is NOT a copy constructor. This is actually a move constructor (for stl container's sake).\n");
3537 fprintf(
file,
" // Use at your own risk!\n");
3538 fprintf(
file,
" (void)rhs; // avoid warning about unused parameter\n");
3548 fprintf(
file,
"{\n");
3549 fprintf(
file,
" // This is NOT a copy operator=. This is actually a move operator= (for stl container's sake).\n");
3550 fprintf(
file,
" // Use at your own risk!\n");
3551 fprintf(
file,
" (void)rhs; // avoid warning about unused parameter\n");
3557 fprintf(
file,
" %s::operator=(const_cast<%s &>( rhs ));\n", element->
GetName(),protoname.
Data());
3561 fprintf(
file,
" %s = std::move((const_cast<%s &>( rhs ).%s));\n",element->
GetName(),protoname.
Data(),element->
GetName());
3563 fprintf(
file,
" %s = (const_cast<%s &>( rhs ).%s);\n",element->
GetName(),protoname.
Data(),element->
GetName());
3571 fprintf(
file,
" return *this;\n");
3585 const char *ename = element->
GetName();
3586 const char *colon2 = strstr(ename,
"::");
3587 if (colon2) ename = colon2+2;
3590 fprintf(
file,
" %s = 0;\n",ename);
3592 fprintf(
file,
" memset(%s,0,%d);\n",ename,element->
GetSize());
3596 fprintf(
file,
" delete %s; %s = 0;\n",ename,ename);
3598 fprintf(
file,
" for (Int_t i=0;i<%d;i++) delete %s[i]; memset(%s,0,%d);\n",element->
GetArrayLength(),ename,ename,element->
GetSize());
3603 const char *ename = element->
GetName();
3605 fprintf(
file,
" %s = 0;\n",ename);
3607 fprintf(
file,
" delete [] %s; %s = 0;\n",ename,ename);
3611 const char *ename = element->
GetName();
3613 fprintf(
file,
" %s = 0;\n",ename);
3615 fprintf(
file,
" delete %s; %s = 0;\n",ename,ename);
3617 fprintf(
file,
" delete [] %s; %s = 0;\n",ename,ename);
3621 const char *ename = element->
GetName();
3622 const char *prefix =
"";
3625 }
else if ( element->
IsBase() ) {
3634 fprintf(
file,
" std::for_each( (%s %s).rbegin(), (%s %s).rend(), DeleteObjectFunctor() );\n",prefix,ename,prefix,ename);
3642 std::vector<std::string> inside;
3645 if ((!inside[1].empty() && inside[1][inside[1].
size()-1]==
'*')
3646 || (!inside[2].empty() && inside[2][inside[2].
size()-1]==
'*')) {
3647 fprintf(
file,
" std::for_each( (%s %s).rbegin(), (%s %s).rend(), DeleteObjectFunctor() );\n",prefix,ename,prefix,ename);
3653 fprintf(
file,
" delete %s; %s = 0;\n",ename,ename);
3670 const char *clname =
GetName();
3672 if (strchr(clname,
':')) {
3675 const char *
name = clname;
3678 for (
Int_t cur = 0; cur <
len; ++cur) {
3679 switch (clname[cur]) {
3686 if (nest == 0) { cur =
len;
continue; }
3690 if (nest == 0 && clname[cur+1] ==
':') {
3693 name = clname + cur + 2;
3700 template_protoname.
Append(clname,pr_pos);
3704 const char *where = strstr(clname,
"<");
3705 isTemplate = where != 0;
3707 template_protoname.
Append(clname,where-clname);
3711 if (needGenericTemplate && isTemplate) {
3713 fprintf(fp,
"#ifndef %s_h\n", templateName.
Data());
3714 fprintf(fp,
"#define %s_h\n", templateName.
Data());
3725 if (!element->
IsBase())
continue;
3727 const char *ename = element->
GetName();
3728 if (nbase == 1) fprintf(fp,
" : public %s",ename);
3729 else fprintf(fp,
" , public %s",ename);
3734 if (subClasses && subClasses->
GetEntries()) {
3735 Bool_t needheader =
true;
3737 TIter subnext(subClasses);
3744 fprintf(fp,
"\npublic:\n");
3745 fprintf(fp,
"// Nested classes forward declaration.\n");
3749 UInt_t sub_numberOfClasses = 0;
3750 UInt_t sub_numberOfNamespaces;
3758 for (
UInt_t i = 0;i < sub_numberOfClasses;++i) {
3759 fprintf(fp,
"}; // end of class.\n");
3761 if (sub_numberOfNamespaces > 0) {
3762 Error(
"GenerateDeclaration",
"Nested classes %s thought to be inside a namespace inside the class %s",subinfo->
GetName(),
GetName());
3769 fprintf(fp,
"\npublic:\n");
3770 fprintf(fp,
"// Nested classes declaration.\n");
3773 if (subClasses && subClasses->
GetEntries()) {
3786 fprintf(fp,
"\npublic:\n");
3787 fprintf(fp,
"// Data Members.\n");
3800 if (element->
IsBase())
continue;
3801 const char *ename = element->
GetName();
3831 }
else if (strncmp(enamebasic.
Data(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
3835 lt = enamebasic.
Length();
3839 if (lt>=ltype) ltype = lt+1;
3841 for (is = 3+lt; is < (3+ltype); ++is)
line +=
' ';
3846 if (ld>=ldata) ldata = ld+1;
3847 for (is = 3+ltype+ld; is < (3+ltype+ldata); ++is)
line +=
' ';
3851 fprintf(fp,
"%s\n",
line.Data());
3854 if (needGenericTemplate && isTemplate) {
3856 fprintf(fp,
"\n %s() {\n",protoname.
Data());
3859 fprintf(fp,
" %s(%s && ) = default;\n",protoname.
Data(),protoname.
Data());
3860 fprintf(fp,
" %s &operator=(const %s & rhs)\n ",protoname.
Data(),protoname.
Data());
3863 fprintf(fp,
" %s(const %s & rhs )\n ",protoname.
Data(),protoname.
Data());
3866 fprintf(fp,
" virtual ~%s() {\n ",protoname.
Data());
3868 fprintf(fp,
" }\n\n");
3872 fprintf(fp,
"\n %s();\n",protoname.
Data());
3873 fprintf(fp,
" %s(%s && ) = default;\n",protoname.
Data(),protoname.
Data());
3874 fprintf(fp,
" %s &operator=(const %s & );\n",protoname.
Data(),protoname.
Data());
3875 fprintf(fp,
" %s(const %s & );\n",protoname.
Data(),protoname.
Data());
3876 fprintf(fp,
" virtual ~%s();\n\n",protoname.
Data());
3880 fprintf(sfp,
"#ifndef %s_cxx\n",guard.
Data());
3881 fprintf(sfp,
"#define %s_cxx\n",guard.
Data());
3882 fprintf(sfp,
"%s::%s() {\n",
GetName(),protoname.
Data());
3886 fprintf(sfp,
"%s &%s::operator=(const %s & rhs)\n",
GetName(),
GetName(),protoname.
Data());
3890 fprintf(sfp,
"%s::%s(const %s & rhs)\n",
GetName(),protoname.
Data(),protoname.
Data());
3894 fprintf(sfp,
"%s::~%s() {\n",
GetName(),protoname.
Data());
3897 fprintf(sfp,
"#endif // %s_cxx\n\n",guard.
Data());
3905 fprintf(fp,
" ClassDef(%s,%d); // Generated by MakeProject.\n",protoname.
Data(),0);
3907 fprintf(fp,
" ClassDef(%s,%d); // Generated by MakeProject.\n",protoname.
Data(),
fClassVersion + 1);
3912 for(
UInt_t i=0;i<numberOfNamespaces;++i) {
3913 fprintf(fp,
"} // namespace\n");
3916 if (needGenericTemplate && isTemplate) {
3917 fprintf(fp,
"#endif // generic template declaration\n");
3926 if (inclist[0]==0) {
3932 const char *clname =
GetName();
3933 if (strchr(clname,
'<')) {
3948 const char *ename = element->
GetName();
3949 const char *colon2 = strstr(ename,
"::");
3950 if (colon2) ename = colon2+2;
3957 if (ltype < lt) ltype = lt;
3958 if (ldata < ld) ldata = ld;
3962 incRiostream =
kTRUE;
3968 if (!include[0])
continue;
3970 Bool_t greater = (include[0]==
'<');
3973 if (strncmp(include,
"include/",8)==0) {
3976 if (strncmp(include,
"include\\",9)==0) {
3981 }
else if (strncmp(element->
GetTypeName(),
"auto_ptr<",strlen(
"auto_ptr<"))==0) {
3984 TString incName( include, strlen(include)-1 );
4006 if (strncmp(
GetName(),
"auto_ptr<",strlen(
"auto_ptr<"))==0)
return 0;
4019 case '>': ++nest;
if (scope==0) { isTemplate =
kTRUE; }
break;
4020 case '<': --nest;
break;
4022 if (nest==0 &&
GetName()[i-1]==
':') {
4029 }
else if (cl == 0 && extrainfos != 0) {
4044 if (
gDebug) printf(
"generating code for class %s\n",
GetName());
4052 FILE *fp = fopen(
filename.Data(),
"w");
4054 Error(
"MakeProject",
"Cannot open output file:%s\n",
filename.Data());
4059 FILE *allfp = fopen(
filename.Data(),
"a");
4061 Error(
"MakeProject",
"Cannot open output file:%s\n",
filename.Data());
4065 fprintf(allfp,
"#include \"%s.h\"\n", headername.
Data());
4068 char *inclist =
new char[50000];
4073 fprintf(fp,
"//////////////////////////////////////////////////////////\n");
4074 fprintf(fp,
"// This class has been generated by TFile::MakeProject\n");
4075 fprintf(fp,
"// (%s by ROOT version %s)\n",td.
AsString(),
gROOT->GetVersion());
4076 fprintf(fp,
"// from the StreamerInfo in file %s\n",
gDirectory->GetFile()->GetName());
4077 fprintf(fp,
"//////////////////////////////////////////////////////////\n");
4080 fprintf(fp,
"#ifndef %s_h\n",headername.
Data());
4081 fprintf(fp,
"#define %s_h\n",headername.
Data());
4087 TIter subnext(subClasses);
4096 FILE *sfp = fopen( sourcename.
Data(),
"a" );
4100 Error(
"GenerateHeaderFile",
"Could not open %s for appending",sourcename.
Data());
4104 fprintf(fp,
"#endif\n");
4108 if (sfp) fclose(sfp);
4119 char dmbracket[256];
4133 char *rdmc = (
char*)rdm->
GetName();
4136 if (dm->
IsaPointer() && rdmc[0] ==
'*') rdmc++;
4139 if (strcmp(rdmc,dm->
GetName()) == 0) {
4151 if (strstr(rdm->
GetName(),dmbracket)) {
4165 if (elementName == 0)
return 0;
4227 Int_t base_offset = 0;
4228 Int_t local_offset = 0;
4234 if (!base_cl || !base_element) {
4237 base_offset = base_element->
GetOffset();
4240 offset = base_offset + local_offset;
4255 Int_t local_offset = 0;
4264 offset = base_offset + local_offset;
4312 ::Obsolete(
"TStreamerInfo::GetStreamerElementReal",
"v5-34-20",
"v6-00-02");
4314 if (i < 0 || i >=
fNdata)
return 0;
4315 if (j < 0)
return 0;
4320 for (
Int_t ise=0;ise < nelems;ise++) {
4322 if (ise+j >= nelems)
return 0;
4331template <
typename T>
4353#if defined(_MSC_VER) && (_MSC_VER <= 1200)
4375#if defined(_MSC_VER) && (_MSC_VER <= 1200)
4381#define READ_ARRAY(TYPE_t) \
4383 Int_t sub_instance, index; \
4384 Int_t instance = k; \
4386 index = instance / len; \
4387 sub_instance = instance % len; \
4392 TYPE_t **val =(TYPE_t**)(ladd); \
4393 return T((val[sub_instance])[index]); \
4411#if defined(_MSC_VER) && (_MSC_VER <= 1200)