-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[ntuple] Check type in RValue::GetRef<T>
and GetPtr<T>
#19342
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
base: master
Are you sure you want to change the base?
Conversation
Test Results 21 files 21 suites 3d 12h 14m 52s ⏱️ Results for commit 6742820. ♻️ This comment has been updated with latest results. |
4834f53
to
6742820
Compare
if constexpr (!std::is_void_v<T>) { | ||
if (fField->GetTypeName() != ROOT::RField<T>::TypeName()) { | ||
throw RException( | ||
R__FAIL("type mismatch: " + fField->GetTypeName() + " vs. " + ROOT::RField<T>::TypeName())); |
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 think the error message could be a bit more descriptive, maybe something like:
R__FAIL("type mismatch: " + fField->GetTypeName() + " vs. " + ROOT::RField<T>::TypeName())); | |
R__FAIL("type mismatch for field \"" + fField->GetFieldName + "\": expected " + fField->GetTypeName() + ", got " + ROOT::RField<T>::TypeName())); |
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! Since this can break user code, I think we add an entry to the release notes.
void EnsureMatchingType() const | ||
{ | ||
if constexpr (!std::is_void_v<T>) { | ||
if (fField->GetTypeName() != ROOT::RField<T>::TypeName()) { |
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.
When #19323 is merged, I think we want to use ROOT::Internal::IsMatchingFieldType
. So maybe schedule the two PRs one after the other?
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.
Yes right, and we probably also want to extend roottest/root/ntuple/atlas-datavector/
to check that the procedure is working. Let's pause this PR for the moment and focus on #19323 which seems close to done.
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.
Since this anyway covers both RValue
and RBulkValues
, how about calling the header RFieldBaseValue.hxx
? I think it would look slightly nicer to me.
Thinking again about it: there is a possible alternative solution using a new, internal helper class, e.g. |
Yes, it's a possibility. However, it probably requires duplicating (some of) |
This requires splitting
RValue
andRBulkValues
into a separate header. After the changes, the organization is as follows:RFieldBase.hxx
: definesRFieldBase
and forward-declaresRFieldBase::RValue
andRFieldBase::RBulkValues
RField.hxx
: includesRFieldBase.hxx
and definesRField<T>
with all specializations; they provideRField<T>::TypeName()
RFieldBaseRValue.hxx
: includes bothRFieldBase.hxx
andRField.hxx
, definesRValue
andRBulkValues
; the typed API usesRField<T>::TypeName()
Closes #18316