38#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 std::uint16_t flags = 0;
61 flags |= RNTupleSerializer::kFlagRepetitiveField;
63 flags |= RNTupleSerializer::kFlagProjectedField;
65 flags |= RNTupleSerializer::kFlagHasTypeChecksum;
66 pos += RNTupleSerializer::SerializeUInt16(flags, *where);
68 pos += RNTupleSerializer::SerializeString(fieldDesc.
GetFieldName(), *where);
69 pos += RNTupleSerializer::SerializeString(fieldDesc.
GetTypeName(), *where);
70 pos += RNTupleSerializer::SerializeString(fieldDesc.
GetTypeAlias(), *where);
73 if (flags & RNTupleSerializer::kFlagRepetitiveField) {
74 pos += RNTupleSerializer::SerializeUInt64(fieldDesc.
GetNRepetitions(), *where);
76 if (flags & RNTupleSerializer::kFlagProjectedField) {
77 pos += RNTupleSerializer::SerializeUInt32(onDiskProjectionSourceId, *where);
79 if (flags & RNTupleSerializer::kFlagHasTypeChecksum) {
80 pos += RNTupleSerializer::SerializeUInt32(fieldDesc.
GetTypeChecksum().value(), *where);
83 auto size = pos - base;
84 RNTupleSerializer::SerializeFramePostscript(base,
size);
97 std::span<const ROOT::Experimental::DescriptorId_t> fieldList,
98 std::size_t firstOnDiskId,
103 auto base =
reinterpret_cast<unsigned char *
>(buffer);
105 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
109 for (
auto fieldId : fieldList) {
111 auto onDiskParentId =
112 (
f.GetParentId() == fieldZeroId) ? onDiskFieldId : context.GetOnDiskFieldId(
f.GetParentId());
113 auto onDiskProjectionSourceId =
115 pos += SerializeField(
f, onDiskParentId, onDiskProjectionSourceId, *where);
127 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
129 std::uint64_t frameSize;
130 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
131 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
136 std::uint32_t fieldVersion;
137 std::uint32_t typeVersion;
138 std::uint32_t parentId;
142 if (fnFrameSizeLeft() < 3 *
sizeof(std::uint32_t) + RNTupleSerializer::SerializeFieldStructure(structure,
nullptr) +
143 sizeof(std::uint16_t)) {
144 return R__FAIL(
"field record frame too short");
146 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, fieldVersion);
147 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, typeVersion);
148 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, parentId);
149 result = RNTupleSerializer::DeserializeFieldStructure(
bytes, structure);
153 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, flags);
156 std::string fieldName;
157 std::string typeName;
158 std::string aliasName;
159 std::string description;
160 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), fieldName).Unwrap();
164 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), typeName).Unwrap();
168 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), aliasName).Unwrap();
172 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), description).Unwrap();
178 if (flags & RNTupleSerializer::kFlagRepetitiveField) {
179 if (fnFrameSizeLeft() <
sizeof(std::uint64_t))
180 return R__FAIL(
"field record frame too short");
181 std::uint64_t nRepetitions;
182 bytes += RNTupleSerializer::DeserializeUInt64(
bytes, nRepetitions);
186 if (flags & RNTupleSerializer::kFlagProjectedField) {
187 if (fnFrameSizeLeft() <
sizeof(std::uint32_t))
188 return R__FAIL(
"field record frame too short");
189 std::uint32_t projectionSourceId;
190 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, projectionSourceId);
194 if (flags & RNTupleSerializer::kFlagHasTypeChecksum) {
195 if (fnFrameSizeLeft() <
sizeof(std::uint32_t))
196 return R__FAIL(
"field record frame too short");
197 std::uint32_t typeChecksum;
198 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, typeChecksum);
211 auto base =
reinterpret_cast<unsigned char *
>(buffer);
213 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
215 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
217 pos += RNTupleSerializer::SerializeColumnType(columnDesc.
GetType(), *where);
218 pos += RNTupleSerializer::SerializeUInt16(columnDesc.
GetBitsOnStorage(), *where);
220 std::uint16_t flags = 0;
222 flags |= RNTupleSerializer::kFlagDeferredColumn;
224 flags |= RNTupleSerializer::kFlagHasValueRange;
227 firstElementIdx = -firstElementIdx;
228 pos += RNTupleSerializer::SerializeUInt16(flags, *where);
230 if (flags & RNTupleSerializer::kFlagDeferredColumn)
231 pos += RNTupleSerializer::SerializeInt64(firstElementIdx, *where);
232 if (flags & RNTupleSerializer::kFlagHasValueRange) {
234 std::uint64_t intMin, intMax;
235 static_assert(
sizeof(min) ==
sizeof(intMin) &&
sizeof(
max) ==
sizeof(intMax));
236 memcpy(&intMin, &min,
sizeof(min));
237 memcpy(&intMax, &max,
sizeof(max));
238 pos += RNTupleSerializer::SerializeUInt64(intMin, *where);
239 pos += RNTupleSerializer::SerializeUInt64(intMax, *where);
242 pos += RNTupleSerializer::SerializeFramePostscript(buffer ? base : nullptr, pos - base);
248 std::span<const ROOT::Experimental::DescriptorId_t> fieldList,
252 auto base =
reinterpret_cast<unsigned char *
>(buffer);
254 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
256 for (
auto parentId : fieldList) {
257 for (
const auto &
c : desc.GetColumnIterable(parentId)) {
258 if (
c.IsAliasColumn())
261 pos += SerializePhysicalColumn(
c, context, *where);
273 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
275 std::uint64_t frameSize;
276 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
277 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
284 std::uint16_t bitsOnStorage;
285 std::uint32_t fieldId;
287 std::uint16_t representationIndex;
288 std::int64_t firstElementIdx = 0;
289 if (fnFrameSizeLeft() <
290 RNTupleSerializer::SerializeColumnType(
type,
nullptr) +
sizeof(std::uint16_t) + 2 *
sizeof(std::uint32_t)) {
291 return R__FAIL(
"column record frame too short");
297 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, bitsOnStorage);
298 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, fieldId);
299 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, flags);
300 bytes += RNTupleSerializer::DeserializeUInt16(
bytes, representationIndex);
301 if (flags & RNTupleSerializer::kFlagDeferredColumn) {
302 if (fnFrameSizeLeft() <
sizeof(std::uint64_t))
303 return R__FAIL(
"column record frame too short");
304 bytes += RNTupleSerializer::DeserializeInt64(
bytes, firstElementIdx);
306 if (flags & RNTupleSerializer::kFlagHasValueRange) {
307 if (fnFrameSizeLeft() < 2 *
sizeof(std::uint64_t))
308 return R__FAIL(
"field record frame too short");
309 std::uint64_t minInt, maxInt;
310 bytes += RNTupleSerializer::DeserializeUInt64(
bytes, minInt);
311 bytes += RNTupleSerializer::DeserializeUInt64(
bytes, maxInt);
313 memcpy(&min, &minInt,
sizeof(min));
314 memcpy(&max, &maxInt,
sizeof(max));
320 if (firstElementIdx < 0)
328 auto base =
reinterpret_cast<unsigned char *
>(buffer);
330 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
332 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
334 pos += RNTupleSerializer::SerializeExtraTypeInfoId(desc.
GetContentId(), *where);
335 pos += RNTupleSerializer::SerializeUInt32(desc.
GetTypeVersion(), *where);
336 pos += RNTupleSerializer::SerializeString(desc.
GetTypeName(), *where);
337 pos += RNTupleSerializer::SerializeString(desc.
GetContent(), *where);
339 auto size = pos - base;
340 RNTupleSerializer::SerializeFramePostscript(base,
size);
347 auto base =
reinterpret_cast<unsigned char *
>(buffer);
349 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
351 for (
const auto &extraTypeInfoDesc : ntplDesc.GetExtraTypeInfoIterable()) {
352 pos += SerializeExtraTypeInfo(extraTypeInfoDesc, *where);
359DeserializeExtraTypeInfo(
const void *buffer, std::uint64_t bufSize,
364 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
366 std::uint64_t frameSize;
367 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
368 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
374 std::uint32_t typeVersion;
375 if (fnFrameSizeLeft() < 2 *
sizeof(std::uint32_t)) {
376 return R__FAIL(
"extra type info record frame too short");
378 result = RNTupleSerializer::DeserializeExtraTypeInfoId(
bytes, contentId);
382 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, typeVersion);
384 std::string typeName;
386 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), typeName).Unwrap();
390 result = RNTupleSerializer::DeserializeString(
bytes, fnFrameSizeLeft(), content).Unwrap();
404 RNTupleSerializer::SerializeUInt64(locator.
GetPosition<std::uint64_t>(), buffer +
sizeof(std::uint64_t));
406 return sizeof(std::uint64_t) +
sizeof(std::uint64_t);
411 std::uint64_t nBytesOnStorage;
412 std::uint64_t position;
413 RNTupleSerializer::DeserializeUInt64(buffer, nBytesOnStorage);
414 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint64_t), position);
422 const uint32_t sizeofNBytesOnStorage = (locator.
GetNBytesOnStorage() > std::numeric_limits<std::uint32_t>::max())
423 ?
sizeof(std::uint64_t)
424 :
sizeof(std::uint32_t);
426 if (sizeofNBytesOnStorage ==
sizeof(std::uint32_t)) {
431 RNTupleSerializer::SerializeUInt64(
data.GetLocation(), buffer + sizeofNBytesOnStorage);
433 return sizeofNBytesOnStorage +
sizeof(std::uint64_t);
436void DeserializeLocatorPayloadObject64(
const unsigned char *buffer, std::uint32_t sizeofLocatorPayload,
439 std::uint64_t location;
440 if (sizeofLocatorPayload == 12) {
441 std::uint32_t nBytesOnStorage;
442 RNTupleSerializer::DeserializeUInt32(buffer, nBytesOnStorage);
444 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint32_t), location);
445 }
else if (sizeofLocatorPayload == 16) {
446 std::uint64_t nBytesOnStorage;
447 RNTupleSerializer::DeserializeUInt64(buffer, nBytesOnStorage);
449 RNTupleSerializer::DeserializeUInt64(buffer +
sizeof(std::uint64_t), location);
462 auto base =
reinterpret_cast<unsigned char *
>(buffer);
464 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
466 pos += RNTupleSerializer::SerializeRecordFramePreamble(*where);
471 pos += RNTupleSerializer::SerializeFramePostscript(buffer ? base : nullptr, pos - base);
477 std::span<const ROOT::Experimental::DescriptorId_t> fieldList,
481 auto base =
reinterpret_cast<unsigned char *
>(buffer);
483 void **where = (buffer ==
nullptr) ? &buffer : reinterpret_cast<
void **>(&pos);
485 for (
auto parentId : fieldList) {
486 for (
const auto &
c : desc.GetColumnIterable(parentId)) {
487 if (!
c.IsAliasColumn())
490 pos += SerializeAliasColumn(
c, context, *where);
498 std::uint32_t &physicalColumnId, std::uint32_t &fieldId)
500 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
502 std::uint64_t frameSize;
503 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
504 auto result = RNTupleSerializer::DeserializeFrameHeader(
bytes, bufSize, frameSize);
509 if (fnFrameSizeLeft() < 2 *
sizeof(std::uint32_t)) {
510 return R__FAIL(
"alias column record frame too short");
513 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, physicalColumnId);
514 bytes += RNTupleSerializer::DeserializeUInt32(
bytes, fieldId);
523 std::uint64_t &xxhash3,
void *buffer)
525 if (buffer !=
nullptr) {
534 std::uint64_t &xxhash3)
536 auto checksumReal = XXH3_64bits(
data,
length);
538 if (xxhash3 != checksumReal)
539 return R__FAIL(
"XxHash-3 checksum mismatch");
546 std::uint64_t xxhash3;
552 if (buffer !=
nullptr) {
553 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
554 bytes[0] = (val & 0x00FF);
555 bytes[1] = (val & 0xFF00) >> 8;
562 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
563 val = std::int16_t(
bytes[0]) + (std::int16_t(
bytes[1]) << 8);
569 return SerializeInt16(val, buffer);
574 return DeserializeInt16(buffer, *
reinterpret_cast<std::int16_t *
>(&val));
579 if (buffer !=
nullptr) {
580 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
581 bytes[0] = (val & 0x000000FF);
582 bytes[1] = (val & 0x0000FF00) >> 8;
583 bytes[2] = (val & 0x00FF0000) >> 16;
584 bytes[3] = (val & 0xFF000000) >> 24;
591 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
592 val = std::int32_t(
bytes[0]) + (std::int32_t(
bytes[1]) << 8) + (std::int32_t(
bytes[2]) << 16) +
593 (std::int32_t(
bytes[3]) << 24);
599 return SerializeInt32(val, buffer);
604 return DeserializeInt32(buffer, *
reinterpret_cast<std::int32_t *
>(&val));
609 if (buffer !=
nullptr) {
610 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
611 bytes[0] = (val & 0x00000000000000FF);
612 bytes[1] = (val & 0x000000000000FF00) >> 8;
613 bytes[2] = (val & 0x0000000000FF0000) >> 16;
614 bytes[3] = (val & 0x00000000FF000000) >> 24;
615 bytes[4] = (val & 0x000000FF00000000) >> 32;
616 bytes[5] = (val & 0x0000FF0000000000) >> 40;
617 bytes[6] = (val & 0x00FF000000000000) >> 48;
618 bytes[7] = (val & 0xFF00000000000000) >> 56;
625 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
626 val = std::int64_t(
bytes[0]) + (std::int64_t(
bytes[1]) << 8) + (std::int64_t(
bytes[2]) << 16) +
627 (std::int64_t(
bytes[3]) << 24) + (std::int64_t(
bytes[4]) << 32) + (std::int64_t(
bytes[5]) << 40) +
628 (std::int64_t(
bytes[6]) << 48) + (std::int64_t(
bytes[7]) << 56);
634 return SerializeInt64(val, buffer);
639 return DeserializeInt64(buffer, *
reinterpret_cast<std::int64_t *
>(&val));
645 auto pos =
reinterpret_cast<unsigned char *
>(buffer);
646 pos += SerializeUInt32(val.length(), pos);
647 memcpy(pos, val.data(), val.length());
649 return sizeof(std::uint32_t) + val.length();
653 std::uint64_t bufSize,
656 if (bufSize <
sizeof(std::uint32_t))
657 return R__FAIL(
"string buffer too short");
658 bufSize -=
sizeof(std::uint32_t);
660 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
665 return R__FAIL(
"string buffer too short");
669 return sizeof(std::uint32_t) +
length;
709 return SerializeUInt16(0x99, buffer);
719 std::uint16_t onDiskType;
720 auto result = DeserializeUInt16(buffer, onDiskType);
722 switch (onDiskType) {
774 return SerializeUInt16(0x99, buffer);
783 std::uint16_t onDiskValue;
784 auto result = DeserializeUInt16(buffer, onDiskValue);
785 switch (onDiskValue) {
813 std::uint32_t onDiskValue;
814 auto result = DeserializeUInt32(buffer, onDiskValue);
815 switch (onDiskValue) {
827 auto base =
reinterpret_cast<unsigned char *
>(buffer);
829 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
831 pos += SerializeUInt64(envelopeType, *where);
838 std::uint64_t &xxhash3)
840 if (
size <
sizeof(std::uint64_t))
842 if (
size >=
static_cast<uint64_t
>(1) << 48)
845 std::uint64_t typeAndSize;
846 DeserializeUInt64(envelope, typeAndSize);
847 typeAndSize |= (
size + 8) << 16;
848 SerializeUInt64(typeAndSize, envelope);
850 return SerializeXxHash3(envelope,
size, xxhash3, envelope ? (envelope +
size) :
nullptr);
856 std::uint64_t xxhash3;
857 return SerializeEnvelopePostscript(envelope,
size, xxhash3);
862 std::uint16_t expectedType, std::uint64_t &xxhash3)
864 const std::uint64_t minEnvelopeSize =
sizeof(std::uint64_t) +
sizeof(std::uint64_t);
865 if (bufSize < minEnvelopeSize)
866 return R__FAIL(
"invalid envelope buffer, too short");
868 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
871 std::uint64_t typeAndSize;
872 bytes += DeserializeUInt64(
bytes, typeAndSize);
874 std::uint16_t envelopeType = typeAndSize & 0xFFFF;
875 if (envelopeType != expectedType) {
876 return R__FAIL(
"envelope type mismatch: expected " + std::to_string(expectedType) +
", found " +
877 std::to_string(envelopeType));
880 std::uint64_t envelopeSize = typeAndSize >> 16;
881 if (bufSize < envelopeSize)
882 return R__FAIL(
"envelope buffer size too small");
883 if (envelopeSize < minEnvelopeSize)
884 return R__FAIL(
"invalid envelope, too short");
886 auto result = VerifyXxHash3(base, envelopeSize - 8, xxhash3);
890 return sizeof(typeAndSize);
895 std::uint16_t expectedType)
897 std::uint64_t xxhash3;
898 return R__FORWARD_RESULT(DeserializeEnvelope(buffer, bufSize, expectedType, xxhash3));
904 return SerializeInt64(1, buffer);
910 auto base =
reinterpret_cast<unsigned char *
>(buffer);
912 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
915 pos += SerializeInt64(-1, *where);
916 pos += SerializeUInt32(
nitems, *where);
922 auto preambleSize =
sizeof(std::int64_t);
923 if (
size < preambleSize)
927 DeserializeInt64(frame, marker);
928 if ((marker < 0) && (
size < (
sizeof(std::uint32_t) + preambleSize)))
930 SerializeInt64(marker *
static_cast<int64_t
>(
size), frame);
937 std::uint64_t &frameSize, std::uint32_t &
nitems)
939 std::uint64_t minSize =
sizeof(std::int64_t);
940 if (bufSize < minSize)
941 return R__FAIL(
"frame too short");
943 std::int64_t *ssize =
reinterpret_cast<std::int64_t *
>(&frameSize);
944 DeserializeInt64(buffer, *ssize);
946 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
954 minSize +=
sizeof(std::uint32_t);
955 if (bufSize < minSize)
956 return R__FAIL(
"frame too short");
961 if (frameSize < minSize)
962 return R__FAIL(
"corrupt frame size");
963 if (bufSize < frameSize)
964 return R__FAIL(
"frame too short");
966 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
971 std::uint64_t &frameSize)
982 return SerializeUInt64(0, buffer);
985 auto bytes =
reinterpret_cast<unsigned char *
>(buffer);
987 for (
unsigned i = 0; i < flags.size(); ++i) {
988 if (flags[i] & 0x8000000000000000)
992 if (i == (flags.size() - 1))
993 SerializeUInt64(flags[i],
bytes);
995 bytes += SerializeUInt64(flags[i] | 0x8000000000000000,
bytes);
998 return (flags.size() *
sizeof(std::int64_t));
1003 std::vector<std::uint64_t> &flags)
1005 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1010 if (bufSize <
sizeof(std::uint64_t))
1011 return R__FAIL(
"feature flag buffer too short");
1013 bufSize -=
sizeof(std::uint64_t);
1014 flags.emplace_back(
f & ~0x8000000000000000);
1015 }
while (
f & 0x8000000000000000);
1017 return (flags.size() *
sizeof(std::uint64_t));
1026 std::uint32_t
size = 0;
1031 buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
size :
nullptr);
1035 std::uint8_t locatorType = 0;
1036 auto payloadp = buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
sizeof(std::int32_t) :
nullptr;
1039 size += SerializeLocatorPayloadLarge(locator, payloadp);
1043 size += SerializeLocatorPayloadObject64(locator, payloadp);
1049 size += SerializeLocatorPayloadObject64(locator, payloadp);
1055 std::int32_t head =
sizeof(std::int32_t) +
size;
1057 head |=
static_cast<int>(locatorType & 0x7F) << 24;
1067 if (bufSize <
sizeof(std::int32_t))
1068 return R__FAIL(
"too short locator");
1070 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1074 bufSize -=
sizeof(std::int32_t);
1077 const int type = head >> 24;
1078 const std::uint32_t payloadSize = (
static_cast<std::uint32_t
>(head) & 0x0000FFFF) -
sizeof(std::int32_t);
1079 if (bufSize < payloadSize)
1080 return R__FAIL(
"too short locator");
1082 locator.
SetReserved(
static_cast<std::uint32_t
>(head >> 16) & 0xFF);
1086 DeserializeLocatorPayloadLarge(
bytes, locator);
1090 DeserializeLocatorPayloadObject64(
bytes, payloadSize, locator);
1094 bytes += payloadSize;
1096 if (bufSize <
sizeof(std::uint64_t))
1097 return R__FAIL(
"too short locator");
1105 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
1111 auto size = SerializeUInt64(envelopeLink.
fLength, buffer);
1112 size += SerializeLocator(envelopeLink.
fLocator, buffer ?
reinterpret_cast<unsigned char *
>(buffer) +
size :
nullptr);
1120 if (bufSize <
sizeof(std::int64_t))
1121 return R__FAIL(
"too short envelope link");
1123 auto bytes =
reinterpret_cast<const unsigned char *
>(buffer);
1125 bufSize -=
sizeof(std::uint64_t);
1130 return bytes -
reinterpret_cast<const unsigned char *
>(buffer);
1137 if (clusterSummary.
fNEntries >= (
static_cast<std::uint64_t
>(1) << 56)) {
1138 throw RException(
R__FAIL(
"number of entries in cluster exceeds maximum of 2^56"));
1141 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1143 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1146 pos += SerializeRecordFramePreamble(*where);
1147 pos += SerializeUInt64(clusterSummary.
fFirstEntry, *where);
1148 const std::uint64_t nEntriesAndFlags =
1149 (
static_cast<std::uint64_t
>(clusterSummary.
fFlags) << 56) | clusterSummary.
fNEntries;
1150 pos += SerializeUInt64(nEntriesAndFlags, *where);
1152 auto size = pos - frame;
1153 pos += SerializeFramePostscript(frame,
size);
1161 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1163 std::uint64_t frameSize;
1164 auto result = DeserializeFrameHeader(
bytes, bufSize, frameSize);
1169 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
1170 if (fnFrameSizeLeft() < 2 *
sizeof(std::uint64_t))
1171 return R__FAIL(
"too short cluster summary");
1174 std::uint64_t nEntriesAndFlags;
1175 bytes += DeserializeUInt64(
bytes, nEntriesAndFlags);
1177 const std::uint64_t nEntries = (nEntriesAndFlags << 8) >> 8;
1178 const std::uint8_t flags = nEntriesAndFlags >> 56;
1181 return R__FAIL(
"sharded cluster flag set in cluster summary; sharded clusters are currently unsupported.");
1185 clusterSummary.
fFlags = flags;
1193 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1195 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1198 pos += SerializeRecordFramePreamble(*where);
1199 pos += SerializeUInt64(clusterGroup.
fMinEntry, *where);
1200 pos += SerializeUInt64(clusterGroup.
fEntrySpan, *where);
1201 pos += SerializeUInt32(clusterGroup.
fNClusters, *where);
1203 auto size = pos - frame;
1204 pos += SerializeFramePostscript(frame,
size);
1212 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1215 std::uint64_t frameSize;
1216 auto result = DeserializeFrameHeader(
bytes, bufSize, frameSize);
1221 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - base); };
1222 if (fnFrameSizeLeft() <
sizeof(std::uint32_t) + 2 *
sizeof(std::uint64_t))
1223 return R__FAIL(
"too short cluster group");
1236 bool forHeaderExtension)
1239 auto depthFirstTraversal = [&](std::span<DescriptorId_t> fieldTrees,
auto doForEachField) {
1240 std::deque<DescriptorId_t> idQueue{fieldTrees.begin(), fieldTrees.end()};
1241 while (!idQueue.empty()) {
1242 auto fieldId = idQueue.front();
1243 idQueue.pop_front();
1245 if (fieldId != fieldZeroId)
1246 doForEachField(fieldId);
1249 idQueue.insert(idQueue.begin() + i++,
f.GetId());
1254 if (!forHeaderExtension)
1255 R__ASSERT(GetHeaderExtensionOffset() == -1U);
1257 std::vector<DescriptorId_t> fieldTrees;
1258 if (!forHeaderExtension) {
1259 fieldTrees.emplace_back(fieldZeroId);
1261 fieldTrees = xHeader->GetTopLevelFields(desc);
1263 depthFirstTraversal(fieldTrees, [&](
DescriptorId_t fieldId) { MapFieldId(fieldId); });
1266 if (!
c.IsAliasColumn()) {
1267 MapPhysicalColumnId(
c.GetPhysicalId());
1272 if (forHeaderExtension) {
1283 BeginHeaderExtension();
1290 bool forHeaderExtension)
1292 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1294 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1296 std::size_t nFields = 0, nColumns = 0, nAliasColumns = 0, fieldListOffset = 0;
1298 std::vector<std::reference_wrapper<const RColumnDescriptor>> extraColumns;
1299 if (forHeaderExtension) {
1303 nFields = xHeader->GetNFields();
1304 nColumns = xHeader->GetNPhysicalColumns();
1305 nAliasColumns = xHeader->GetNLogicalColumns() - xHeader->GetNPhysicalColumns();
1308 extraColumns.reserve(xHeader->GetExtendedColumnRepresentations().size());
1309 for (
auto columnId : xHeader->GetExtendedColumnRepresentations()) {
1320 R__ASSERT(onDiskFields.size() >= fieldListOffset);
1321 std::span<const DescriptorId_t> fieldList{onDiskFields.data() + fieldListOffset,
1322 onDiskFields.size() - fieldListOffset};
1325 pos += SerializeListFramePreamble(nFields, *where);
1326 pos += SerializeFieldList(desc, fieldList, fieldListOffset, context, *where);
1327 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1330 pos += SerializeListFramePreamble(nColumns, *where);
1331 pos += SerializeColumnsOfFields(desc, fieldList, context, *where);
1332 for (
const auto &
c : extraColumns) {
1333 if (!
c.get().IsAliasColumn()) {
1334 pos += SerializePhysicalColumn(
c.get(), context, *where);
1337 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1340 pos += SerializeListFramePreamble(nAliasColumns, *where);
1341 pos += SerializeAliasColumnsOfFields(desc, fieldList, context, *where);
1342 for (
const auto &
c : extraColumns) {
1343 if (
c.get().IsAliasColumn()) {
1344 pos += SerializeAliasColumn(
c.get(), context, *where);
1347 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1350 pos += SerializeListFramePreamble(nExtraTypeInfos, *where);
1351 pos += SerializeExtraTypeInfoList(desc, *where);
1352 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1354 return static_cast<std::uint32_t
>(pos - base);
1361 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1363 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1366 std::uint64_t frameSize;
1368 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - frame); };
1370 std::uint32_t nFields;
1371 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nFields);
1377 for (
unsigned i = 0; i < nFields; ++i) {
1378 std::uint32_t fieldId = fieldIdRangeBegin + i;
1380 result = DeserializeField(
bytes, fnFrameSizeLeft(), fieldBuilder);
1385 fieldBuilder.
ParentId(kZeroFieldId);
1389 const auto parentId = fieldDesc.Inspect().
GetParentId();
1390 const auto projectionSourceId = fieldDesc.Inspect().GetProjectionSourceId();
1391 descBuilder.
AddField(fieldDesc.Unwrap());
1392 auto resVoid = descBuilder.
AddFieldLink(parentId, fieldId);
1401 bytes = frame + frameSize;
1405 auto fnNextColumnIndex = [&descBuilder](
DescriptorId_t fieldId, std::uint16_t representationIndex) -> std::uint32_t {
1407 if (existingColumns.empty())
1410 return (representationIndex == lastColumnDesc.GetRepresentationIndex()) ? (lastColumnDesc.GetIndex() + 1) : 0;
1413 std::uint32_t nColumns;
1415 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nColumns);
1424 for (
unsigned i = 0; i < nColumns; ++i) {
1425 std::uint32_t columnId = columnIdRangeBegin + i;
1427 result = DeserializeColumn(
bytes, fnFrameSizeLeft(), columnBuilder);
1438 auto resVoid = descBuilder.
AddColumn(columnDesc.Unwrap());
1442 bytes = frame + frameSize;
1444 std::uint32_t nAliasColumns;
1446 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nAliasColumns);
1451 for (
unsigned i = 0; i < nAliasColumns; ++i) {
1452 std::uint32_t physicalId;
1453 std::uint32_t fieldId;
1454 result = DeserializeAliasColumn(
bytes, fnFrameSizeLeft(), physicalId, fieldId);
1462 columnBuilder.
BitsOnStorage(physicalColumnDesc.GetBitsOnStorage());
1463 columnBuilder.
ValueRange(physicalColumnDesc.GetValueRange());
1464 columnBuilder.
Type(physicalColumnDesc.GetType());
1469 if (!aliasColumnDesc)
1471 auto resVoid = descBuilder.
AddColumn(aliasColumnDesc.Unwrap());
1475 bytes = frame + frameSize;
1477 std::uint32_t nExtraTypeInfos;
1479 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nExtraTypeInfos);
1483 for (
unsigned i = 0; i < nExtraTypeInfos; ++i) {
1485 result = DeserializeExtraTypeInfo(
bytes, fnFrameSizeLeft(), extraTypeInfoBuilder);
1492 if (extraTypeInfoDesc)
1495 bytes = frame + frameSize;
1497 return bytes - base;
1506 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1508 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1510 pos += SerializeEnvelopePreamble(kEnvelopeTypeHeader, *where);
1513 pos += SerializeString(desc.
GetName(), *where);
1515 pos += SerializeString(std::string(
"ROOT v") +
ROOT_RELEASE, *where);
1518 pos += SerializeSchemaDescription(*where, desc, context);
1520 std::uint64_t
size = pos - base;
1521 std::uint64_t xxhash3 = 0;
1522 size += SerializeEnvelopePostscript(base,
size, xxhash3);
1531 std::span<DescriptorId_t> physClusterIDs,
1534 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1536 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1538 pos += SerializeEnvelopePreamble(kEnvelopeTypePageList, *where);
1543 const auto nClusters = physClusterIDs.size();
1544 auto clusterSummaryFrame = pos;
1545 pos += SerializeListFramePreamble(nClusters, *where);
1546 for (
auto clusterId : physClusterIDs) {
1548 RClusterSummary summary{clusterDesc.GetFirstEntryIndex(), clusterDesc.GetNEntries(), 0};
1549 pos += SerializeClusterSummary(summary, *where);
1551 pos += SerializeFramePostscript(buffer ? clusterSummaryFrame :
nullptr, pos - clusterSummaryFrame);
1554 auto topMostFrame = pos;
1555 pos += SerializeListFramePreamble(nClusters, *where);
1557 for (
auto clusterId : physClusterIDs) {
1560 std::set<DescriptorId_t> onDiskColumnIds;
1561 for (
const auto &columnRange : clusterDesc.GetColumnRangeIterable())
1562 onDiskColumnIds.insert(context.
GetOnDiskColumnId(columnRange.fPhysicalColumnId));
1564 auto outerFrame = pos;
1565 pos += SerializeListFramePreamble(onDiskColumnIds.size(), *where);
1566 for (
auto onDiskId : onDiskColumnIds) {
1568 const auto &columnRange = clusterDesc.GetColumnRange(memId);
1570 auto innerFrame = pos;
1571 if (columnRange.fIsSuppressed) {
1573 pos += SerializeListFramePreamble(0, *where);
1574 pos += SerializeInt64(kSuppressedColumnMarker, *where);
1576 const auto &pageRange = clusterDesc.GetPageRange(memId);
1577 pos += SerializeListFramePreamble(pageRange.fPageInfos.size(), *where);
1579 for (
const auto &pi : pageRange.fPageInfos) {
1580 std::int32_t nElements = pi.fHasChecksum ? -
static_cast<std::int32_t
>(pi.fNElements) : pi.fNElements;
1581 pos += SerializeUInt32(nElements, *where);
1582 pos += SerializeLocator(pi.fLocator, *where);
1584 pos += SerializeInt64(columnRange.fFirstElementIndex, *where);
1585 pos += SerializeUInt32(columnRange.fCompressionSettings, *where);
1588 pos += SerializeFramePostscript(buffer ? innerFrame :
nullptr, pos - innerFrame);
1590 pos += SerializeFramePostscript(buffer ? outerFrame :
nullptr, pos - outerFrame);
1593 pos += SerializeFramePostscript(buffer ? topMostFrame :
nullptr, pos - topMostFrame);
1594 std::uint64_t
size = pos - base;
1595 size += SerializeEnvelopePostscript(base,
size);
1604 auto base =
reinterpret_cast<unsigned char *
>(buffer);
1606 void **where = (buffer ==
nullptr) ? &buffer :
reinterpret_cast<void **
>(&pos);
1608 pos += SerializeEnvelopePreamble(kEnvelopeTypeFooter, *where);
1611 pos += SerializeFeatureFlags(std::vector<std::uint64_t>(), *where);
1616 pos += SerializeRecordFramePreamble(*where);
1617 pos += SerializeSchemaDescription(*where, desc, context,
true);
1618 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1623 pos += SerializeListFramePreamble(nClusterGroups, *where);
1624 for (
unsigned int i = 0; i < nClusterGroups; ++i) {
1627 clusterGroup.
fMinEntry = cgDesc.GetMinEntry();
1628 clusterGroup.
fEntrySpan = cgDesc.GetEntrySpan();
1629 clusterGroup.
fNClusters = cgDesc.GetNClusters();
1632 pos += SerializeClusterGroup(clusterGroup, *where);
1634 pos += SerializeFramePostscript(buffer ? frame :
nullptr, pos - frame);
1636 std::uint32_t
size = pos - base;
1637 size += SerializeEnvelopePostscript(base,
size);
1645 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1647 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1650 std::uint64_t xxhash3{0};
1651 result = DeserializeEnvelope(
bytes, fnBufSizeLeft(), kEnvelopeTypeHeader, xxhash3);
1657 std::vector<std::uint64_t> featureFlags;
1658 result = DeserializeFeatureFlags(
bytes, fnBufSizeLeft(), featureFlags);
1662 for (std::size_t i = 0; i < featureFlags.size(); ++i) {
1663 if (!featureFlags[i])
1665 unsigned int bit = 0;
1666 while (!(featureFlags[i] & (
static_cast<uint64_t
>(1) << bit)))
1668 return R__FAIL(
"unsupported format feature: " + std::to_string(i * 64 + bit));
1672 std::string description;
1678 result = DeserializeString(
bytes, fnBufSizeLeft(), description);
1691 result = DeserializeSchemaDescription(
bytes, fnBufSizeLeft(), descBuilder);
1702 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1704 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1707 result = DeserializeEnvelope(
bytes, fnBufSizeLeft(), kEnvelopeTypeFooter);
1712 std::vector<std::uint64_t> featureFlags;
1713 result = DeserializeFeatureFlags(
bytes, fnBufSizeLeft(), featureFlags);
1717 for (
auto f : featureFlags) {
1722 std::uint64_t xxhash3{0};
1723 if (fnBufSizeLeft() <
static_cast<int>(
sizeof(std::uint64_t)))
1724 return R__FAIL(
"footer too short");
1727 return R__FAIL(
"XxHash-3 mismatch between header and footer");
1729 std::uint64_t frameSize;
1731 auto fnFrameSizeLeft = [&]() {
return frameSize - (
bytes - frame); };
1733 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize);
1737 if (fnFrameSizeLeft() > 0) {
1739 result = DeserializeSchemaDescription(
bytes, fnFrameSizeLeft(), descBuilder);
1743 bytes = frame + frameSize;
1745 std::uint32_t nClusterGroups;
1747 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), frameSize, nClusterGroups);
1751 for (std::uint32_t groupId = 0; groupId < nClusterGroups; ++groupId) {
1753 result = DeserializeClusterGroup(
bytes, fnFrameSizeLeft(), clusterGroup);
1768 bytes = frame + frameSize;
1774 std::uint64_t bufSize,
1778 auto base =
reinterpret_cast<const unsigned char *
>(buffer);
1780 auto fnBufSizeLeft = [&]() {
return bufSize - (
bytes - base); };
1783 result = DeserializeEnvelope(
bytes, fnBufSizeLeft(), kEnvelopeTypePageList);
1788 std::uint64_t xxhash3{0};
1789 if (fnBufSizeLeft() <
static_cast<int>(
sizeof(std::uint64_t)))
1790 return R__FAIL(
"page list too short");
1793 return R__FAIL(
"XxHash-3 mismatch between header and page list");
1795 std::vector<RClusterDescriptorBuilder> clusterBuilders;
1801 std::uint64_t clusterSummaryFrameSize;
1802 auto clusterSummaryFrame =
bytes;
1803 auto fnClusterSummaryFrameSizeLeft = [&]() {
return clusterSummaryFrameSize - (
bytes - clusterSummaryFrame); };
1805 std::uint32_t nClusterSummaries;
1806 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), clusterSummaryFrameSize, nClusterSummaries);
1810 for (
auto clusterId = firstClusterId; clusterId < firstClusterId + nClusterSummaries; ++clusterId) {
1812 result = DeserializeClusterSummary(
bytes, fnClusterSummaryFrameSizeLeft(), clusterSummary);
1819 clusterBuilders.emplace_back(std::move(builder));
1821 bytes = clusterSummaryFrame + clusterSummaryFrameSize;
1823 std::uint64_t topMostFrameSize;
1824 auto topMostFrame =
bytes;
1825 auto fnTopMostFrameSizeLeft = [&]() {
return topMostFrameSize - (
bytes - topMostFrame); };
1827 std::uint32_t nClusters;
1828 result = DeserializeFrameHeader(
bytes, fnBufSizeLeft(), topMostFrameSize, nClusters);
1833 if (nClusters != nClusterSummaries)
1834 return R__FAIL(
"mismatch between number of clusters and number of cluster summaries");
1836 std::vector<RClusterDescriptor> clusters;
1837 for (std::uint32_t i = 0; i < nClusters; ++i) {
1838 std::uint64_t outerFrameSize;
1839 auto outerFrame =
bytes;
1840 auto fnOuterFrameSizeLeft = [&]() {
return outerFrameSize - (
bytes - outerFrame); };
1842 std::uint32_t nColumns;
1843 result = DeserializeFrameHeader(
bytes, fnTopMostFrameSizeLeft(), outerFrameSize, nColumns);
1848 for (std::uint32_t j = 0; j < nColumns; ++j) {
1849 std::uint64_t innerFrameSize;
1850 auto innerFrame =
bytes;
1851 auto fnInnerFrameSizeLeft = [&]() {
return innerFrameSize - (
bytes - innerFrame); };
1853 std::uint32_t nPages;
1854 result = DeserializeFrameHeader(
bytes, fnOuterFrameSizeLeft(), innerFrameSize, nPages);
1861 for (std::uint32_t k = 0; k < nPages; ++k) {
1862 if (fnInnerFrameSizeLeft() <
static_cast<int>(
sizeof(std::uint32_t)))
1863 return R__FAIL(
"inner frame too short");
1864 std::int32_t nElements;
1865 bool hasChecksum =
false;
1868 if (nElements < 0) {
1869 nElements = -nElements;
1872 result = DeserializeLocator(
bytes, fnInnerFrameSizeLeft(), locator);
1875 pageRange.
fPageInfos.push_back({
static_cast<std::uint32_t
>(nElements), locator, hasChecksum});
1879 if (fnInnerFrameSizeLeft() <
static_cast<int>(
sizeof(std::int64_t)))
1880 return R__FAIL(
"page list frame too short");
1881 std::int64_t columnOffset;
1882 bytes += DeserializeInt64(
bytes, columnOffset);
1883 if (columnOffset < 0) {
1885 return R__FAIL(
"unexpected non-empty page list");
1886 clusterBuilders[i].MarkSuppressedColumnRange(j);
1888 if (fnInnerFrameSizeLeft() <
static_cast<int>(
sizeof(std::uint32_t)))
1889 return R__FAIL(
"page list frame too short");
1890 std::uint32_t compressionSettings;
1891 bytes += DeserializeUInt32(
bytes, compressionSettings);
1892 clusterBuilders[i].CommitColumnRange(j, columnOffset, compressionSettings, pageRange);
1895 bytes = innerFrame + innerFrameSize;
1898 bytes = outerFrame + outerFrameSize;
1900 auto voidRes = clusterBuilders[i].CommitSuppressedColumnRanges(desc);
1903 clusterBuilders[i].AddExtendedColumnRanges(desc);
1904 clusters.emplace_back(clusterBuilders[i].MoveDescriptor().Unwrap());
1913 TList streamerInfos;
1914 for (
auto si : infos) {
1915 assert(si.first == si.second->GetNumber());
1916 streamerInfos.
Add(si.second);
1920 assert(buffer.
Length() > 0);
1934 TObjLink *lnk = infoList->FirstLink();
1938 infoMap[info->GetNumber()] = info->GetClass()->GetStreamerInfo();
1939 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 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 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)
RResult< RClusterGroupDescriptor > MoveDescriptor()
RClusterGroupDescriptorBuilder & MinEntry(std::uint64_t minEntry)
RClusterGroupDescriptorBuilder & ClusterGroupId(DescriptorId_t clusterGroupId)
RClusterGroupDescriptorBuilder & EntrySpan(std::uint64_t entrySpan)
RClusterGroupDescriptorBuilder & NClusters(std::uint32_t nClusters)
RClusterGroupDescriptorBuilder & PageListLength(std::uint64_t pageListLength)
A helper class for piece-wise construction of an RColumnDescriptor.
RColumnDescriptorBuilder & PhysicalColumnId(DescriptorId_t physicalColumnId)
RColumnDescriptorBuilder & Type(EColumnType type)
DescriptorId_t GetRepresentationIndex() const
RColumnDescriptorBuilder & SetSuppressedDeferred()
RColumnDescriptorBuilder & BitsOnStorage(std::uint16_t bitsOnStorage)
RColumnDescriptorBuilder & RepresentationIndex(std::uint16_t representationIndex)
RColumnDescriptorBuilder & FieldId(DescriptorId_t fieldId)
RColumnDescriptorBuilder & Index(std::uint32_t index)
RColumnDescriptorBuilder & FirstElementIndex(std::uint64_t firstElementIdx)
DescriptorId_t GetFieldId() const
RResult< RColumnDescriptor > MakeDescriptor() const
Attempt to make a column descriptor.
RColumnDescriptorBuilder & LogicalColumnId(DescriptorId_t logicalColumnId)
RColumnDescriptorBuilder & ValueRange(double min, double max)
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 & ProjectionSourceId(DescriptorId_t id)
RFieldDescriptorBuilder & FieldVersion(std::uint32_t fieldVersion)
RFieldDescriptorBuilder & Structure(const ENTupleStructure &structure)
RFieldDescriptorBuilder & TypeName(const std::string &typeName)
RFieldDescriptorBuilder & FieldName(const std::string &fieldName)
RResult< RFieldDescriptor > MakeDescriptor() const
Attempt to make a field descriptor.
RFieldDescriptorBuilder & ParentId(DescriptorId_t id)
RFieldDescriptorBuilder & TypeChecksum(const std::optional< std::uint32_t > typeChecksum)
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.
RResult< void > AddExtraTypeInfo(RExtraTypeInfoDescriptor &&extraTypeInfoDesc)
RResult< void > AddColumn(RColumnDescriptor &&columnDesc)
RResult< void > AddFieldProjection(DescriptorId_t sourceId, DescriptorId_t targetId)
void BeginHeaderExtension()
Mark the beginning of the header extension; any fields and columns added after a call to this functio...
void ShiftAliasColumns(std::uint32_t offset)
If the descriptor is constructed in pieces consisting of physical and alias columns (regular and proj...
RResult< void > AddClusterGroup(RClusterGroupDescriptor &&clusterGroup)
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)
const RNTupleDescriptor & GetDescriptor() const
void AddField(const RFieldDescriptor &fieldDesc)
RResult< void > AddFieldLink(DescriptorId_t fieldId, DescriptorId_t linkId)
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 std::uint32_t SerializeListFramePreamble(std::uint32_t nitems, void *buffer)
static RResult< std::uint32_t > DeserializeSchemaDescription(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static RResult< StreamerInfoMap_t > DeserializeStreamerInfos(const std::string &extraTypeInfoContent)
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 std::uint32_t SerializeFeatureFlags(const std::vector< std::uint64_t > &flags, void *buffer)
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< std::uint32_t > DeserializeColumnType(const void *buffer, ROOT::Experimental::EColumnType &type)
static std::uint32_t SerializePageList(void *buffer, const RNTupleDescriptor &desc, std::span< DescriptorId_t > physClusterIDs, const RContext &context)
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 > 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)
static std::uint32_t SerializeClusterSummary(const RClusterSummary &clusterSummary, void *buffer)
static std::uint32_t SerializeFramePostscript(void *frame, std::uint64_t size)
static std::uint32_t SerializeInt16(std::int16_t val, void *buffer)
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 RResult< std::uint32_t > DeserializeFieldStructure(const void *buffer, ROOT::Experimental::ENTupleStructure &structure)
static std::uint32_t SerializeSchemaDescription(void *buffer, const RNTupleDescriptor &desc, const RContext &context, bool forHeaderExtension=false)
Serialize the schema description in desc into buffer.
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
static std::uint32_t SerializeLocator(const RNTupleLocator &locator, void *buffer)
static std::uint32_t SerializeInt32(std::int32_t val, void *buffer)
static RResult< void > DeserializeFooter(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static std::uint32_t DeserializeUInt64(const void *buffer, std::uint64_t &val)
static RResult< void > DeserializeHeader(const void *buffer, std::uint64_t bufSize, RNTupleDescriptorBuilder &descBuilder)
static RResult< void > DeserializePageList(const void *buffer, std::uint64_t bufSize, DescriptorId_t clusterGroupId, RNTupleDescriptor &desc)
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 > DeserializeExtraTypeInfoId(const void *buffer, ROOT::Experimental::EExtraTypeInfoIds &id)
static std::uint32_t SerializeEnvelopeLink(const REnvelopeLink &envelopeLink, 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 > DeserializeLocator(const void *buffer, std::uint64_t bufSize, RNTupleLocator &locator)
static std::uint32_t SerializeClusterGroup(const RClusterGroup &clusterGroup, void *buffer)
static std::uint32_t SerializeFooter(void *buffer, const RNTupleDescriptor &desc, const RContext &context)
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 std::uint32_t SerializeExtraTypeInfoId(ROOT::Experimental::EExtraTypeInfoIds id, void *buffer)
std::uint32_t GetNClusters() const
Meta-data stored for every column of an ntuple.
bool IsSuppressedDeferredColumn() const
bool IsDeferredColumn() const
EColumnType GetType() const
std::uint16_t GetBitsOnStorage() const
std::uint64_t GetFirstElementIndex() const
DescriptorId_t GetFieldId() const
std::optional< RValueRange > GetValueRange() const
std::uint16_t GetRepresentationIndex() const
bool IsAliasColumn() const
DescriptorId_t GetPhysicalId() const
Meta-data stored for every field of an ntuple.
const std::string & GetFieldName() const
const std::string & GetTypeName() const
const std::string & GetFieldDescription() const
std::uint32_t GetTypeVersion() const
const std::vector< DescriptorId_t > & GetLogicalColumnIds() const
const std::string & GetTypeAlias() const
std::uint32_t GetFieldVersion() const
bool IsProjectedField() const
std::uint64_t GetNRepetitions() const
ENTupleStructure GetStructure() const
std::optional< std::uint32_t > GetTypeChecksum() const
The on-storage meta-data of an ntuple.
std::size_t GetNLogicalColumns() const
const std::string & GetName() const
std::uint64_t GetOnDiskHeaderXxHash3() const
RColumnDescriptorIterable GetColumnIterable() const
const RClusterDescriptor & GetClusterDescriptor(DescriptorId_t clusterId) const
std::size_t GetNExtraTypeInfos() 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
std::size_t GetNPhysicalColumns() const
const std::string & GetDescription() const
const RHeaderExtension * GetHeaderExtension() const
Return header extension information; if the descriptor does not have a header extension,...
RFieldDescriptorIterable GetFieldIterable(const RFieldDescriptor &fieldDesc) const
std::vector< std::uint64_t > GetFeatureFlags() const
RNTupleLocator payload that is common for object stores using 64bit location information.
Generic information about the physical location of data.
std::uint8_t GetReserved() const
std::uint64_t GetNBytesOnStorage() const
ELocatorType GetType() const
void SetNBytesOnStorage(std::uint64_t nBytesOnStorage)
void SetPosition(T position)
void SetReserved(std::uint8_t reserved)
void SetType(ELocatorType type)
Base class for all ROOT issued exceptions.
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.
constexpr RNTupleLocator::ELocatorType kTestLocatorType
constexpr ENTupleStructure kTestFutureFieldStructure
constexpr EColumnType kTestFutureType
RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
EExtraTypeInfoIds
Used in RExtraTypeInfoDescriptor.
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
constexpr DescriptorId_t kInvalidDescriptorId
void(off) SmallVectorTemplateBase< T
__device__ AFloat max(AFloat x, AFloat y)
REnvelopeLink fPageListEnvelopeLink
std::uint64_t fFirstEntry