92 for(
Int_t ind = last-1; ind >= at; --ind) {
93 arr->
AddAt( arr->
At(ind), ind+1);
101 Int_t offset = objs.size();
104 for(
Int_t ind = last-1; ind >= at; --ind) {
105 arr->
AddAt( arr->
At(ind), ind+offset);
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) {
243 struct TPreventRecursiveBuildGuard {
244 TPreventRecursiveBuildGuard(
TStreamerInfo* info): fInfo(info) {
248 ~TPreventRecursiveBuildGuard() {
279 TPreventRecursiveBuildGuard buildGuard(
this);
305 ROOT::TSchemaRuleSet::TMatches rules;
331 Error(
"Build()",
"Cannot stream virtual base %s of class %s",
335 const char* bname = base->
GetName();
336 const char* btitle = base->
GetTitle();
338 if (!strcmp(bname,
"string")) {
347 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);
353 element =
new TStreamerBase(bname, btitle, offset, isTransient);
361 Warning(
"Build",
"%s: base class %s has no streamer or dictionary it will not be saved",
GetName(), clm->
GetName());
377 if (!isTransient && !clm->
IsLoaded() && !(isCollection || isString)) {
380 Warning(
"Build",
"%s: base class %s has no streamer or dictionary it will not be saved",
GetName(), clm->
GetName());
396 std::string typeNameBuf;
397 std::string trueTypeNameBuf;
418 const char* dmName = dm->
GetName();
419 const char* dmTitle = dm->
GetTitle();
425 std::array<Int_t, 5> maxIndices;
435 while(typeNameBuf.back() ==
'*') typeNameBuf.pop_back();
436 dmFull = trueTypeNameBuf.c_str();
437 dmType = typeNameBuf.c_str();
444 trueTypeNameBuf = typeNameBuf;
445 while(typeNameBuf.back() ==
'*') typeNameBuf.pop_back();
446 dmFull = dmType = typeNameBuf.c_str();
447 dt =
gROOT->GetType(dmType);
460 const char* rbracket = ::strchr(dmTitle,
']');
461 if (lbracket && rbracket) {
466 Error(
"Build",
"%s, discarding: %s %s, illegal %s\n",
GetName(), dmFull, dmName, dmTitle);
472 if (!dtCounter || !isInteger) {
474 Error(
"Build",
"%s, discarding: %s %s, illegal [%s] (must be Int_t)\n",
GetName(), dmFull, dmName, counterName);
483 Error(
"Build",
"%s, discarding: %s %s, illegal [%s] must be placed before \n",
GetName(), dmFull, dmName, counterName);
493 if (!dmCounter && (strstr(dmFull,
"char*") || strstr(dmFull,
"Char_t*"))) {
495 dsize =
sizeof(
char*);
499 Error(
"Build",
"%s, unknown type: %s %s",
GetName(), dmFull, dmName);
501 }
else if (dmIsPtr && (dtype !=
kCharStar)) {
506 if ((
fName ==
"TString") || (
fName ==
"TClass")) {
510 Error(
"Build",
"%s, discarding: %s %s, no [dimension]\n",
GetName(), dmFull, dmName);
524 static const char* full_string_name =
"basic_string<char,char_traits<char>,allocator<char> >";
525 if (!strcmp(dmType,
"string") || !strcmp(dmType,
"std::string") || !strcmp(dmType, full_string_name)) {
529 if (proxy) element =
new TStreamerSTL(dmName, dmTitle, offset, dmFull, *proxy, dmIsPtr);
530 else element =
new TStreamerSTL(dmName, dmTitle, offset, dmFull, dmFull, dmIsPtr);
533 auto printErrorMsg = [&](
const char* category)
536 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);
540 printErrorMsg(
"compiled");
546 printErrorMsg(
"interpreted");
556 Error(
"Build",
"%s, unknown type: %s %s\n",
GetName(), dmFull, dmName);
574 Error(
"Build",
"%s: %s has no streamer or dictionary, data member %s will not be saved",
586 Warning(
"Build",
"%s: %s has no streamer or dictionary, data member \"%s\" will not be saved",
599 for (
Int_t i = 0; i < ndim; ++i) {
601 if (isStdArray) maxIndex = maxIndices[i];
621 if ( !wasCompiled && (rules && rules.HasRuleWithSource( element->
GetName(),
kTRUE )) ) {
622 needAllocClass =
kTRUE;
631 && rules && !rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) )
660 if (needAllocClass) {
735 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
737 if (element->
GetTitle()[0] ==
'<') {
742 if (content[
c] ==
'<') ++level;
743 else if (content[
c] ==
'>') --level;
754 "Update the collection proxy of the class \"%s\" \n"
755 "\tto be similar to \"%s\".",
760 The class %s had a collection proxy when written but it is not an STL\n \
761 collection and we did not record the type of the content of the collection.\n \
762 We will claim the content is a bool (i.e. no data will be read).",
794 ::Warning(
"TClass::TClass",
"no dictionary for class %s is available",
GetName());
801 Bool_t isstl = element && strcmp(
"This",element->
GetName())==0;
803 if (element->
GetTitle()[0] ==
'<') {
808 if (content[
c] ==
'<') ++level;
809 else if (content[
c] ==
'>') --level;
820 "Update the collection proxy of the class \"%s\" \n"
821 "\tto be similar to \"%s\".",
826 The class %s had a collection proxy when written but it is not an STL\n \
827 collection and we did not record the type of the content of the collection.\n \
828 We will claim the content is a bool (i.e. no data will be read).",
850 searchOnChecksum =
kFALSE;
856 searchOnChecksum =
kTRUE;
863 searchOnChecksum =
kFALSE;
869 searchOnChecksum =
kTRUE;
879 searchOnChecksum =
kFALSE;
885 searchOnChecksum =
kTRUE;
896 if (!searchOnChecksum) {
902 for (
Int_t i = -1; i < ninfos; ++i) {
919 while ((slot < ninfos) && (array->
UncheckedAt(slot) != 0)) {
965#ifdef TEST_FOR_BACKWARD_COMPATIBILITY_ABSTRACT_CLASSES
1026 for (
Int_t i = 0; i < nel; ++i) {
1044 if (oldIsNonVersioned) {
1047 The class %s transitioned from not having a specified class version\n\
1048 to having a specified class version (the current class version is %d).\n\
1049 However too many different non-versioned layouts of the class have been\n\
1050 loaded so far. This prevent the proper reading of objects written with\n\
1051 the class layout version %d, in particular from the file:\n\
1053 To work around this issue, load fewer 'old' files in the same ROOT session.",
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.\n\
1062 To work around this issue, load fewer 'old' files in the same ROOT session.",
1069 The StreamerInfo for version %d of class %s read from the file %s\n\
1070 has a different checksum than the previously loaded StreamerInfo.\n\
1071 Reading objects of type %s from the file %s \n\
1072 (and potentially other files) might not work correctly.\n\
1073 Most likely the version number of the class was not properly\n\
1074 updated [See ClassDef(%s,%d)].",
1078 The StreamerInfo from %s does not match existing one (%s:%d)\n\
1079 The existing one has not been used yet and will be discarded.\n\
1080 Reading the file %s will work properly, however writing object of\n\
1081 type %s will not work properly. Most likely the version number\n\
1082 of the class was not properly updated [See ClassDef(%s,%d)].",
1088 The StreamerInfo for version %d of class %s\n\
1089 has a different checksum than the previously loaded StreamerInfo.\n\
1090 Reading objects of type %s\n\
1091 (and potentially other files) might not work correctly.\n\
1092 Most likely the version number of the class was not properly\n\
1093 updated [See ClassDef(%s,%d)].",
1097 The StreamerInfo from %s does not match existing one (%s:%d)\n\
1098 The existing one has not been used yet and will be discarded.\n\
1099 Reading should work properly, however writing object of\n\
1100 type %s will not work properly. Most likely the version number\n\
1101 of the class was not properly updated [See ClassDef(%s,%d)].",
1133#ifdef TEST_FOR_BACKWARD_COMPATIBILITY_ABSTRACT_CLASSES
1169 The StreamerInfo of class %s read from file %s\n\
1170 has the same version (=%d) as the active class but a different checksum.\n\
1171 You should update the version to ClassDef(%s,%d).\n\
1172 Do not try to write objects with the current class definition,\n\
1176 The StreamerInfo of class %s \n\
1177 has the same version (=%d) as the active class but a different checksum.\n\
1178 You should update the version to ClassDef(%s,%d).\n\
1179 Do not try to write objects with the current class definition,\n\
1187 Fatal(
"BuildCheck",
"\n\
1188 The StreamerInfo of unversioned class %s \n\
1189 has the same version (=%d) as the active class but an old checksum.\n\
1221 fNumber = maininfo->GetNumber();
1254 for (
Int_t i=0;i < ndata;i++) {
1256 if (!element)
break;
1263 if (ty <=
kULong)
continue;
1267 {
for (
int j=ndata-1;j>=i;j--) {elements->
AddAtAndExpand(elements->
At(j),j+1);}}
1268 elements->
AddAt(bt,i);
1290 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() );
1308 if (oldClass == 0 || newClass == 0)
return kFALSE;
1313 const char *oldname = oldClass->
GetName();
1314 for (
UInt_t i = oldlen, done =
false, nest = 0; (i>0) && !done ; --i) {
1315 switch (oldClass->
GetName()[i-1]) {
1316 case '>' : ++nest;
break;
1317 case '<' :
if (nest==0)
return kFALSE;
1319 case ':' :
if (nest == 0) oldname= &(oldClass->
GetName()[i]); done =
kTRUE;
break;
1322 oldlen = strlen(oldname);
1323 if (!(strlen(newClass->
GetName()) > strlen(oldClass->
GetName()))) {
1327 const char* newEnd = & (newClass->
GetName()[newlen-oldlen]);
1329 if (0 != strcmp(newEnd, oldname)) {
1357 Error(
"ImportStreamerInfo",
"Unable to clone the StreamerInfo for %s.",(*next)->GetName());
1403 if (oldContent == newContent) {
1404 contentMatch =
kTRUE;
1405 }
else if (newContent) {
1408 if (oldFlatContent == newFlatContent) {
1409 contentMatch =
kTRUE;
1415 contentMatch = (newContent==0);
1419 if ((oldContent==0 && oldProxy->
GetType() == newProxy->
GetType())
1496 TClass *FindAlternate(
TClass *context,
const std::string &i_name, std::string& newName)
1502 std::string
name(i_name);
1504 if (
name.compare(0,6,
"const ")==0) {
1510 while(
name[
name.length()-nstars-1]==
'*') {
1515 name.erase(
name.length()-nstars,nstars);
1518 std::string alternate(context->
GetName());
1519 alternate.append(
"::");
1520 alternate.append(
name);
1524 newName.append(altcl->
GetName());
1525 newName.append(suffix);
1529 size_t ctxt_cursor = strlen(context->
GetName());
1530 for (
size_t level = 0; ctxt_cursor != 0; --ctxt_cursor) {
1531 switch (context->
GetName()[ctxt_cursor]) {
1532 case '<': --level;
break;
1533 case '>': ++level;
break;
1534 case ':':
if (level == 0) {
1538 alternate.append(context->
GetName(),ctxt_cursor+1);
1539 alternate.append(
name);
1542 newName.append(altcl->
GetName());
1543 newName.append(suffix);
1588 TClass *firstNewCl =
f ?
f->GetClass() : 0;
1589 TClass *secondNewCl =
s ?
s->GetClass() : 0;
1594 if ((firstNewCl && !firstOldCl) || (secondNewCl && !secondOldCl))
1596 std::vector<std::string> inside;
1600 TClass *firstAltCl = firstOldCl;
1601 TClass *secondAltCl = secondOldCl;
1602 std::string firstNewName;
1603 std::string secondNewName;
1604 if (!info && !firstOldCl) {
1607 if (!info && !secondOldCl) {
1610 if (firstNewCl && !firstOldCl) {
1611 firstAltCl = FindAlternate(context, inside[1], firstNewName);
1612 }
else if (firstAltCl) {
1613 firstNewName = firstAltCl->
GetName();
1615 firstNewName = inside[1];
1617 if (secondNewCl && !secondOldCl) {
1618 secondAltCl = FindAlternate(context, inside[2], secondNewName);
1619 }
else if (secondAltCl) {
1620 secondNewName = secondAltCl->
GetName();
1622 secondNewName = inside[2];
1624 if ((firstNewCl && firstAltCl != firstOldCl) ||
1625 (secondNewCl && secondAltCl != secondOldCl) ) {
1628 std::string alternate = inside[0];
1629 alternate.append(
"<");
1630 alternate.append(firstNewName);
1631 alternate.append(
",");
1632 alternate.append(secondNewName);
1636 if (alternate[alternate.length()-1]==
'>') {
1637 alternate.append(
" ");
1639 alternate.append(
">");
1652 std::vector<std::string> inside;
1657 std::string newName;
1658 TClass *altcl = FindAlternate(context, inside[1], newName);
1661 std::string alternate = inside[0];
1662 alternate.append(
"<");
1663 alternate.append(newName);
1667 if (alternate[alternate.length()-1]==
'>') {
1668 alternate.append(
" ");
1670 alternate.append(
">");
1678 struct TBuildOldGuard {
1704 TBuildOldGuard buildOldGuard(
this);
1707 printf(
"\n====>Rebuilding TStreamerInfo for class: %s, version: %d\n",
GetName(),
fClassVersion);
1751 constexpr size_t kSizeOfPtr =
sizeof(
void*);
1778 ROOT::TSchemaRuleSet::TMatches rules;
1784 Int_t virtualInfoLocAlloc = 0;
1809#if defined(PROPER_IMPLEMEMANTION_OF_BASE_CLASS_RENAMING)
1832 Error(
"BuildOld",
"Could not find base class: %s for %s and could not find any matching rename rule\n", base->
GetName(),
GetName());
1842 Error(
"BuildOld",
"Could not find base class: %s for %s, renaming rule was found but is malformed\n", base->
GetName(),
GetName());
1852 else if( !baseclass ) {
1855 Warning(
"BuildOld",
"Missing base class: %s skipped", base->
GetName());
1857 baseclass =
new TClass(element->
GetName(), 1, 0, 0, -1, -1);
1858 element->
Update(0, baseclass);
1868 if (baseOffset < 0) {
1880 if (!baserule.empty()) {
1891 element->
Init(
this);
1903 if (infobase) baseclass = infobase->
GetClass();
1909 if (infobase && infobase->
fComp == 0) {
1931 if (baseOffset < 0) {
1936 offset += baseclass->
Size();
1943 Int_t baseOffset = -1;
1951 if (strchr(bc->
GetName(),
'<') || !strcmp(bc->
GetName(),
"string")) {
1954 if (bcName == elName) {
1969 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());
1982 if (newInfo ==
this) {
1983 baseOffset = offset;
1985 }
else if (newInfo) {
1989 const char *newElName = newElement->
GetName();
1990 if (newElement->
IsBase() && (strchr(newElName,
'<') || !strcmp(newElName,
"string")) ) {
1993 if (bcName == elName) {
1999 Error(
"BuildOld",
"Could not find STL base class: %s for %s\n", element->
GetName(),
GetName());
2003 asize = newElement->
GetSize();
2006 if (baseOffset == -1) {
2017 if (baseOffset < 0) {
2023 element->
Init(
this);
2038 std::string typeNameBuf;
2039 const char* dmType =
nullptr;
2043 std::array<Int_t, 5> maxIndices;
2054 element->
Init(
this);
2068 element->
Init(
this);
2077 dmType = typeNameBuf.c_str();
2084 dmType = typeNameBuf.c_str();
2085 dt =
gROOT->GetType(dmType);
2092 if (dmClassName.
Index(
"const ")==0) dmClassName.
Remove(0,6);
2097 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());
2114 element->
Init(
this);
2127 element->
Init(
this);
2129 int pair_element_offset =
kMissing;
2130 pattern->GetStreamerElement(element->
GetName(), pair_element_offset);
2143 auto theType = isStdArray ? dt : dm->
GetDataType();
2155 if ((newType ==
::kChar_t) && dmIsPtr && !isArray && !hasCount) {
2157 }
else if (dmIsPtr) {
2159 }
else if (isArray) {
2163 if (newType == -1) {
2170 if (newInfo && (newInfo !=
this)) {
2173 if (newClass == 0) {
2174 newType = newElems ? newElems->
GetType() : -1;
2198 }
else if (element->
GetType() != newType) {
2211 if (oldClass == newClass.
GetClass()) {
2213 }
else if (ClassWasMovedToNamespace(oldClass, newClass.
GetClass())) {
2215 if (0 != (oldv = ImportStreamerInfo(oldClass, newClass.
GetClass()))) {
2216 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);
2224 if (ContainerMatchTClonesArray(newClass.
GetClass())) {
2247 TClass *oldFixedClass = FixCollectionV5(
GetClass(),oldClass,newClass);
2248 if (oldFixedClass && oldFixedClass != oldClass) {
2249 element->
Update(oldClass,oldFixedClass);
2250 oldClass = oldFixedClass;
2253 if (CollectionMatch(oldClass, newClass)) {
2266 if (
ms &&
ms->IsValid()) {
2268 switch( element->
GetType() ) {
2294 }
else if (CollectionMatchFloat16(oldClass,newClass)) {
2296 }
else if (CollectionMatchDouble32(oldClass,newClass)) {
2298 }
else if (CollectionMatchLong64(oldClass,newClass)) {
2301 }
else if (CollectionMatchULong64(oldClass,newClass)) {
2314 }
else if(oldClass &&
2331 if (strncmp(dm->
GetTitle(),
"->",2)==0) {
2364 if ((!dmIsPtr || newType==
kSTLp) && (isStdArray ? ndim : dm->
GetArrayDim()) > 0) {
2369 if (newInfo && (newInfo !=
this)) {
2372 newType = newElems->
GetType();
2403 if (newType != -1) {
2411 cannotConvert =
kTRUE;
2415 printf(
"%s We have no clue\n", dm->
GetName());
2416 cannotConvert =
kTRUE;
2419 if (newType != -1) {
2423 cannotConvert =
kTRUE;
2427 cannotConvert =
kTRUE;
2431 if (cannotConvert) {
2454 strcmp(element->
GetName(),
"This") == 0 &&
2460 asize =
sizeof(std::vector<int>);
2466 if ((offset % kSizeOfPtr) != 0) {
2467 offset = offset - (offset % kSizeOfPtr) + kSizeOfPtr;
2473 if (!wasCompiled && rules) {
2474 if (rules.HasRuleWithSource( element->
GetName(),
kTRUE ) ) {
2476 if (allocClass == 0) {
2484 allocClass = infoalloc->
GetClass();
2490 && !rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2512 }
else if (rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2524 }
else if (rules && rules.HasRuleWithTarget( element->
GetName(),
kTRUE ) ) {
2560 for (iel = 0; iel < narr; ++iel) {
2563 tai[kel++] = element;
2565 arr[jel++] = element;
2568 for (kel = 0; jel < narr;) {
2569 arr[jel++] = tai[kel++];
2576 if (!wasCompiled && allocClass) {
2633 TMemberInfo(
TClass *parent) : fParent(parent) {};
2635 void SetDataType(
Int_t datatype) {
2636 fDataType = datatype;
2642 void SetClassName(
const char *
name) {
2645 void SetComment(
const char *title) {
2646 const char *left = strstr(title,
"[");
2648 const char *right = strstr(left,
"]");
2651 fComment.
Append(left,right-left);
2669 if (fName != other.fName)
return kTRUE;
2672 if (fDataType != other.fDataType) {
2673 if ( (fDataType == 4 && other.fDataType == 16)
2674 || (fDataType == 16 && other.fDataType == 4) ) {
2676 }
else if ( (fDataType == 14 && other.fDataType == 17)
2677 || (fDataType == 17 && other.fDataType == 14) ) {
2679 }
else if ( (fDataType == 3 && other.fDataType == 6)
2680 ||(fDataType == 6 && other.fDataType == 3) ){
2689 }
else if (fClassName != other.fClassName) {
2690 if ( (fClassName ==
"long" && (other.fClassName ==
"long long" || other.fClassName ==
"Long64_t"))
2691 || ( (fClassName ==
"long long" || fClassName ==
"Long64_t") && other.fClassName ==
"long") ) {
2693 }
else if ( (fClassName ==
"unsigned long" && (other.fClassName ==
"unsigned long long" || other.fClassName ==
"ULong64_t"))
2694 || ( (fClassName ==
"unsigned long long" || fClassName ==
"ULong64_t") && other.fClassName ==
"unsigned long") ) {
2699 if (
name != othername) {
2702 if (!CollectionMatch(cl,otherCl)) {
2703 TClass *oldFixedClass = FixCollectionV5(fParent,cl,otherCl);
2704 if (!oldFixedClass || !CollectionMatch(oldFixedClass,otherCl)) {
2713 return fComment != other.fComment;
2735 char* eaddr = ((
char*)obj) + element->
GetOffset();
2754 if (ecl && (
fClass!=ecl )) {
2773 char* eaddr = ((
char*)obj) + element->
GetOffset();
2790 if (newname && newname[0] &&
fName != newname) {
2793 for(
Int_t i = 0; i < ndata; ++i) {
2826 R__ASSERT( (cl==0 || info==0) && (cl!=0 || info!=0) );
2859 if (el && el->
IsBase()) {
2874 if (infoel && infoel->
IsBase()) {
2875 otherClass = infoel->
GetName();
2886 if (localClass != otherClass) {
2890 "The in-memory layout version %d for class '%s' has a base class (%s) that the on-file layout version %d does not have.",
2892 }
else if (otherClass.
Length()==0) {
2894 "The on-file layout version %d for class '%s' has a base class (%s) that the in-memory layout version %d does not have",
2898 "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'",
2902 if (!complete)
return kFALSE;
2903 result = result &&
kFALSE;
2907 if (!localBase)
continue;
2910 if (!otherBaseClass)
continue;
2913 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2914 " has the same version (=%d) as the active class but a different checksum.\n"
2915 " You should update the version to ClassDef(%s,%d).\n"
2916 " The objects on this file might not be readable because:\n"
2917 " 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).",
2926 if (!localBaseInfo) {
2930 const TList *list =
file->GetStreamerInfoCache();
2933 if (!localBaseInfo) {
2935 msg.
Form(
" The StreamerInfo of the base class %s (of class %s) read from %s%s\n"
2936 " refers to a checksum (%x) that can not be found neither in memory nor in the file.\n",
2950 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2951 " has the same version (=%d) as the active class but a different checksum.\n"
2952 " You should update the version to ClassDef(%s,%d).\n"
2953 " The objects on this file might not be readable because:\n"
2954 " 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).",
2964 if (!localBase || !otherBase)
continue;
2970 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2971 " has the same version (=%d) as the active class but a different checksum.\n"
2972 " You should update the version to ClassDef(%s,%d).\n"
2973 " The objects on this file might not be readable because:\n"
2974 " 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).",
2984 if (localBaseInfo == otherBaseInfo ||
2990 msg.
Form(
" The StreamerInfo of class %s read from %s%s\n"
2991 " has the same version (=%d) as the active class but a different checksum.\n"
2992 " You should update the version to ClassDef(%s,%d).\n"
2993 " The objects on this file might not be readable because:\n"
2994 " 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).",
3002 if (!result && !complete) {
3011 TMemberInfo other(cl ? cl : info->
GetClass());
3022 local.SetName( el->
GetName() );
3024 local.SetComment( el->
GetTitle() );
3025 local.SetDataType( el->
GetType() );
3033 other.SetName( tdm->
GetName() );
3035 other.SetComment( tdm->
GetTitle() );
3062 other.SetName( infoel->
GetName() );
3064 other.SetComment( infoel->
GetTitle() );
3065 other.SetDataType( infoel->
GetType() );
3074 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"
3077 ,other.fClassName.Data(),other.fName.Data(),other.fComment.Data());
3079 }
else if (other.fName.Length()==0) {
3080 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"
3083 ,local.fClassName.Data(),local.fName.Data(),local.fComment.Data());
3085 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"
3090 ,local.fClassName.Data(),local.fName.Data(),local.fComment.Data()
3091 ,other.fClassName.Data(),other.fName.Data(),other.fComment.Data());
3094 result = result &&
kFALSE;
3095 if (!complete)
return result;
3126 constexpr size_t kSizeOfPtr =
sizeof(
void*);
3164 static TClassRef string_classref(
"string");
3165 if (
fClass == string_classref) {
3224 if (allocator)
return allocator->
GetClass();
3274 for (
int i=0; i<il; i++)
id =
id*3+
name[i];
3286 for (
int i=0; i<il; i++)
id =
id*3+
name[i];
3297 if (el->
IsBase())
continue;
3312 for (i=0; i<il; i++)
id =
id*3+
name[i];
3334 type.ReplaceAll(
"ULong64_t",
"unsigned long long");
3335 type.ReplaceAll(
"Long64_t",
"long long");
3336 type.ReplaceAll(
"signed char",
"char");
3337 type.ReplaceAll(
"<signed char",
"<char");
3338 type.ReplaceAll(
",signed char",
",char");
3339 if (
type==
"signed char")
type =
"char";
3343 for (i=0; i<il; i++)
id =
id*3+
type[i];
3358 const char *right = strstr(left,
"]");
3361 while (left != right) {
3405 constexpr auto auto_ptr_len =
str_length(
"auto_ptr<");
3406 constexpr auto unique_ptr_len =
str_length(
"unique_ptr<");
3410 return ((strncmp(
name,
"auto_ptr<", auto_ptr_len) == 0)
3411 || (strncmp(
name,
"unique_ptr<", unique_ptr_len) == 0));
3424 if (atstart) { fprintf(
file,
" : "); atstart =
kFALSE; }
3425 else fprintf(
file,
" , ");
3426 fprintf(
file,
"%s(const_cast<%s &>( rhs ))\n", element->
GetName(),protoname.
Data());
3429 if (atstart) { fprintf(
file,
" : "); atstart =
kFALSE; }
3430 else fprintf(
file,
" , ");
3432 fprintf(
file,
"%s(const_cast<%s &>( rhs ).%s.release() )\n",element->
GetName(),protoname.
Data(),element->
GetName());
3434 fprintf(
file,
"%s(const_cast<%s &>( rhs ).%s)\n",element->
GetName(),protoname.
Data(),element->
GetName());
3439 fprintf(
file,
"{\n");
3440 fprintf(
file,
" // This is NOT a copy constructor. This is actually a move constructor (for stl container's sake).\n");
3441 fprintf(
file,
" // Use at your own risk!\n");
3442 fprintf(
file,
" (void)rhs; // avoid warning about unused parameter\n");
3450 if (!defMod) { fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE; };
3451 const char *ename = element->
GetName();
3452 const char *colon2 = strstr(ename,
"::");
3453 if (colon2) ename = colon2+2;
3455 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3457 fprintf(
file,
" memset(modrhs.%s,0,%d);\n",ename,element->
GetSize());
3460 const char *ename = element->
GetName();
3463 fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3465 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3468 fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3470 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3474 fprintf(
file,
" for (Int_t i=0;i<%d;i++) %s[i] = rhs.%s[i];\n",element->
GetArrayLength(),ename,ename);
3478 fprintf(
file,
"[0]");
3480 fprintf(
file,
"))[i] = (&(rhs.%s",ename);
3482 fprintf(
file,
"[0]");
3484 fprintf(
file,
"))[i];\n");
3487 if (!defMod) { fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE; };
3488 fprintf(
file,
" modrhs.%s = 0;\n",ename);
3491 fprintf(
file,
" %s &modrhs = const_cast<%s &>( rhs );\n",protoname.
Data(),protoname.
Data()); defMod =
kTRUE;
3495 std::string method_name =
"clear";
3497 method_name =
"reset";
3500 fprintf(
file,
" modrhs.%s();\n", method_name.c_str());
3502 fprintf(
file,
" modrhs.%s.%s();\n",ename, method_name.c_str());
3520 const char *ename = element->
GetName();
3521 const char *colon2 = strstr(ename,
"::");
3522 if (colon2) ename = colon2+2;
3525 fprintf(
file,
" %s = 0;\n",ename);
3527 fprintf(
file,
" memset(%s,0,%d);\n",ename,element->
GetSize());
3531 fprintf(
file,
" delete %s; %s = 0;\n",ename,ename);
3533 fprintf(
file,
" for (Int_t i=0;i<%d;i++) delete %s[i]; memset(%s,0,%d);\n",element->
GetArrayLength(),ename,ename,element->
GetSize());
3538 const char *ename = element->
GetName();
3540 fprintf(
file,
" %s = 0;\n",ename);
3542 fprintf(
file,
" delete [] %s; %s = 0;\n",ename,ename);
3546 const char *ename = element->
GetName();
3548 fprintf(
file,
" %s = 0;\n",ename);
3550 fprintf(
file,
" delete %s; %s = 0;\n",ename,ename);
3552 fprintf(
file,
" delete [] %s; %s = 0;\n",ename,ename);
3556 const char *ename = element->
GetName();
3557 const char *prefix =
"";
3560 }
else if ( element->
IsBase() ) {
3569 fprintf(
file,
" std::for_each( (%s %s).rbegin(), (%s %s).rend(), DeleteObjectFunctor() );\n",prefix,ename,prefix,ename);
3577 std::vector<std::string> inside;
3580 if ((!inside[1].empty() && inside[1][inside[1].size()-1]==
'*')
3581 || (!inside[2].empty() && inside[2][inside[2].size()-1]==
'*')) {
3582 fprintf(
file,
" std::for_each( (%s %s).rbegin(), (%s %s).rend(), DeleteObjectFunctor() );\n",prefix,ename,prefix,ename);
3588 fprintf(
file,
" delete %s; %s = 0;\n",ename,ename);
3605 const char *clname =
GetName();
3607 if (strchr(clname,
':')) {
3609 Int_t len = strlen(clname);
3610 const char *
name = clname;
3613 for (
Int_t cur = 0; cur < len; ++cur) {
3614 switch (clname[cur]) {
3621 if (nest == 0) { cur = len;
continue; }
3625 if (nest == 0 && clname[cur+1] ==
':') {
3628 name = clname + cur + 2;
3635 template_protoname.
Append(clname,pr_pos);
3639 const char *where = strstr(clname,
"<");
3640 isTemplate = where != 0;
3642 template_protoname.
Append(clname,where-clname);
3646 if (needGenericTemplate && isTemplate) {
3648 fprintf(fp,
"#ifndef %s_h\n", templateName.
Data());
3649 fprintf(fp,
"#define %s_h\n", templateName.
Data());
3660 if (!element->
IsBase())
continue;
3662 const char *ename = element->
GetName();
3663 if (nbase == 1) fprintf(fp,
" : public %s",ename);
3664 else fprintf(fp,
" , public %s",ename);
3669 if (subClasses && subClasses->
GetEntries()) {
3670 Bool_t needheader =
true;
3672 TIter subnext(subClasses);
3677 if (subinfo->
GetName()[len+1]==
':' && strstr(subinfo->
GetName()+len+2,
":")==0) {
3679 fprintf(fp,
"\npublic:\n");
3680 fprintf(fp,
"// Nested classes forward declaration.\n");
3684 UInt_t sub_numberOfClasses = 0;
3685 UInt_t sub_numberOfNamespaces;
3693 for (
UInt_t i = 0;i < sub_numberOfClasses;++i) {
3694 fprintf(fp,
"}; // end of class.\n");
3696 if (sub_numberOfNamespaces > 0) {
3697 Error(
"GenerateDeclaration",
"Nested classes %s thought to be inside a namespace inside the class %s",subinfo->
GetName(),
GetName());
3704 fprintf(fp,
"\npublic:\n");
3705 fprintf(fp,
"// Nested classes declaration.\n");
3708 if (subClasses && subClasses->
GetEntries()) {
3714 if (subinfo->
GetName()[len+1]==
':' && strstr(subinfo->
GetName()+len+2,
":")==0) {
3721 fprintf(fp,
"\npublic:\n");
3722 fprintf(fp,
"// Data Members.\n");
3735 if (element->
IsBase())
continue;
3736 const char *ename = element->
GetName();
3766 }
else if (strncmp(enamebasic.
Data(),
"auto_ptr<", strlen(
"auto_ptr<")) == 0) {
3770 lt = enamebasic.
Length();
3774 if (lt>=ltype) ltype = lt+1;
3776 for (is = 3+lt; is < (3+ltype); ++is)
line +=
' ';
3781 if (ld>=ldata) ldata = ld+1;
3782 for (is = 3+ltype+ld; is < (3+ltype+ldata); ++is)
line +=
' ';
3786 fprintf(fp,
"%s\n",
line.Data());
3789 if (needGenericTemplate && isTemplate) {
3791 fprintf(fp,
"\n %s() {\n",protoname.
Data());
3794 fprintf(fp,
" %s(%s && ) = default;\n",protoname.
Data(),protoname.
Data());
3795 fprintf(fp,
" %s(const %s & rhs )\n",protoname.
Data(),protoname.
Data());
3798 fprintf(fp,
" virtual ~%s() {\n",protoname.
Data());
3800 fprintf(fp,
" }\n\n");
3804 fprintf(fp,
"\n %s();\n",protoname.
Data());
3805 fprintf(fp,
" %s(%s && ) = default;\n",protoname.
Data(),protoname.
Data());
3806 fprintf(fp,
" %s(const %s & );\n",protoname.
Data(),protoname.
Data());
3807 fprintf(fp,
" virtual ~%s();\n\n",protoname.
Data());
3811 fprintf(sfp,
"#ifndef %s_cxx\n",guard.
Data());
3812 fprintf(sfp,
"#define %s_cxx\n",guard.
Data());
3813 fprintf(sfp,
"%s::%s() {\n",
GetName(),protoname.
Data());
3817 fprintf(sfp,
"%s::%s(const %s & rhs)\n",
GetName(),protoname.
Data(),protoname.
Data());
3821 fprintf(sfp,
"%s::~%s() {\n",
GetName(),protoname.
Data());
3824 fprintf(sfp,
"#endif // %s_cxx\n\n",guard.
Data());
3832 fprintf(fp,
" ClassDef(%s,%d); // Generated by MakeProject.\n",protoname.
Data(),0);
3834 fprintf(fp,
" ClassDef(%s,%d); // Generated by MakeProject.\n",protoname.
Data(),
fClassVersion + 1);
3839 for(
UInt_t i=0;i<numberOfNamespaces;++i) {
3840 fprintf(fp,
"} // namespace\n");
3843 if (needGenericTemplate && isTemplate) {
3844 fprintf(fp,
"#endif // generic template declaration\n");
3853 if (inclist[0]==0) {
3859 const char *clname =
GetName();
3860 if (strchr(clname,
'<')) {
3875 const char *ename = element->
GetName();
3876 const char *colon2 = strstr(ename,
"::");
3877 if (colon2) ename = colon2+2;
3884 if (ltype < lt) ltype = lt;
3885 if (ldata < ld) ldata = ld;
3889 incRiostream =
kTRUE;
3895 if (!include[0])
continue;
3897 Bool_t greater = (include[0]==
'<');
3900 if (strncmp(include,
"include/",8)==0) {
3903 if (strncmp(include,
"include\\",9)==0) {
3908 }
else if (strncmp(element->
GetTypeName(),
"auto_ptr<",strlen(
"auto_ptr<"))==0) {
3911 TString incName( include, strlen(include)-1 );
3933 if (strncmp(
GetName(),
"auto_ptr<",strlen(
"auto_ptr<"))==0)
return 0;
3944 for(
UInt_t i=len; i>0; --i) {
3946 case '>': ++nest;
if (scope==0) { isTemplate =
kTRUE; }
break;
3947 case '<': --nest;
break;
3949 if (nest==0 &&
GetName()[i-1]==
':') {
3952 cl =
gROOT->GetClass(nsname);
3956 }
else if (cl == 0 && extrainfos != 0) {
3971 if (
gDebug) printf(
"generating code for class %s\n",
GetName());
3977 filename.
Form(
"%s/%s.h",dirname,headername.
Data());
3979 FILE *fp = fopen(filename.
Data(),
"w");
3981 Error(
"MakeProject",
"Cannot open output file:%s\n",filename.
Data());
3986 FILE *allfp = fopen(filename.
Data(),
"a");
3988 Error(
"MakeProject",
"Cannot open output file:%s\n",filename.
Data());
3992 fprintf(allfp,
"#include \"%s.h\"\n", headername.
Data());
3995 char *inclist =
new char[50000];
4000 fprintf(fp,
"//////////////////////////////////////////////////////////\n");
4001 fprintf(fp,
"// This class has been generated by TFile::MakeProject\n");
4002 fprintf(fp,
"// (%s by ROOT version %s)\n",td.
AsString(),
gROOT->GetVersion());
4003 fprintf(fp,
"// from the StreamerInfo in file %s\n",
gDirectory->GetFile()->GetName());
4004 fprintf(fp,
"//////////////////////////////////////////////////////////\n");
4007 fprintf(fp,
"#ifndef %s_h\n",headername.
Data());
4008 fprintf(fp,
"#define %s_h\n",headername.
Data());
4015 TIter subnext(subClasses);
4024 FILE *sfp = fopen( sourcename.
Data(),
"a" );
4028 Error(
"GenerateHeaderFile",
"Could not open %s for appending",sourcename.
Data());
4032 fprintf(fp,
"#endif\n");
4036 if (sfp) fclose(sfp);
4047 char dmbracket[256];
4061 char *rdmc = (
char*)rdm->
GetName();
4064 if (dm->
IsaPointer() && rdmc[0] ==
'*') rdmc++;
4067 if (strcmp(rdmc,dm->
GetName()) == 0) {
4079 if (strstr(rdm->
GetName(),dmbracket)) {
4093 if (elementName == 0)
return 0;
4155 Int_t base_offset = 0;
4156 Int_t local_offset = 0;
4162 if (!base_cl || !base_element) {
4165 base_offset = base_element->
GetOffset();
4168 offset = base_offset + local_offset;
4183 Int_t local_offset = 0;
4192 offset = base_offset + local_offset;
4240 ::Obsolete(
"TStreamerInfo::GetStreamerElementReal",
"v5-34-20",
"v6-00-02");
4242 if (i < 0 || i >=
fNdata)
return 0;
4243 if (j < 0)
return 0;
4248 for (
Int_t ise=0;ise < nelems;ise++) {
4250 if (ise+j >= nelems)
return 0;
4259template <
typename T>
4281#if defined(_MSC_VER) && (_MSC_VER <= 1200)
4303#if defined(_MSC_VER) && (_MSC_VER <= 1200)
4309#define READ_ARRAY(TYPE_t) \
4311 Int_t sub_instance, index; \
4312 Int_t instance = k; \
4314 index = instance / len; \
4315 sub_instance = instance % len; \
4320 TYPE_t **val =(TYPE_t**)(ladd); \
4321 return T((val[sub_instance])[index]); \
4339#if defined(_MSC_VER) && (_MSC_VER <= 1200)
4363template <
typename T>
4372 if (i < 0)
return 0;
4376 if (atype ==
kSTL) {
4378 if (newClass == 0) {
4390 if (j >= nc)
return 0;
4391 char *element_ptr = (
char*)proxy->
At(j);
4392 return GetTypedValueAux<T>(atype,element_ptr,0,1);
4396 return GetTypedValueAux<T>(atype,ladd,j,len);
4405template <
typename T>
4412 if (j >= nc)
return 0;
4427template <
typename T>
4431 if (j >= nc)
return 0;
4433 char *pointer = (
char*)cont->
At(j);