51std::uint32_t SerializeInt64(std::int64_t val,
void *buffer)
53 if (buffer !=
nullptr) {
54 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
55 bytes[0] = (val & 0x00000000000000FF);
56 bytes[1] = (val & 0x000000000000FF00) >> 8;
57 bytes[2] = (val & 0x0000000000FF0000) >> 16;
58 bytes[3] = (val & 0x00000000FF000000) >> 24;
59 bytes[4] = (val & 0x000000FF00000000) >> 32;
60 bytes[5] = (val & 0x0000FF0000000000) >> 40;
61 bytes[6] = (val & 0x00FF000000000000) >> 48;
62 bytes[7] = (val & 0xFF00000000000000) >> 56;
67std::uint32_t SerializeUInt64(std::uint64_t val,
void *buffer)
69 return SerializeInt64(val, buffer);
72std::uint32_t DeserializeInt64(
const void *buffer, std::int64_t *val)
74 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
75 *val = std::int64_t(bytes[0]) + (std::int64_t(bytes[1]) << 8) +
76 (std::int64_t(bytes[2]) << 16) + (std::int64_t(bytes[3]) << 24) +
77 (std::int64_t(bytes[4]) << 32) + (std::int64_t(bytes[5]) << 40) +
78 (std::int64_t(bytes[6]) << 48) + (std::int64_t(bytes[7]) << 56);
82std::uint32_t DeserializeUInt64(
const void *buffer, std::uint64_t *val)
84 return DeserializeInt64(buffer,
reinterpret_cast<std::int64_t *
>(val));
87std::uint32_t SerializeInt32(std::int32_t val,
void *buffer)
89 if (buffer !=
nullptr) {
90 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
91 bytes[0] = (val & 0x000000FF);
92 bytes[1] = (val & 0x0000FF00) >> 8;
93 bytes[2] = (val & 0x00FF0000) >> 16;
94 bytes[3] = (val & 0xFF000000) >> 24;
99std::uint32_t SerializeUInt32(std::uint32_t val,
void *buffer)
101 return SerializeInt32(val, buffer);
104std::uint32_t DeserializeInt32(
const void *buffer, std::int32_t *val)
106 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
107 *val = std::int32_t(bytes[0]) + (std::int32_t(bytes[1]) << 8) +
108 (std::int32_t(bytes[2]) << 16) + (std::int32_t(bytes[3]) << 24);
112std::uint32_t DeserializeUInt32(
const void *buffer, std::uint32_t *val)
114 return DeserializeInt32(buffer,
reinterpret_cast<std::int32_t *
>(val));
117std::uint32_t SerializeInt16(std::int16_t val,
void *buffer)
119 if (buffer !=
nullptr) {
120 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
121 bytes[0] = (val & 0x00FF);
122 bytes[1] = (val & 0xFF00) >> 8;
127std::uint32_t SerializeUInt16(std::uint16_t val,
void *buffer)
129 return SerializeInt16(val, buffer);
132std::uint32_t DeserializeInt16(
const void *buffer, std::int16_t *val)
134 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
135 *val = std::int16_t(bytes[0]) + (std::int16_t(bytes[1]) << 8);
139std::uint32_t DeserializeUInt16(
const void *buffer, std::uint16_t *val)
141 return DeserializeInt16(buffer,
reinterpret_cast<std::int16_t *
>(val));
146 return SerializeUInt32(val, buffer);
152 auto nbytes = DeserializeUInt32(buffer, &size);
157std::uint32_t SerializeString(
const std::string &val,
void *buffer)
159 if (buffer !=
nullptr) {
160 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
161 pos += SerializeUInt32(val.length(), pos);
162 memcpy(pos, val.data(), val.length());
164 return SerializeUInt32(val.length(),
nullptr) + val.length();
167std::uint32_t DeserializeString(
const void *buffer, std::string *val)
169 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
171 std::uint32_t length;
172 bytes += DeserializeUInt32(buffer, &length);
174 memcpy(&(*val)[0], bytes, length);
175 return bytes + length - base;
181 if (buffer !=
nullptr) {
182 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
183 pos += SerializeInt64(val.
fPosition, pos);
185 pos += SerializeString(val.
fUrl, pos);
187 return SerializeString(val.
fUrl,
nullptr) + 12;
192 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
193 bytes += DeserializeInt64(bytes, &val->
fPosition);
195 bytes += DeserializeString(bytes, &val->
fUrl);
196 return SerializeString(val->
fUrl,
nullptr) + 12;
199std::uint32_t SerializeFrame(std::uint16_t protocolVersionCurrent, std::uint16_t protocolVersionMin,
void *buffer,
202 if (buffer !=
nullptr) {
203 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
204 pos += SerializeUInt16(protocolVersionCurrent, pos);
205 pos += SerializeUInt16(protocolVersionMin, pos);
207 pos += SerializeUInt32(0, pos);
212std::uint32_t DeserializeFrame(std::uint16_t protocolVersion,
const void *buffer, std::uint32_t *size)
214 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
215 std::uint16_t protocolVersionAtWrite;
216 std::uint16_t protocolVersionMinRequired;
217 bytes += DeserializeUInt16(bytes, &protocolVersionAtWrite);
218 bytes += DeserializeUInt16(bytes, &protocolVersionMinRequired);
219 R__ASSERT(protocolVersionAtWrite >= protocolVersionMinRequired);
220 R__ASSERT(protocolVersion >= protocolVersionMinRequired);
221 bytes += DeserializeUInt32(bytes, size);
227 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
229 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
231 void *ptrSize =
nullptr;
232 pos += SerializeFrame(0, 0, *where, &ptrSize);
236 pos += SerializeUInt64(val.
GetFlags(), *where);
238 auto size = pos - base;
239 SerializeUInt32(size, ptrSize);
245 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
246 std::uint32_t frameSize;
247 bytes += DeserializeFrame(0, bytes, &frameSize);
249 std::uint32_t versionUse;
250 std::uint32_t versionMin;
252 bytes += DeserializeUInt32(bytes, &versionUse);
253 bytes += DeserializeUInt32(bytes, &versionMin);
254 bytes += DeserializeUInt64(bytes, &flags);
262 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
264 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
266 void *ptrSize =
nullptr;
267 pos += SerializeFrame(0, 0, *where, &ptrSize);
269 pos += SerializeString(val, *where);
271 auto size = pos - base;
272 SerializeUInt32(size, ptrSize);
278 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
279 std::uint32_t frameSize;
280 bytes += DeserializeFrame(0, bytes, &frameSize);
282 bytes += DeserializeString(bytes, uuid);
289 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
291 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
293 void *ptrSize =
nullptr;
294 pos += SerializeFrame(0, 0, *where, &ptrSize);
296 pos += SerializeInt32(
static_cast<int>(val.
GetType()), *where);
297 pos += SerializeInt32(
static_cast<int>(val.
GetIsSorted()), *where);
299 auto size = pos - base;
300 SerializeUInt32(size, ptrSize);
306 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
307 std::uint32_t frameSize;
308 bytes += DeserializeFrame(0, bytes, &frameSize);
311 std::int32_t isSorted;
312 bytes += DeserializeInt32(bytes, &
type);
313 bytes += DeserializeInt32(bytes, &isSorted);
319std::uint32_t SerializeTimeStamp(
const std::chrono::system_clock::time_point &val,
void *buffer)
321 return SerializeInt64(std::chrono::system_clock::to_time_t(val), buffer);
324std::uint32_t DeserializeTimeStamp(
const void *buffer, std::chrono::system_clock::time_point *timeStamp)
326 std::int64_t secSinceUnixEpoch;
327 auto size = DeserializeInt64(buffer, &secSinceUnixEpoch);
328 *timeStamp = std::chrono::system_clock::from_time_t(secSinceUnixEpoch);
335 if (buffer !=
nullptr) {
336 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
339 pos += SerializeClusterSize(val.
fNElements, pos);
345std::uint32_t DeserializeColumnRange(
const void *buffer,
348 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
351 bytes += DeserializeClusterSize(bytes, &columnRange->
fNElements);
359 if (buffer !=
nullptr) {
360 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
362 pos += SerializeClusterSize(val.
fNElements, pos);
363 pos += SerializeLocator(val.
fLocator, pos);
365 return 4 + SerializeLocator(val.
fLocator,
nullptr);
368std::uint32_t DeserializePageInfo(
const void *buffer,
371 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
374 bytes += DeserializeClusterSize(bytes, &pageInfo->
fNElements);
375 bytes += DeserializeLocator(bytes, &pageInfo->
fLocator);
379std::uint32_t SerializeCrc32(
const unsigned char *data, std::uint32_t length,
void *buffer)
381 auto checksum = R__crc32(0,
nullptr, 0);
382 if (buffer !=
nullptr) {
383 checksum = R__crc32(checksum, data, length);
384 SerializeUInt32(checksum, buffer);
389void VerifyCrc32(
const unsigned char *data, std::uint32_t length)
391 auto checksumReal = R__crc32(0,
nullptr, 0);
392 checksumReal = R__crc32(checksumReal, data, length);
393 std::uint32_t checksumFound;
394 DeserializeUInt32(data + length, &checksumFound);
395 R__ASSERT(checksumFound == checksumReal);
400 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
402 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
404 void *ptrSize =
nullptr;
408 pos += SerializeUInt64(val.
GetId(), *where);
415 pos += SerializeUInt32(
static_cast<int>(val.
GetStructure()), *where);
417 pos += SerializeUInt32(val.
GetLinkIds().size(), *where);
419 pos += SerializeUInt64(
l, *where);
421 auto size = pos - base;
422 SerializeUInt32(size, ptrSize);
428 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
430 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
432 void *ptrSize =
nullptr;
436 pos += SerializeUInt64(val.
GetId(), *where);
437 pos += SerializeVersion(val.
GetVersion(), *where);
438 pos += SerializeColumnModel(val.
GetModel(), *where);
439 pos += SerializeUInt64(val.
GetFieldId(), *where);
440 pos += SerializeUInt32(val.
GetIndex(), *where);
442 auto size = pos - base;
443 SerializeUInt32(size, ptrSize);
449 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
451 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
453 void *ptrSize =
nullptr;
457 pos += SerializeUInt64(val.
GetId(), *where);
458 pos += SerializeVersion(val.
GetVersion(), *where);
461 pos += SerializeLocator(val.
GetLocator(), *where);
463 auto size = pos - base;
464 SerializeUInt32(size, ptrSize);
518 return fName == other.
fName &&
535 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
537 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
539 void *ptrSize =
nullptr;
540 pos += SerializeFrame(
542 pos += SerializeUInt64(0, *where);
544 pos += SerializeString(fName, *where);
545 pos += SerializeString(fDescription, *where);
546 pos += SerializeString(fAuthor, *where);
547 pos += SerializeString(fCustodian, *where);
548 pos += SerializeTimeStamp(fTimeStampData, *where);
549 pos += SerializeTimeStamp(fTimeStampWritten, *where);
550 pos += SerializeVersion(fVersion, *where);
551 pos += SerializeUuid(fOwnUuid, *where);
552 pos += SerializeUuid(fGroupUuid, *where);
553 pos += SerializeUInt32(fFieldDescriptors.size(), *where);
554 for (
const auto&
f : fFieldDescriptors) {
555 pos += SerializeField(
f.second, *where);
557 pos += SerializeUInt32(fColumnDescriptors.size(), *where);
558 for (
const auto&
c : fColumnDescriptors) {
559 pos += SerializeColumn(
c.second, *where);
562 std::uint32_t size = pos - base;
563 SerializeUInt32(size, ptrSize);
564 size += SerializeCrc32(base, size, *where);
571 auto base =
reinterpret_cast<unsigned char *
>((buffer !=
nullptr) ? buffer : 0);
573 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
575 void *ptrSize =
nullptr;
576 pos += SerializeFrame(
578 pos += SerializeUInt64(0, *where);
580 pos += SerializeUInt64(fClusterDescriptors.size(), *where);
581 for (
const auto& cluster : fClusterDescriptors) {
582 pos += SerializeUuid(fOwnUuid, *where);
583 pos += SerializeClusterSummary(cluster.second, *where);
585 pos += SerializeUInt32(fColumnDescriptors.size(), *where);
586 for (
const auto& column : fColumnDescriptors) {
587 auto columnId = column.first;
588 pos += SerializeUInt64(columnId, *where);
590 const auto &columnRange = cluster.second.GetColumnRange(columnId);
591 R__ASSERT(columnRange.fColumnId == columnId);
592 pos += SerializeColumnRange(columnRange, *where);
594 const auto &pageRange = cluster.second.GetPageRange(columnId);
595 R__ASSERT(pageRange.fColumnId == columnId);
596 auto nPages = pageRange.fPageInfos.size();
597 pos += SerializeUInt32(nPages, *where);
598 for (
unsigned int i = 0; i < nPages; ++i) {
599 pos += SerializePageInfo(pageRange.fPageInfos[i], *where);
605 pos += SerializeUInt16(kFrameVersionCurrent, *where);
606 pos += SerializeUInt16(kFrameVersionMin, *where);
608 pos += SerializeUInt32(SerializeHeader(
nullptr), *where);
609 std::uint32_t size = pos - base + 4;
610 pos += SerializeUInt32(size + 4, *where);
611 size += SerializeCrc32(base, size, *where);
618 const void *postscript, std::uint32_t &szHeader, std::uint32_t &szFooter)
620 auto pos =
reinterpret_cast<const unsigned char *
>(postscript);
622 pos += DeserializeUInt16(pos, &
dummy);
623 pos += DeserializeUInt16(pos, &
dummy);
624 pos += DeserializeUInt32(pos, &szHeader);
625 pos += DeserializeUInt32(pos, &szFooter);
632 for (
const auto &cd : fClusterDescriptors) {
633 result = std::max(result, cd.second.GetFirstEntryIndex() + cd.second.GetNEntries());
641 for (
const auto &cd : fClusterDescriptors) {
642 auto columnRange = cd.second.GetColumnRange(columnId);
643 result = std::max(result, columnRange.fFirstElementIndex + columnRange.fNElements);
651 std::string leafName(fieldName);
652 auto posDot = leafName.find_last_of(
'.');
653 if (posDot != std::string::npos) {
654 auto parentName = leafName.substr(0, posDot);
655 leafName = leafName.substr(posDot + 1);
656 parentId = FindFieldId(parentName, parentId);
658 for (
const auto &fd : fFieldDescriptors) {
659 if (fd.second.GetParentId() == parentId && fd.second.GetFieldName() == leafName)
660 return fd.second.GetId();
669 return FindFieldId(fieldName, rootId);
676 for (
const auto &cd : fColumnDescriptors) {
677 if (cd.second.GetFieldId() == fieldId && cd.second.GetIndex() == columnIndex)
678 return cd.second.GetId();
688 for (
const auto &cd : fClusterDescriptors) {
689 auto columnRange = cd.second.GetColumnRange(columnId);
690 if (columnRange.Contains(index))
691 return cd.second.GetId();
699 auto model = std::make_unique<RNTupleModel>();
701 const auto &rootDesc = GetFieldDescriptor(rootId);
702 for (
const auto id : rootDesc.GetLinkIds()) {
703 const auto &topDesc = GetFieldDescriptor(
id);
705 model->AddField(std::unique_ptr<Detail::RFieldBase>(field));
723 auto pos =
reinterpret_cast<unsigned char *
>(headerBuffer);
726 std::uint32_t frameSize;
728 VerifyCrc32(base, frameSize);
729 std::uint64_t reserved;
730 pos += DeserializeUInt64(pos, &reserved);
732 pos += DeserializeString(pos, &fDescriptor.fName);
733 pos += DeserializeString(pos, &fDescriptor.fDescription);
734 pos += DeserializeString(pos, &fDescriptor.fAuthor);
735 pos += DeserializeString(pos, &fDescriptor.fCustodian);
736 pos += DeserializeTimeStamp(pos, &fDescriptor.fTimeStampData);
737 pos += DeserializeTimeStamp(pos, &fDescriptor.fTimeStampWritten);
738 pos += DeserializeVersion(pos, &fDescriptor.fVersion);
739 pos += DeserializeUuid(pos, &fDescriptor.fOwnUuid);
740 pos += DeserializeUuid(pos, &fDescriptor.fGroupUuid);
742 std::uint32_t nFields;
743 pos += DeserializeUInt32(pos, &nFields);
744 for (std::uint32_t i = 0; i < nFields; ++i) {
745 auto fieldBase = pos;
749 pos += DeserializeUInt64(pos, &
f.fFieldId);
750 pos += DeserializeVersion(pos, &
f.fFieldVersion);
751 pos += DeserializeVersion(pos, &
f.fTypeVersion);
752 pos += DeserializeString(pos, &
f.fFieldName);
753 pos += DeserializeString(pos, &
f.fFieldDescription);
754 pos += DeserializeString(pos, &
f.fTypeName);
755 pos += DeserializeUInt64(pos, &
f.fNRepetitions);
756 std::int32_t structure;
757 pos += DeserializeInt32(pos, &structure);
759 pos += DeserializeUInt64(pos, &
f.fParentId);
761 std::uint32_t nLinks;
762 pos += DeserializeUInt32(pos, &nLinks);
763 f.fLinkIds.resize(nLinks);
764 for (std::uint32_t j = 0; j < nLinks; ++j) {
765 pos += DeserializeUInt64(pos, &
f.fLinkIds[j]);
768 pos = fieldBase + frameSize;
769 fDescriptor.fFieldDescriptors.emplace(
f.fFieldId, std::move(
f));
772 std::uint32_t nColumns;
773 pos += DeserializeUInt32(pos, &nColumns);
774 for (std::uint32_t i = 0; i < nColumns; ++i) {
775 auto columnBase = pos;
779 pos += DeserializeUInt64(pos, &
c.fColumnId);
780 pos += DeserializeVersion(pos, &
c.fVersion);
781 pos += DeserializeColumnModel(pos, &
c.fModel);
782 pos += DeserializeUInt64(pos, &
c.fFieldId);
783 pos += DeserializeUInt32(pos, &
c.fIndex);
785 pos = columnBase + frameSize;
786 fDescriptor.fColumnDescriptors.emplace(
c.fColumnId, std::move(
c));
791 auto pos =
reinterpret_cast<unsigned char *
>(footerBuffer);
794 std::uint32_t frameSize;
796 VerifyCrc32(base, frameSize);
797 std::uint64_t reserved;
798 pos += DeserializeUInt64(pos, &reserved);
800 std::uint64_t nClusters;
801 pos += DeserializeUInt64(pos, &nClusters);
802 for (std::uint64_t i = 0; i < nClusters; ++i) {
804 pos += DeserializeUuid(pos, &uuid);
806 auto clusterBase = pos;
809 std::uint64_t clusterId;
811 std::uint64_t firstEntry;
812 std::uint64_t nEntries;
813 pos += DeserializeUInt64(pos, &clusterId);
814 pos += DeserializeVersion(pos, &version);
815 pos += DeserializeUInt64(pos, &firstEntry);
816 pos += DeserializeUInt64(pos, &nEntries);
819 pos += DeserializeLocator(pos, &locator);
820 SetClusterLocator(clusterId, locator);
822 pos = clusterBase + frameSize;
824 std::uint32_t nColumns;
825 pos += DeserializeUInt32(pos, &nColumns);
826 for (std::uint32_t j = 0; j < nColumns; ++j) {
828 pos += DeserializeUInt64(pos, &columnId);
832 pos += DeserializeColumnRange(pos, &columnRange);
833 AddClusterColumnRange(clusterId, columnRange);
838 pos += DeserializeUInt32(pos, &nPages);
839 for (
unsigned int k = 0; k < nPages; ++k) {
841 pos += DeserializePageInfo(pos, &pageInfo);
844 AddClusterPageRange(clusterId, std::move(pageRange));
853 fDescriptor.fName = std::string(
name);
854 fDescriptor.fDescription = std::string(description);
855 fDescriptor.fAuthor = std::string(author);
856 fDescriptor.fVersion = version;
857 fDescriptor.fOwnUuid = uuid;
858 fDescriptor.fGroupUuid = uuid;
866 f.fFieldId = fieldId;
867 f.fFieldVersion = fieldVersion;
868 f.fTypeVersion = typeVersion;
869 f.fFieldName = std::string(fieldName);
870 f.fTypeName = std::string(typeName);
871 f.fNRepetitions = nRepetitions;
872 f.fStructure = structure;
873 fDescriptor.fFieldDescriptors.emplace(fieldId, std::move(
f));
879 fDescriptor.fFieldDescriptors[linkId].fParentId = fieldId;
880 fDescriptor.fFieldDescriptors[fieldId].fLinkIds.push_back(linkId);
888 c.fColumnId = columnId;
889 c.fFieldId = fieldId;
890 c.fVersion = version;
893 fDescriptor.fColumnDescriptors.emplace(columnId, std::move(
c));
900 c.fClusterId = clusterId;
901 c.fVersion = version;
902 c.fFirstEntryIndex = firstEntryIndex;
903 c.fNEntries = nEntries;
904 fDescriptor.fClusterDescriptors.emplace(clusterId, std::move(
c));
910 fDescriptor.fClusterDescriptors[clusterId].fLocator = locator;
916 fDescriptor.fClusterDescriptors[clusterId].fColumnRanges[columnRange.
fColumnId] = columnRange;
922 fDescriptor.fClusterDescriptors[clusterId].fPageRanges.emplace(pageRange.fColumnId, std::move(pageRange));
static RooMathCoreReg dummy
static RFieldBase * Create(const std::string &fieldName, const std::string &typeName)
Factory method to resurrect a field from the stored on-disk type information.
The available trivial, native content types of a column.
Meta-data for a set of ntuple clusters.
std::unordered_map< DescriptorId_t, RPageRange > fPageRanges
RNTupleVersion fVersion
Future versions of the cluster descriptor might add more meta-data, e.g. a semantic checksum.
RLocator fLocator
For pre-fetching / caching an entire contiguous cluster.
static constexpr std::uint16_t kFrameVersionMin
RNTupleVersion GetVersion() const
NTupleSize_t fFirstEntryIndex
Clusters can be swapped by adjusting the entry offsets.
DescriptorId_t fClusterId
RLocator GetLocator() const
NTupleSize_t GetFirstEntryIndex() const
std::unordered_map< DescriptorId_t, RColumnRange > fColumnRanges
bool operator==(const RClusterDescriptor &other) const
ClusterSize_t GetNEntries() const
static constexpr std::uint16_t kFrameVersionCurrent
In order to handle changes to the serialization routine in future ntuple versions.
DescriptorId_t GetId() const
Meta-data stored for every column of an ntuple.
RNTupleVersion GetVersion() const
RColumnModel GetModel() const
static constexpr std::uint16_t kFrameVersionCurrent
In order to handle changes to the serialization routine in future ntuple versions.
DescriptorId_t GetId() const
DescriptorId_t fFieldId
Every column belongs to one and only one field.
DescriptorId_t GetFieldId() const
RColumnModel fModel
Contains the column type and whether it is sorted.
static constexpr std::uint16_t kFrameVersionMin
RNTupleVersion fVersion
Versions can change, e.g., when new column types are added.
std::uint32_t GetIndex() const
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
Holds the static meta-data of a column in a tree.
EColumnType GetType() const
Meta-data stored for every field of an ntuple.
std::vector< DescriptorId_t > fLinkIds
The pointers in the other direction from parent to children.
DescriptorId_t GetParentId() const
RNTupleVersion GetTypeVersion() const
RNTupleVersion fFieldVersion
The version of the C++-type-to-column translation mechanics.
RNTupleVersion GetFieldVersion() const
std::string GetFieldName() const
std::string fFieldDescription
Free text set by the user.
static constexpr std::uint16_t kFrameVersionMin
std::string fFieldName
The leaf name, not including parent fields.
DescriptorId_t GetId() const
const std::vector< DescriptorId_t > & GetLinkIds() const
std::string GetFieldDescription() const
std::string GetTypeName() const
DescriptorId_t fParentId
Establishes sub field relationships, such as classes and collections.
RNTupleVersion fTypeVersion
The version of the C++ type itself.
std::uint64_t GetNRepetitions() const
bool operator==(const RFieldDescriptor &other) const
ENTupleStructure fStructure
The structural information carried by this field in the data model tree.
ENTupleStructure GetStructure() const
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.
static constexpr std::uint16_t kFrameVersionCurrent
In order to handle changes to the serialization routine in future ntuple versions.
RNTupleDescriptor MoveDescriptor()
void SetFromHeader(void *headerBuffer)
void AddCluster(DescriptorId_t clusterId, RNTupleVersion version, NTupleSize_t firstEntryIndex, ClusterSize_t nEntries)
void AddFieldLink(DescriptorId_t fieldId, DescriptorId_t linkId)
void AddColumn(DescriptorId_t columnId, DescriptorId_t fieldId, const RNTupleVersion &version, const RColumnModel &model, std::uint32_t index)
void SetClusterLocator(DescriptorId_t clusterId, RClusterDescriptor::RLocator locator)
void AddClusterColumnRange(DescriptorId_t clusterId, const RClusterDescriptor::RColumnRange &columnRange)
void AddField(DescriptorId_t fieldId, const RNTupleVersion &fieldVersion, const RNTupleVersion &typeVersion, std::string_view fieldName, std::string_view typeName, std::uint64_t nRepetitions, ENTupleStructure structure)
void AddClustersFromFooter(void *footerBuffer)
void SetNTuple(const std::string_view name, const std::string_view description, const std::string_view author, const RNTupleVersion &version, const RNTupleUuid &uuid)
void AddClusterPageRange(DescriptorId_t clusterId, RClusterDescriptor::RPageRange &&pageRange)
The on-storage meta-data of an ntuple.
std::unordered_map< DescriptorId_t, RClusterDescriptor > fClusterDescriptors
May contain only a subset of all the available clusters, e.g.
RNTupleUuid fGroupUuid
Column sets that are created as derived sets from existing NTuples share the same group id.
std::unique_ptr< RNTupleModel > GenerateModel() const
Re-create the C++ model from the stored meta-data.
std::chrono::system_clock::time_point fTimeStampWritten
The time stamp of writing the data to storage, which gets updated when re-written.
std::uint32_t SerializeHeader(void *buffer) const
We deliberately do not use ROOT's built-in serialization in order to allow for use of RNTuple's witho...
std::unordered_map< DescriptorId_t, RColumnDescriptor > fColumnDescriptors
NTupleSize_t GetNEntries() const
std::string fName
The ntuple name needs to be unique in a given storage location (file)
std::uint32_t SerializeFooter(void *buffer) const
Serializes cluster meta data. Returns the number of bytes and fills buffer if it is not nullptr.
std::string fAuthor
The origin of the data.
std::unordered_map< DescriptorId_t, RFieldDescriptor > fFieldDescriptors
static constexpr std::uint16_t kFrameVersionMin
RNTupleVersion fVersion
The version evolves with the ntuple summary meta-data.
bool operator==(const RNTupleDescriptor &other) const
DescriptorId_t FindFieldId(std::string_view fieldName, DescriptorId_t parentId) const
std::string fCustodian
The current responsible for storing the data.
DescriptorId_t FindColumnId(DescriptorId_t fieldId, std::uint32_t columnIndex) const
NTupleSize_t GetNElements(DescriptorId_t columnId) const
static void LocateMetadata(const void *postscript, std::uint32_t &szHeader, std::uint32_t &szFooter)
Given kNBytesPostscript bytes, extract the header and footer lengths in bytes.
std::string fDescription
Free text from the user.
static constexpr std::uint16_t kFrameVersionCurrent
In order to handle changes to the serialization routine in future ntuple versions.
RNTupleUuid fOwnUuid
Every NTuple gets a unique identifier.
std::chrono::system_clock::time_point fTimeStampData
The time stamp of the ntuple data (immutable)
DescriptorId_t FindClusterId(DescriptorId_t columnId, NTupleSize_t index) const
For forward and backward compatibility, attach version information to the consitituents of the file f...
std::uint32_t GetVersionUse() const
NTupleFlags_t GetFlags() const
std::uint32_t GetVersionMin() const
basic_string_view< char > string_view
void swap(RDirectoryEntry &e1, RDirectoryEntry &e2) noexcept
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::string RNTupleUuid
Every NTuple is identified by a UUID. TODO(jblomer): should this be a TUUID?
constexpr DescriptorId_t kInvalidDescriptorId
The window of element indexes of a particular column in a particular cluster.
std::int64_t fCompressionSettings
The usual format for ROOT compression settings (see Compression.h).
NTupleSize_t fFirstElementIndex
A 64bit element index.
ClusterSize_t fNElements
A 32bit value for the number of column elements in the cluster.
Generic information about the physical location of data.
std::uint32_t fBytesOnStorage
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...