50#include <unordered_set>
72 " cannot be constructed from a class that's not at least Interpreted"));
78 if (
field.GetTypeName() ==
"TObject") {
83 "use RProxiedCollectionField instead"));
94 R__FAIL(
field.GetTypeName() +
" has streamer mode enforced, not supported as native RNTuple class"));
106 " with a custom streamer; not supported natively in RNTuple"));
132 for (
size_t i = 0; i <
itemFields.size(); ++i) {
176 for (
int i : {0, 1}) {
196 fSubfieldsInfo(
source.fSubfieldsInfo)
198 for (
const auto &
f :
source.GetConstSubfields()) {
235 " virtually inherits from " +
baseClass->GetName()));
258 std::string typeName{
dataMember->GetTrueTypeName()};
262 for (
int dim = 0,
n =
dataMember->GetArrayDim(); dim <
n; ++dim) {
263 typeName +=
"[" + std::to_string(
dataMember->GetMaxIndex(dim)) +
"]";
278 for (
const auto &[
_,
si] : fStagingItems) {
279 if (!(
si.fField->GetTraits() & kTraitTriviallyDestructible)) {
280 auto deleter = GetDeleterOf(*
si.fField);
281 deleter->operator()(fStagingArea.get() +
si.fOffset,
true );
289 fSubfieldsInfo.push_back(
info);
320 std::size_t
nskip = 0;
327 <<
"ignoring I/O customization rule with unsupported type: " <<
rule->GetRuleType();
338 <<
"ignoring I/O customization rule due to conflicting source member type: " <<
itrSrc->second <<
" vs. "
350 if (
rule->GetTarget() ==
nullptr) {
371 for (
unsigned i = 0; i < fSubfields.size(); i++) {
372 nbytes += CallAppendOn(*fSubfields[i],
static_cast<const unsigned char *
>(from) + fSubfieldsInfo[i].fOffset);
379 for (
const auto &[
_,
si] : fStagingItems) {
382 for (
unsigned i = 0; i < fSubfields.size(); i++) {
383 CallReadOn(*fSubfields[i],
globalIndex,
static_cast<unsigned char *
>(to) + fSubfieldsInfo[i].fOffset);
389 for (
const auto &[
_,
si] : fStagingItems) {
390 CallReadOn(*
si.fField,
localIndex, fStagingArea.get() +
si.fOffset);
392 for (
unsigned i = 0; i < fSubfields.size(); i++) {
393 CallReadOn(*fSubfields[i],
localIndex,
static_cast<unsigned char *
>(to) + fSubfieldsInfo[i].fOffset);
419 if (
classVersion != GetTypeVersion() || className != GetTypeName()) {
421 if (!fStagingClass) {
448 throw RException(
R__FAIL(std::string(
"cannot find on disk rule source member ") + GetTypeName() +
"." +
455 auto fieldZero = std::make_unique<RFieldZero>();
473 for (
const auto &[
_,
si] : fStagingItems) {
475 if (!(
memberField.GetTraits() & kTraitTriviallyConstructible)) {
476 CallConstructValueOn(
memberField, fStagingArea.get() +
si.fOffset);
484 auto func =
rule->GetReadFunctionPointer();
485 if (func ==
nullptr) {
490 TVirtualObject onfileObj{nullptr};
500 std::vector<const TSchemaRule *>
rules;
510 rules = FindRules(
nullptr);
512 SetStagingClass(GetTypeName(), GetTypeVersion());
521 auto substitute = std::make_unique<RStreamerField>(GetFieldName(), GetTypeName());
543 throw RException(
R__FAIL(
"incompatible type name for field " + GetFieldName() +
": " + GetTypeName() +
549 return r->GetSource() && (r->GetSource()->GetEntries() > 0);
557 for (
auto &[
_,
si] : fStagingItems) {
565 if (!
rule->GetTarget())
575 AddReadCallbacksFromIORule(
rule);
580 for (
auto &
field : fSubfields) {
583 CallSetArtificialOn(*
field);
590 throw RException(
R__FAIL(std::string(
"incompatible number of base classes for field ") + GetFieldName() +
": " +
592 " base classes in memory "
603 EnsureMatchingOnDiskField(desc, kDiffTypeVersion | kDiffTypeName).ThrowOnError();
621 std::vector<RValue>
result;
625 for (
unsigned i = 0; i <
fSubfields.size(); i++) {
665 visitor.VisitClassField(*
this);
672 fSoAClass(
source.fSoAClass),
673 fSoAMemberOffsets(
source.fSoAMemberOffsets)
719 fRecordMemberDeleters.emplace_back(GetDeleterOf(*
nestedSoA.fRecordMemberFields[i]));
740 for (
auto itr = fSubfields[0]->begin(),
iEnd = fSubfields[0]->end();
itr !=
iEnd; ++
itr) {
741 if (
itr->GetParent() == fSubfields[0].get()) {
742 if (
itr->GetFieldName()[0] ==
':') {
751 auto parent =
itr->GetParent();
752 while (parent != fSubfields[0].get()) {
754 parent = parent->GetParent();
762 const auto *
soaBases = fSoAClass->GetListOfBases();
764 throw RException(
R__FAIL(std::string(
"number of base classes don't match between SoA class ") + GetFieldName() +
765 " and its underlying record type"));
769 if (base->GetDelta() < 0) {
770 throw RException(
R__FAIL(std::string(
"virtual inheritance is not supported: ") + GetTypeName() +
771 " virtually inherits from " + base->GetName()));
773 TClass *cl = base->GetClassPointer();
782 throw RException(
R__FAIL(std::string(
"inheritance of SoA class ") + GetFieldName() +
783 " does not match its underlying record type"));
791 GetFieldName() +
" (" +
e.what() +
")"));
794 GraftNestedMemberFields(*
soaBaseField, base->GetDelta(), [&](
const std::string &
name) {
795 return realRecordMemberFields[recordFieldNameToIdx[name]];
813 const std::string typeName{
dataMember->GetTrueTypeName()};
826 soaField->GetTypeName() +
"] does not match underlying type " +
831 return realRecordMemberFields[recordFieldNameToIdx[name]];
848 fSoAMemberOffsets.emplace_back(
dataMember->GetOffset());
865 static std::once_flag
once;
866 std::call_once(
once, []() {
874 " is not marked with the rntupleSoARecord "
875 "dictionary option; cannot create corresponding RSoAField."));
884 throw RException(
R__FAIL(std::string(
"version mismatch between SoA type and underlying record type: ") +
886 std::to_string(
fSubfields[0]->GetTypeVersion())));
926 const std::size_t
nSoAMembers = fSoAMemberOffsets.size();
930 const void *
rvecPtr =
static_cast<const unsigned char *
>(from) + fSoAMemberOffsets[i];
936 if (
static_cast<std::size_t
>(*
sizePtr) !=
N) {
937 const auto f = fRecordMemberFields[i];
939 " vs. " + std::to_string(
N) +
" (expected)"));
947 const void *
rvecPtr =
static_cast<const unsigned char *
>(from) + fSoAMemberOffsets[i];
951 GetPrincipalColumnOf(*memberField)->AppendV(*
beginPtr,
N);
952 nbytes +=
N * GetPrincipalColumnOf(*memberField)->GetElement()->GetPackedSize();
954 for (std::size_t
j = 0;
j <
N; ++
j) {
962 fPrincipalColumn->Append(&fNWritten);
963 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
977 void *
rvecPtr =
static_cast<unsigned char *
>(to) + fSoAMemberOffsets[i];
983 for (std::size_t
j = 0;
j <
N; ++
j) {
992 fSoAClass->New(
where);
1011 fSplitFields = std::make_unique<std::vector<std::unique_ptr<ROOT::RFieldBase>>>();
1012 fSplitOffsets = std::make_unique<std::vector<std::size_t>>();
1016 TClass *cl = base->GetClassPointer();
1027 const std::string typeName{
dataMember->GetTrueTypeName()};
1041 std::vector<RValue> values;
1102 switch (
enump->GetUnderlyingType()) {
1121 std::unique_ptr<RFieldBase>
intField)
1130 auto newIntField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
1137 EnsureMatchingOnDiskField(desc, kDiffTypeName | kDiffTypeVersion).ThrowOnError();
1142 std::vector<RValue>
result;
1143 result.emplace_back(fSubfields[0]->BindValue(
value.GetPtr<
void>()));
1149 visitor.VisitEnumField(*
this);
1182 std::array<std::unique_ptr<RFieldBase>, 2>
itemClones = {fSubfields[0]->Clone(fSubfields[0]->GetFieldName()),
1183 fSubfields[1]->Clone(fSubfields[1]->GetFieldName())};
1189 static const std::vector<std::string>
prefixes = {
"std::pair<",
"std::tuple<"};
1191 EnsureMatchingOnDiskField(desc, kDiffTypeName).ThrowOnError();
1192 EnsureMatchingTypePrefix(desc,
prefixes).ThrowOnError();
1214 (
ifuncs.fNext !=
nullptr));
1223 if (!
classp->GetCollectionProxy())
1227 "std::set<",
"std::unordered_set<",
"std::multiset<",
"std::unordered_multiset<",
1228 "std::map<",
"std::unordered_map<",
"std::multimap<",
"std::unordered_multimap<"};
1244 fProxy.reset(
classp->GetCollectionProxy()->Generate());
1247 if (
fProxy->HasPointers())
1248 throw RException(
R__FAIL(
"collection proxies whose value type is a pointer are not supported"));
1259 throw RException(
R__FAIL(
"custom associative collection proxies not supported"));
1261 std::unique_ptr<ROOT::RFieldBase>
itemField;
1267 switch (
fProxy->GetType()) {
1293 clone->fItemSize = fItemSize;
1294 clone->Attach(fSubfields[0]->Clone(fSubfields[0]->GetFieldName()));
1304 (fCollectionType ==
kSTLvector ? fItemSize : 0U)}) {
1305 nbytes += CallAppendOn(*fSubfields[0], ptr);
1310 fPrincipalColumn->Append(&fNWritten);
1311 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
1326 (fCollectionType ==
kSTLvector || obj != to ? fItemSize : 0U)}) {
1330 fProxy->Commit(obj);
1355 EnsureMatchingOnDiskCollection(desc).ThrowOnError();
1367 return std::make_unique<RProxiedCollectionDeleter>(fProxy, GetDeleterOf(*fSubfields[0]),
itemSize);
1369 return std::make_unique<RProxiedCollectionDeleter>(fProxy);
1373 std::shared_ptr<TVirtualCollectionProxy>
proxy)
1380 :
RDeleter(
proxy->GetCollectionClass()->GetClassAlignment()),
1393 fItemDeleter->operator()(ptr,
true );
1402 std::vector<RValue>
result;
1419 const auto align =
fProxy->GetCollectionClass()->GetClassAlignment();
1426 visitor.VisitProxiedCollectionField(*
this);
1447 return std::make_unique<RMapField>(
newName, fMapType, fSubfields[0]->Clone(fSubfields[0]->GetFieldName()));
1452 static const std::vector<std::string>
prefixesRegular = {
"std::map<",
"std::unordered_map<"};
1454 EnsureMatchingOnDiskCollection(desc).ThrowOnError();
1457 case EMapType::kMap:
1458 case EMapType::kUnorderedMap: EnsureMatchingTypePrefix(desc,
prefixesRegular).ThrowOnError();
break;
1482 return std::make_unique<RSetField>(
newName, fSetType, fSubfields[0]->Clone(fSubfields[0]->GetFieldName()));
1487 static const std::vector<std::string>
prefixesRegular = {
"std::set<",
"std::unordered_set<",
"std::map<",
1488 "std::unordered_map<"};
1490 EnsureMatchingOnDiskCollection(desc).ThrowOnError();
1493 case ESetType::kSet:
1494 case ESetType::kUnorderedSet: EnsureMatchingTypePrefix(desc,
prefixesRegular).ThrowOnError();
break;
1511 RCallbackStreamerInfo fCallbackStreamerInfo;
1557 fClass->Streamer(
const_cast<void *
>(from), buffer);
1559 auto nbytes = buffer.Length();
1560 fAuxiliaryColumn->AppendV(buffer.Buffer(), buffer.Length());
1562 fPrincipalColumn->Append(&fIndex);
1563 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
1574 fClass->Streamer(to, buffer);
1599 source.RegisterStreamerInfos();
1605 EnsureMatchingOnDiskField(desc, kDiffTypeName | kDiffTypeVersion).ThrowOnError();
1658 visitor.VisitStreamerField(*
this);
1675 Attach(
source.GetConstSubfields()[0]->Clone(
"fUniqueID"));
1698 auto *obj =
static_cast<const TObject *
>(from);
1704 nbytes += CallAppendOn(*fSubfields[0],
reinterpret_cast<const unsigned char *
>(from) + GetOffsetUniqueID());
1706 UInt_t bits = *
reinterpret_cast<const UInt_t *
>(
reinterpret_cast<const unsigned char *
>(from) + GetOffsetBits());
1708 nbytes += CallAppendOn(*fSubfields[1], &bits);
1717 auto *obj =
static_cast<TObject *
>(to);
1722 *
reinterpret_cast<UInt_t *
>(
reinterpret_cast<unsigned char *
>(to) + GetOffsetUniqueID()) =
uniqueID;
1726 *
reinterpret_cast<UInt_t *
>(
reinterpret_cast<unsigned char *
>(to) + GetOffsetBits()) = bits;
1741 CallReadOn(*fSubfields[1],
localIndex, &bits);
1762 std::vector<RValue>
result;
1765 auto charPtr =
static_cast<unsigned char *
>(ptr.get());
1766 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<void>(ptr,
charPtr + GetOffsetUniqueID())));
1767 result.emplace_back(fSubfields[1]->BindValue(std::shared_ptr<void>(ptr,
charPtr + GetOffsetBits())));
1783 visitor.VisitTObjectField(*
this);
1807 for (
unsigned i = 0; i <
fSubfields.size(); ++i) {
1808 std::string
memberName(
"_" + std::to_string(i));
1818 std::vector<std::unique_ptr<RFieldBase>>
itemClones;
1820 for (
const auto &
f : fSubfields) {
1828 static const std::vector<std::string>
prefixes = {
"std::pair<",
"std::tuple<"};
1830 EnsureMatchingOnDiskField(desc, kDiffTypeName).ThrowOnError();
1831 EnsureMatchingTypePrefix(desc,
prefixes).ThrowOnError();
1851 std::variant<char> t;
1852 constexpr auto sizeOfT =
sizeof(t);
1854 static_assert(
sizeOfT == 2 ||
sizeOfT == 8,
"unsupported std::variant layout");
1858template <std::
size_t VariantSizeT>
1860 using ValueType_t =
typename std::conditional_t<
VariantSizeT == 1, std::uint8_t,
1861 typename std::conditional_t<VariantSizeT == 4, std::uint32_t, void>>;
1868 fMaxItemSize(
source.fMaxItemSize),
1869 fMaxAlignment(
source.fMaxAlignment),
1870 fTagOffset(
source.fTagOffset),
1871 fVariantOffset(
source.fVariantOffset),
1874 for (
const auto &
f :
source.GetConstSubfields())
1875 Attach(
f->Clone(
f->GetFieldName()));
1895 for (
unsigned int i = 0; i <
nFields; ++i) {
1924 return (tag ==
TagType_t(-1)) ? 0 : tag + 1;
1936 auto tag = GetTag(from, fTagOffset);
1940 nbytes += CallAppendOn(*fSubfields[tag - 1],
reinterpret_cast<const unsigned char *
>(from) + fVariantOffset);
1941 index = fNWritten[tag - 1]++;
1959 void *
varPtr =
reinterpret_cast<unsigned char *
>(to) + fVariantOffset;
1960 CallConstructValueOn(*fSubfields[tag - 1],
varPtr);
1963 SetTag(to, fTagOffset, tag);
1984 static const std::vector<std::string>
prefixes = {
"std::variant<"};
1986 EnsureMatchingOnDiskField(desc, kDiffTypeName).ThrowOnError();
1987 EnsureMatchingTypePrefix(desc,
prefixes).ThrowOnError();
1990 if (fSubfields.size() !=
fieldDesc.GetLinkIds().size()) {
1991 throw RException(
R__FAIL(
"number of variants on-disk do not match for " + GetQualifiedFieldName() +
"\n" +
1999 CallConstructValueOn(*fSubfields[0],
reinterpret_cast<unsigned char *
>(
where) + fVariantOffset);
2000 SetTag(
where, fTagOffset, 1);
2005 auto tag = GetTag(
objPtr, fTagOffset);
2007 fItemDeleters[tag - 1]->operator()(
reinterpret_cast<unsigned char *
>(
objPtr) + fVariantOffset,
true );
2016 for (
const auto &
f : fSubfields) {
2019 return std::make_unique<RVariantDeleter>(fTagOffset, fVariantOffset, GetAlignment(), std::move(
itemDeleters));
2024 return std::max(fMaxAlignment,
alignof(RVariantTag<
GetVariantTagSize()>::ValueType_t));
2037 std::fill(fNWritten.begin(), fNWritten.end(), 0);
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
#define R__LOG_WARNING(...)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Abstract base class for classes implementing the visitor design pattern.
void operator()(void *objPtr, bool dtorOnly) final
The SoA field provides I/O for an in-memory SoA layout linked to an on-disk collection of the underly...
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void GraftNestedMemberFields(const RSoAField &nestedSoA, std::size_t offsetInParent, std::function< RFieldBase *(const std::string &)> fnRecordFieldFinder)
For a nested SoA struct (either as a member of as a base class), use their fRecordMemberFields in thi...
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
const std::type_info * GetPolymorphicTypeInfo() const
For polymorphic classes (that declare or inherit at least one virtual method), return the expected dy...
size_t GetValueSize() const final
What sizeof(T) for this type returns.
std::vector< std::unique_ptr< RDeleter > > fRecordMemberDeleters
void CollectRecordMemberFields()
Called during construction, picks up the (nested) member fields of the underlying record type(s) and ...
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
size_t GetAlignment() const final
What alignof(T) for this type returns.
std::unique_ptr< std::vector< std::size_t > > fSplitOffsets
std::vector< RFieldBase * > fRecordMemberFields
Direct access to the member fields of the underlying record.
RSoAField(std::string_view fieldName, const RSoAField &source)
Used by CloneImpl.
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::unique_ptr< std::vector< std::unique_ptr< ROOT::RFieldBase > > > fSplitFields
For reading and writing, the RVecs of the SoA class do not have a dedicated field.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
std::unique_ptr< std::mutex > fLockSplitFields
protects the fSplitFields member.
void ReconstructSplitFields() const
Holds the index and the tag of a kSwitch column.
static std::string SerializeStreamerInfos(const StreamerInfoMap_t &infos)
Abstract interface to read data from an ntuple.
void operator()(void *objPtr, bool dtorOnly) final
RClassDeleter(TClass *cl)
The field for a class with dictionary.
std::unique_ptr< RFieldBase > BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
void AddReadCallbacksFromIORule(const TSchemaRule *rule)
Register post-read callback corresponding to a ROOT I/O customization rules.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::vector< RSubfieldInfo > fSubfieldsInfo
Additional information kept for each entry in fSubfields
void Attach(std::unique_ptr< RFieldBase > child, RSubfieldInfo info)
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
std::vector< const TSchemaRule * > FindRules(const ROOT::RFieldDescriptor *fieldDesc)
Given the on-disk information from the page source, find all the I/O customization rules that apply t...
ROOT::DescriptorId_t LookupMember(const ROOT::RNTupleDescriptor &desc, std::string_view memberName, ROOT::DescriptorId_t classFieldId)
Returns the id of member 'name' in the class field given by 'fieldId', or kInvalidDescriptorId if no ...
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
RClassField(std::string_view fieldName, const RClassField &source)
Used by CloneImpl.
void PrepareStagingArea(const std::vector< const TSchemaRule * > &rules, const ROOT::RNTupleDescriptor &desc, const ROOT::RFieldDescriptor &classFieldId)
If there are rules with inputs (source members), create the staging area according to the TClass inst...
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
const std::type_info * GetPolymorphicTypeInfo() const
For polymorphic classes (that declare or inherit at least one virtual method), return the expected dy...
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
void SetStagingClass(const std::string &className, unsigned int classVersion)
Sets fStagingClass according to the given name and version.
The field for an unscoped or scoped enum with dictionary.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
REnumField(std::string_view fieldName, TEnum *enump)
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
Base class for all ROOT issued exceptions.
The list of column representations a field can have.
A functor to release the memory acquired by CreateValue() (memory and constructor).
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
A field translates read and write calls from/to underlying columns to/from tree values.
void Attach(std::unique_ptr< RFieldBase > child, std::string_view expectedChildName="")
Add a new subfield to the list of nested fields.
std::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
static std::unique_ptr< RDeleter > GetDeleterOf(const RFieldBase &other)
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
@ kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. the destructor performs a no-op.
@ kTraitTriviallyConstructible
No constructor needs to be called, i.e.
@ kTraitSoACollection
The field represents a collection in SoA layout.
@ kTraitTypeChecksum
The TClass checksum is set and valid.
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &typeName, const ROOT::RCreateFieldOptions &options, const ROOT::RNTupleDescriptor *desc, ROOT::DescriptorId_t fieldId)
Factory method to resurrect a field from the stored on-disk type information.
std::string fTypeAlias
A typedef or using name that was used when creating the field.
const std::string & GetTypeName() const
RValue BindValue(std::shared_ptr< void > objPtr)
Creates a value from a memory location with an already constructed object.
Metadata stored for every field of an RNTuple.
The container field for an ntuple model, which itself has no physical representation.
std::vector< std::unique_ptr< RFieldBase > > ReleaseSubfields()
Moves all subfields into the returned vector.
Classes with dictionaries that can be inspected by TClass.
RField(std::string_view name)
RMapField(std::string_view fieldName, EMapType mapType, std::unique_ptr< RFieldBase > itemField)
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
The on-storage metadata of an RNTuple.
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
const RFieldDescriptor & GetFieldDescriptor(ROOT::DescriptorId_t fieldId) const
std::string GetTypeNameForComparison(const RFieldDescriptor &fieldDesc) const
Adjust the type name of the passed RFieldDescriptor for comparison with another renormalized type nam...
ROOT::DescriptorId_t FindFieldId(std::string_view fieldName, ROOT::DescriptorId_t parentId) const
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Template specializations for C++ std::pair.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
RPairField(std::string_view fieldName, std::array< std::unique_ptr< RFieldBase >, 2 > itemFields)
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Allows for iterating over the elements of a proxied collection.
static RIteratorFuncs GetIteratorFuncs(TVirtualCollectionProxy *proxy, bool readFromDisk)
std::shared_ptr< TVirtualCollectionProxy > fProxy
RCollectionIterableOnce::RIteratorFuncs fIFuncsWrite
RProxiedCollectionDeleter(std::shared_ptr< TVirtualCollectionProxy > proxy)
void operator()(void *objPtr, bool dtorOnly) final
The field for a class representing a collection of elements via TVirtualCollectionProxy.
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
RProxiedCollectionField(std::string_view fieldName, TClass *classp)
Constructor used when the value type of the collection is not known in advance, i....
RCollectionIterableOnce::RIteratorFuncs fIFuncsWrite
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
RCollectionIterableOnce::RIteratorFuncs fIFuncsRead
Two sets of functions to operate on iterators, to be used depending on the access type.
std::shared_ptr< TVirtualCollectionProxy > fProxy
The collection proxy is needed by the deleters and thus defined as a shared pointer.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RDeleter > GetDeleter() const final
void ReconcileOnDiskField(const RNTupleDescriptor &desc) override
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Template specializations for ROOT's RVec.
static unsigned char * ResizeRVec(void *rvec, std::size_t nItems, std::size_t itemSize, const RFieldBase *itemField, RDeleter *itemDeleter)
const_iterator begin() const
const_iterator end() const
The field for an untyped record.
void AttachItemFields(ContainerT &&itemFields)
std::vector< std::size_t > fOffsets
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RSetField(std::string_view fieldName, ESetType setType, std::unique_ptr< RFieldBase > itemField)
void operator()(void *objPtr, bool dtorOnly) final
RStreamerFieldDeleter(TClass *cl)
The field for a class using ROOT standard streaming.
ROOT::RExtraTypeInfoDescriptor GetExtraTypeInfo() const final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::unique_ptr< RFieldBase > BeforeConnectPageSource(ROOT::Internal::RPageSource &source) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
RStreamerField(std::string_view fieldName, TClass *classp)
size_t GetAlignment() const final
What alignof(T) for this type returns.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
size_t GetValueSize() const final
What sizeof(T) for this type returns.
Template specializations for C++ std::tuple.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
RTupleField(std::string_view fieldName, std::vector< std::unique_ptr< RFieldBase > > itemFields)
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void operator()(void *objPtr, bool dtorOnly) final
Template specializations for C++ std::variant.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
static constexpr std::size_t kMaxVariants
std::vector< ROOT::Internal::RColumnIndex::ValueType > fNWritten
static std::uint8_t GetTag(const void *variantPtr, std::size_t tagOffset)
Extracts the index from an std::variant and transforms it into the 1-based index used for the switch ...
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
size_t fVariantOffset
In the std::variant memory layout, the actual union of types may start at an offset > 0.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
std::unique_ptr< RDeleter > GetDeleter() const final
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
size_t fTagOffset
In the std::variant memory layout, at which byte number is the index stored.
RVariantField(std::string_view name, const RVariantField &source)
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
static void SetTag(void *variantPtr, std::size_t tagOffset, std::uint8_t tag)
void CommitClusterImpl() final
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
TClass instances represent classes, structs and namespaces in the ROOT type system.
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
void Destructor(void *obj, Bool_t dtorOnly=kFALSE)
Explicitly call destructor for object.
size_t GetClassAlignment() const
Return the alignment requirement (in bytes) for objects of this class.
void BuildRealData(void *pointer=nullptr, Bool_t isTransient=kFALSE)
Build a full list of persistent data members.
const std::type_info * GetTypeInfo() const
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
TList * GetListOfRealData() const
Int_t Size() const
Return size of object of this class.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Int_t GetClassSize() const
Long_t ClassProperty() const
Return the C++ property of this class, eg.
Long_t Property() const override
Returns the properties of the TClass as a bit field stored as a Long_t value.
Version_t GetClassVersion() const
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
All ROOT classes may have RTTI (run time type identification) support added.
The TEnum class implements the enum type.
static TEnum * GetEnum(const std::type_info &ti, ESearchAction sa=kALoadAndInterpLookup)
TObject * First() const override
Return the first object in the list. Returns 0 when list is empty.
const char * GetName() const override
Returns name of object.
Mother of all ROOT objects.
@ kIsOnHeap
object is on heap
@ kNotDeleted
object has not been deleted
@ kIsReferenced
if object is referenced by a TRef or TRefArray
The TRealData class manages the effective list of all data members for a given class.
RAII helper class that ensures that PushProxy() / PopProxy() are called when entering / leaving a C++...
Defines a common interface to inspect/change the contents of an object that represents a collection.
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
Abstract Interface class describing Streamer information for one class.
TRangeCast< T, false > TRangeStaticCast
TRangeStaticCast is an adapter class that allows the typed iteration through a TCollection.
void SetAllowFieldSubstitutions(RFieldZero &fieldZero, bool val)
std::tuple< unsigned char **, std::int32_t *, std::int32_t * > GetRVecDataMembers(void *rvecPtr)
Retrieve the addresses of the data members of a generic RVec from a pointer to the beginning of the R...
ROOT::RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
void CallConnectPageSourceOnField(RFieldBase &, ROOT::Internal::RPageSource &)
std::string GetRNTupleSoARecord(const TClass *cl)
Checks if the "rntuple.SoARecord" class attribute is set in the dictionary.
bool NeedsMetaNameAsAlias(const std::string &metaNormalizedName, std::string &renormalizedAlias, bool isArgInTemplatedUserClass=false)
Checks if the meta normalized name is different from the RNTuple normalized name in a way that would ...
std::string GetTypeTraceReport(const RFieldBase &field, const RNTupleDescriptor &desc)
Prints the hierarchy of types with their field names and field IDs for the given in-memory field and ...
ERNTupleSerializationMode GetRNTupleSerializationMode(const TClass *cl)
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
constexpr bool IsValidAlignment(std::size_t align) noexcept
Return true if align is a valid C++ alignment value: strictly positive and a power of two.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
ENTupleStructure
The fields in the RNTuple data model tree can carry different structural information about the type s...
void GetNormalizedName(std::string &norm_name, std::string_view name)
Return the normalized name.