38#include <unordered_map>
55 auto base =
reinterpret_cast<unsigned char *
>(buffer);
59 pos += RNTupleSerializer::SerializeRecordFramePreamble(*
where);
61 pos += RNTupleSerializer::SerializeUInt32(
fieldDesc.GetFieldVersion(), *
where);
62 pos += RNTupleSerializer::SerializeUInt32(
fieldDesc.GetTypeVersion(), *
where);
64 if (
auto res = RNTupleSerializer::SerializeFieldStructure(
fieldDesc.GetStructure(), *
where)) {
70 std::uint16_t flags = 0;
72 flags |= RNTupleSerializer::kFlagRepetitiveField;
74 flags |= RNTupleSerializer::kFlagProjectedField;
75 if (
fieldDesc.GetTypeChecksum().has_value())
76 flags |= RNTupleSerializer::kFlagHasTypeChecksum;
77 pos += RNTupleSerializer::SerializeUInt16(flags, *
where);
79 pos += RNTupleSerializer::SerializeString(
fieldDesc.GetFieldName(), *
where);
80 pos += RNTupleSerializer::SerializeString(
fieldDesc.GetTypeName(), *
where);
81 pos += RNTupleSerializer::SerializeString(
fieldDesc.GetTypeAlias(), *
where);
82 pos += RNTupleSerializer::SerializeString(
fieldDesc.GetFieldDescription(), *
where);
84 if (flags & RNTupleSerializer::kFlagRepetitiveField) {
85 pos += RNTupleSerializer::SerializeUInt64(
fieldDesc.GetNRepetitions(), *
where);
87 if (flags & RNTupleSerializer::kFlagProjectedField) {
90 if (flags & RNTupleSerializer::kFlagHasTypeChecksum) {
91 pos += RNTupleSerializer::SerializeUInt32(
fieldDesc.GetTypeChecksum().value(), *
where);
94 auto size = pos - base;
95 RNTupleSerializer::SerializeFramePostscript(base,
size);
112 auto base =
reinterpret_cast<unsigned char *
>(buffer);
140 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
145 bytes += res.Unwrap();
154 ENTupleStructure structure{ENTupleStructure::kLeaf};
157 if (
auto res = RNTupleSerializer::SerializeFieldStructure(structure,
nullptr)) {
163 return R__FAIL(
"field record frame too short");
168 if (
auto res = RNTupleSerializer::DeserializeFieldStructure(
bytes, structure)) {
169 bytes += res.Unwrap();
173 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, flags);
177 std::string typeName;
181 bytes += res.Unwrap();
186 bytes += res.Unwrap();
191 bytes += res.Unwrap();
196 bytes += res.Unwrap();
202 if (flags & RNTupleSerializer::kFlagRepetitiveField) {
204 return R__FAIL(
"field record frame too short");
210 if (flags & RNTupleSerializer::kFlagProjectedField) {
212 return R__FAIL(
"field record frame too short");
218 if (flags & RNTupleSerializer::kFlagHasTypeChecksum) {
220 return R__FAIL(
"field record frame too short");
235 auto base =
reinterpret_cast<unsigned char *
>(buffer);
239 pos += RNTupleSerializer::SerializeRecordFramePreamble(*
where);
241 if (
auto res = RNTupleSerializer::SerializeColumnType(
columnDesc.GetType(), *
where)) {
246 pos += RNTupleSerializer::SerializeUInt16(
columnDesc.GetBitsOnStorage(), *
where);
248 std::uint16_t flags = 0;
250 flags |= RNTupleSerializer::kFlagDeferredColumn;
252 flags |= RNTupleSerializer::kFlagHasValueRange;
256 pos += RNTupleSerializer::SerializeUInt16(flags, *
where);
257 pos += RNTupleSerializer::SerializeUInt16(
columnDesc.GetRepresentationIndex(), *
where);
258 if (flags & RNTupleSerializer::kFlagDeferredColumn)
260 if (flags & RNTupleSerializer::kFlagHasValueRange) {
261 auto [min, max] = *
columnDesc.GetValueRange();
263 static_assert(
sizeof(min) ==
sizeof(
intMin) &&
sizeof(max) ==
sizeof(
intMax));
266 pos += RNTupleSerializer::SerializeUInt64(
intMin, *
where);
267 pos += RNTupleSerializer::SerializeUInt64(
intMax, *
where);
270 if (
auto res = RNTupleSerializer::SerializeFramePostscript(buffer ? base : nullptr, pos - base)) {
284 auto base =
reinterpret_cast<unsigned char *
>(buffer);
297 for (
const auto &
c : desc.GetColumnIterable(
parentId)) {
298 if (
c.IsAliasColumn() || (
xHeader &&
xHeader->ContainsExtendedColumnRepresentation(
c.GetLogicalId())))
317 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
322 bytes += res.Unwrap();
334 if (
fnFrameSizeLeft() < RNTupleSerializer::SerializeColumnType(
type,
nullptr).Unwrap() +
sizeof(std::uint16_t) +
335 2 *
sizeof(std::uint32_t)) {
336 return R__FAIL(
"column record frame too short");
338 if (
auto res = RNTupleSerializer::DeserializeColumnType(
bytes,
type)) {
339 bytes += res.Unwrap();
345 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, flags);
347 if (flags & RNTupleSerializer::kFlagDeferredColumn) {
349 return R__FAIL(
"column record frame too short");
352 if (flags & RNTupleSerializer::kFlagHasValueRange) {
354 return R__FAIL(
"field record frame too short");
374 auto base =
reinterpret_cast<unsigned char *
>(buffer);
378 pos += RNTupleSerializer::SerializeRecordFramePreamble(*
where);
380 if (
auto res = RNTupleSerializer::SerializeExtraTypeInfoId(desc.
GetContentId(), *
where)) {
389 auto size = pos - base;
390 RNTupleSerializer::SerializeFramePostscript(base,
size);
397 auto base =
reinterpret_cast<unsigned char *
>(buffer);
417 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
426 EExtraTypeInfoIds
contentId{EExtraTypeInfoIds::kInvalid};
429 return R__FAIL(
"extra type info record frame too short");
437 std::string typeName;
456 RNTupleSerializer::SerializeUInt64(
locator.GetNBytesOnStorage(), buffer);
457 RNTupleSerializer::SerializeUInt64(
locator.GetPosition<std::uint64_t>(), buffer +
sizeof(std::uint64_t));
459 return sizeof(std::uint64_t) +
sizeof(std::uint64_t);
465 std::uint64_t position;
467 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint64_t), position);
476 ?
sizeof(std::uint64_t)
477 :
sizeof(std::uint32_t);
480 RNTupleSerializer::SerializeUInt32(
locator.GetNBytesOnStorage(), buffer);
482 RNTupleSerializer::SerializeUInt64(
locator.GetNBytesOnStorage(), buffer);
492 std::uint64_t location;
497 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint32_t), location);
502 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint64_t), location);
516 auto base =
reinterpret_cast<unsigned char *
>(buffer);
520 pos += RNTupleSerializer::SerializeRecordFramePreamble(*
where);
525 pos += RNTupleSerializer::SerializeFramePostscript(buffer ? base : nullptr, pos - base).Unwrap();
531 std::span<const ROOT::DescriptorId_t>
fieldList,
535 auto base =
reinterpret_cast<unsigned char *
>(buffer);
545 for (
const auto &
c : desc.GetColumnIterable(
parentId)) {
546 if (!
c.IsAliasColumn() || (
xHeader &&
xHeader->ContainsExtendedColumnRepresentation(
c.GetLogicalId())))
559 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
569 return R__FAIL(
"alias column record frame too short");
582 std::uint64_t &
xxhash3,
void *buffer)
584 if (buffer !=
nullptr) {
598 return R__FAIL(
"XxHash-3 checksum mismatch");
611 if (buffer !=
nullptr) {
612 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
613 bytes[0] = (val & 0x00FF);
614 bytes[1] = (val & 0xFF00) >> 8;
621 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
622 val = std::int16_t(
bytes[0]) + (std::int16_t(
bytes[1]) << 8);
628 return SerializeInt16(val, buffer);
633 return DeserializeInt16(buffer, *
reinterpret_cast<std::int16_t *
>(&val));
638 if (buffer !=
nullptr) {
639 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
640 bytes[0] = (val & 0x000000FF);
641 bytes[1] = (val & 0x0000FF00) >> 8;
642 bytes[2] = (val & 0x00FF0000) >> 16;
643 bytes[3] = (val & 0xFF000000) >> 24;
650 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
651 val = std::int32_t(
bytes[0]) + (std::int32_t(
bytes[1]) << 8) + (std::int32_t(
bytes[2]) << 16) +
652 (std::int32_t(
bytes[3]) << 24);
658 return SerializeInt32(val, buffer);
663 return DeserializeInt32(buffer, *
reinterpret_cast<std::int32_t *
>(&val));
668 if (buffer !=
nullptr) {
669 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
670 bytes[0] = (val & 0x00000000000000FF);
671 bytes[1] = (val & 0x000000000000FF00) >> 8;
672 bytes[2] = (val & 0x0000000000FF0000) >> 16;
673 bytes[3] = (val & 0x00000000FF000000) >> 24;
674 bytes[4] = (val & 0x000000FF00000000) >> 32;
675 bytes[5] = (val & 0x0000FF0000000000) >> 40;
676 bytes[6] = (val & 0x00FF000000000000) >> 48;
677 bytes[7] = (val & 0xFF00000000000000) >> 56;
684 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
685 val = std::int64_t(
bytes[0]) + (std::int64_t(
bytes[1]) << 8) + (std::int64_t(
bytes[2]) << 16) +
686 (std::int64_t(
bytes[3]) << 24) + (std::int64_t(
bytes[4]) << 32) + (std::int64_t(
bytes[5]) << 40) +
687 (std::int64_t(
bytes[6]) << 48) + (std::int64_t(
bytes[7]) << 56);
693 return SerializeInt64(val, buffer);
698 return DeserializeInt64(buffer, *
reinterpret_cast<std::int64_t *
>(&val));
704 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
705 pos += SerializeUInt32(val.length(), pos);
706 memcpy(pos, val.data(), val.length());
708 return sizeof(std::uint32_t) + val.length();
715 if (
bufSize <
sizeof(std::uint32_t))
716 return R__FAIL(
"string buffer too short");
717 bufSize -=
sizeof(std::uint32_t);
719 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
724 return R__FAIL(
"string buffer too short");
728 return sizeof(std::uint32_t) +
length;
766 return SerializeUInt16(0x99, buffer);
767 return R__FAIL(
"unexpected column type");
828 return SerializeUInt16(0x99, buffer);
829 return R__FAIL(
"unexpected field structure type");
857 default:
return R__FAIL(
"unexpected extra type info id");
879 auto base =
reinterpret_cast<unsigned char *
>(buffer);
881 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
892 if (
size <
sizeof(std::uint64_t))
893 return R__FAIL(
"envelope size too small");
894 if (
size >=
static_cast<uint64_t
>(1) << 48)
895 return R__FAIL(
"envelope size too big");
917 const std::uint64_t
minEnvelopeSize =
sizeof(std::uint64_t) +
sizeof(std::uint64_t);
919 return R__FAIL(
"invalid envelope buffer, too short");
921 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
929 return R__FAIL(
"envelope type mismatch: expected " + std::to_string(
expectedType) +
", found " +
935 return R__FAIL(
"envelope buffer size too small");
937 return R__FAIL(
"invalid envelope, too short");
957 return SerializeInt64(1, buffer);
963 auto base =
reinterpret_cast<unsigned char *
>(buffer);
965 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
968 pos += SerializeInt64(-1, *
where);
978 return R__FAIL(
"frame too short: " + std::to_string(
size));
981 DeserializeInt64(frame, marker);
983 return R__FAIL(
"frame too short: " + std::to_string(
size));
984 SerializeInt64(marker *
static_cast<int64_t
>(
size), frame);
993 std::uint64_t
minSize =
sizeof(std::int64_t);
995 return R__FAIL(
"frame too short");
997 std::int64_t *
ssize =
reinterpret_cast<std::int64_t *
>(&
frameSize);
998 DeserializeInt64(buffer, *
ssize);
1000 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1008 minSize +=
sizeof(std::uint32_t);
1010 return R__FAIL(
"frame too short");
1016 return R__FAIL(
"corrupt frame size");
1018 return R__FAIL(
"frame too short");
1020 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
1036 return SerializeUInt64(0, buffer);
1039 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
1041 for (
unsigned i = 0; i < flags.size(); ++i) {
1042 if (flags[i] & 0x8000000000000000)
1043 return R__FAIL(
"feature flag out of bounds");
1046 if (i == (flags.size() - 1))
1047 SerializeUInt64(flags[i],
bytes);
1049 bytes += SerializeUInt64(flags[i] | 0x8000000000000000,
bytes);
1052 return (flags.size() *
sizeof(std::int64_t));
1057 std::vector<std::uint64_t> &flags)
1059 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1064 if (
bufSize <
sizeof(std::uint64_t))
1065 return R__FAIL(
"feature flag buffer too short");
1067 bufSize -=
sizeof(std::uint64_t);
1068 flags.emplace_back(
f & ~0x8000000000000000);
1069 }
while (
f & 0x8000000000000000);
1071 return (flags.size() *
sizeof(std::uint64_t));
1078 return R__FAIL(
"locator is not serializable");
1080 std::uint32_t
size = 0;
1082 (
locator.GetNBytesOnStorage() <= std::numeric_limits<std::int32_t>::max())) {
1083 size += SerializeUInt32(
locator.GetNBytesOnStorage(), buffer);
1084 size += SerializeUInt64(
locator.GetPosition<std::uint64_t>(),
1085 buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
size :
nullptr);
1090 auto payloadp = buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
sizeof(std::int32_t) :
nullptr;
1106 return R__FAIL(
"locator has unknown type");
1109 std::int32_t head =
sizeof(std::int32_t) +
size;
1110 head |=
locator.GetReserved() << 16;
1111 head |=
static_cast<int>(
locatorType & 0x7F) << 24;
1121 if (
bufSize <
sizeof(std::int32_t))
1122 return R__FAIL(
"too short locator");
1124 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1128 bufSize -=
sizeof(std::int32_t);
1131 const int type = head >> 24;
1132 const std::uint32_t
payloadSize = (
static_cast<std::uint32_t
>(head) & 0x0000FFFF) -
sizeof(std::int32_t);
1134 return R__FAIL(
"too short locator");
1136 locator.SetReserved(
static_cast<std::uint32_t
>(head >> 16) & 0xFF);
1150 if (
bufSize <
sizeof(std::uint64_t))
1151 return R__FAIL(
"too short locator");
1155 locator.SetNBytesOnStorage(head);
1159 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
1167 SerializeLocator(
envelopeLink.fLocator, buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
size :
nullptr);
1169 size += res.Unwrap();
1179 if (
bufSize <
sizeof(std::int64_t))
1180 return R__FAIL(
"too short envelope link");
1182 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1184 bufSize -=
sizeof(std::uint64_t);
1186 bytes += res.Unwrap();
1190 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
1197 if (
clusterSummary.fNEntries >= (
static_cast<std::uint64_t
>(1) << 56)) {
1198 return R__FAIL(
"number of entries in cluster exceeds maximum of 2^56");
1201 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1203 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1206 pos += SerializeRecordFramePreamble(*
where);
1212 auto size = pos - frame;
1213 if (
auto res = SerializeFramePostscript(frame,
size)) {
1214 pos += res.Unwrap();
1225 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1229 bytes += res.Unwrap();
1236 return R__FAIL(
"too short cluster summary");
1246 return R__FAIL(
"sharded cluster flag set in cluster summary; sharded clusters are currently unsupported.");
1258 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1260 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1263 pos += SerializeRecordFramePreamble(*
where);
1267 if (
auto res = SerializeEnvelopeLink(
clusterGroup.fPageListEnvelopeLink, *
where)) {
1268 pos += res.Unwrap();
1272 auto size = pos - frame;
1273 if (
auto res = SerializeFramePostscript(frame,
size)) {
1284 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1289 bytes += res.Unwrap();
1295 if (
fnFrameSizeLeft() <
sizeof(std::uint32_t) + 2 *
sizeof(std::uint64_t))
1296 return R__FAIL(
"too short cluster group");
1302 bytes += res.Unwrap();
1330 std::vector<ROOT::DescriptorId_t>
fieldTrees;
1339 if (!
c.IsAliasColumn()) {
1340 MapPhysicalColumnId(
c.GetPhysicalId());
1351 MapPhysicalColumnId(
columnDesc.GetPhysicalId());
1360 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1362 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1366 std::vector<std::reference_wrapper<const ROOT::RColumnDescriptor>>
extraColumns;
1386 (
xHeader->GetNLogicalColumns() -
xHeader->GetNPhysicalColumns());
1401 pos += res.Unwrap();
1405 if (
auto res = SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame)) {
1406 pos += res.Unwrap();
1414 pos += res.Unwrap();
1419 if (!
c.get().IsAliasColumn()) {
1421 pos += res.Unwrap();
1427 if (
auto res = SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame)) {
1428 pos += res.Unwrap();
1437 if (
c.get().IsAliasColumn()) {
1441 if (
auto res = SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame)) {
1442 pos += res.Unwrap();
1452 pos += res.Unwrap();
1457 pos += SerializeListFramePreamble(0, *
where);
1459 if (
auto res = SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame)) {
1460 pos += res.Unwrap();
1465 return static_cast<std::uint32_t
>(pos - base);
1472 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1482 bytes += res.Unwrap();
1488 for (
unsigned i = 0; i <
nFields; ++i) {
1492 bytes += res.Unwrap();
1529 bytes += res.Unwrap();
1534 if (
descBuilder.GetDescriptor().GetNLogicalColumns() >
descBuilder.GetDescriptor().GetNPhysicalColumns())
1538 for (
unsigned i = 0; i <
nColumns; ++i) {
1542 bytes += res.Unwrap();
1562 bytes += res.Unwrap();
1571 bytes += res.Unwrap();
1597 bytes += res.Unwrap();
1604 bytes += res.Unwrap();
1616 return bytes - base;
1624 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1626 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1628 pos += SerializeEnvelopePreamble(kEnvelopeTypeHeader, *
where);
1631 pos += res.Unwrap();
1641 if (
auto res = SerializeSchemaDescription(*
where, desc, context)) {
1642 pos += res.Unwrap();
1647 std::uint64_t
size = pos - base;
1649 if (
auto res = SerializeEnvelopePostscript(base,
size,
xxhash3)) {
1650 size += res.Unwrap();
1665 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1667 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1669 pos += SerializeEnvelopePreamble(kEnvelopeTypePageList, *
where);
1680 if (
auto res = SerializeClusterSummary(
summary, *
where)) {
1681 pos += res.Unwrap();
1687 pos += res.Unwrap();
1712 pos += SerializeListFramePreamble(0, *
where);
1713 pos += SerializeInt64(kSuppressedColumnMarker, *
where);
1716 pos += SerializeListFramePreamble(
pageRange.GetPageInfos().size(), *
where);
1718 for (
const auto &pi :
pageRange.GetPageInfos()) {
1720 pi.HasChecksum() ? -
static_cast<std::int32_t
>(pi.GetNElements()) : pi.GetNElements();
1722 if (
auto res = SerializeLocator(pi.GetLocator(), *
where)) {
1723 pos += res.Unwrap();
1729 pos += SerializeUInt32(
columnRange.GetCompressionSettings().value(), *
where);
1733 pos += res.Unwrap();
1739 pos += res.Unwrap();
1746 pos += res.Unwrap();
1750 std::uint64_t
size = pos - base;
1751 if (
auto res = SerializeEnvelopePostscript(base,
size)) {
1752 size += res.Unwrap();
1763 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1765 void **
where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1767 pos += SerializeEnvelopePreamble(kEnvelopeTypeFooter, *
where);
1770 if (
auto res = SerializeFeatureFlags(std::vector<std::uint64_t>(), *
where)) {
1771 pos += res.Unwrap();
1779 pos += SerializeRecordFramePreamble(*
where);
1780 if (
auto res = SerializeSchemaDescription(*
where, desc, context,
true)) {
1781 pos += res.Unwrap();
1785 if (
auto res = SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame)) {
1786 pos += res.Unwrap();
1804 pos += res.Unwrap();
1809 if (
auto res = SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame)) {
1810 pos += res.Unwrap();
1815 std::uint32_t
size = pos - base;
1816 if (
auto res = SerializeEnvelopePostscript(base,
size)) {
1817 size += res.Unwrap();
1828 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1834 bytes += res.Unwrap();
1842 bytes += res.Unwrap();
1846 for (std::size_t i = 0; i <
featureFlags.size(); ++i) {
1849 unsigned int bit = 0;
1852 return R__FAIL(
"unsupported format feature: " + std::to_string(i * 64 +
bit));
1859 bytes += res.Unwrap();
1864 bytes += res.Unwrap();
1869 bytes += res.Unwrap();
1877 .FieldId(kZeroFieldId)
1892 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1896 bytes += res.Unwrap();
1903 bytes += res.Unwrap();
1913 if (
fnBufSizeLeft() <
static_cast<int>(
sizeof(std::uint64_t)))
1914 return R__FAIL(
"footer too short");
1917 return R__FAIL(
"XxHash-3 mismatch between header and footer");
1924 bytes += res.Unwrap();
1939 bytes += res.Unwrap();
1946 bytes += res.Unwrap();
1954 .PageListLocator(
clusterGroup.fPageListEnvelopeLink.fLocator)
1955 .PageListLength(
clusterGroup.fPageListEnvelopeLink.fLength)
1971 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1976 bytes += res.Unwrap();
1982 if (
fnBufSizeLeft() <
static_cast<int>(
sizeof(std::uint64_t)))
1983 return R__FAIL(
"page list too short");
1986 return R__FAIL(
"XxHash-3 mismatch between header and page list");
2000 bytes += res.Unwrap();
2007 bytes += res.Unwrap();
2024 bytes += res.Unwrap();
2030 return R__FAIL(
"mismatch between number of clusters and number of cluster summaries");
2032 for (std::uint32_t i = 0; i <
nClusters; ++i) {
2039 bytes += res.Unwrap();
2051 bytes += res.Unwrap();
2058 for (std::uint32_t k = 0; k <
nPages; ++k) {
2060 return R__FAIL(
"inner frame too short");
2070 bytes += res.Unwrap();
2078 return R__FAIL(
"page list frame too short");
2083 return R__FAIL(
"unexpected non-empty page list");
2087 return R__FAIL(
"page list frame too short");
2114 std::vector<ROOT::RClusterDescriptor>
clusters;
2119 case EDescriptorDeserializeMode::kForReading:
2121 if (
auto res = builder.CommitSuppressedColumnRanges(desc); !res)
2123 builder.AddExtendedColumnRanges(desc);
2124 clusters.emplace_back(builder.MoveDescriptor().Unwrap());
2127 case EDescriptorDeserializeMode::kForWriting:
2129 if (
auto res = builder.CommitSuppressedColumnRanges(desc); !res)
2131 clusters.emplace_back(builder.MoveDescriptor().Unwrap());
2134 case EDescriptorDeserializeMode::kRaw:
2136 clusters.emplace_back(builder.MoveDescriptor().Unwrap());
#define R__FORWARD_ERROR(res)
Short-hand to return an RResult<T> in an error state (i.e. after checking)
#define R__FORWARD_RESULT(res)
Short-hand to return an RResult<T> value from a subroutine to the calling stack frame.
#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(...)
#define R__LOG_DEBUG(DEBUGLEVEL,...)
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 data
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 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 length
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 nitems
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 bytes
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
The available trivial, native content types of a column.
The serialization context is used for the piecewise serialization of a descriptor.
ROOT::DescriptorId_t GetMemClusterGroupId(ROOT::DescriptorId_t onDiskId) const
ROOT::DescriptorId_t GetOnDiskFieldId(ROOT::DescriptorId_t memId) const
ROOT::DescriptorId_t GetOnDiskColumnId(ROOT::DescriptorId_t memId) const
std::uint64_t GetHeaderXxHash3() const
void SetHeaderXxHash3(std::uint64_t xxhash3)
ROOT::DescriptorId_t GetMemClusterId(ROOT::DescriptorId_t onDiskId) const
ROOT::DescriptorId_t GetMemColumnId(ROOT::DescriptorId_t onDiskId) const
void SetHeaderSize(std::uint64_t size)
const std::vector< ROOT::DescriptorId_t > & GetOnDiskFieldList() const
Return a vector containing the in-memory field ID for each on-disk counterpart, in order,...
void MapSchema(const RNTupleDescriptor &desc, bool forHeaderExtension)
Map in-memory field and column IDs to their on-disk counterparts.
A helper class for serializing and deserialization of the RNTuple binary format.
static std::uint32_t SerializeXxHash3(const unsigned char *data, std::uint64_t length, std::uint64_t &xxhash3, void *buffer)
Writes a XxHash-3 64bit checksum of the byte range given by data and length.
static RResult< std::uint32_t > DeserializeColumnType(const void *buffer, ROOT::ENTupleColumnType &type)
static std::uint32_t SerializeListFramePreamble(std::uint32_t nitems, void *buffer)
static RResult< std::uint32_t > DeserializeExtraTypeInfoId(const void *buffer, ROOT::EExtraTypeInfoIds &id)
static RResult< std::uint32_t > SerializeFramePostscript(void *frame, std::uint64_t size)
static RResult< std::uint32_t > DeserializeFieldStructure(const void *buffer, ROOT::ENTupleStructure &structure)
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
static RResult< std::uint32_t > SerializeLocator(const RNTupleLocator &locator, void *buffer)
static RResult< std::uint32_t > SerializeEnvelopePostscript(unsigned char *envelope, std::uint64_t size)
static RResult< std::uint32_t > DeserializeEnvelope(const void *buffer, std::uint64_t bufSize, std::uint16_t expectedType)
static std::uint32_t DeserializeUInt16(const void *buffer, std::uint16_t &val)
static RResult< std::uint32_t > DeserializeString(const void *buffer, std::uint64_t bufSize, std::string &val)
static RResult< std::uint32_t > DeserializeFeatureFlags(const void *buffer, std::uint64_t bufSize, std::vector< std::uint64_t > &flags)
static std::uint32_t SerializeString(const std::string &val, void *buffer)
static std::string SerializeStreamerInfos(const StreamerInfoMap_t &infos)
static RResult< void > DeserializeFooter(const void *buffer, std::uint64_t bufSize, ROOT::Internal::RNTupleDescriptorBuilder &descBuilder)
static RResult< std::uint32_t > SerializeClusterGroup(const RClusterGroup &clusterGroup, void *buffer)
static RResult< std::uint32_t > DeserializeFrameHeader(const void *buffer, std::uint64_t bufSize, std::uint64_t &frameSize, std::uint32_t &nitems)
static RResult< std::uint32_t > SerializeFieldStructure(ROOT::ENTupleStructure structure, void *buffer)
While we could just interpret the enums as ints, we make the translation explicit in order to avoid a...
static RResult< std::uint32_t > DeserializeEnvelopeLink(const void *buffer, std::uint64_t bufSize, REnvelopeLink &envelopeLink)
static std::uint32_t DeserializeUInt32(const void *buffer, std::uint32_t &val)
static std::uint32_t SerializeUInt64(std::uint64_t val, void *buffer)
static std::uint32_t SerializeEnvelopePreamble(std::uint16_t envelopeType, void *buffer)
static std::uint32_t DeserializeInt16(const void *buffer, std::int16_t &val)
EDescriptorDeserializeMode
static RResult< std::vector< ROOT::Internal::RClusterDescriptorBuilder > > DeserializePageListRaw(const void *buffer, std::uint64_t bufSize, ROOT::DescriptorId_t clusterGroupId, const RNTupleDescriptor &desc)
static RResult< std::uint32_t > SerializeExtraTypeInfoId(ROOT::EExtraTypeInfoIds id, void *buffer)
static std::uint32_t SerializeInt16(std::int16_t val, void *buffer)
static RResult< std::uint32_t > SerializeFeatureFlags(const std::vector< std::uint64_t > &flags, void *buffer)
static RResult< std::uint32_t > SerializePageList(void *buffer, const RNTupleDescriptor &desc, std::span< ROOT::DescriptorId_t > physClusterIDs, const RContext &context)
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
static std::uint32_t SerializeInt32(std::int32_t val, void *buffer)
static std::uint32_t DeserializeUInt64(const void *buffer, std::uint64_t &val)
static RResult< std::uint32_t > SerializeFooter(void *buffer, const RNTupleDescriptor &desc, const RContext &context)
static std::uint32_t DeserializeInt32(const void *buffer, std::int32_t &val)
static std::uint32_t DeserializeInt64(const void *buffer, std::int64_t &val)
static RResult< std::uint32_t > DeserializeClusterGroup(const void *buffer, std::uint64_t bufSize, RClusterGroup &clusterGroup)
static RResult< std::uint32_t > SerializeColumnType(ROOT::ENTupleColumnType type, void *buffer)
static std::uint32_t SerializeRecordFramePreamble(void *buffer)
static std::uint32_t SerializeUInt16(std::uint16_t val, void *buffer)
static RResult< std::uint32_t > SerializeSchemaDescription(void *buffer, const RNTupleDescriptor &desc, const RContext &context, bool forHeaderExtension=false)
Serialize the schema description in desc into buffer.
static RResult< std::uint32_t > DeserializeLocator(const void *buffer, std::uint64_t bufSize, RNTupleLocator &locator)
static RResult< std::uint32_t > SerializeEnvelopeLink(const REnvelopeLink &envelopeLink, void *buffer)
static RResult< std::uint32_t > DeserializeSchemaDescription(const void *buffer, std::uint64_t bufSize, ROOT::Internal::RNTupleDescriptorBuilder &descBuilder)
static RResult< void > VerifyXxHash3(const unsigned char *data, std::uint64_t length, std::uint64_t &xxhash3)
Expects an xxhash3 checksum in the 8 bytes following data + length and verifies it.
static std::uint32_t SerializeInt64(std::int64_t val, void *buffer)
static RResult< std::uint32_t > DeserializeClusterSummary(const void *buffer, std::uint64_t bufSize, RClusterSummary &clusterSummary)
static std::uint32_t SerializeUInt32(std::uint32_t val, void *buffer)
static RResult< void > DeserializePageList(const void *buffer, std::uint64_t bufSize, ROOT::DescriptorId_t clusterGroupId, RNTupleDescriptor &desc, EDescriptorDeserializeMode mode)
static RResult< void > DeserializeHeader(const void *buffer, std::uint64_t bufSize, ROOT::Internal::RNTupleDescriptorBuilder &descBuilder)
static RResult< std::uint32_t > SerializeClusterSummary(const RClusterSummary &clusterSummary, void *buffer)
static RResult< RContext > SerializeHeader(void *buffer, const RNTupleDescriptor &desc)
A helper class for piece-wise construction of an RClusterDescriptor.
RClusterDescriptorBuilder & NEntries(std::uint64_t nEntries)
RClusterDescriptorBuilder & ClusterId(ROOT::DescriptorId_t clusterId)
RClusterDescriptorBuilder & FirstEntryIndex(std::uint64_t firstEntryIndex)
A helper class for piece-wise construction of an RClusterGroupDescriptor.
A helper class for piece-wise construction of an RColumnDescriptor.
A helper class for piece-wise construction of an RFieldDescriptor.
A helper class for piece-wise construction of an RNTupleDescriptor.
Metadata stored for every column of an RNTuple.
Metadata stored for every field of an RNTuple.
The on-storage metadata of an RNTuple.
const RClusterGroupDescriptor & GetClusterGroupDescriptor(ROOT::DescriptorId_t clusterGroupId) const
const RColumnDescriptor & GetColumnDescriptor(ROOT::DescriptorId_t columnId) const
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
const RFieldDescriptor & GetFieldDescriptor(ROOT::DescriptorId_t fieldId) const
std::size_t GetNExtraTypeInfos() const
RColumnDescriptorIterable GetColumnIterable() const
const std::string & GetName() const
std::vector< std::uint64_t > GetFeatureFlags() const
ROOT::DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level RNTuple data fields.
std::size_t GetNPhysicalColumns() const
const RHeaderExtension * GetHeaderExtension() const
Return header extension information; if the descriptor does not have a header extension,...
const RClusterDescriptor & GetClusterDescriptor(ROOT::DescriptorId_t clusterId) const
std::uint64_t GetOnDiskHeaderXxHash3() const
std::size_t GetNFields() const
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::size_t GetNLogicalColumns() const
std::size_t GetNClusterGroups() const
const std::string & GetDescription() const
RNTupleLocator payload that is common for object stores using 64bit location information.
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...
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
TObject * ReadObject(const TClass *cl) override
Read object from I/O buffer.
void WriteObject(const TObject *obj, Bool_t cacheReuse=kTRUE) override
Write object to I/O buffer.
Wrapper around a TObject so it can be stored in a TList.
Describes a persistent version of a class.
constexpr ROOT::ENTupleStructure kTestFutureFieldStructure
ROOT::RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
constexpr ENTupleColumnType kTestFutureColumnType
constexpr RNTupleLocator::ELocatorType kTestLocatorType
EExtraTypeInfoIds
Used in RExtraTypeInfoDescriptor.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.