-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ntuple] don't try to construct an Emulated TClass as a RClassField #17661
base: master
Are you sure you want to change the base?
Conversation
When constructing a RClassField we need some information that we don't have when the TClass is Emulated (or less), therefore we now check that we have at least an Interpreted TClass in RFieldBase::Create(). If not, we follow the same logic as when we have no TClass at all (i.e. either create an emulated field or fail, depending on the user options).
5a829b0
to
6c10350
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Test Results 18 files 18 suites 4d 4h 0m 58s ⏱️ For more details on these failures, see this check. Results for commit 6c10350. |
@@ -594,7 +594,10 @@ ROOT::Experimental::RFieldBase::Create(const std::string &fieldName, const std:: | |||
|
|||
if (!result) { | |||
auto cl = TClass::GetClass(canonicalType.c_str()); | |||
if (cl != nullptr) { | |||
// NOTE: if the class is not at least "Interpreted" we don't have enough information to | |||
// properly construct the RClassField (e.g. we are missing the list of bases), so in that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not precise. The list of base class is available in the TStreamerInfo
and thus available for an Emulated class.
Is this PR a temporary fix/workaround or am I missing something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you access that information? When we load a class from file without dictionary we observe that TClass::GetListOfBases()
returns nullptr
. Do we need to take some explicit steps to have that list filled? Or do we need to call a different method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have to look at the TStreamerInfo, eg.
auto info = cl->GetStreamerInfo(); // This return the current StreamerInfo describing the in memory layout
for(auto elem : TRangeStaticCast<TStreamerElement>( *info )) {
if (elem->IsBase()) {
...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pcanal I guess you meant TRangeStaticCast<TStreamerElement>(info->GetElements())
;
but this gives me TStreamerElement
s and TStreamerBase
s: how do I get to the TBaseClass
from there?
Or can I still access stuff like GetDelta()
from a TStreamerBase
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess you meant TRangeStaticCast(info->GetElements());
Indeed, sorry :)
how do I get to the TBaseClass from there?
You can't, it is a different interface.
Or can I still access stuff like GetDelta() from a TStreamerBase?
Yes, through GetOffset
. Note that the list of TStreamerElement
will only contains the direct base classes.
When constructing a RClassField we need some information that we don't have when the TClass is Emulated (or less), therefore we now check that we have at least an Interpreted TClass in RFieldBase::Create(). If not, we follow the same logic as when we have no TClass at all (i.e. either create an emulated field or fail, depending on the user options).
Checklist:
This PR fixes #17648