-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[ntuple] Remove type name from public field constructors #19875
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?
Changes from all commits
020309e
92cbd1a
76818e9
6047b7e
4d80ea9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -761,9 +761,10 @@ void ROOT::RBitsetField::AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) con | |
|
||
//------------------------------------------------------------------------------ | ||
|
||
ROOT::RNullableField::RNullableField(std::string_view fieldName, std::string_view typeName, | ||
ROOT::RNullableField::RNullableField(std::string_view fieldName, const std::string &typePrefix, | ||
std::unique_ptr<RFieldBase> itemField) | ||
: ROOT::RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kCollection, false /* isSimple */) | ||
: ROOT::RFieldBase(fieldName, typePrefix + "<" + itemField->GetTypeName() + ">", ROOT::ENTupleStructure::kCollection, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As implied by:
doesn't the 'prefix' then also need to be normalized? (At least here) wasn't the 'real' issue that the 2 types ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, because the constructor that accepts a prefix is protected. I could have used the full type name instead of the type prefix approach. The reason I didn't is that the code calling this constructor would then both get the type name from the item field and move the item field to the base class. And doing both these things in a single call is illegal. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wasn't the previous constructor also protected? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the problem was not with |
||
false /* isSimple */) | ||
{ | ||
Attach(std::move(itemField)); | ||
} | ||
|
@@ -826,16 +827,15 @@ void ROOT::RNullableField::AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) c | |
|
||
//------------------------------------------------------------------------------ | ||
|
||
ROOT::RUniquePtrField::RUniquePtrField(std::string_view fieldName, std::string_view typeName, | ||
std::unique_ptr<RFieldBase> itemField) | ||
: RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubfields[0])) | ||
ROOT::RUniquePtrField::RUniquePtrField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField) | ||
: RNullableField(fieldName, "std::unique_ptr", std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubfields[0])) | ||
{ | ||
} | ||
|
||
std::unique_ptr<ROOT::RFieldBase> ROOT::RUniquePtrField::CloneImpl(std::string_view newName) const | ||
{ | ||
auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName()); | ||
return std::make_unique<RUniquePtrField>(newName, GetTypeName(), std::move(newItemField)); | ||
return std::make_unique<RUniquePtrField>(newName, std::move(newItemField)); | ||
} | ||
|
||
std::size_t ROOT::RUniquePtrField::AppendImpl(const void *from) | ||
|
@@ -905,9 +905,8 @@ std::vector<ROOT::RFieldBase::RValue> ROOT::RUniquePtrField::SplitValue(const RV | |
|
||
//------------------------------------------------------------------------------ | ||
|
||
ROOT::ROptionalField::ROptionalField(std::string_view fieldName, std::string_view typeName, | ||
std::unique_ptr<RFieldBase> itemField) | ||
: RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubfields[0])) | ||
ROOT::ROptionalField::ROptionalField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField) | ||
: RNullableField(fieldName, "std::optional", std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubfields[0])) | ||
{ | ||
if (fSubfields[0]->GetTraits() & kTraitTriviallyDestructible) | ||
fTraits |= kTraitTriviallyDestructible; | ||
|
@@ -926,7 +925,7 @@ const bool *ROOT::ROptionalField::GetEngagementPtr(const void *optionalPtr) cons | |
std::unique_ptr<ROOT::RFieldBase> ROOT::ROptionalField::CloneImpl(std::string_view newName) const | ||
{ | ||
auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName()); | ||
return std::make_unique<ROptionalField>(newName, GetTypeName(), std::move(newItemField)); | ||
return std::make_unique<ROptionalField>(newName, std::move(newItemField)); | ||
} | ||
|
||
std::size_t ROOT::ROptionalField::AppendImpl(const void *from) | ||
|
@@ -1007,9 +1006,9 @@ size_t ROOT::ROptionalField::GetAlignment() const | |
|
||
//------------------------------------------------------------------------------ | ||
|
||
ROOT::RAtomicField::RAtomicField(std::string_view fieldName, std::string_view typeName, | ||
std::unique_ptr<RFieldBase> itemField) | ||
: RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kPlain, false /* isSimple */) | ||
ROOT::RAtomicField::RAtomicField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField) | ||
: RFieldBase(fieldName, "std::atomic<" + itemField->GetTypeName() + ">", ROOT::ENTupleStructure::kPlain, | ||
false /* isSimple */) | ||
{ | ||
if (itemField->GetTraits() & kTraitTriviallyConstructible) | ||
fTraits |= kTraitTriviallyConstructible; | ||
|
@@ -1021,7 +1020,7 @@ ROOT::RAtomicField::RAtomicField(std::string_view fieldName, std::string_view ty | |
std::unique_ptr<ROOT::RFieldBase> ROOT::RAtomicField::CloneImpl(std::string_view newName) const | ||
{ | ||
auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName()); | ||
return std::make_unique<RAtomicField>(newName, GetTypeName(), std::move(newItemField)); | ||
return std::make_unique<RAtomicField>(newName, std::move(newItemField)); | ||
} | ||
|
||
void ROOT::RAtomicField::ReconcileOnDiskField(const RNTupleDescriptor &desc) | ||
|
Uh oh!
There was an error while loading. Please reload this page.