68std::unique_ptr<ROOT::Experimental::RFieldBase>
73 auto streamerField = std::make_unique<RStreamerField>(GetFieldName(), GetTypeName());
82 auto invalidField = std::make_unique<RInvalidField>(GetFieldName(), GetTypeName(),
"",
87 throw RException(
R__FAIL(
"unexpected on-disk field structure value for field \"" + GetFieldName() +
"\""));
91 if (GetTypeName().empty()) {
92 switch (GetStructure()) {
96 for (
auto id : fLinkIds) {
108 if (fLinkIds.size() != 1) {
109 throw RException(
R__FAIL(
"unsupported untyped collection for field \"" + GetFieldName() +
"\""));
118 default:
throw RException(
R__FAIL(
"unsupported untyped field structure for field \"" + GetFieldName() +
"\""));
124 const auto &typeName = GetTypeAlias().empty() ? GetTypeName() : GetTypeAlias();
129 field->SetOnDiskId(fFieldId);
144 return std::make_unique<RInvalidField>(GetFieldName(), GetTypeName(),
ex.GetError().GetReport(),
161 if (
fTypeName.compare(0, 10,
"std::pair<") == 0)
163 if (
fTypeName.compare(0, 11,
"std::tuple<") == 0)
174 return fLogicalColumnId ==
other.fLogicalColumnId && fPhysicalColumnId ==
other.fPhysicalColumnId &&
175 fBitsOnStorage ==
other.fBitsOnStorage && fType ==
other.fType && fFieldId ==
other.fFieldId &&
176 fIndex ==
other.fIndex && fRepresentationIndex ==
other.fRepresentationIndex &&
177 fValueRange ==
other.fValueRange;
200 const auto N = fCumulativeNElements.size();
204 std::size_t left = 0;
205 std::size_t right =
N - 1;
207 while (left <= right) {
236 const auto nElements = std::accumulate(fPageInfos.begin(), fPageInfos.end(), 0U,
237 [](std::size_t
n,
const auto &
PI) { return n + PI.fNElements; });
252 PI.fLocator.SetNBytesOnStorage(
element.GetPackedSize(
PI.fNElements));
258 std::make_move_iterator(fPageInfos.end()));
265 return fClusterId ==
other.fClusterId && fFirstEntryIndex ==
other.fFirstEntryIndex &&
266 fNEntries ==
other.fNEntries && fColumnRanges ==
other.fColumnRanges && fPageRanges ==
other.fPageRanges;
272 for (
const auto &
pr : fPageRanges) {
273 for (
const auto &pi :
pr.second.fPageInfos) {
274 nbytes += pi.fLocator.GetNBytesOnStorage();
287 for (
const auto &
d : fPageRanges)
314 return fName ==
other.fName &&
315 fDescription ==
other.fDescription &&
316 fNEntries ==
other.fNEntries &&
317 fGeneration ==
other.fGeneration &&
318 fFieldZeroId ==
other.fFieldZeroId &&
319 fFieldDescriptors ==
other.fFieldDescriptors &&
320 fColumnDescriptors ==
other.fColumnDescriptors &&
321 fClusterGroupDescriptors ==
other.fClusterGroupDescriptors &&
322 fClusterDescriptors ==
other.fClusterDescriptors;
330 for (
const auto &cd : fClusterDescriptors) {
344 if (
posDot != std::string::npos) {
373 return FindFieldId(
fieldName, GetFieldZeroId());
381 if (
itr == fFieldDescriptors.cend())
386 if (
itr->second.GetLogicalColumnIds().size() <= idx)
388 return itr->second.GetLogicalColumnIds()[idx];
398 return GetColumnDescriptor(
logicalId).GetPhysicalId();
404 if (GetNClusterGroups() == 0)
410 std::size_t
cgRight = GetNClusterGroups() - 1;
413 const auto &
clusterIds = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]).GetClusterIds();
462 if (GetNClusterGroups() == 0)
468 std::size_t
cgRight = GetNClusterGroups() - 1;
471 const auto &
cgDesc = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]);
534 return FindClusterId(
clusterDesc.GetFirstEntryIndex() - 1);
537std::vector<ROOT::Experimental::DescriptorId_t>
542 std::vector<DescriptorId_t>
fields;
552 : fNTuple(
ntuple), fColumns(
field.GetLogicalColumnIds())
578 std::vector<std::uint64_t>
result;
579 unsigned int base = 0;
580 std::uint64_t flags = 0;
582 if ((
f > 0) && ((
f % 64) == 0))
584 while (
f > base + 64) {
585 result.emplace_back(flags);
592 result.emplace_back(flags);
602 return R__FAIL(
"invalid attempt to add details of unknown cluster group");
603 if (iter->second.HasClusterDetails())
604 return R__FAIL(
"invalid attempt to re-populate cluster group details");
606 return R__FAIL(
"mismatch of number of clusters");
613 return R__FAIL(
"invalid attempt to re-populate existing cluster");
617 return fClusterDescriptors[a].GetFirstEntryIndex() < fClusterDescriptors[b].GetFirstEntryIndex();
621 iter->second =
cgBuilder.MoveDescriptor().Unwrap();
629 return R__FAIL(
"invalid attempt to drop cluster details of unknown cluster group");
630 if (!iter->second.HasClusterDetails())
631 return R__FAIL(
"invalid attempt to drop details of cluster group summary");
633 for (
auto clusterId : iter->second.GetClusterIds())
635 iter->second = iter->second.CloneSummary();
639std::unique_ptr<ROOT::Experimental::RNTupleModel>
642 auto fieldZero = std::make_unique<RFieldZero>();
655 model->AddProjectedField(std::move(
field), [
this](
const std::string &
targetName) -> std::string {
659 model->AddField(std::move(
field));
699 return fClusterGroupId ==
other.fClusterGroupId && fClusterIds ==
other.fClusterIds &&
729 return R__FAIL(
"column ID mismatch");
730 if (fCluster.fColumnRanges.count(
physicalId) > 0)
731 return R__FAIL(
"column ID conflict");
733 for (
const auto &pi :
pageRange.fPageInfos) {
744 if (fCluster.fColumnRanges.count(
physicalId) > 0)
745 return R__FAIL(
"column ID conflict");
783 return R__FAIL(std::string(
"cannot find non-suppressed column for column ID ") +
785 ", cluster ID: " + std::to_string(fCluster.GetId()));
816 for (const auto &c : desc.GetColumnIterable(fieldId)) {
817 const DescriptorId_t physicalId = c.GetPhysicalId();
818 auto &columnRange = fCluster.fColumnRanges[physicalId];
823 if (columnRange.fPhysicalColumnId == kInvalidDescriptorId) {
824 columnRange.fPhysicalColumnId = physicalId;
825 columnRange.fFirstElementIndex = 0;
826 columnRange.fNElements = 0;
827 columnRange.fIsSuppressed = c.IsSuppressedDeferredColumn();
835 if (c.IsDeferredColumn()) {
836 columnRange.fFirstElementIndex = fCluster.GetFirstEntryIndex() * nRepetitions;
837 columnRange.fNElements = fCluster.GetNEntries() * nRepetitions;
838 if (!columnRange.fIsSuppressed) {
839 auto &pageRange = fCluster.fPageRanges[physicalId];
840 pageRange.fPhysicalColumnId = physicalId;
841 const auto element = Internal::RColumnElementBase::Generate<void>(c.GetType());
842 pageRange.ExtendToFitColumnRange(columnRange, *element, Internal::RPage::kPageZeroSize);
844 } else if (!columnRange.fIsSuppressed) {
845 fCluster.fPageRanges[physicalId].fPhysicalColumnId = physicalId;
858 return R__FAIL(
"unset cluster ID");
859 if (fCluster.fNEntries == 0)
860 return R__FAIL(
"empty cluster");
861 for (
auto &
pr : fCluster.fPageRanges) {
862 if (fCluster.fColumnRanges.count(
pr.first) == 0) {
863 return R__FAIL(
"missing column range");
865 pr.second.fCumulativeNElements.clear();
866 pr.second.fCumulativeNElements.reserve(
pr.second.fPageInfos.size());
868 for (
const auto &pi :
pr.second.fPageInfos) {
869 sum += pi.fNElements;
870 pr.second.fCumulativeNElements.emplace_back(
sum);
874 std::swap(
result, fCluster);
898 return R__FAIL(
"unset cluster group ID");
900 std::swap(
result, fClusterGroup);
912 std::swap(
result, fExtraTypeInfo);
921 if (fDescriptor.fFieldDescriptors.count(
fieldId) == 0)
922 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' doesn't exist");
937 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has an invalid parent id");
955 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has incomplete column representations");
963 EnsureValidDescriptor().ThrowOnError();
965 for (
const auto &[
id,
_] : fDescriptor.fClusterGroupDescriptors)
966 fDescriptor.fSortedClusterGroupIds.emplace_back(
id);
967 std::sort(fDescriptor.fSortedClusterGroupIds.begin(), fDescriptor.fSortedClusterGroupIds.end(),
969 return fDescriptor.fClusterGroupDescriptors[a].GetMinEntry() <
970 fDescriptor.fClusterGroupDescriptors[b].GetMinEntry();
973 std::swap(
result, fDescriptor);
980 fDescriptor.fName = std::string(
name);
981 fDescriptor.fDescription = std::string(
description);
988 fDescriptor.fFeatureFlags.insert(
flag);
995 return R__FAIL(
"invalid logical column id");
997 return R__FAIL(
"invalid physical column id");
999 return R__FAIL(
"invalid field id, dangling column");
1007 const auto [
minBits,
maxBits] = RColumnElementBase::GetValidBitRange(fColumn.GetType());
1008 if (fColumn.GetBitsOnStorage() <
minBits || fColumn.GetBitsOnStorage() >
maxBits)
1009 return R__FAIL(
"invalid column bit width");
1012 return fColumn.Clone();
1028 .TypeVersion(
field.GetTypeVersion())
1029 .FieldName(
field.GetFieldName())
1030 .FieldDescription(
field.GetDescription())
1031 .TypeName(
field.GetTypeName())
1032 .TypeAlias(
field.GetTypeAlias())
1033 .Structure(
field.GetStructure())
1034 .NRepetitions(
field.GetNRepetitions());
1044 return R__FAIL(
"invalid field id");
1047 return R__FAIL(
"invalid field structure");
1055 if (fField.GetFieldName().empty()) {
1056 return R__FAIL(
"name cannot be empty string \"\"");
1059 return fField.Clone();
1065 if (fDescriptor.fHeaderExtension)
1066 fDescriptor.fHeaderExtension->MarkExtendedField(
fieldDesc);
1068 fDescriptor.fFieldZeroId =
fieldDesc.GetId();
1079 return R__FAIL(
"child field with id '" + std::to_string(
linkId) +
"' doesn't exist in NTuple");
1081 if (
linkId == fDescriptor.GetFieldZeroId()) {
1082 return R__FAIL(
"cannot make FieldZero a child field");
1085 auto parentId = fDescriptor.fFieldDescriptors.at(
linkId).GetParentId();
1087 return R__FAIL(
"field '" + std::to_string(
linkId) +
"' already has a parent ('" + std::to_string(
parentId) +
")");
1090 return R__FAIL(
"cannot make field '" + std::to_string(
fieldId) +
"' a child of itself");
1092 fDescriptor.fFieldDescriptors.at(
linkId).fParentId =
fieldId;
1093 fDescriptor.fFieldDescriptors.at(
fieldId).fLinkIds.push_back(
linkId);
1104 return R__FAIL(
"projected field with id '" + std::to_string(
targetId) +
"' doesn't exist in NTuple");
1106 if (
targetId == fDescriptor.GetFieldZeroId()) {
1107 return R__FAIL(
"cannot make FieldZero a projected field");
1110 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of itself");
1112 if (fDescriptor.fFieldDescriptors.at(
sourceId).IsProjectedField()) {
1113 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of an already projected field");
1118 return R__FAIL(
"field '" + std::to_string(
targetId) +
"' has already a projection source ('" +
1119 std::to_string(
targetDesc.GetProjectionSourceId()) +
")");
1138 if (
columnDesc.GetType() != fDescriptor.GetColumnDescriptor(
columnDesc.GetPhysicalId()).GetType())
1139 return R__FAIL(
"alias column type mismatch");
1142 return R__FAIL(
"column index clash");
1146 return R__FAIL(
"out of bounds column index");
1150 return R__FAIL(
"out of bounds representation index");
1156 return R__FAIL(
"incomplete column representations");
1160 return R__FAIL(
"irregular column representations");
1171 fDescriptor.fNPhysicalColumns++;
1173 if (fDescriptor.fHeaderExtension)
1174 fDescriptor.fHeaderExtension->MarkExtendedColumn(
columnDesc);
1183 if (fDescriptor.fClusterGroupDescriptors.count(
id) > 0)
1184 return R__FAIL(
"cluster group id clash");
1187 fDescriptor.fClusterGroupDescriptors.emplace(
id, std::move(
clusterGroup));
1193 fDescriptor.fName =
"";
1194 fDescriptor.fDescription =
"";
1195 fDescriptor.fFieldDescriptors.clear();
1196 fDescriptor.fColumnDescriptors.clear();
1197 fDescriptor.fClusterDescriptors.clear();
1198 fDescriptor.fClusterGroupDescriptors.clear();
1199 fDescriptor.fHeaderExtension.reset();
1204 if (!fDescriptor.fHeaderExtension)
1205 fDescriptor.fHeaderExtension = std::make_unique<RNTupleDescriptor::RHeaderExtension>();
1210 if (fDescriptor.GetNLogicalColumns() == 0)
1212 R__ASSERT(fDescriptor.GetNPhysicalColumns() > 0);
1214 for (
DescriptorId_t id = fDescriptor.GetNLogicalColumns() - 1;
id >= fDescriptor.GetNPhysicalColumns(); --
id) {
1215 auto c = fDescriptor.fColumnDescriptors[
id].Clone();
1218 fDescriptor.fColumnDescriptors.erase(
id);
1219 for (
auto &
link : fDescriptor.fFieldDescriptors[
c.fFieldId].fLogicalColumnIds) {
1220 if (
link ==
c.fLogicalColumnId) {
1226 R__ASSERT(fDescriptor.fColumnDescriptors.count(
c.fLogicalColumnId) == 0);
1227 fDescriptor.fColumnDescriptors.emplace(
c.fLogicalColumnId, std::move(
c));
1234 if (fDescriptor.fClusterDescriptors.count(
clusterId) > 0)
1235 return R__FAIL(
"cluster id clash");
1244 if (std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1246 return R__FAIL(
"extra type info duplicates");
1248 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1256 const auto &desc = GetDescriptor();
1283 for (
const auto &
extraTypeInfo : desc.GetExtraTypeInfoIterable()) {
1316 return GetFieldIterable(GetFieldDescriptor(
fieldId));
1328 return GetFieldIterable(GetFieldZeroId());
1335 return GetFieldIterable(GetFieldZeroId(),
comparator);
#define R__FORWARD_ERROR(res)
Short-hand to return an RResult<T> in an error state (i.e. after checking)
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
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 offset
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 id
A helper class for piece-wise construction of an RClusterDescriptor.
RResult< void > MarkSuppressedColumnRange(DescriptorId_t physicalId)
Books the given column ID as being suppressed in this cluster.
RResult< void > CommitSuppressedColumnRanges(const RNTupleDescriptor &desc)
Sets the first element index and number of elements for all the suppressed column ranges.
RResult< RClusterDescriptor > MoveDescriptor()
Move out the full cluster descriptor including page locations.
RClusterDescriptorBuilder & AddExtendedColumnRanges(const RNTupleDescriptor &desc)
Add column and page ranges for columns created during late model extension missing in this cluster.
RResult< void > CommitColumnRange(DescriptorId_t physicalId, std::uint64_t firstElementIndex, std::uint32_t compressionSettings, const RClusterDescriptor::RPageRange &pageRange)
A helper class for piece-wise construction of an RClusterGroupDescriptor.
RClusterGroupDescriptorBuilder & PageListLocator(const RNTupleLocator &pageListLocator)
RResult< RClusterGroupDescriptor > MoveDescriptor()
RClusterGroupDescriptorBuilder & MinEntry(std::uint64_t minEntry)
RClusterGroupDescriptorBuilder & ClusterGroupId(DescriptorId_t clusterGroupId)
RClusterGroupDescriptorBuilder & EntrySpan(std::uint64_t entrySpan)
RClusterGroupDescriptorBuilder & NClusters(std::uint32_t nClusters)
RClusterGroupDescriptorBuilder & PageListLength(std::uint64_t pageListLength)
static RClusterGroupDescriptorBuilder FromSummary(const RClusterGroupDescriptor &clusterGroupDesc)
RResult< RColumnDescriptor > MakeDescriptor() const
Attempt to make a column descriptor.
A column element encapsulates the translation between basic C++ types and their column representation...
A helper class for piece-wise construction of an RFieldDescriptor.
static RFieldDescriptorBuilder FromField(const RFieldBase &field)
Make a new RFieldDescriptorBuilder based off a live NTuple field.
RResult< RFieldDescriptor > MakeDescriptor() const
Attempt to make a field descriptor.
RFieldDescriptorBuilder()=default
Make an empty dangling field descriptor.
RNTupleSerializer::StreamerInfoMap_t BuildStreamerInfos() const
Get the streamer info records for custom classes. Currently requires the corresponding dictionaries t...
RResult< void > AddExtraTypeInfo(RExtraTypeInfoDescriptor &&extraTypeInfoDesc)
RResult< void > AddColumn(RColumnDescriptor &&columnDesc)
RResult< void > AddFieldProjection(DescriptorId_t sourceId, DescriptorId_t targetId)
void BeginHeaderExtension()
Mark the beginning of the header extension; any fields and columns added after a call to this functio...
void ShiftAliasColumns(std::uint32_t offset)
If the descriptor is constructed in pieces consisting of physical and alias columns (regular and proj...
RResult< void > AddClusterGroup(RClusterGroupDescriptor &&clusterGroup)
RResult< void > EnsureFieldExists(DescriptorId_t fieldId) const
void SetNTuple(const std::string_view name, const std::string_view description)
void SetFeature(unsigned int flag)
RResult< void > AddCluster(RClusterDescriptor &&clusterDesc)
RResult< void > EnsureValidDescriptor() const
Checks whether invariants hold:
void AddField(const RFieldDescriptor &fieldDesc)
RResult< void > AddFieldLink(DescriptorId_t fieldId, DescriptorId_t linkId)
RNTupleDescriptor MoveDescriptor()
void Reset()
Clears so-far stored clusters, fields, and columns and return to a pristine ntuple descriptor.
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
Meta-data for a set of ntuple clusters.
std::unordered_map< DescriptorId_t, RPageRange > fPageRanges
std::uint64_t GetNBytesOnStorage() const
RColumnRangeIterable GetColumnRangeIterable() const
Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
NTupleSize_t fFirstEntryIndex
Clusters can be swapped by adjusting the entry offsets.
DescriptorId_t fClusterId
RClusterDescriptor Clone() const
std::unordered_map< DescriptorId_t, RColumnRange > fColumnRanges
bool operator==(const RClusterDescriptor &other) const
Clusters are bundled in cluster groups.
std::uint64_t fMinEntry
The minimum first entry number of the clusters in the cluster group.
RClusterGroupDescriptor Clone() const
std::uint64_t fEntrySpan
Number of entries that are (partially for sharded clusters) covered by this cluster group.
std::uint64_t fPageListLength
Uncompressed size of the page list.
RClusterGroupDescriptor CloneSummary() const
std::uint32_t fNClusters
Number of clusters is always known even if the cluster IDs are not (yet) populated.
RNTupleLocator fPageListLocator
The page list that corresponds to the cluster group.
DescriptorId_t fClusterGroupId
bool operator==(const RClusterGroupDescriptor &other) const
std::vector< DescriptorId_t > fClusterIds
The cluster IDs can be empty if the corresponding page list is not loaded.
Meta-data stored for every column of an ntuple.
ENTupleColumnType fType
The on-disk column type.
std::optional< RValueRange > fValueRange
Optional value range (used e.g. by quantized real fields)
std::uint16_t fBitsOnStorage
The size in bits of elements of this column.
DescriptorId_t fPhysicalColumnId
Usually identical to the logical column ID, except for alias columns where it references the shadowed...
DescriptorId_t fLogicalColumnId
The actual column identifier, which is the link to the corresponding field.
RColumnDescriptor Clone() const
Get a copy of the descriptor.
DescriptorId_t fFieldId
Every column belongs to one and only one field.
std::int64_t fFirstElementIndex
The absolute value specifies the index for the first stored element for this column.
std::uint16_t fRepresentationIndex
A field may use multiple column representations, which are numbered from zero to $m$.
std::uint32_t fIndex
A field can be serialized into several columns, which are numbered from zero to $n$.
bool operator==(const RColumnDescriptor &other) const
A field translates read and write calls from/to underlying columns to/from tree values.
@ kTraitTypeChecksum
The TClass checksum is set and valid.
@ kTraitInvalidField
This field is an instance of RInvalidField and can be safely static_cast to it.
Meta-data stored for every field of an ntuple.
std::vector< DescriptorId_t > fLinkIds
The pointers in the other direction from parent to children.
std::uint32_t fTypeVersion
The version of the C++ type itself.
std::uint32_t fColumnCardinality
The number of columns in the column representations of the field.
std::optional< std::uint32_t > fTypeChecksum
For custom classes, we store the ROOT TClass reported checksum to facilitate the use of I/O rules tha...
bool IsCustomClass() const
Tells if the field describes a user-defined class rather than a fundamental type, a collection,...
std::string fFieldDescription
Free text set by the user.
std::string fFieldName
The leaf name, not including parent fields.
std::uint32_t fFieldVersion
The version of the C++-type-to-column translation mechanics.
std::vector< DescriptorId_t > fLogicalColumnIds
The ordered list of columns attached to this field: first by representation index then by column inde...
std::unique_ptr< RFieldBase > CreateField(const RNTupleDescriptor &ntplDesc, const RCreateFieldOptions &options={}) const
In general, we create a field simply from the C++ type name.
DescriptorId_t fParentId
Establishes sub field relationships, such as classes and collections.
RFieldDescriptor Clone() const
Get a copy of the descriptor.
bool operator==(const RFieldDescriptor &other) const
std::string fTypeAlias
A typedef or using directive that resolved to the type name during field creation.
ENTupleStructure fStructure
The structural information carried by this field in the data model tree.
std::string fTypeName
The C++ type that was used when writing the field.
std::uint64_t fNRepetitions
The number of elements per entry for fixed-size arrays.
DescriptorId_t fProjectionSourceId
For projected fields, the source field ID.
Used in RFieldBase::Check() to record field creation failures.
@ kGeneric
Generic unrecoverable error.
@ kUnknownStructure
The field could not be created because its descriptor had an unknown structural role.
Used to loop over all the clusters of an ntuple (in unspecified order)
Used to loop over all the cluster groups of an ntuple (in unspecified order)
Used to loop over a field's associated columns.
std::vector< DescriptorId_t > fColumns
The descriptor ids of the columns ordered by field, representation, and column index.
RColumnDescriptorIterable(const RNTupleDescriptor &ntuple, const RFieldDescriptor &fieldDesc)
Used to loop over a field's child fields.
The on-storage meta-data of an ntuple.
std::uint64_t fNPhysicalColumns
Updated by the descriptor builder when columns are added.
std::unordered_map< DescriptorId_t, RClusterDescriptor > fClusterDescriptors
May contain only a subset of all the available clusters, e.g.
std::uint64_t fGeneration
Once constructed by an RNTupleDescriptorBuilder, the descriptor is mostly immutable except for set of...
std::uint64_t fOnDiskFooterSize
Like fOnDiskHeaderSize, contains both cluster summaries and page locations.
std::uint64_t fNEntries
Updated by the descriptor builder when the cluster groups are added.
std::set< unsigned int > fFeatureFlags
std::vector< RExtraTypeInfoDescriptor > fExtraTypeInfoDescriptors
NTupleSize_t GetNElements(DescriptorId_t physicalColumnId) const
std::unordered_map< DescriptorId_t, RClusterGroupDescriptor > fClusterGroupDescriptors
std::unique_ptr< RNTupleModel > CreateModel(const RCreateModelOptions &options=RCreateModelOptions()) const
Re-create the C++ model from the stored meta-data.
DescriptorId_t FindLogicalColumnId(DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
DescriptorId_t FindNextClusterId(DescriptorId_t clusterId) const
DescriptorId_t FindPrevClusterId(DescriptorId_t clusterId) const
std::unordered_map< DescriptorId_t, RColumnDescriptor > fColumnDescriptors
RColumnDescriptorIterable GetColumnIterable() const
std::uint64_t fNClusters
Updated by the descriptor builder when the cluster groups are added.
std::string fName
The ntuple name needs to be unique in a given storage location (file)
std::unordered_map< DescriptorId_t, RFieldDescriptor > fFieldDescriptors
DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level NTuple data fields.
RNTupleDescriptor Clone() const
DescriptorId_t FindPhysicalColumnId(DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
std::uint64_t fOnDiskHeaderXxHash3
Set by the descriptor builder when deserialized.
RResult< void > AddClusterGroupDetails(DescriptorId_t clusterGroupId, std::vector< RClusterDescriptor > &clusterDescs)
Methods to load and drop cluster group details (cluster IDs and page locations)
bool operator==(const RNTupleDescriptor &other) const
std::vector< DescriptorId_t > fSortedClusterGroupIds
References cluster groups sorted by entry range and thus allows for binary search.
RResult< void > DropClusterGroupDetails(DescriptorId_t clusterGroupId)
std::string GetQualifiedFieldName(DescriptorId_t fieldId) const
Walks up the parents of the field ID and returns a field name of the form a.b.c.d In case of invalid ...
DescriptorId_t FindFieldId(std::string_view fieldName, DescriptorId_t parentId) const
const RColumnDescriptor & GetColumnDescriptor(DescriptorId_t columnId) const
RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const
const RFieldDescriptor & GetFieldDescriptor(DescriptorId_t fieldId) const
std::unique_ptr< RHeaderExtension > fHeaderExtension
RClusterGroupDescriptorIterable GetClusterGroupIterable() const
RClusterDescriptorIterable GetClusterIterable() const
std::string fDescription
Free text from the user.
RFieldDescriptorIterable GetTopLevelFields() const
DescriptorId_t FindClusterId(NTupleSize_t entryIdx) const
DescriptorId_t fFieldZeroId
Set by the descriptor builder.
const RHeaderExtension * GetHeaderExtension() const
Return header extension information; if the descriptor does not have a header extension,...
std::uint64_t fOnDiskHeaderSize
Set by the descriptor builder when deserialized.
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
std::vector< std::uint64_t > GetFeatureFlags() const
static std::unique_ptr< RNTupleModel > Create()
static std::unique_ptr< RNTupleModel > CreateBare()
A bare model has no default entry.
static std::unique_ptr< RVectorField > CreateUntyped(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
Base class for all ROOT issued exceptions.
const_iterator begin() const
const_iterator end() const
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
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.
RResult< void > EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
Check whether a given string is a valid name according to the RNTuple specification.
ROOT::RResult< std::unique_ptr< ROOT::Experimental::RFieldBase > > CallFieldBaseCreate(const std::string &fieldName, const std::string &canonicalType, const std::string &typeAlias, const RCreateFieldOptions &options, const RNTupleDescriptor *desc, DescriptorId_t fieldId)
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId
The window of element indexes of a particular column in a particular cluster.
bool fReturnInvalidOnError
If true, failing to create a field will return a RInvalidField instead of throwing an exception.
Modifiers passed to CreateModel
bool fCreateBare
If true, the model will be created without a default entry (bare model).
bool fReconstructProjections
If set to true, projected fields will be reconstructed as such.
bool fEmulateUnknownTypes
If true, fields with a user defined type that have no available dictionaries will be reconstructed as...
bool fForwardCompatible
Normally creating a model will fail if any of the reconstructed fields contains an unknown column typ...
static uint64_t sum(uint64_t i)