35#include <unordered_map>
48 auto base =
reinterpret_cast<unsigned char *
>(buffer);
50 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
52 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
54 pos += RNTupleSerializer::SerializeUInt32(fieldDesc.
GetFieldVersion(), *where);
55 pos += RNTupleSerializer::SerializeUInt32(fieldDesc.
GetTypeVersion(), *where);
56 pos += RNTupleSerializer::SerializeUInt32(onDiskParentId, *where);
57 pos += RNTupleSerializer::SerializeFieldStructure(fieldDesc.
GetStructure(), *where);
59 pos += RNTupleSerializer::SerializeUInt16(RNTupleSerializer::kFlagRepetitiveField, *where);
60 pos += RNTupleSerializer::SerializeUInt64(fieldDesc.
GetNRepetitions(), *where);
62 pos += RNTupleSerializer::SerializeUInt16(0, *where);
64 pos += RNTupleSerializer::SerializeString(fieldDesc.
GetFieldName(), *where);
65 pos += RNTupleSerializer::SerializeString(fieldDesc.
GetTypeName(), *where);
66 pos += RNTupleSerializer::SerializeString(fieldDesc.
GetTypeAlias(), *where);
69 auto size = pos - base;
70 RNTupleSerializer::SerializeFramePostscript(base,
size);
83 std::span<const ROOT::Experimental::DescriptorId_t> fieldList,
84 std::size_t firstOnDiskId,
87 auto base =
reinterpret_cast<unsigned char *
>(buffer);
89 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
93 for (
auto fieldId : fieldList) {
96 (
f.GetParentId() == fieldZeroId) ? onDiskFieldId : context.
GetOnDiskFieldId(
f.GetParentId());
97 pos += SerializeField(
f, onDiskParentId, *where);
109 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
111 std::uint64_t frameSize;
112 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
113 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
118 std::uint32_t fieldVersion;
119 std::uint32_t typeVersion;
120 std::uint32_t parentId;
122 ENTupleStructure structure{ENTupleStructure::kLeaf};
124 if (fnFrameSizeLeft() < 3 *
sizeof(std::uint32_t) +
125 RNTupleSerializer::SerializeFieldStructure(structure,
nullptr) +
126 sizeof(std::uint16_t))
128 return R__FAIL(
"field record frame too short");
130 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, fieldVersion);
131 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, typeVersion);
132 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, parentId);
133 result = RNTupleSerializer::DeserializeFieldStructure(
bytes, structure);
137 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, flags);
140 if (flags & RNTupleSerializer::kFlagRepetitiveField) {
141 if (fnFrameSizeLeft() <
sizeof(std::uint64_t))
142 return R__FAIL(
"field record frame too short");
143 std::uint64_t nRepetitions;
144 bytes += RNTupleSerializer::DeserializeUInt64(
bytes, nRepetitions);
148 std::string fieldName;
149 std::string typeName;
150 std::string aliasName;
151 std::string description;
152 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), fieldName).Unwrap();
156 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), typeName).Unwrap();
160 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), aliasName).Unwrap();
164 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), description).Unwrap();
174 std::span<const ROOT::Experimental::DescriptorId_t> fieldList,
180 auto base =
reinterpret_cast<unsigned char *
>(buffer);
182 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
184 for (
auto parentId : fieldList) {
186 if (
c.IsAliasColumn())
190 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
192 auto type =
c.GetModel().GetType();
193 pos += RNTupleSerializer::SerializeColumnType(
type, *where);
194 pos += RNTupleSerializer::SerializeUInt16(RColumnElementBase::GetBitsOnStorage(
type), *where);
195 pos += RNTupleSerializer::SerializeUInt32(context.
GetOnDiskFieldId(
c.GetFieldId()), *where);
196 std::uint32_t flags = 0;
198 if (
c.GetModel().GetIsSorted())
199 flags |= RNTupleSerializer::kFlagSortAscColumn;
202 flags |= RNTupleSerializer::kFlagNonNegativeColumn;
203 const std::uint64_t firstElementIdx =
c.GetFirstElementIndex();
204 if (firstElementIdx > 0)
205 flags |= RNTupleSerializer::kFlagDeferredColumn;
206 pos += RNTupleSerializer::SerializeUInt32(flags, *where);
207 if (flags & RNTupleSerializer::kFlagDeferredColumn)
208 pos += RNTupleSerializer::SerializeUInt64(firstElementIdx, *where);
210 pos += RNTupleSerializer::SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
222 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
224 std::uint64_t frameSize;
225 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
226 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
233 std::uint16_t bitsOnStorage;
234 std::uint32_t fieldId;
236 std::uint64_t firstElementIdx = 0;
237 if (fnFrameSizeLeft() < RNTupleSerializer::SerializeColumnType(
type,
nullptr) +
238 sizeof(std::uint16_t) + 2 *
sizeof(std::uint32_t))
240 return R__FAIL(
"column record frame too short");
246 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, bitsOnStorage);
247 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, fieldId);
248 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, flags);
249 if (flags & RNTupleSerializer::kFlagDeferredColumn) {
250 if (fnFrameSizeLeft() <
sizeof(std::uint64_t))
251 return R__FAIL(
"column record frame too short");
252 bytes += RNTupleSerializer::DeserializeUInt64(
bytes, firstElementIdx);
256 return R__FAIL(
"column element size mismatch");
258 const bool isSorted = (flags & (RNTupleSerializer::kFlagSortAscColumn | RNTupleSerializer::kFlagSortDesColumn));
259 columnDesc.
FieldId(fieldId).
Model({
type, isSorted}).FirstElementIndex(firstElementIdx);
266 auto base =
reinterpret_cast<unsigned char *
>(buffer);
268 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
270 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
272 pos += RNTupleSerializer::SerializeExtraTypeInfoId(desc.GetContentId(), *where);
273 pos += RNTupleSerializer::SerializeUInt32(desc.GetTypeVersionFrom(), *where);
274 pos += RNTupleSerializer::SerializeUInt32(desc.GetTypeVersionTo(), *where);
275 pos += RNTupleSerializer::SerializeString(desc.GetTypeName(), *where);
276 pos += RNTupleSerializer::SerializeString(desc.GetContent(), *where);
278 auto size = pos - base;
279 RNTupleSerializer::SerializeFramePostscript(base,
size);
286 auto base =
reinterpret_cast<unsigned char *
>(buffer);
288 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
291 pos += SerializeExtraTypeInfo(extraTypeInfoDesc, *where);
302 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
304 std::uint64_t frameSize;
305 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
306 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
311 EExtraTypeInfoIds contentId{EExtraTypeInfoIds::kInvalid};
312 std::uint32_t typeVersionFrom;
313 std::uint32_t typeVersionTo;
314 if (fnFrameSizeLeft() < 3 *
sizeof(std::uint32_t)) {
315 return R__FAIL(
"extra type info record frame too short");
317 result = RNTupleSerializer::DeserializeExtraTypeInfoId(
bytes, contentId);
321 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, typeVersionFrom);
322 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, typeVersionTo);
324 std::string typeName;
326 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), typeName).Unwrap();
330 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), content).Unwrap();
346 const auto &uri = locator.
GetPosition<std::string>();
347 if (uri.length() >= (1 << 16))
350 memcpy(buffer, uri.data(), uri.length());
354void DeserializeLocatorPayloadURI(
const unsigned char *buffer, std::uint32_t payloadSize,
358 auto &uri = locator.
fPosition.emplace<std::string>();
359 uri.resize(payloadSize);
360 memcpy(uri.data(), buffer, payloadSize);
368 RNTupleSerializer::SerializeUInt64(
data.fLocation, buffer +
sizeof(std::uint32_t));
370 return sizeof(std::uint32_t) +
sizeof(std::uint64_t);
377 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint32_t),
data.fLocation);
381 std::span<const ROOT::Experimental::DescriptorId_t> fieldList,
385 auto base =
reinterpret_cast<unsigned char *
>(buffer);
387 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
389 for (
auto parentId : fieldList) {
391 if (!
c.IsAliasColumn())
395 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
397 pos += RNTupleSerializer::SerializeUInt32(context.
GetOnDiskColumnId(
c.GetPhysicalId()), *where);
398 pos += RNTupleSerializer::SerializeUInt32(context.
GetOnDiskFieldId(
c.GetFieldId()), *where);
400 pos += RNTupleSerializer::SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
408 std::uint32_t &physicalColumnId, std::uint32_t &fieldId)
410 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
412 std::uint64_t frameSize;
413 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
414 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
419 if (fnFrameSizeLeft() < 2 *
sizeof(std::uint32_t)) {
420 return R__FAIL(
"alias column record frame too short");
423 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, physicalColumnId);
424 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, fieldId);
433 std::uint64_t &xxhash3,
void *buffer)
435 if (buffer !=
nullptr) {
444 std::uint64_t &xxhash3)
446 auto checksumReal = XXH3_64bits(
data,
length);
448 if (xxhash3 != checksumReal)
449 return R__FAIL(
"XxHash-3 checksum mismatch");
456 std::uint64_t xxhash3;
463 if (buffer !=
nullptr) {
464 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
465 bytes[0] = (val & 0x00FF);
466 bytes[1] = (val & 0xFF00) >> 8;
473 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
474 val = std::int16_t(
bytes[0]) + (std::int16_t(
bytes[1]) << 8);
480 return SerializeInt16(val, buffer);
485 return DeserializeInt16(buffer, *
reinterpret_cast<std::int16_t *
>(&val));
490 if (buffer !=
nullptr) {
491 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
492 bytes[0] = (val & 0x000000FF);
493 bytes[1] = (val & 0x0000FF00) >> 8;
494 bytes[2] = (val & 0x00FF0000) >> 16;
495 bytes[3] = (val & 0xFF000000) >> 24;
502 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
503 val = std::int32_t(
bytes[0]) + (std::int32_t(
bytes[1]) << 8) +
504 (std::int32_t(
bytes[2]) << 16) + (std::int32_t(
bytes[3]) << 24);
510 return SerializeInt32(val, buffer);
515 return DeserializeInt32(buffer, *
reinterpret_cast<std::int32_t *
>(&val));
520 if (buffer !=
nullptr) {
521 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
522 bytes[0] = (val & 0x00000000000000FF);
523 bytes[1] = (val & 0x000000000000FF00) >> 8;
524 bytes[2] = (val & 0x0000000000FF0000) >> 16;
525 bytes[3] = (val & 0x00000000FF000000) >> 24;
526 bytes[4] = (val & 0x000000FF00000000) >> 32;
527 bytes[5] = (val & 0x0000FF0000000000) >> 40;
528 bytes[6] = (val & 0x00FF000000000000) >> 48;
529 bytes[7] = (val & 0xFF00000000000000) >> 56;
536 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
537 val = std::int64_t(
bytes[0]) + (std::int64_t(
bytes[1]) << 8) +
538 (std::int64_t(
bytes[2]) << 16) + (std::int64_t(
bytes[3]) << 24) +
539 (std::int64_t(
bytes[4]) << 32) + (std::int64_t(
bytes[5]) << 40) +
540 (std::int64_t(
bytes[6]) << 48) + (std::int64_t(
bytes[7]) << 56);
546 return SerializeInt64(val, buffer);
551 return DeserializeInt64(buffer, *
reinterpret_cast<std::int64_t *
>(&val));
557 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
558 pos += SerializeUInt32(val.length(), pos);
559 memcpy(pos, val.data(), val.length());
561 return sizeof(std::uint32_t) + val.length();
565 std::uint64_t bufSize,
568 if (bufSize <
sizeof(std::uint32_t))
569 return R__FAIL(
"string buffer too short");
570 bufSize -=
sizeof(std::uint32_t);
572 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
577 return R__FAIL(
"string buffer too short");
581 return sizeof(std::uint32_t) +
length;
625 std::uint16_t onDiskType;
626 auto result = DeserializeUInt16(buffer, onDiskType);
627 switch (onDiskType) {
655 default:
return R__FAIL(
"unexpected on-disk column type");
679 std::uint16_t onDiskValue;
680 auto result = DeserializeUInt16(buffer, onDiskValue);
681 switch (onDiskValue) {
687 default:
return R__FAIL(
"unexpected on-disk field structure value");
708 std::uint32_t onDiskValue;
709 auto result = DeserializeUInt32(buffer, onDiskValue);
710 switch (onDiskValue) {
722 auto base =
reinterpret_cast<unsigned char *
>(buffer);
724 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
726 pos += SerializeUInt64(envelopeType, *where);
733 std::uint64_t &xxhash3)
735 if (
size <
sizeof(std::uint64_t))
737 if (
size >=
static_cast<uint64_t
>(1) << 48)
740 std::uint64_t typeAndSize;
741 DeserializeUInt64(envelope, typeAndSize);
742 typeAndSize |= (
size + 8) << 16;
743 SerializeUInt64(typeAndSize, envelope);
745 return SerializeXxHash3(envelope,
size, xxhash3, envelope ? (envelope +
size) :
nullptr);
751 std::uint64_t xxhash3;
752 return SerializeEnvelopePostscript(envelope,
size, xxhash3);
757 std::uint16_t expectedType, std::uint64_t &xxhash3)
759 const std::uint64_t minEnvelopeSize =
sizeof(std::uint64_t) +
sizeof(std::uint64_t);
760 if (bufSize < minEnvelopeSize)
761 return R__FAIL(
"invalid envelope buffer, too short");
763 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
766 std::uint64_t typeAndSize;
767 bytes += DeserializeUInt64(
bytes, typeAndSize);
769 std::uint16_t envelopeType = typeAndSize & 0xFFFF;
770 if (envelopeType != expectedType) {
771 return R__FAIL(
"envelope type mismatch: expected " + std::to_string(expectedType) +
", found " +
772 std::to_string(envelopeType));
775 std::uint64_t envelopeSize = typeAndSize >> 16;
776 if (bufSize < envelopeSize)
777 return R__FAIL(
"envelope buffer size too small");
778 if (envelopeSize < minEnvelopeSize)
779 return R__FAIL(
"invalid envelope, too short");
781 auto result = VerifyXxHash3(base, envelopeSize - 8, xxhash3);
785 return sizeof(typeAndSize);
789 std::uint64_t bufSize,
790 std::uint16_t expectedType)
792 std::uint64_t xxhash3;
793 return R__FORWARD_RESULT(DeserializeEnvelope(buffer, bufSize, expectedType, xxhash3));
800 return SerializeInt64(1, buffer);
805 std::uint32_t
nitems,
void *buffer)
807 auto base =
reinterpret_cast<unsigned char *
>(buffer);
809 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
812 pos += SerializeInt64(-1, *where);
813 pos += SerializeUInt32(
nitems, *where);
819 auto preambleSize =
sizeof(std::int64_t);
820 if (
size < preambleSize)
824 DeserializeInt64(frame, marker);
825 if ((marker < 0) && (
size < (
sizeof(std::uint32_t) + preambleSize)))
827 SerializeInt64(marker *
static_cast<int64_t
>(
size), frame);
834 std::uint64_t &frameSize, std::uint32_t &
nitems)
836 std::uint64_t minSize =
sizeof(std::int64_t);
837 if (bufSize < minSize)
838 return R__FAIL(
"frame too short");
840 std::int64_t *ssize =
reinterpret_cast<std::int64_t *
>(&frameSize);
841 DeserializeInt64(buffer, *ssize);
843 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
851 minSize +=
sizeof(std::uint32_t);
852 if (bufSize < minSize)
853 return R__FAIL(
"frame too short");
858 if (frameSize < minSize)
859 return R__FAIL(
"corrupt frame size");
860 if (bufSize < frameSize)
861 return R__FAIL(
"frame too short");
863 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
868 std::uint64_t &frameSize)
879 return SerializeUInt64(0, buffer);
882 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
884 for (
unsigned i = 0; i < flags.size(); ++i) {
885 if (flags[i] & 0x8000000000000000)
889 if (i == (flags.size() - 1))
890 SerializeUInt64(flags[i],
bytes);
892 bytes += SerializeUInt64(flags[i] | 0x8000000000000000,
bytes);
895 return (flags.size() *
sizeof(std::int64_t));
900 std::vector<std::uint64_t> &flags)
902 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
907 if (bufSize <
sizeof(std::uint64_t))
908 return R__FAIL(
"feature flag buffer too short");
910 bufSize -=
sizeof(std::uint64_t);
911 flags.emplace_back(
f & ~0x8000000000000000);
912 }
while (
f & 0x8000000000000000);
914 return (flags.size() *
sizeof(std::uint64_t));
923 std::uint32_t
size = 0;
929 buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
size :
nullptr);
933 auto payloadp = buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
sizeof(std::int32_t) :
nullptr;
934 switch (locator.
fType) {
939 std::int32_t head =
sizeof(std::int32_t) +
size;
941 head |=
static_cast<int>(locator.
fType & 0x7F) << 24;
948 std::uint64_t bufSize,
951 if (bufSize <
sizeof(std::int32_t))
952 return R__FAIL(
"too short locator");
954 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
958 bufSize -=
sizeof(std::int32_t);
961 const int type = head >> 24;
962 const std::uint32_t payloadSize = (
static_cast<std::uint32_t
>(head) & 0x0000FFFF) -
sizeof(std::int32_t);
963 if (bufSize < payloadSize)
964 return R__FAIL(
"too short locator");
966 locator.
fReserved =
static_cast<std::uint32_t
>(head >> 16) & 0xFF;
970 default:
return R__FAIL(
"unsupported locator type: " + std::to_string(
type));
972 bytes += payloadSize;
974 if (bufSize <
sizeof(std::uint64_t))
975 return R__FAIL(
"too short locator");
982 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
988 auto size = SerializeUInt64(envelopeLink.
fLength, buffer);
990 buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
size :
nullptr);
998 if (bufSize <
sizeof(std::int64_t))
999 return R__FAIL(
"too short envelope link");
1001 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1003 bufSize -=
sizeof(std::uint64_t);
1008 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
1015 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1017 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
1020 pos += SerializeRecordFramePreamble(*where);
1021 pos += SerializeUInt64(clusterSummary.
fFirstEntry, *where);
1023 pos += SerializeInt64(-
static_cast<int64_t
>(clusterSummary.
fNEntries), *where);
1026 pos += SerializeInt64(
static_cast<int64_t
>(clusterSummary.
fNEntries), *where);
1028 auto size = pos - frame;
1029 pos += SerializeFramePostscript(frame,
size);
1037 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1039 std::uint64_t frameSize;
1040 auto result = DeserializeFrameHeader(
bytes, bufSize, frameSize);
1045 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
1046 if (fnFrameSizeLeft() < 2 *
sizeof(std::uint64_t))
1047 return R__FAIL(
"too short cluster summary");
1050 std::int64_t nEntries;
1054 if (fnFrameSizeLeft() <
sizeof(std::uint32_t))
1055 return R__FAIL(
"too short cluster summary");
1057 std::uint32_t columnGroupID;
1058 bytes += DeserializeUInt32(
bytes, columnGroupID);
1072 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1074 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
1077 pos += SerializeRecordFramePreamble(*where);
1078 pos += SerializeUInt64(clusterGroup.
fMinEntry, *where);
1079 pos += SerializeUInt64(clusterGroup.
fEntrySpan, *where);
1080 pos += SerializeUInt32(clusterGroup.
fNClusters, *where);
1082 auto size = pos - frame;
1083 pos += SerializeFramePostscript(frame,
size);
1091 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1094 std::uint64_t frameSize;
1095 auto result = DeserializeFrameHeader(
bytes, bufSize, frameSize);
1100 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
1101 if (fnFrameSizeLeft() <
sizeof(std::uint32_t) + 2 *
sizeof(std::uint64_t))
1102 return R__FAIL(
"too short cluster group");
1115 bool forHeaderExtension)
1118 auto depthFirstTraversal = [&](std::span<DescriptorId_t> fieldTrees,
auto doForEachField) {
1119 std::deque<DescriptorId_t> idQueue{fieldTrees.begin(), fieldTrees.end()};
1120 while (!idQueue.empty()) {
1121 auto fieldId = idQueue.front();
1122 idQueue.pop_front();
1124 if (fieldId != fieldZeroId)
1125 doForEachField(fieldId);
1128 idQueue.insert(idQueue.begin() + i++,
f.GetId());
1133 if (!forHeaderExtension)
1134 R__ASSERT(GetHeaderExtensionOffset() == -1U);
1136 std::vector<DescriptorId_t> fieldTrees;
1137 if (!forHeaderExtension) {
1138 fieldTrees.emplace_back(fieldZeroId);
1140 fieldTrees = xHeader->GetTopLevelFields(desc);
1142 depthFirstTraversal(fieldTrees, [&](
DescriptorId_t fieldId) { MapFieldId(fieldId); });
1145 if (!
c.IsAliasColumn())
1146 MapColumnId(
c.GetLogicalId());
1150 if (
c.IsAliasColumn())
1151 MapColumnId(
c.GetLogicalId());
1155 if (!forHeaderExtension)
1156 BeginHeaderExtension();
1162 bool forHeaderExtension)
1164 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1166 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
1168 std::size_t nFields = 0, nColumns = 0, nAliasColumns = 0, fieldListOffset = 0;
1169 if (forHeaderExtension) {
1173 nFields = xHeader->GetNFields();
1174 nColumns = xHeader->GetNPhysicalColumns();
1175 nAliasColumns = xHeader->GetNLogicalColumns() - xHeader->GetNPhysicalColumns();
1185 R__ASSERT(onDiskFields.size() >= fieldListOffset);
1186 std::span<const DescriptorId_t> fieldList{onDiskFields.data() + fieldListOffset,
1187 onDiskFields.size() - fieldListOffset};
1190 pos += SerializeListFramePreamble(nFields, *where);
1191 pos += SerializeFieldList(desc, fieldList, fieldListOffset, context, *where);
1192 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1195 pos += SerializeListFramePreamble(nColumns, *where);
1196 pos += SerializeColumnList(desc, fieldList, context, *where);
1197 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1200 pos += SerializeListFramePreamble(nAliasColumns, *where);
1201 pos += SerializeAliasColumnList(desc, fieldList, context, *where);
1202 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1205 pos += SerializeListFramePreamble(nExtraTypeInfos, *where);
1206 pos += SerializeExtraTypeInfoList(desc, *where);
1207 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1209 return static_cast<std::uint32_t
>(pos - base);
1216 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1218 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1221 std::uint64_t frameSize;
1223 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - frame); };
1225 std::uint32_t nFields;
1226 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nFields);
1232 for (
unsigned i = 0; i < nFields; ++i) {
1233 std::uint32_t fieldId = fieldIdRangeBegin + i;
1235 result = DeserializeField(
bytes, fnFrameSizeLeft(), fieldBuilder);
1240 fieldBuilder.
ParentId(kZeroFieldId);
1244 auto parentId = fieldDesc.Inspect().GetParentId();
1245 descBuilder.
AddField(fieldDesc.Unwrap());
1246 auto resVoid = descBuilder.
AddFieldLink(parentId, fieldId);
1250 bytes = frame + frameSize;
1252 std::uint32_t nColumns;
1254 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nColumns);
1259 std::unordered_map<DescriptorId_t, std::uint32_t> maxIndexes;
1260 for (
unsigned i = 0; i < nColumns; ++i) {
1261 std::uint32_t columnId = columnIdRangeBegin + i;
1263 result = DeserializeColumn(
bytes, fnFrameSizeLeft(), columnBuilder);
1268 std::uint32_t idx = 0;
1269 const auto fieldId = columnBuilder.
GetFieldId();
1270 auto maxIdx = maxIndexes.find(fieldId);
1271 if (maxIdx != maxIndexes.end())
1272 idx = maxIdx->second + 1;
1273 maxIndexes[fieldId] = idx;
1278 auto resVoid = descBuilder.
AddColumn(columnDesc.Unwrap());
1282 bytes = frame + frameSize;
1284 std::uint32_t nAliasColumns;
1286 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nAliasColumns);
1290 const std::uint32_t aliasColumnIdRangeBegin = columnIdRangeBegin + nColumns;
1291 for (
unsigned i = 0; i < nAliasColumns; ++i) {
1292 std::uint32_t physicalId;
1293 std::uint32_t fieldId;
1294 result = DeserializeAliasColumn(
bytes, fnFrameSizeLeft(), physicalId, fieldId);
1303 std::uint32_t idx = 0;
1304 auto maxIdx = maxIndexes.find(fieldId);
1305 if (maxIdx != maxIndexes.end())
1306 idx = maxIdx->second + 1;
1307 maxIndexes[fieldId] = idx;
1310 if (!aliasColumnDesc)
1312 auto resVoid = descBuilder.
AddColumn(aliasColumnDesc.Unwrap());
1316 bytes = frame + frameSize;
1318 std::uint32_t nExtraTypeInfos;
1320 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nExtraTypeInfos);
1324 for (
unsigned i = 0; i < nExtraTypeInfos; ++i) {
1326 result = DeserializeExtraTypeInfo(
bytes, fnFrameSizeLeft(), extraTypeInfoBuilder);
1333 if (extraTypeInfoDesc)
1336 bytes = frame + frameSize;
1338 return bytes - base;
1347 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1349 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1351 pos += SerializeEnvelopePreamble(kEnvelopeTypeHeader, *where);
1354 pos += SerializeString(desc.
GetName(), *where);
1356 pos += SerializeString(std::string(
"ROOT v") +
ROOT_RELEASE, *where);
1359 pos += SerializeSchemaDescription(*where, desc, context);
1361 std::uint64_t
size = pos - base;
1362 std::uint64_t xxhash3 = 0;
1363 size += SerializeEnvelopePostscript(base,
size, xxhash3);
1372 std::span<DescriptorId_t> physClusterIDs,
1375 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1377 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
1379 pos += SerializeEnvelopePreamble(kEnvelopeTypePageList, *where);
1384 const auto nClusters = physClusterIDs.size();
1385 auto clusterSummaryFrame = pos;
1386 pos += SerializeListFramePreamble(nClusters, *where);
1387 for (
auto clusterId : physClusterIDs) {
1389 RClusterSummary summary{clusterDesc.GetFirstEntryIndex(), clusterDesc.GetNEntries(), -1};
1390 pos += SerializeClusterSummary(summary, *where);
1392 pos += SerializeFramePostscript(buffer ? clusterSummaryFrame :
nullptr, pos - clusterSummaryFrame);
1395 auto topMostFrame = pos;
1396 pos += SerializeListFramePreamble(nClusters, *where);
1398 for (
auto clusterId : physClusterIDs) {
1401 std::set<DescriptorId_t> onDiskColumnIds;
1402 for (
auto column : clusterDesc.GetColumnIds())
1405 auto outerFrame = pos;
1406 pos += SerializeListFramePreamble(onDiskColumnIds.size(), *where);
1407 for (
auto onDiskId : onDiskColumnIds) {
1409 const auto &columnRange = clusterDesc.GetColumnRange(memId);
1410 const auto &pageRange = clusterDesc.GetPageRange(memId);
1412 auto innerFrame = pos;
1413 pos += SerializeListFramePreamble(pageRange.fPageInfos.size(), *where);
1415 for (
const auto &pi : pageRange.fPageInfos) {
1416 pos += SerializeUInt32(pi.fNElements, *where);
1417 pos += SerializeLocator(pi.fLocator, *where);
1419 pos += SerializeUInt64(columnRange.fFirstElementIndex, *where);
1420 pos += SerializeUInt32(columnRange.fCompressionSettings, *where);
1422 pos += SerializeFramePostscript(buffer ? innerFrame :
nullptr, pos - innerFrame);
1424 pos += SerializeFramePostscript(buffer ? outerFrame :
nullptr, pos - outerFrame);
1427 pos += SerializeFramePostscript(buffer ? topMostFrame :
nullptr, pos - topMostFrame);
1428 std::uint64_t
size = pos - base;
1429 size += SerializeEnvelopePostscript(base,
size);
1438 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1440 void** where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void**
>(&pos);
1442 pos += SerializeEnvelopePreamble(kEnvelopeTypeFooter, *where);
1445 pos += SerializeFeatureFlags(std::vector<std::uint64_t>(), *where);
1450 pos += SerializeRecordFramePreamble(*where);
1451 pos += SerializeSchemaDescription(*where, desc, context,
true);
1452 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1456 pos += SerializeListFramePreamble(0, *where);
1457 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1462 pos += SerializeListFramePreamble(nClusterGroups, *where);
1463 for (
unsigned int i = 0; i < nClusterGroups; ++i) {
1466 clusterGroup.
fMinEntry = cgDesc.GetMinEntry();
1467 clusterGroup.
fEntrySpan = cgDesc.GetEntrySpan();
1468 clusterGroup.
fNClusters = cgDesc.GetNClusters();
1471 pos += SerializeClusterGroup(clusterGroup, *where);
1473 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1477 pos += SerializeListFramePreamble(0, *where);
1478 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1480 std::uint32_t
size = pos - base;
1481 size += SerializeEnvelopePostscript(base,
size);
1489 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1491 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1494 std::uint64_t xxhash3{0};
1495 result = DeserializeEnvelope(
bytes, fnBufSizeLeft(), kEnvelopeTypeHeader, xxhash3);
1501 std::vector<std::uint64_t> featureFlags;
1502 result = DeserializeFeatureFlags(
bytes, fnBufSizeLeft(), featureFlags);
1506 for (std::size_t i = 0; i < featureFlags.size(); ++i) {
1507 if (!featureFlags[i])
1509 unsigned int bit = 0;
1510 while (!(featureFlags[i] & (
static_cast<uint64_t
>(1) << bit)))
1512 return R__FAIL(
"unsupported format feature: " + std::to_string(i * 64 + bit));
1516 std::string description;
1522 result = DeserializeString(
bytes, fnBufSizeLeft(), description);
1535 result = DeserializeSchemaDescription(
bytes, fnBufSizeLeft(), descBuilder);
1546 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1548 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1551 result = DeserializeEnvelope(
bytes, fnBufSizeLeft(), kEnvelopeTypeFooter);
1556 std::vector<std::uint64_t> featureFlags;
1557 result = DeserializeFeatureFlags(
bytes, fnBufSizeLeft(), featureFlags);
1561 for (
auto f: featureFlags) {
1566 std::uint64_t xxhash3{0};
1567 if (fnBufSizeLeft() <
static_cast<int>(
sizeof(std::uint64_t)))
1568 return R__FAIL(
"footer too short");
1571 return R__FAIL(
"XxHash-3 mismatch between header and footer");
1573 std::uint64_t frameSize;
1575 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - frame); };
1577 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize);
1581 if (fnFrameSizeLeft() > 0) {
1583 result = DeserializeSchemaDescription(
bytes, fnFrameSizeLeft(), descBuilder);
1587 bytes = frame + frameSize;
1589 std::uint32_t nColumnGroups;
1591 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nColumnGroups);
1594 if (nColumnGroups > 0)
1595 return R__FAIL(
"sharded clusters are still unsupported");
1596 bytes = frame + frameSize;
1598 std::uint32_t nClusterGroups;
1600 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nClusterGroups);
1604 for (std::uint32_t groupId = 0; groupId < nClusterGroups; ++groupId) {
1606 result = DeserializeClusterGroup(
bytes, fnFrameSizeLeft(), clusterGroup);
1621 bytes = frame + frameSize;
1623 std::uint32_t nMDBlocks;
1625 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nMDBlocks);
1630 bytes = frame + frameSize;
1640 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1642 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1645 result = DeserializeEnvelope(
bytes, fnBufSizeLeft(), kEnvelopeTypePageList);
1650 std::uint64_t xxhash3{0};
1651 if (fnBufSizeLeft() <
static_cast<int>(
sizeof(std::uint64_t)))
1652 return R__FAIL(
"page list too short");
1655 return R__FAIL(
"XxHash-3 mismatch between header and page list");
1657 std::vector<RClusterDescriptorBuilder> clusterBuilders;
1663 std::uint64_t clusterSummaryFrameSize;
1664 auto clusterSummaryFrame =
bytes;
1665 auto fnClusterSummaryFrameSizeLeft = [&]() {
return clusterSummaryFrameSize - (
bytes - clusterSummaryFrame); };
1667 std::uint32_t nClusterSummaries;
1668 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), clusterSummaryFrameSize, nClusterSummaries);
1672 for (
auto clusterId = firstClusterId; clusterId < firstClusterId + nClusterSummaries; ++clusterId) {
1674 result = DeserializeClusterSummary(
bytes, fnClusterSummaryFrameSizeLeft(), clusterSummary);
1679 return R__FAIL(
"sharded clusters are still unsupported");
1683 clusterBuilders.emplace_back(std::move(builder));
1685 bytes = clusterSummaryFrame + clusterSummaryFrameSize;
1687 std::uint64_t topMostFrameSize;
1688 auto topMostFrame =
bytes;
1689 auto fnTopMostFrameSizeLeft = [&]() {
return topMostFrameSize - (
bytes - topMostFrame); };
1691 std::uint32_t nClusters;
1692 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), topMostFrameSize, nClusters);
1697 if (nClusters != nClusterSummaries)
1698 return R__FAIL(
"mismatch between number of clusters and number of cluster summaries");
1700 std::vector<RClusterDescriptor> clusters;
1701 for (std::uint32_t i = 0; i < nClusters; ++i) {
1702 std::uint64_t outerFrameSize;
1703 auto outerFrame =
bytes;
1704 auto fnOuterFrameSizeLeft = [&]() {
return outerFrameSize - (
bytes - outerFrame); };
1706 std::uint32_t nColumns;
1707 result = DeserializeFrameHeader(
bytes, fnTopMostFrameSizeLeft(), outerFrameSize, nColumns);
1712 for (std::uint32_t j = 0; j < nColumns; ++j) {
1713 std::uint64_t innerFrameSize;
1714 auto innerFrame =
bytes;
1715 auto fnInnerFrameSizeLeft = [&]() {
return innerFrameSize - (
bytes - innerFrame); };
1717 std::uint32_t nPages;
1718 result = DeserializeFrameHeader(
bytes, fnOuterFrameSizeLeft(), innerFrameSize, nPages);
1725 for (std::uint32_t k = 0; k < nPages; ++k) {
1726 if (fnInnerFrameSizeLeft() <
static_cast<int>(
sizeof(std::uint32_t)))
1727 return R__FAIL(
"inner frame too short");
1728 std::int32_t nElements;
1731 if (nElements < 0) {
1733 nElements = -nElements;
1735 result = DeserializeLocator(
bytes, fnInnerFrameSizeLeft(), locator);
1738 pageRange.
fPageInfos.push_back({
static_cast<std::uint32_t
>(nElements), locator});
1742 if (fnInnerFrameSizeLeft() <
static_cast<int>(
sizeof(std::uint32_t) +
sizeof(std::uint64_t)))
1743 return R__FAIL(
"page list frame too short");
1744 std::uint64_t columnOffset;
1745 bytes += DeserializeUInt64(
bytes, columnOffset);
1746 std::uint32_t compressionSettings;
1747 bytes += DeserializeUInt32(
bytes, compressionSettings);
1749 clusterBuilders[i].CommitColumnRange(j, columnOffset, compressionSettings, pageRange);
1750 bytes = innerFrame + innerFrameSize;
1753 bytes = outerFrame + outerFrameSize;
1755 clusterBuilders[i].AddExtendedColumnRanges(desc);
1756 clusters.emplace_back(clusterBuilders[i].MoveDescriptor().Unwrap());
1765 TList streamerInfos;
1766 for (
auto si : infos) {
1767 assert(si.first == si.second->GetNumber());
1768 streamerInfos.
Add(si.second);
1772 assert(buffer.
Length() > 0);
1786 TObjLink *lnk = infoList->FirstLink();
1790 infoMap[info->GetNumber()] = info->GetClass()->GetStreamerInfo();
1791 assert(info->GetNumber() == infoMap[info->GetNumber()]->GetNumber());
#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
#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 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 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 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.
A helper class for piece-wise construction of an RClusterDescriptor.
RClusterDescriptorBuilder & ClusterId(DescriptorId_t clusterId)
RClusterDescriptorBuilder & NEntries(std::uint64_t nEntries)
RClusterDescriptorBuilder & FirstEntryIndex(std::uint64_t firstEntryIndex)
A helper class for piece-wise construction of an RClusterGroupDescriptor.
RClusterGroupDescriptorBuilder & PageListLocator(const RNTupleLocator &pageListLocator)
RClusterGroupDescriptorBuilder & MinEntry(std::uint64_t minEntry)
RClusterGroupDescriptorBuilder & ClusterGroupId(DescriptorId_t clusterGroupId)
RClusterGroupDescriptorBuilder & EntrySpan(std::uint64_t entrySpan)
RClusterGroupDescriptorBuilder & NClusters(std::uint32_t nClusters)
RClusterGroupDescriptorBuilder & PageListLength(std::uint64_t pageListLength)
RResult< RClusterGroupDescriptor > MoveDescriptor()
A helper class for piece-wise construction of an RColumnDescriptor.
RColumnDescriptorBuilder & PhysicalColumnId(DescriptorId_t physicalColumnId)
RColumnDescriptorBuilder & Model(const RColumnModel &model)
RColumnDescriptorBuilder & FieldId(DescriptorId_t fieldId)
RColumnDescriptorBuilder & Index(std::uint32_t index)
RResult< RColumnDescriptor > MakeDescriptor() const
Attempt to make a column descriptor.
DescriptorId_t GetFieldId() const
RColumnDescriptorBuilder & LogicalColumnId(DescriptorId_t logicalColumnId)
A column element encapsulates the translation between basic C++ types and their column representation...
std::size_t GetBitsOnStorage() const
A helper class for piece-wise construction of an RFieldDescriptor.
DescriptorId_t GetParentId() const
RFieldDescriptorBuilder & TypeVersion(std::uint32_t typeVersion)
RFieldDescriptorBuilder & NRepetitions(std::uint64_t nRepetitions)
RFieldDescriptorBuilder & FieldVersion(std::uint32_t fieldVersion)
RFieldDescriptorBuilder & Structure(const ENTupleStructure &structure)
RFieldDescriptorBuilder & TypeName(const std::string &typeName)
RResult< RFieldDescriptor > MakeDescriptor() const
Attempt to make a field descriptor.
RFieldDescriptorBuilder & FieldName(const std::string &fieldName)
RFieldDescriptorBuilder & ParentId(DescriptorId_t id)
RFieldDescriptorBuilder & TypeAlias(const std::string &typeAlias)
RFieldDescriptorBuilder & FieldId(DescriptorId_t fieldId)
RFieldDescriptorBuilder & FieldDescription(const std::string &fieldDescription)
A helper class for piece-wise construction of an RNTupleDescriptor.
void BeginHeaderExtension()
Mark the beginning of the header extension; any fields and columns added after a call to this functio...
RResult< void > AddFieldLink(DescriptorId_t fieldId, DescriptorId_t linkId)
void AddToOnDiskFooterSize(std::uint64_t size)
The real footer size also include the page list envelopes.
void SetNTuple(const std::string_view name, const std::string_view description)
RResult< void > AddClusterGroup(RClusterGroupDescriptor &&clusterGroup)
const RNTupleDescriptor & GetDescriptor() const
void AddField(const RFieldDescriptor &fieldDesc)
RResult< void > AddColumn(DescriptorId_t logicalId, DescriptorId_t physicalId, DescriptorId_t fieldId, const RColumnModel &model, std::uint32_t index, std::uint64_t firstElementIdx=0U)
RResult< void > AddExtraTypeInfo(RExtraTypeInfoDescriptor &&extraTypeInfoDesc)
void SetOnDiskHeaderXxHash3(std::uint64_t xxhash3)
The serialization context is used for the piecewise serialization of a descriptor.
DescriptorId_t GetOnDiskColumnId(DescriptorId_t memId) const
const std::vector< DescriptorId_t > & GetOnDiskFieldList() const
Return a vector containing the in-memory field ID for each on-disk counterpart, in order,...
DescriptorId_t GetOnDiskFieldId(DescriptorId_t memId) const
DescriptorId_t GetMemColumnId(DescriptorId_t onDiskId) const
std::uint64_t GetHeaderXxHash3() const
void SetHeaderXxHash3(std::uint64_t xxhash3)
std::size_t GetHeaderExtensionOffset() const
Return the offset of the first element in fOnDisk2MemFieldIDs that is part of the schema extension.
DescriptorId_t GetMemClusterGroupId(DescriptorId_t onDiskId) const
DescriptorId_t GetMemClusterId(DescriptorId_t onDiskId) const
void SetHeaderSize(std::uint64_t size)
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 > DeserializeClusterSummary(const void *buffer, std::uint64_t bufSize, RClusterSummary &clusterSummary)
static std::uint32_t SerializeListFramePreamble(std::uint32_t nitems, void *buffer)
static RResult< std::uint32_t > DeserializeClusterGroup(const void *buffer, std::uint64_t bufSize, RClusterGroup &clusterGroup)
static std::uint32_t SerializeEnvelopePostscript(unsigned char *envelope, std::uint64_t size)
static std::uint32_t SerializeColumnType(ROOT::Experimental::EColumnType type, void *buffer)
static RContext SerializeHeader(void *buffer, const RNTupleDescriptor &desc)
static RResult< std::uint32_t > DeserializeColumnType(const void *buffer, ROOT::Experimental::EColumnType &type)
static std::uint32_t SerializeFeatureFlags(const std::vector< std::uint64_t > &flags, void *buffer)
static RResult< std::uint32_t > DeserializeExtraTypeInfoId(const void *buffer, ROOT::Experimental::EExtraTypeInfoIds &id)
std::unordered_map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
static std::uint32_t DeserializeUInt16(const void *buffer, std::uint16_t &val)
static RResult< void > DeserializeHeader(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static RResult< void > DeserializeFooter(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static std::uint32_t SerializeString(const std::string &val, void *buffer)
static std::string SerializeStreamerInfos(const StreamerInfoMap_t &infos)
static RResult< std::uint32_t > DeserializeFrameHeader(const void *buffer, std::uint64_t bufSize, std::uint64_t &frameSize, std::uint32_t &nitems)
static std::uint32_t SerializePageList(void *buffer, const RNTupleDescriptor &desc, std::span< DescriptorId_t > physClusterIDs, const RContext &context)
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)
static RResult< std::uint32_t > DeserializeFieldStructure(const void *buffer, ROOT::Experimental::ENTupleStructure &structure)
static std::uint32_t SerializeClusterSummary(const RClusterSummary &clusterSummary, void *buffer)
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
static std::uint32_t SerializeFramePostscript(void *frame, std::uint64_t size)
static std::uint32_t SerializeInt16(std::int16_t val, void *buffer)
static RResult< void > DeserializePageList(const void *buffer, std::uint64_t bufSize, DescriptorId_t clusterGroupId, RNTupleDescriptor &desc)
static std::uint32_t SerializeFieldStructure(ROOT::Experimental::ENTupleStructure structure, void *buffer)
While we could just interpret the enums as ints, we make the translation explicit in order to avoid a...
static 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 > DeserializeSchemaDescription(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static std::uint32_t SerializeLocator(const RNTupleLocator &locator, void *buffer)
static std::uint32_t SerializeInt32(std::int32_t val, void *buffer)
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 DeserializeUInt64(const void *buffer, std::uint64_t &val)
static RResult< std::uint32_t > DeserializeFeatureFlags(const void *buffer, std::uint64_t bufSize, std::vector< std::uint64_t > &flags)
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 std::uint32_t SerializeEnvelopeLink(const REnvelopeLink &envelopeLink, void *buffer)
static RResult< std::uint32_t > DeserializeString(const void *buffer, std::uint64_t bufSize, std::string &val)
static std::uint32_t SerializeRecordFramePreamble(void *buffer)
static std::uint32_t SerializeUInt16(std::uint16_t val, void *buffer)
static std::uint32_t SerializeClusterGroup(const RClusterGroup &clusterGroup, void *buffer)
static RResult< std::uint32_t > DeserializeEnvelopeLink(const void *buffer, std::uint64_t bufSize, REnvelopeLink &envelopeLink)
static std::uint32_t SerializeFooter(void *buffer, const RNTupleDescriptor &desc, const RContext &context)
static std::uint32_t SerializeInt64(std::int64_t val, void *buffer)
static RResult< std::uint32_t > DeserializeEnvelope(const void *buffer, std::uint64_t bufSize, std::uint16_t expectedType)
static std::uint32_t SerializeUInt32(std::uint32_t val, void *buffer)
static RResult< std::uint32_t > DeserializeLocator(const void *buffer, std::uint64_t bufSize, RNTupleLocator &locator)
static std::uint32_t SerializeExtraTypeInfoId(ROOT::Experimental::EExtraTypeInfoIds id, void *buffer)
std::uint32_t GetNClusters() const
RColumnModel GetModel() const
Base class for all ROOT issued exceptions.
Meta-data stored for every field of an ntuple.
std::string GetTypeAlias() const
std::uint32_t GetTypeVersion() const
std::string GetFieldName() const
std::uint32_t GetFieldVersion() const
std::string GetFieldDescription() const
std::string GetTypeName() const
std::uint64_t GetNRepetitions() const
ENTupleStructure GetStructure() const
The on-storage meta-data of an ntuple.
RExtraTypeInfoDescriptorIterable GetExtraTypeInfoIterable() const
std::size_t GetNLogicalColumns() const
std::string GetDescription() const
std::string GetName() const
std::uint64_t GetOnDiskHeaderXxHash3() const
const RClusterDescriptor & GetClusterDescriptor(DescriptorId_t clusterId) const
std::size_t GetNExtraTypeInfos() const
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
DescriptorId_t GetFieldZeroId() const
Returns the logical parent of all top-level NTuple data fields.
std::size_t GetNFields() const
RResult< void > AddClusterGroupDetails(DescriptorId_t clusterGroupId, std::vector< RClusterDescriptor > &clusterDescs)
Methods to load and drop cluster group details (cluster IDs and page locations)
const RColumnDescriptor & GetColumnDescriptor(DescriptorId_t columnId) const
std::size_t GetNClusterGroups() const
const RFieldDescriptor & GetFieldDescriptor(DescriptorId_t fieldId) const
const RClusterGroupDescriptor & GetClusterGroupDescriptor(DescriptorId_t clusterGroupId) const
RColumnDescriptorIterable GetColumnIterable() const
std::size_t GetNPhysicalColumns() const
const RHeaderExtension * GetHeaderExtension() const
Return header extension information; if the descriptor does not have a header extension,...
std::vector< std::uint64_t > GetFeatureFlags() 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.
virtual void SetOwner(Bool_t enable=kTRUE)
Set whether this collection is the owner (enable==true) of its content.
void Add(TObject *obj) override
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
Describes a persistent version of a class.
void BuildCheck(TFile *file=nullptr, Bool_t load=kTRUE) override
Check if built and consistent with the class dictionary.
RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
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.
EExtraTypeInfoIds
Used in RExtraTypeInfoDescriptor.
REnvelopeLink fPageListEnvelopeLink
std::uint64_t fFirstEntry
std::int32_t fColumnGroupID
-1 for "all columns"
RNTupleLocator payload that is common for object stores using 64bit location information.
Generic information about the physical location of data.
ELocatorType
Values for the Type field in non-disk locators.
std::uint8_t fReserved
Reserved for use by concrete storage backends.
ELocatorType fType
For non-disk locators, the value for the Type field.
std::uint32_t fBytesOnStorage
std::variant< std::uint64_t, std::string, RNTupleLocatorObject64 > fPosition
Simple on-disk locators consisting of a 64-bit offset use variant type uint64_t; extended locators ha...
const T & GetPosition() const