Skip to content

Commit 134c7d5

Browse files
committed
[ntuple] deprecate small helpers in RFieldDescriptor
The query methods `IsCustomClass`, `IsCustomEnum`, and `IsStdAtomic` are rather arbitrary and should not have been added to the public interface. They only make sense in the internal context in which they are used. Removed for v6.42.
1 parent 52ac3a0 commit 134c7d5

File tree

4 files changed

+42
-28
lines changed

4 files changed

+42
-28
lines changed

tree/ntuple/inc/ROOT/RNTupleDescriptor.hxx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,10 @@ public:
189189
std::uint32_t GetColumnCardinality() const { return fColumnCardinality; }
190190
std::optional<std::uint32_t> GetTypeChecksum() const { return fTypeChecksum; }
191191
bool IsProjectedField() const { return fProjectionSourceId != ROOT::kInvalidDescriptorId; }
192-
/// Tells if the field describes a user-defined class rather than a fundamental type, a collection, or one of the
193-
/// natively supported stdlib classes.
194-
/// The dictionary does not need to be available for this method.
195-
bool IsCustomClass() const;
196-
/// Tells if the field describes a user-defined enum type.
197-
/// The dictionary does not need to be available for this method.
198-
/// Needs the full descriptor to look up sub fields.
199-
bool IsCustomEnum(const RNTupleDescriptor &desc) const;
200-
bool IsStdAtomic() const;
192+
193+
bool IsCustomClass() const R__DEPRECATED(6, 42, "removed from public interface");
194+
bool IsCustomEnum(const RNTupleDescriptor &desc) const R__DEPRECATED(6, 42, "removed from public interface");
195+
bool IsStdAtomic() const R__DEPRECATED(6, 42, "removed from public interface");
201196
};
202197

203198
// clang-format off
@@ -1769,6 +1764,14 @@ inline RNTupleDescriptor CloneDescriptorSchema(const RNTupleDescriptor &desc)
17691764
return desc.CloneSchema();
17701765
}
17711766

1767+
/// Tells if the field describes a user-defined enum type.
1768+
/// The dictionary does not need to be available for this method.
1769+
/// Needs the full descriptor to look up sub fields.
1770+
bool IsCustomEnumFieldDesc(const RNTupleDescriptor &desc, const RFieldDescriptor &fieldDesc);
1771+
1772+
/// Tells if the field describes a std::atomic<T> type
1773+
bool IsStdAtomicFieldDesc(const RFieldDescriptor &fieldDesc);
1774+
17721775
} // namespace Internal
17731776

17741777
} // namespace ROOT

tree/ntuple/src/RField.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ void ROOT::RSimpleField<T>::ReconcileIntegralField(const RNTupleDescriptor &desc
117117
EnsureMatchingOnDiskField(desc, kDiffTypeName);
118118

119119
const RFieldDescriptor &fieldDesc = desc.GetFieldDescriptor(GetOnDiskId());
120-
if (fieldDesc.IsCustomEnum(desc)) {
120+
if (Internal::IsCustomEnumFieldDesc(desc, fieldDesc)) {
121121
SetOnDiskId(desc.FindFieldId("_0", GetOnDiskId()));
122122
return;
123123
}

tree/ntuple/src/RFieldBase.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,8 @@ void ROOT::RFieldBase::ConnectPageSource(ROOT::Internal::RPageSource &pageSource
959959
// Note that we have to do this before calling BeforeConnectPageSource(), which already may compare the field
960960
// to its on-disk description.
961961
const auto &desc = pageSource.GetSharedDescriptorGuard().GetRef();
962-
if (!dynamic_cast<RAtomicField *>(this) && desc.GetFieldDescriptor(GetOnDiskId()).IsStdAtomic()) {
962+
if (!dynamic_cast<RAtomicField *>(this) &&
963+
Internal::IsStdAtomicFieldDesc(desc.GetFieldDescriptor(GetOnDiskId()))) {
963964
SetOnDiskId(desc.GetFieldDescriptor(GetOnDiskId()).GetLinkIds()[0]);
964965
}
965966
}

tree/ntuple/src/RNTupleDescriptor.cxx

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -170,27 +170,12 @@ bool ROOT::RFieldDescriptor::IsCustomClass() const
170170

171171
bool ROOT::RFieldDescriptor::IsCustomEnum(const RNTupleDescriptor &desc) const
172172
{
173-
if (fStructure != ROOT::ENTupleStructure::kPlain)
174-
return false;
175-
if (fTypeName.rfind("std::", 0) == 0)
176-
return false;
177-
178-
auto subFieldId = desc.FindFieldId("_0", fFieldId);
179-
if (subFieldId == kInvalidDescriptorId)
180-
return false;
181-
182-
static const std::string gIntTypeNames[] = {"bool", "char", "std::int8_t", "std::uint8_t",
183-
"std::int16_t", "std::uint16_t", "std::int32_t", "std::uint32_t",
184-
"std::int64_t", "std::uint64_t"};
185-
return std::find(std::begin(gIntTypeNames), std::end(gIntTypeNames),
186-
desc.GetFieldDescriptor(subFieldId).GetTypeName()) != std::end(gIntTypeNames);
173+
return Internal::IsCustomEnumFieldDesc(desc, *this);
187174
}
188175

189176
bool ROOT::RFieldDescriptor::IsStdAtomic() const
190177
{
191-
if (fStructure != ROOT::ENTupleStructure::kPlain)
192-
return false;
193-
return (fTypeName.rfind("std::atomic<", 0) == 0);
178+
return Internal::IsStdAtomicFieldDesc(*this);
194179
}
195180

196181
////////////////////////////////////////////////////////////////////////////////
@@ -1507,3 +1492,28 @@ ROOT::Experimental::RNTupleAttrSetDescriptor ROOT::Experimental::RNTupleAttrSetD
15071492
desc.fName = fName;
15081493
return desc;
15091494
}
1495+
1496+
bool ROOT::Internal::IsCustomEnumFieldDesc(const RNTupleDescriptor &desc, const RFieldDescriptor &fieldDesc)
1497+
{
1498+
if (fieldDesc.GetStructure() != ROOT::ENTupleStructure::kPlain)
1499+
return false;
1500+
if (fieldDesc.GetTypeName().rfind("std::", 0) == 0)
1501+
return false;
1502+
1503+
auto subFieldId = desc.FindFieldId("_0", fieldDesc.GetId());
1504+
if (subFieldId == kInvalidDescriptorId)
1505+
return false;
1506+
1507+
static const std::string gIntTypeNames[] = {"bool", "char", "std::int8_t", "std::uint8_t",
1508+
"std::int16_t", "std::uint16_t", "std::int32_t", "std::uint32_t",
1509+
"std::int64_t", "std::uint64_t"};
1510+
return std::find(std::begin(gIntTypeNames), std::end(gIntTypeNames),
1511+
desc.GetFieldDescriptor(subFieldId).GetTypeName()) != std::end(gIntTypeNames);
1512+
}
1513+
1514+
bool ROOT::Internal::IsStdAtomicFieldDesc(const RFieldDescriptor &fieldDesc)
1515+
{
1516+
if (fieldDesc.GetStructure() != ROOT::ENTupleStructure::kPlain)
1517+
return false;
1518+
return (fieldDesc.GetTypeName().rfind("std::atomic<", 0) == 0);
1519+
}

0 commit comments

Comments
 (0)