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) {
237 std::accumulate(fPageInfos.begin(), fPageInfos.end(), 0U,
238 [](std::size_t
n,
const auto &
pageInfo) { return n + pageInfo.GetNElements(); });
261 std::make_move_iterator(fPageInfos.end()));
268 return fClusterId ==
other.fClusterId && fFirstEntryIndex ==
other.fFirstEntryIndex &&
269 fNEntries ==
other.fNEntries && fColumnRanges ==
other.fColumnRanges && fPageRanges ==
other.fPageRanges;
275 for (
const auto &
pr : fPageRanges) {
276 for (
const auto &pi :
pr.second.fPageInfos) {
277 nbytes += pi.GetLocator().GetNBytesOnStorage();
290 for (
const auto &
d : fPageRanges)
317 return fName ==
other.fName &&
318 fDescription ==
other.fDescription &&
319 fNEntries ==
other.fNEntries &&
320 fGeneration ==
other.fGeneration &&
321 fFieldZeroId ==
other.fFieldZeroId &&
322 fFieldDescriptors ==
other.fFieldDescriptors &&
323 fColumnDescriptors ==
other.fColumnDescriptors &&
324 fClusterGroupDescriptors ==
other.fClusterGroupDescriptors &&
325 fClusterDescriptors ==
other.fClusterDescriptors;
332 for (
const auto &cd : fClusterDescriptors) {
346 if (
posDot != std::string::npos) {
375 return FindFieldId(
fieldName, GetFieldZeroId());
383 if (
itr == fFieldDescriptors.cend())
388 if (
itr->second.GetLogicalColumnIds().size() <= idx)
390 return itr->second.GetLogicalColumnIds()[idx];
400 return GetColumnDescriptor(
logicalId).GetPhysicalId();
406 if (GetNClusterGroups() == 0)
412 std::size_t
cgRight = GetNClusterGroups() - 1;
415 const auto &
clusterIds = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]).GetClusterIds();
468 if (GetNClusterGroups() == 0)
474 std::size_t
cgRight = GetNClusterGroups() - 1;
477 const auto &
cgDesc = GetClusterGroupDescriptor(fSortedClusterGroupIds[
cgMidpoint]);
538 return FindClusterId(
clusterDesc.GetFirstEntryIndex() - 1);
541std::vector<ROOT::DescriptorId_t>
546 std::vector<ROOT::DescriptorId_t>
fields;
547 for (
const auto fieldId : fFieldIdsOrder) {
556 : fNTuple(
ntuple), fColumns(
field.GetLogicalColumnIds())
582 std::vector<std::uint64_t>
result;
583 unsigned int base = 0;
584 std::uint64_t flags = 0;
586 if ((
f > 0) && ((
f % 64) == 0))
588 while (
f > base + 64) {
589 result.emplace_back(flags);
596 result.emplace_back(flags);
606 return R__FAIL(
"invalid attempt to add details of unknown cluster group");
607 if (iter->second.HasClusterDetails())
608 return R__FAIL(
"invalid attempt to re-populate cluster group details");
610 return R__FAIL(
"mismatch of number of clusters");
617 return R__FAIL(
"invalid attempt to re-populate existing cluster");
621 return fClusterDescriptors[a].GetFirstEntryIndex() < fClusterDescriptors[b].GetFirstEntryIndex();
625 iter->second =
cgBuilder.MoveDescriptor().Unwrap();
633 return R__FAIL(
"invalid attempt to drop cluster details of unknown cluster group");
634 if (!iter->second.HasClusterDetails())
635 return R__FAIL(
"invalid attempt to drop details of cluster group summary");
637 for (
auto clusterId : iter->second.GetClusterIds())
639 iter->second = iter->second.CloneSummary();
643std::unique_ptr<ROOT::Experimental::RNTupleModel>
646 auto fieldZero = std::make_unique<RFieldZero>();
659 model->AddProjectedField(std::move(
field), [
this](
const std::string &
targetName) -> std::string {
663 model->AddField(std::move(
field));
717 return fClusterGroupId ==
other.fClusterGroupId && fClusterIds ==
other.fClusterIds &&
747 return R__FAIL(
"column ID mismatch");
748 if (fCluster.fColumnRanges.count(
physicalId) > 0)
749 return R__FAIL(
"column ID conflict");
751 for (
const auto &pi :
pageRange.fPageInfos) {
762 if (fCluster.fColumnRanges.count(
physicalId) > 0)
763 return R__FAIL(
"column ID conflict");
801 return R__FAIL(std::string(
"cannot find non-suppressed column for column ID ") +
802 std::to_string(
columnRange.GetPhysicalColumnId()) +
803 ", cluster ID: " + std::to_string(fCluster.GetId()));
834 for (const auto &c : desc.GetColumnIterable(fieldId)) {
835 const ROOT::DescriptorId_t physicalId = c.GetPhysicalId();
836 auto &columnRange = fCluster.fColumnRanges[physicalId];
841 if (columnRange.GetPhysicalColumnId() == ROOT::kInvalidDescriptorId) {
842 columnRange.SetPhysicalColumnId(physicalId);
843 columnRange.SetFirstElementIndex(0);
844 columnRange.SetNElements(0);
845 columnRange.SetIsSuppressed(c.IsSuppressedDeferredColumn());
853 if (c.IsDeferredColumn()) {
854 columnRange.SetFirstElementIndex(fCluster.GetFirstEntryIndex() * nRepetitions);
855 columnRange.SetNElements(fCluster.GetNEntries() * nRepetitions);
856 if (!columnRange.IsSuppressed()) {
857 auto &pageRange = fCluster.fPageRanges[physicalId];
858 pageRange.fPhysicalColumnId = physicalId;
859 const auto element = Internal::RColumnElementBase::Generate<void>(c.GetType());
860 pageRange.ExtendToFitColumnRange(columnRange, *element, Internal::RPage::kPageZeroSize);
862 } else if (!columnRange.IsSuppressed()) {
863 fCluster.fPageRanges[physicalId].fPhysicalColumnId = physicalId;
876 return R__FAIL(
"unset cluster ID");
877 if (fCluster.fNEntries == 0)
878 return R__FAIL(
"empty cluster");
879 for (
auto &
pr : fCluster.fPageRanges) {
880 if (fCluster.fColumnRanges.count(
pr.first) == 0) {
881 return R__FAIL(
"missing column range");
883 pr.second.fCumulativeNElements.clear();
884 pr.second.fCumulativeNElements.reserve(
pr.second.fPageInfos.size());
886 for (
const auto &pi :
pr.second.fPageInfos) {
887 sum += pi.GetNElements();
888 pr.second.fCumulativeNElements.emplace_back(
sum);
892 std::swap(
result, fCluster);
916 return R__FAIL(
"unset cluster group ID");
918 std::swap(
result, fClusterGroup);
930 std::swap(
result, fExtraTypeInfo);
939 if (fDescriptor.fFieldDescriptors.count(
fieldId) == 0)
940 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' doesn't exist");
955 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has an invalid parent id");
973 return R__FAIL(
"field with id '" + std::to_string(
fieldId) +
"' has incomplete column representations");
981 EnsureValidDescriptor().ThrowOnError();
983 for (
const auto &[
id,
_] : fDescriptor.fClusterGroupDescriptors)
984 fDescriptor.fSortedClusterGroupIds.emplace_back(
id);
985 std::sort(fDescriptor.fSortedClusterGroupIds.begin(), fDescriptor.fSortedClusterGroupIds.end(),
987 return fDescriptor.fClusterGroupDescriptors[a].GetMinEntry() <
988 fDescriptor.fClusterGroupDescriptors[b].GetMinEntry();
991 std::swap(
result, fDescriptor);
998 fDescriptor.fName = std::string(
name);
999 fDescriptor.fDescription = std::string(
description);
1006 fDescriptor.fFeatureFlags.insert(
flag);
1013 return R__FAIL(
"invalid logical column id");
1015 return R__FAIL(
"invalid physical column id");
1017 return R__FAIL(
"invalid field id, dangling column");
1025 const auto [
minBits,
maxBits] = RColumnElementBase::GetValidBitRange(fColumn.GetType());
1026 if (fColumn.GetBitsOnStorage() <
minBits || fColumn.GetBitsOnStorage() >
maxBits)
1027 return R__FAIL(
"invalid column bit width");
1030 return fColumn.Clone();
1046 .TypeVersion(
field.GetTypeVersion())
1047 .FieldName(
field.GetFieldName())
1048 .FieldDescription(
field.GetDescription())
1049 .TypeName(
field.GetTypeName())
1050 .TypeAlias(
field.GetTypeAlias())
1051 .Structure(
field.GetStructure())
1052 .NRepetitions(
field.GetNRepetitions());
1062 return R__FAIL(
"invalid field id");
1065 return R__FAIL(
"invalid field structure");
1073 if (fField.GetFieldName().empty()) {
1074 return R__FAIL(
"name cannot be empty string \"\"");
1077 return fField.Clone();
1083 if (fDescriptor.fHeaderExtension)
1084 fDescriptor.fHeaderExtension->MarkExtendedField(
fieldDesc);
1086 fDescriptor.fFieldZeroId =
fieldDesc.GetId();
1097 return R__FAIL(
"child field with id '" + std::to_string(
linkId) +
"' doesn't exist in NTuple");
1099 if (
linkId == fDescriptor.GetFieldZeroId()) {
1100 return R__FAIL(
"cannot make FieldZero a child field");
1103 auto parentId = fDescriptor.fFieldDescriptors.at(
linkId).GetParentId();
1105 return R__FAIL(
"field '" + std::to_string(
linkId) +
"' already has a parent ('" + std::to_string(
parentId) +
")");
1108 return R__FAIL(
"cannot make field '" + std::to_string(
fieldId) +
"' a child of itself");
1110 fDescriptor.fFieldDescriptors.at(
linkId).fParentId =
fieldId;
1111 fDescriptor.fFieldDescriptors.at(
fieldId).fLinkIds.push_back(
linkId);
1123 return R__FAIL(
"projected field with id '" + std::to_string(
targetId) +
"' doesn't exist in NTuple");
1125 if (
targetId == fDescriptor.GetFieldZeroId()) {
1126 return R__FAIL(
"cannot make FieldZero a projected field");
1129 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of itself");
1131 if (fDescriptor.fFieldDescriptors.at(
sourceId).IsProjectedField()) {
1132 return R__FAIL(
"cannot make field '" + std::to_string(
targetId) +
"' a projection of an already projected field");
1137 return R__FAIL(
"field '" + std::to_string(
targetId) +
"' has already a projection source ('" +
1138 std::to_string(
targetDesc.GetProjectionSourceId()) +
")");
1157 if (
columnDesc.GetType() != fDescriptor.GetColumnDescriptor(
columnDesc.GetPhysicalId()).GetType())
1158 return R__FAIL(
"alias column type mismatch");
1161 return R__FAIL(
"column index clash");
1165 return R__FAIL(
"out of bounds column index");
1169 return R__FAIL(
"out of bounds representation index");
1175 return R__FAIL(
"incomplete column representations");
1179 return R__FAIL(
"irregular column representations");
1190 fDescriptor.fNPhysicalColumns++;
1192 if (fDescriptor.fHeaderExtension)
1193 fDescriptor.fHeaderExtension->MarkExtendedColumn(
columnDesc);
1202 if (fDescriptor.fClusterGroupDescriptors.count(
id) > 0)
1203 return R__FAIL(
"cluster group id clash");
1206 fDescriptor.fClusterGroupDescriptors.emplace(
id, std::move(
clusterGroup));
1212 fDescriptor.fName =
"";
1213 fDescriptor.fDescription =
"";
1214 fDescriptor.fFieldDescriptors.clear();
1215 fDescriptor.fColumnDescriptors.clear();
1216 fDescriptor.fClusterDescriptors.clear();
1217 fDescriptor.fClusterGroupDescriptors.clear();
1218 fDescriptor.fHeaderExtension.reset();
1228 if (!fDescriptor.fHeaderExtension)
1229 fDescriptor.fHeaderExtension = std::make_unique<RNTupleDescriptor::RHeaderExtension>();
1234 if (fDescriptor.GetNLogicalColumns() == 0)
1236 R__ASSERT(fDescriptor.GetNPhysicalColumns() > 0);
1238 for (
ROOT::DescriptorId_t id = fDescriptor.GetNLogicalColumns() - 1;
id >= fDescriptor.GetNPhysicalColumns(); --
id) {
1239 auto c = fDescriptor.fColumnDescriptors[
id].Clone();
1242 fDescriptor.fColumnDescriptors.erase(
id);
1243 for (
auto &
link : fDescriptor.fFieldDescriptors[
c.fFieldId].fLogicalColumnIds) {
1244 if (
link ==
c.fLogicalColumnId) {
1250 R__ASSERT(fDescriptor.fColumnDescriptors.count(
c.fLogicalColumnId) == 0);
1251 fDescriptor.fColumnDescriptors.emplace(
c.fLogicalColumnId, std::move(
c));
1258 if (fDescriptor.fClusterDescriptors.count(
clusterId) > 0)
1259 return R__FAIL(
"cluster id clash");
1268 if (std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1270 return R__FAIL(
"extra type info duplicates");
1272 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1279 auto it = std::find(fDescriptor.fExtraTypeInfoDescriptors.begin(), fDescriptor.fExtraTypeInfoDescriptors.end(),
1281 if (it != fDescriptor.fExtraTypeInfoDescriptors.end())
1284 fDescriptor.fExtraTypeInfoDescriptors.emplace_back(std::move(
extraTypeInfoDesc));
1291 const auto &desc = GetDescriptor();
1318 for (
const auto &
extraTypeInfo : desc.GetExtraTypeInfoIterable()) {
1352 return GetFieldIterable(GetFieldDescriptor(
fieldId));
1365 return GetFieldIterable(GetFieldZeroId());
1372 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 > 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.
RResult< void > MarkSuppressedColumnRange(ROOT::DescriptorId_t physicalId)
Books the given column ID as being suppressed in this cluster.
RResult< void > CommitColumnRange(ROOT::DescriptorId_t physicalId, std::uint64_t firstElementIndex, std::uint32_t compressionSettings, const RClusterDescriptor::RPageRange &pageRange)
RClusterDescriptorBuilder & AddExtendedColumnRanges(const RNTupleDescriptor &desc)
Add column and page ranges for columns created during late model extension missing in this cluster.
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(ROOT::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)
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)
void SetSchemaFromExisting(const RNTupleDescriptor &descriptor)
Copies the "schema" part of descriptor into the builder's descriptor.
RResult< void > AddFieldProjection(ROOT::DescriptorId_t sourceId, ROOT::DescriptorId_t targetId)
void ReplaceExtraTypeInfo(RExtraTypeInfoDescriptor &&extraTypeInfoDesc)
void SetNTuple(const std::string_view name, const std::string_view description)
void SetFeature(unsigned int flag)
RResult< void > AddFieldLink(ROOT::DescriptorId_t fieldId, ROOT::DescriptorId_t linkId)
RResult< void > AddCluster(RClusterDescriptor &&clusterDesc)
RResult< void > EnsureFieldExists(ROOT::DescriptorId_t fieldId) const
RResult< void > EnsureValidDescriptor() const
Checks whether invariants hold:
void AddField(const RFieldDescriptor &fieldDesc)
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
The window of element indexes of a particular column in a particular cluster.
Meta-data for a set of ntuple clusters.
std::uint64_t GetNBytesOnStorage() const
RColumnRangeIterable GetColumnRangeIterable() const
Returns an iterator over pairs { columnId, columnRange }. The iteration order is unspecified.
std::unordered_map< ROOT::DescriptorId_t, RPageRange > fPageRanges
ROOT::DescriptorId_t fClusterId
RClusterDescriptor Clone() const
bool operator==(const RClusterDescriptor &other) const
std::unordered_map< ROOT::DescriptorId_t, RColumnRange > fColumnRanges
ROOT::NTupleSize_t fFirstEntryIndex
Clusters can be swapped by adjusting the entry offsets.
ROOT::NTupleSize_t fNEntries
Clusters are bundled in cluster groups.
std::uint64_t fMinEntry
The minimum first entry number of the clusters in the cluster group.
std::vector< ROOT::DescriptorId_t > fClusterIds
The cluster IDs can be empty if the corresponding page list is not loaded.
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.
ROOT::DescriptorId_t fClusterGroupId
bool operator==(const RClusterGroupDescriptor &other) const
Meta-data stored for every column of an ntuple.
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.
RColumnDescriptor Clone() const
Get a copy of the descriptor.
ROOT::DescriptorId_t fLogicalColumnId
The actual column identifier, which is the link to the corresponding field.
ROOT::ENTupleColumnType fType
The on-disk column type.
ROOT::DescriptorId_t fPhysicalColumnId
Usually identical to the logical column ID, except for alias columns where it references the shadowed...
std::int64_t fFirstElementIndex
The absolute value specifies the index for the first stored element for this column.
ROOT::DescriptorId_t fFieldId
Every column belongs to one and only one field.
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::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...
ROOT::DescriptorId_t fParentId
Establishes sub field relationships, such as classes and collections.
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.
ROOT::DescriptorId_t fFieldId
ROOT::DescriptorId_t fProjectionSourceId
For projected fields, the source field ID.
std::unique_ptr< RFieldBase > CreateField(const RNTupleDescriptor &ntplDesc, const ROOT::RCreateFieldOptions &options={}) const
In general, we create a field simply from the C++ type name.
std::vector< ROOT::DescriptorId_t > fLogicalColumnIds
The ordered list of columns attached to this field: first by representation index then by column inde...
RFieldDescriptor Clone() const
Get a copy of the descriptor.
bool operator==(const RFieldDescriptor &other) const
std::vector< ROOT::DescriptorId_t > fLinkIds
The pointers in the other direction from parent to children.
std::string fTypeAlias
A typedef or using directive that resolved to the type name during field creation.
ROOT::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.
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< ROOT::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::uint64_t fGeneration
Once constructed by an RNTupleDescriptorBuilder, the descriptor is mostly immutable except for set of...
ROOT::DescriptorId_t FindPhysicalColumnId(ROOT::DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
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.
ROOT::NTupleSize_t GetNElements(ROOT::DescriptorId_t physicalColumnId) const
std::set< unsigned int > fFeatureFlags
std::vector< RExtraTypeInfoDescriptor > fExtraTypeInfoDescriptors
RResult< void > DropClusterGroupDetails(ROOT::DescriptorId_t clusterGroupId)
RResult< void > AddClusterGroupDetails(ROOT::DescriptorId_t clusterGroupId, std::vector< RClusterDescriptor > &clusterDescs)
Methods to load and drop cluster group details (cluster IDs and page locations)
std::unique_ptr< RNTupleModel > CreateModel(const RCreateModelOptions &options=RCreateModelOptions()) const
Re-create the C++ model from the stored meta-data.
std::vector< ROOT::DescriptorId_t > fSortedClusterGroupIds
References cluster groups sorted by entry range and thus allows for binary search.
ROOT::DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level NTuple data fields.
RColumnDescriptorIterable GetColumnIterable() const
const RColumnDescriptor & GetColumnDescriptor(ROOT::DescriptorId_t columnId) const
ROOT::DescriptorId_t FindPrevClusterId(ROOT::DescriptorId_t clusterId) const
const RFieldDescriptor & GetFieldDescriptor(ROOT::DescriptorId_t fieldId) 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)
ROOT::DescriptorId_t FindLogicalColumnId(ROOT::DescriptorId_t fieldId, std::uint32_t columnIndex, std::uint16_t representationIndex) const
std::unordered_map< ROOT::DescriptorId_t, RFieldDescriptor > fFieldDescriptors
RNTupleDescriptor Clone() const
std::uint64_t fOnDiskHeaderXxHash3
Set by the descriptor builder when deserialized.
std::unordered_map< ROOT::DescriptorId_t, RColumnDescriptor > fColumnDescriptors
bool operator==(const RNTupleDescriptor &other) const
ROOT::DescriptorId_t FindFieldId(std::string_view fieldName, ROOT::DescriptorId_t parentId) const
ROOT::DescriptorId_t FindNextClusterId(ROOT::DescriptorId_t clusterId) const
ROOT::DescriptorId_t fFieldZeroId
Set by the descriptor builder.
RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const
std::unordered_map< ROOT::DescriptorId_t, RClusterDescriptor > fClusterDescriptors
May contain only a subset of all the available clusters, e.g.
std::unique_ptr< RHeaderExtension > fHeaderExtension
RClusterGroupDescriptorIterable GetClusterGroupIterable() const
std::unordered_map< ROOT::DescriptorId_t, RClusterGroupDescriptor > fClusterGroupDescriptors
RNTupleDescriptor CloneSchema() const
Creates a descriptor containing only the schema information about this RNTuple, i....
RClusterDescriptorIterable GetClusterIterable() const
std::string fDescription
Free text from the user.
RFieldDescriptorIterable GetTopLevelFields() const
ROOT::DescriptorId_t FindClusterId(ROOT::NTupleSize_t entryIdx) const
std::string GetQualifiedFieldName(ROOT::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 ...
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.
Generic information about the physical location of data.
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 &typeName, const ROOT::RCreateFieldOptions &options, const RNTupleDescriptor *desc, ROOT::DescriptorId_t fieldId)
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
Modifiers passed to CreateModel
bool GetForwardCompatible() const
bool GetReconstructProjections() const
bool GetCreateBare() const
bool GetEmulateUnknownTypes() const
bool GetReturnInvalidOnError() const
static uint64_t sum(uint64_t i)