43 std::uint16_t fValBE = 0;
44 static std::uint16_t
Swap(std::uint16_t val) {
45 return (val & 0x00FF) << 8 | (val & 0xFF00) >> 8;
48 RUInt16BE() =
default;
49 explicit RUInt16BE(
const std::uint16_t val) : fValBE(
Swap(val)) {}
50 operator std::uint16_t()
const {
53 RUInt16BE&
operator =(
const std::uint16_t val) {
62 std::uint32_t fValBE = 0;
63 static std::uint32_t
Swap(std::uint32_t val) {
64 auto x = (val & 0x0000FFFF) << 16 | (val & 0xFFFF0000) >> 16;
65 return (
x & 0x00FF00FF) << 8 | (
x & 0xFF00FF00) >> 8;
68 RUInt32BE() =
default;
69 explicit RUInt32BE(
const std::uint32_t val) : fValBE(
Swap(val)) {}
70 operator std::uint32_t()
const {
73 RUInt32BE&
operator =(
const std::uint32_t val) {
82 std::int32_t fValBE = 0;
83 static std::int32_t
Swap(std::int32_t val) {
84 auto x = (val & 0x0000FFFF) << 16 | (val & 0xFFFF0000) >> 16;
85 return (
x & 0x00FF00FF) << 8 | (
x & 0xFF00FF00) >> 8;
89 explicit RInt32BE(
const std::int32_t val) : fValBE(
Swap(val)) {}
90 operator std::int32_t()
const {
102 std::uint64_t fValBE = 0;
103 static std::uint64_t
Swap(std::uint64_t val) {
104 auto x = (val & 0x00000000FFFFFFFF) << 32 | (val & 0xFFFFFFFF00000000) >> 32;
105 x = (
x & 0x0000FFFF0000FFFF) << 16 | (
x & 0xFFFF0000FFFF0000) >> 16;
106 return (
x & 0x00FF00FF00FF00FF) << 8 | (
x & 0xFF00FF00FF00FF00) >> 8;
109 RUInt64BE() =
default;
110 explicit RUInt64BE(
const std::uint64_t val) : fValBE(
Swap(val)) {}
111 operator std::uint64_t()
const {
114 RUInt64BE&
operator =(
const std::uint64_t val) {
120constexpr std::int32_t ChecksumRNTupleClass() {
121 const char ident[] =
"ROOT::Experimental::RNTuple"
143 for (
unsigned i = 0; i < (
sizeof(ident) - 1); i++)
144 id =
static_cast<std::int32_t
>(
static_cast<std::int64_t
>(
id) * 3 + ident[i]);
154 RTFString() =
default;
155 RTFString(
const std::string &str) {
157 fLName = str.length();
158 memcpy(fData, str.data(), fLName);
160 char GetSize()
const {
return 1 + fLName; }
167 auto now = std::chrono::system_clock::now();
168 auto tt = std::chrono::system_clock::to_time_t(now);
169 auto tm = *localtime(&
tt);
170 fDatetime = (tm.tm_year + 1900 - 1995) << 26 | (tm.tm_mon + 1) << 22 | tm.tm_mday << 17 |
171 tm.tm_hour << 12 | tm.tm_min << 6 | tm.tm_sec;
173 explicit RTFDatetime(RUInt32BE val) : fDatetime(val) {}
179 RUInt16BE fVersion{4};
180 RUInt32BE fObjLen{0};
181 RTFDatetime fDatetime;
182 RUInt16BE fKeyLen{0};
186 RUInt32BE fSeekKey{0};
187 RUInt32BE fSeekPdir{0};
190 RUInt64BE fSeekKey{0};
191 RUInt64BE fSeekPdir{0};
195 std::uint32_t fKeyHeaderSize{18 +
sizeof(fInfoShort)};
197 RTFKey() : fInfoShort() {}
198 RTFKey(std::uint64_t seekKey, std::uint64_t seekPdir,
199 const RTFString &clName,
const RTFString &objName,
const RTFString &titleName,
200 std::uint32_t szObjInMem, std::uint32_t szObjOnDisk = 0)
202 fObjLen = szObjInMem;
203 if ((seekKey >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max())) ||
204 (seekPdir >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max())))
206 fKeyHeaderSize = 18 +
sizeof(fInfoLong);
207 fKeyLen = fKeyHeaderSize + clName.GetSize() + objName.GetSize() + titleName.GetSize();
208 fInfoLong.fSeekKey = seekKey;
209 fInfoLong.fSeekPdir = seekPdir;
210 fVersion = fVersion + 1000;
212 fKeyHeaderSize = 18 +
sizeof(fInfoShort);
213 fKeyLen = fKeyHeaderSize + clName.GetSize() + objName.GetSize() + titleName.GetSize();
214 fInfoShort.fSeekKey = seekKey;
215 fInfoShort.fSeekPdir = seekPdir;
217 fNbytes = fKeyLen + ((szObjOnDisk == 0) ? szObjInMem : szObjOnDisk);
222 if (fVersion >= 1000)
224 std::uint32_t seekKey = fInfoShort.fSeekKey;
225 std::uint32_t seekPdir = fInfoShort.fSeekPdir;
226 fInfoLong.fSeekKey = seekKey;
227 fInfoLong.fSeekPdir = seekPdir;
228 fKeyHeaderSize = fKeyHeaderSize +
sizeof(fInfoLong) -
sizeof(fInfoShort);
229 fNbytes = fNbytes +
sizeof(fInfoLong) -
sizeof(fInfoShort);
230 fVersion = fVersion + 1000;
233 std::uint32_t GetSize()
const {
240 std::uint32_t GetHeaderSize()
const {
241 if (fVersion >= 1000)
242 return 18 +
sizeof(fInfoLong);
243 return 18 +
sizeof(fInfoShort);
246 std::uint64_t GetSeekKey()
const {
247 if (fVersion >= 1000)
248 return fInfoLong.fSeekKey;
249 return fInfoShort.fSeekKey;
255 char fMagic[4]{
'r',
'o',
'o',
't' };
259 RUInt32BE fBEGIN{100};
263 RUInt32BE fSeekFree{0};
264 RUInt32BE fNbytesFree{0};
266 RUInt32BE fNbytesName{0};
267 unsigned char fUnits{4};
268 RUInt32BE fCompress{0};
269 RUInt32BE fSeekInfo{0};
270 RUInt32BE fNbytesInfo{0};
274 RUInt64BE fSeekFree{0};
275 RUInt32BE fNbytesFree{0};
277 RUInt32BE fNbytesName{0};
278 unsigned char fUnits{8};
279 RUInt32BE fCompress{0};
280 RUInt64BE fSeekInfo{0};
281 RUInt32BE fNbytesInfo{0};
285 RTFHeader() : fInfoShort() {}
286 RTFHeader(
int compression) : fInfoShort() {
287 fInfoShort.fCompress = compression;
291 if (fVersion >= 1000000)
294 std::uint32_t
end = fInfoShort.fEND;
295 std::uint32_t seekFree = fInfoShort.fSeekFree;
296 std::uint32_t nbytesFree = fInfoShort.fNbytesFree;
297 std::uint32_t nFree = fInfoShort.fNfree;
298 std::uint32_t nbytesName = fInfoShort.fNbytesName;
299 std::uint32_t compress = fInfoShort.fCompress;
300 std::uint32_t seekInfo = fInfoShort.fSeekInfo;
301 std::uint32_t nbytesInfo = fInfoShort.fNbytesInfo;
302 fInfoLong.fEND =
end;
303 fInfoLong.fSeekFree = seekFree;
304 fInfoLong.fNbytesFree = nbytesFree;
305 fInfoLong.fNfree = nFree;
306 fInfoLong.fNbytesName = nbytesName;
307 fInfoLong.fUnits = 8;
308 fInfoLong.fCompress = compress;
309 fInfoLong.fSeekInfo = seekInfo;
310 fInfoLong.fNbytesInfo = nbytesInfo;
311 fVersion = fVersion + 1000000;
314 bool IsBigFile(std::uint64_t
offset = 0)
const {
315 return (fVersion >= 1000000) || (
offset >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max()));
318 std::uint32_t GetSize()
const {
319 std::uint32_t sizeHead = 4 +
sizeof(fVersion) +
sizeof(fBEGIN);
320 if (IsBigFile())
return sizeHead +
sizeof(fInfoLong);
321 return sizeHead +
sizeof(fInfoShort);
324 std::uint64_t GetEnd()
const {
325 if (IsBigFile())
return fInfoLong.fEND;
326 return fInfoShort.fEND;
329 void SetEnd(std::uint64_t
value) {
330 if (IsBigFile(
value)) {
332 fInfoLong.fEND =
value;
334 fInfoShort.fEND =
value;
338 std::uint64_t GetSeekFree()
const {
339 if (IsBigFile())
return fInfoLong.fSeekFree;
340 return fInfoShort.fSeekFree;
343 void SetSeekFree(std::uint64_t
value) {
344 if (IsBigFile(
value)) {
346 fInfoLong.fSeekFree =
value;
348 fInfoShort.fSeekFree =
value;
352 void SetNbytesFree(std::uint32_t
value) {
354 fInfoLong.fNbytesFree =
value;
356 fInfoShort.fNbytesFree =
value;
360 void SetNbytesName(std::uint32_t
value) {
362 fInfoLong.fNbytesName =
value;
364 fInfoShort.fNbytesName =
value;
368 std::uint64_t GetSeekInfo()
const {
369 if (IsBigFile())
return fInfoLong.fSeekInfo;
370 return fInfoShort.fSeekInfo;
373 void SetSeekInfo(std::uint64_t
value) {
374 if (IsBigFile(
value)) {
376 fInfoLong.fSeekInfo =
value;
378 fInfoShort.fSeekInfo =
value;
382 void SetNbytesInfo(std::uint32_t
value) {
384 fInfoLong.fNbytesInfo =
value;
386 fInfoShort.fNbytesInfo =
value;
390 void SetCompression(std::uint32_t
value) {
392 fInfoLong.fCompress =
value;
394 fInfoShort.fCompress =
value;
402 RUInt16BE fVersion{1};
414 RTFFreeEntry() : fInfoShort() {}
415 void Set(std::uint64_t
first, std::uint64_t last) {
416 if (last >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max())) {
417 fVersion = fVersion + 1000;
418 fInfoLong.fFirst =
first;
419 fInfoLong.fLast = last;
421 fInfoShort.fFirst =
first;
422 fInfoShort.fLast = last;
425 std::uint32_t GetSize() {
return (fVersion >= 1000) ? 18 : 10; }
430 RUInt16BE fVersion{1};
431 RUInt32BE fUniqueID{0};
433 explicit RTFObject(std::uint32_t bits) : fBits(bits) {}
437struct RTFStreamerElementChecksum {
438 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementChecksum) -
sizeof(RUInt32BE))};
439 RUInt16BE fVersion{4};
441 RUInt32BE fByteCountNamed{0x40000000 | (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 11)};
442 RUInt16BE fVersionNamed{1};
443 RTFObject fObjectNamed{0x02000000 | 0x01000000};
445 char fName[9]{
'f',
'C',
'h',
'e',
'c',
'k',
's',
'u',
'm'};
450 RUInt32BE fArrLength{0};
451 RUInt32BE fArrDim{0};
452 char fMaxIndex[20]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
458struct RTFStreamerElementVersion {
459 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementVersion) -
sizeof(RUInt32BE))};
460 RUInt16BE fVersion{4};
462 RUInt32BE fByteCountNamed{0x40000000 | (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 10)};
463 RUInt16BE fVersionNamed{1};
464 RTFObject fObjectNamed{0x02000000 | 0x01000000};
466 char fName[8]{
'f',
'V',
'e',
'r',
's',
'i',
'o',
'n' };
471 RUInt32BE fArrLength{0};
472 RUInt32BE fArrDim{0};
473 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
474 char fLTypeName = 12;
475 char fTypeName[12]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'i',
'n',
't' };
479struct RTFStreamerElementSize {
480 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementSize) -
sizeof(RUInt32BE))};
481 RUInt16BE fVersion{4};
483 RUInt32BE fByteCountNamed{0x40000000 | (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 7)};
484 RUInt16BE fVersionNamed{1};
485 RTFObject fObjectNamed{0x02000000 | 0x01000000};
487 char fName[5]{
'f',
'S',
'i',
'z',
'e' };
492 RUInt32BE fArrLength{0};
493 RUInt32BE fArrDim{0};
494 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
495 char fLTypeName = 12;
496 char fTypeName[12]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'i',
'n',
't' };
500struct RTFStreamerElementSeekHeader {
501 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementSeekHeader) -
sizeof(RUInt32BE))};
502 RUInt16BE fVersion{4};
504 RUInt32BE fByteCountNamed{0x40000000 |
505 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 13)};
506 RUInt16BE fVersionNamed{1};
507 RTFObject fObjectNamed{0x02000000 | 0x01000000};
509 char fName[11]{
'f',
'S',
'e',
'e',
'k',
'H',
'e',
'a',
'd',
'e',
'r' };
514 RUInt32BE fArrLength{0};
515 RUInt32BE fArrDim{0};
516 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
517 char fLTypeName = 13;
518 char fTypeName[13]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'l',
'o',
'n',
'g' };
522struct RTFStreamerElementNBytesHeader {
523 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementNBytesHeader) -
sizeof(RUInt32BE))};
524 RUInt16BE fVersion{4};
526 RUInt32BE fByteCountNamed{0x40000000 |
527 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 15)};
528 RUInt16BE fVersionNamed{1};
529 RTFObject fObjectNamed{0x02000000 | 0x01000000};
531 char fName[13]{
'f',
'N',
'B',
'y',
't',
'e',
's',
'H',
'e',
'a',
'd',
'e',
'r' };
536 RUInt32BE fArrLength{0};
537 RUInt32BE fArrDim{0};
538 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
539 char fLTypeName = 12;
540 char fTypeName[12]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'i',
'n',
't' };
544struct RTFStreamerElementLenHeader {
545 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementLenHeader) -
sizeof(RUInt32BE))};
546 RUInt16BE fVersion{4};
548 RUInt32BE fByteCountNamed{0x40000000 |
549 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 12)};
550 RUInt16BE fVersionNamed{1};
551 RTFObject fObjectNamed{0x02000000 | 0x01000000};
553 char fName[10]{
'f',
'L',
'e',
'n',
'H',
'e',
'a',
'd',
'e',
'r' };
558 RUInt32BE fArrLength{0};
559 RUInt32BE fArrDim{0};
560 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
561 char fLTypeName = 12;
562 char fTypeName[12]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'i',
'n',
't' };
566struct RTFStreamerElementSeekFooter {
567 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementSeekFooter) -
sizeof(RUInt32BE))};
568 RUInt16BE fVersion{4};
570 RUInt32BE fByteCountNamed{0x40000000 |
571 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 13)};
572 RUInt16BE fVersionNamed{1};
573 RTFObject fObjectNamed{0x02000000 | 0x01000000};
575 char fName[11]{
'f',
'S',
'e',
'e',
'k',
'F',
'o',
'o',
't',
'e',
'r' };
580 RUInt32BE fArrLength{0};
581 RUInt32BE fArrDim{0};
582 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
583 char fLTypeName = 13;
584 char fTypeName[13]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'l',
'o',
'n',
'g' };
588struct RTFStreamerElementNBytesFooter {
589 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementNBytesFooter) -
sizeof(RUInt32BE))};
590 RUInt16BE fVersion{4};
592 RUInt32BE fByteCountNamed{0x40000000 | (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 15)};
593 RUInt16BE fVersionNamed{1};
594 RTFObject fObjectNamed{0x02000000 | 0x01000000};
596 char fName[13]{
'f',
'N',
'B',
'y',
't',
'e',
's',
'F',
'o',
'o',
't',
'e',
'r' };
601 RUInt32BE fArrLength{0};
602 RUInt32BE fArrDim{0};
603 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
604 char fLTypeName = 12;
605 char fTypeName[12]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'i',
'n',
't' };
609struct RTFStreamerElementLenFooter {
610 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementLenFooter) -
sizeof(RUInt32BE))};
611 RUInt16BE fVersion{4};
613 RUInt32BE fByteCountNamed{0x40000000 | (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 12)};
614 RUInt16BE fVersionNamed{1};
615 RTFObject fObjectNamed{0x02000000 | 0x01000000};
617 char fName[10]{
'f',
'L',
'e',
'n',
'F',
'o',
'o',
't',
'e',
'r' };
622 RUInt32BE fArrLength{0};
623 RUInt32BE fArrDim{0};
624 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
625 char fLTypeName = 12;
626 char fTypeName[12]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'i',
'n',
't' };
630struct RTFStreamerElementReserved {
631 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerElementReserved) -
sizeof(RUInt32BE))};
632 RUInt16BE fVersion{4};
634 RUInt32BE fByteCountNamed{0x40000000 |
635 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 11)};
636 RUInt16BE fVersionNamed{1};
637 RTFObject fObjectNamed{0x02000000 | 0x01000000};
639 char fName[9]{
'f',
'R',
'e',
's',
'e',
'r',
'v',
'e',
'd' };
644 RUInt32BE fArrLength{0};
645 RUInt32BE fArrDim{0};
646 char fMaxIndex[20]{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
647 char fLTypeName = 13;
648 char fTypeName[13]{
'u',
'n',
's',
'i',
'g',
'n',
'e',
'd',
' ',
'l',
'o',
'n',
'g' };
652struct RTFStreamerChecksum {
653 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerChecksum) -
sizeof(RUInt32BE))};
654 RUInt32BE fNewClassTag{0xffffffff};
655 char fClassName[19]{
'T',
'S',
't',
'r',
'e',
'a',
'm',
'e',
'r',
'B',
'a',
's',
'i',
'c',
'T',
'y',
'p',
'e',
'\0'};
656 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerChecksum) - 2 *
sizeof(RUInt32BE) -
657 19 -
sizeof(RUInt32BE))};
658 RUInt16BE fVersion{2};
659 RTFStreamerElementChecksum fStreamerElementChecksum;
663struct RTFStreamerVersion {
664 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerVersion) -
sizeof(RUInt32BE))};
665 RUInt32BE fClassTag{0x80000000};
666 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerVersion) - 3 *
sizeof(RUInt32BE))};
667 RUInt16BE fVersion{2};
668 RTFStreamerElementVersion fStreamerElementVersion;
672struct RTFStreamerSize {
673 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerSize) -
sizeof(RUInt32BE))};
674 RUInt32BE fClassTag{0x80000000};
675 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerSize) - 3 *
sizeof(RUInt32BE))};
676 RUInt16BE fVersion{2};
677 RTFStreamerElementSize fStreamerElementSize;
681struct RTFStreamerSeekHeader {
682 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerSeekHeader) -
sizeof(RUInt32BE))};
683 RUInt32BE fClassTag{0x80000000};
684 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerSeekHeader) - 3 *
sizeof(RUInt32BE))};
685 RUInt16BE fVersion{2};
686 RTFStreamerElementSeekHeader fStreamerElementSeekHeader;
690struct RTFStreamerNBytesHeader {
691 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerNBytesHeader) -
sizeof(RUInt32BE))};
692 RUInt32BE fClassTag{0x80000000};
693 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerNBytesHeader) - 3 *
sizeof(RUInt32BE))};
694 RUInt16BE fVersion{2};
695 RTFStreamerElementNBytesHeader fStreamerElementNBytesHeader;
699struct RTFStreamerLenHeader {
700 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerLenHeader) -
sizeof(RUInt32BE))};
701 RUInt32BE fClassTag{0x80000000};
702 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerLenHeader) - 3 *
sizeof(RUInt32BE))};
703 RUInt16BE fVersion{2};
704 RTFStreamerElementLenHeader fStreamerElementLenHeader;
708struct RTFStreamerSeekFooter {
709 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerSeekFooter) -
sizeof(RUInt32BE))};
710 RUInt32BE fClassTag{0x80000000};
711 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerSeekFooter) - 3 *
sizeof(RUInt32BE))};
712 RUInt16BE fVersion{2};
713 RTFStreamerElementSeekFooter fStreamerElementSeekFooter;
717struct RTFStreamerNBytesFooter {
718 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerNBytesFooter) -
sizeof(RUInt32BE))};
719 RUInt32BE fClassTag{0x80000000};
720 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerNBytesFooter) - 3 *
sizeof(RUInt32BE))};
721 RUInt16BE fVersion{2};
722 RTFStreamerElementNBytesFooter fStreamerElementNBytesFooter;
726struct RTFStreamerLenFooter {
727 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerLenFooter) -
sizeof(RUInt32BE))};
728 RUInt32BE fClassTag{0x80000000};
729 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerLenFooter) - 3 *
sizeof(RUInt32BE))};
730 RUInt16BE fVersion{2};
731 RTFStreamerElementLenFooter fStreamerElementLenFooter;
735struct RTFStreamerReserved {
736 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerReserved) -
sizeof(RUInt32BE))};
737 RUInt32BE fClassTag{0x80000000};
738 RUInt32BE fByteCountRemaining{0x40000000 | (
sizeof(RTFStreamerReserved) - 3 *
sizeof(RUInt32BE))};
739 RUInt16BE fVersion{2};
740 RTFStreamerElementReserved fStreamerElementReserved;
744struct RTFStreamerInfoObject {
745 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerInfoObject) -
sizeof(fByteCount))};
746 RUInt32BE fNewClassTag{0xffffffff};
747 char fClassName[14]{
'T',
'S',
't',
'r',
'e',
'a',
'm',
'e',
'r',
'I',
'n',
'f',
'o',
'\0' };
748 RUInt32BE fByteCountRemaining{0x40000000 |
749 (
sizeof(RTFStreamerInfoObject) - 2 *
sizeof(RUInt32BE) - 14 -
sizeof(RUInt32BE))};
750 RUInt16BE fVersion{9};
752 RUInt32BE fByteCountNamed{0x40000000 |
753 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 29 )};
754 RUInt16BE fVersionNamed{1};
755 RTFObject fObjectNamed{0x02000000 | 0x01000000 | 0x00010000};
757 char fName[27]{
'R',
'O',
'O',
'T',
':',
':',
758 'E',
'x',
'p',
'e',
'r',
'i',
'm',
'e',
'n',
't',
'a',
'l',
':',
':',
759 'R',
'N',
'T',
'u',
'p',
'l',
'e'};
762 RInt32BE fChecksum{ChecksumRNTupleClass()};
763 RUInt32BE fVersionRNTuple{1};
765 RUInt32BE fByteCountObjArr{0x40000000 |
766 (
sizeof(RUInt32BE) + 10 +
sizeof(RUInt32BE) +
767 sizeof(RUInt16BE) +
sizeof(RTFObject) + 1 + 2*
sizeof(RUInt32BE) +
768 sizeof(fStreamers))};
769 RUInt32BE fNewClassTagObjArray{0xffffffff};
770 char fClassNameObjArray[10]{
'T',
'O',
'b',
'j',
'A',
'r',
'r',
'a',
'y',
'\0'};
771 RUInt32BE fByteCountObjArrRemaining{0x40000000 |
772 (
sizeof(RUInt16BE) +
sizeof(RTFObject) + 1 + 2*
sizeof(RUInt32BE) +
773 sizeof(fStreamers))};
774 RUInt16BE fVersionObjArr{3};
775 RTFObject fObjectObjArr{0x02000000};
778 RUInt32BE fNObjects{10};
779 RUInt32BE fLowerBound{0};
782 RTFStreamerChecksum fStreamerChecksum;
783 RTFStreamerVersion fStreamerVersion;
784 RTFStreamerSize fStreamerSize;
785 RTFStreamerSeekHeader fStreamerSeekHeader;
786 RTFStreamerNBytesHeader fStreamerNBytesHeader;
787 RTFStreamerLenHeader fStreamerLenHeader;
788 RTFStreamerSeekFooter fStreamerSeekFooter;
789 RTFStreamerNBytesFooter fStreamerNBytesFooter;
790 RTFStreamerLenFooter fStreamerLenFooter;
791 RTFStreamerReserved fStreamerReserved;
796struct RTFStreamerInfoList {
797 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFStreamerInfoList) -
sizeof(fByteCount))};
798 RUInt16BE fVersion{5};
799 RTFObject fObject{0x02000000};
801 RUInt32BE fNObjects{1};
802 RTFStreamerInfoObject fStreamerInfo;
805 std::uint32_t GetSize()
const {
return sizeof(RTFStreamerInfoList); }
811 std::uint32_t GetSize()
const {
return sizeof(RTFKeyList); }
812 explicit RTFKeyList(std::uint32_t nKeys) : fNKeys(nKeys) {}
817 RUInt16BE fClassVersion{5};
820 RUInt32BE fNBytesKeys{0};
821 RUInt32BE fNBytesName{0};
825 RUInt32BE fSeekDir{100};
826 RUInt32BE fSeekParent{0};
827 RUInt32BE fSeekKeys{0};
830 RUInt64BE fSeekDir{100};
831 RUInt64BE fSeekParent{0};
832 RUInt64BE fSeekKeys{0};
836 RTFFile() : fInfoShort() {}
839 std::uint32_t GetSize()
const
841 if (fClassVersion >= 1000)
842 return sizeof(RTFFile);
843 return 18 +
sizeof(fInfoShort);
846 std::uint64_t GetSeekKeys()
const
848 if (fClassVersion >= 1000)
849 return fInfoLong.fSeekKeys;
850 return fInfoShort.fSeekKeys;
853 void SetSeekKeys(std::uint64_t seekKeys)
855 if (seekKeys >
static_cast<unsigned int>(std::numeric_limits<std::int32_t>::max())) {
856 std::uint32_t seekDir = fInfoShort.fSeekDir;
857 std::uint32_t seekParent = fInfoShort.fSeekParent;
858 fInfoLong.fSeekDir = seekDir;
859 fInfoLong.fSeekParent = seekParent;
860 fInfoLong.fSeekKeys = seekKeys;
861 fClassVersion = fClassVersion + 1000;
863 fInfoShort.fSeekKeys = seekKeys;
870 RUInt16BE fVersionClass{1};
871 unsigned char fUUID[16] = {0};
874 std::uint32_t GetSize()
const {
return sizeof(RTFUUID); }
879 RUInt32BE fByteCount{0x40000000 | (
sizeof(RTFNTuple) -
sizeof(fByteCount))};
880 RUInt16BE fVersionClass{3};
881 RInt32BE fChecksum{ChecksumRNTupleClass()};
882 RUInt32BE fVersionInternal{0};
884 RUInt64BE fSeekHeader{0};
885 RUInt32BE fNBytesHeader{0};
886 RUInt32BE fLenHeader{0};
887 RUInt64BE fSeekFooter{0};
888 RUInt32BE fNBytesFooter{0};
889 RUInt32BE fLenFooter{0};
890 RUInt64BE fReserved{0};
892 RTFNTuple() =
default;
895 fVersionInternal = inMemoryAnchor.
fVersion;
905 std::uint32_t GetSize()
const {
return sizeof(RTFNTuple); }
924struct RBareFileHeader {
925 char fMagic[7]{
'r',
'n',
't',
'u',
'p',
'l',
'e' };
929 RUInt32BE fFormatVersion{1};
930 RUInt32BE fCompress{0};
937static constexpr char const *kBlobClassName =
"RBlob";
939static constexpr char const *kNTupleClassName =
"ROOT::Experimental::RNTuple";
943class RKeyBlob :
public TKey {
946 fClassName = kBlobClassName;
952 void Reserve(
size_t nbytes, std::uint64_t *seekKey)
963namespace Experimental {
988 if (std::string(ident, 4) ==
"root")
989 return GetNTupleProper(ntupleName);
991 return GetNTupleBare(ntupleName);
997 RTFHeader fileHeader;
998 ReadBuffer(&fileHeader,
sizeof(fileHeader), 0);
1002 ReadBuffer(&key,
sizeof(key), fileHeader.fBEGIN);
1003 std::uint64_t
offset = fileHeader.fBEGIN + key.fKeyLen;
1018 for (
unsigned int i = 0; i < nKeys; ++i) {
1020 auto offsetNextKey =
offset + key.fKeyLen;
1022 offset += key.GetHeaderSize();
1025 if (std::string_view(
name.fData,
name.fLName) != kNTupleClassName) {
1032 if (std::string_view(
name.fData,
name.fLName) == ntupleName) {
1039 return R__FAIL(
"no RNTuple named '" + std::string(ntupleName)
1040 +
"' in file '" + fRawFile->GetUrl() +
"'");
1043 ReadBuffer(&key,
sizeof(key), key.GetSeekKey());
1044 offset = key.GetSeekKey() + key.fKeyLen;
1046 if (key.fObjLen >
sizeof(ntuple)) {
1047 return R__FAIL(
"invalid anchor size: " + std::to_string(key.fObjLen) +
" > " + std::to_string(
sizeof(ntuple)));
1050 if (
sizeof(ntuple) != key.fObjLen) {
1052 decompressor.
Unzip(&ntuple,
sizeof(ntuple), key.fObjLen);
1054 return ntuple.ToAnchor();
1060 RBareFileHeader fileHeader;
1061 ReadBuffer(&fileHeader,
sizeof(fileHeader), 0);
1063 auto offset =
sizeof(fileHeader);
1066 std::string_view foundName(
name.fData,
name.fLName);
1067 if (foundName != ntupleName) {
1068 return R__FAIL(
"expected RNTuple named '" + std::string(ntupleName)
1069 +
"' but instead found '" + std::string(foundName)
1070 +
"' in file '" + fRawFile->GetUrl() +
"'");
1076 return ntuple.ToAnchor();
1082 auto nread = fRawFile->ReadAt(buffer, nbytes,
offset);
1098 const void *buffer,
size_t nbytes, std::int64_t
offset)
1102 if ((
offset >= 0) && (
static_cast<std::uint64_t
>(
offset) != fFilePos)) {
1104 retval = fseeko64(fFile,
offset, SEEK_SET);
1106 retval = fseek(fFile,
offset, SEEK_SET);
1111 retval = fwrite(buffer, 1, nbytes, fFile);
1118 const void *buffer, std::size_t nbytes, std::size_t
len, std::int64_t
offset,
1119 std::uint64_t directoryOffset,
1120 const std::string &className,
1121 const std::string &objectName,
1122 const std::string &title)
1126 RTFString strClass{className};
1127 RTFString strObject{objectName};
1128 RTFString strTitle{title};
1130 RTFKey key(
offset, directoryOffset, strClass, strObject, strTitle,
len, nbytes);
1131 Write(&key, key.fKeyHeaderSize,
offset);
1132 Write(&strClass, strClass.GetSize());
1133 Write(&strObject, strObject.GetSize());
1134 Write(&strTitle, strTitle.GetSize());
1135 auto offsetData = fFilePos;
1137 Write(buffer, nbytes);
1147 const void *buffer,
size_t nbytes, std::int64_t
offset)
1151 bool rv = fFile->WriteBuffer((
char *)(buffer), nbytes);
1157 const void *buffer,
size_t nbytes,
size_t len)
1159 std::uint64_t offsetKey;
1160 RKeyBlob keyBlob(fFile);
1163 keyBlob.Reserve(nbytes, &offsetKey);
1166 RTFString strClass{kBlobClassName};
1167 RTFString strObject;
1169 RTFKey keyHeader(
offset,
offset, strClass, strObject, strTitle,
len, nbytes);
1171 keyHeader.MakeBigKey();
1173 Write(&keyHeader, keyHeader.fKeyHeaderSize,
offset);
1174 offset += keyHeader.fKeyHeaderSize;
1175 Write(&strClass, strClass.GetSize(),
offset);
1176 offset += strClass.GetSize();
1177 Write(&strObject, strObject.GetSize(),
offset);
1178 offset += strObject.GetSize();
1179 Write(&strTitle, strTitle.GetSize(),
offset);
1180 offset += strTitle.GetSize();
1181 auto offsetData =
offset;
1182 Write(buffer, nbytes,
offset);
1204 std::string_view ntupleName, std::string_view path,
int defaultCompression,
ENTupleContainerFormat containerFormat)
1206 std::string fileName(path);
1207 size_t idxDirSep = fileName.find_last_of(
"\\/");
1208 if (idxDirSep != std::string::npos) {
1209 fileName.erase(0, idxDirSep + 1);
1212 FILE *fileStream = fopen64(std::string(path.data(), path.size()).c_str(),
"wb");
1214 FILE *fileStream = fopen(std::string(path.data(), path.size()).c_str(),
"wb");
1219 writer->fFileSimple.fFile = fileStream;
1220 writer->fFileName = fileName;
1222 switch (containerFormat) {
1224 writer->WriteTFileSkeleton(defaultCompression);
1228 writer->WriteBareFileSkeleton(defaultCompression);
1231 R__ASSERT(
false &&
"Internal error: unhandled container format");
1239 std::string_view ntupleName, std::string_view path, std::unique_ptr<TFile> &
file)
1241 file = std::unique_ptr<TFile>(
TFile::Open(std::string(path.data(), path.size()).c_str(),
"RECREATE"));
1251 std::string_view ntupleName,
TFile &
file)
1264 fFileProper.fFile->WriteObject(&ntuple, fNTupleName.c_str());
1265 fFileProper.fFile->Write();
1273 RTFNTuple ntupleOnDisk(fNTupleAnchor);
1274 fFileSimple.Write(&ntupleOnDisk, ntupleOnDisk.GetSize(), fFileSimple.fControlBlock->fSeekNTuple);
1275 fflush(fFileSimple.fFile);
1279 WriteTFileNTupleKey();
1280 WriteTFileKeysList();
1281 WriteTFileStreamerInfo();
1282 WriteTFileFreeList();
1285 fFileSimple.Write(&fFileSimple.fControlBlock->fHeader, fFileSimple.fControlBlock->fHeader.GetSize(), 0);
1286 fFileSimple.Write(&fFileSimple.fControlBlock->fFileRecord, fFileSimple.fControlBlock->fFileRecord.GetSize(),
1287 fFileSimple.fControlBlock->fSeekFileRecord);
1288 fflush(fFileSimple.fFile);
1297 offset = fFileSimple.fFilePos;
1298 fFileSimple.Write(
data, nbytes);
1300 offset = fFileSimple.WriteKey(
data, nbytes,
len, -1, 100, kBlobClassName);
1310 const void *
data,
size_t nbytes,
size_t lenHeader)
1312 auto offset = WriteBlob(
data, nbytes, lenHeader);
1313 fNTupleAnchor.fLenHeader = lenHeader;
1314 fNTupleAnchor.fNBytesHeader = nbytes;
1315 fNTupleAnchor.fSeekHeader =
offset;
1321 const void *
data,
size_t nbytes,
size_t lenFooter)
1323 auto offset = WriteBlob(
data, nbytes, lenFooter);
1324 fNTupleAnchor.fLenFooter = lenFooter;
1325 fNTupleAnchor.fNBytesFooter = nbytes;
1326 fNTupleAnchor.fSeekFooter =
offset;
1333 RBareFileHeader bareHeader;
1334 bareHeader.fCompress = defaultCompression;
1335 fFileSimple.Write(&bareHeader,
sizeof(bareHeader), 0);
1336 RTFString ntupleName{fNTupleName};
1337 fFileSimple.Write(&ntupleName, ntupleName.GetSize());
1340 RTFNTuple ntupleOnDisk;
1341 fFileSimple.fControlBlock->fSeekNTuple = fFileSimple.fFilePos;
1342 fFileSimple.Write(&ntupleOnDisk, ntupleOnDisk.GetSize());
1347 RTFString strTList{
"TList"};
1348 RTFString strStreamerInfo{
"StreamerInfo"};
1349 RTFString strStreamerTitle{
"Doubly linked list"};
1351 fFileSimple.fControlBlock->fHeader.SetSeekInfo(fFileSimple.fFilePos);
1352 RTFKey keyStreamerInfo(
1353 fFileSimple.fControlBlock->fHeader.GetSeekInfo(), 100, strTList, strStreamerInfo, strStreamerTitle, 0);
1354 RTFStreamerInfoList streamerInfo;
1355 auto classTagOffset = keyStreamerInfo.fKeyLen + offsetof(
struct RTFStreamerInfoList, fStreamerInfo) +
1356 offsetof(
struct RTFStreamerInfoObject, fStreamers) +
1357 offsetof(
struct RTFStreamerChecksum, fNewClassTag) + 2;
1358 streamerInfo.fStreamerInfo.fStreamers.fStreamerVersion.fClassTag = 0x80000000 | classTagOffset;
1359 streamerInfo.fStreamerInfo.fStreamers.fStreamerSize.fClassTag = 0x80000000 | classTagOffset;
1360 streamerInfo.fStreamerInfo.fStreamers.fStreamerSeekHeader.fClassTag = 0x80000000 | classTagOffset;
1361 streamerInfo.fStreamerInfo.fStreamers.fStreamerNBytesHeader.fClassTag = 0x80000000 | classTagOffset;
1362 streamerInfo.fStreamerInfo.fStreamers.fStreamerLenHeader.fClassTag = 0x80000000 | classTagOffset;
1363 streamerInfo.fStreamerInfo.fStreamers.fStreamerSeekFooter.fClassTag = 0x80000000 | classTagOffset;
1364 streamerInfo.fStreamerInfo.fStreamers.fStreamerNBytesFooter.fClassTag = 0x80000000 | classTagOffset;
1365 streamerInfo.fStreamerInfo.fStreamers.fStreamerLenFooter.fClassTag = 0x80000000 | classTagOffset;
1366 streamerInfo.fStreamerInfo.fStreamers.fStreamerReserved.fClassTag = 0x80000000 | classTagOffset;
1368 auto szStreamerInfo = compressor.
Zip(&streamerInfo, streamerInfo.GetSize(), 1);
1369 fFileSimple.WriteKey(compressor.
GetZipBuffer(), szStreamerInfo, streamerInfo.GetSize(),
1370 fFileSimple.fControlBlock->fHeader.GetSeekInfo(), 100,
1371 "TList",
"StreamerInfo",
"Doubly linked list");
1372 fFileSimple.fControlBlock->fHeader.SetNbytesInfo(
1373 fFileSimple.fFilePos - fFileSimple.fControlBlock->fHeader.GetSeekInfo());
1379 RTFString strRNTupleClass{
"ROOT::Experimental::RNTuple"};
1380 RTFString strRNTupleName{fNTupleName};
1381 RTFString strFileName{fFileName};
1383 RTFKey keyRNTuple(fFileSimple.fControlBlock->fSeekNTuple, 100, strRNTupleClass, strRNTupleName, strEmpty,
1384 RTFNTuple().GetSize());
1386 fFileSimple.fControlBlock->fFileRecord.SetSeekKeys(fFileSimple.fFilePos);
1387 RTFKeyList keyList{1};
1388 RTFKey keyKeyList(fFileSimple.fControlBlock->fFileRecord.GetSeekKeys(), 100, strEmpty, strFileName, strEmpty,
1389 keyList.GetSize() + keyRNTuple.fKeyLen);
1390 fFileSimple.Write(&keyKeyList, keyKeyList.fKeyHeaderSize, fFileSimple.fControlBlock->fFileRecord.GetSeekKeys());
1391 fFileSimple.Write(&strEmpty, strEmpty.GetSize());
1392 fFileSimple.Write(&strFileName, strFileName.GetSize());
1393 fFileSimple.Write(&strEmpty, strEmpty.GetSize());
1394 fFileSimple.Write(&keyList, keyList.GetSize());
1395 fFileSimple.Write(&keyRNTuple, keyRNTuple.fKeyHeaderSize);
1396 fFileSimple.Write(&strRNTupleClass, strRNTupleClass.GetSize());
1397 fFileSimple.Write(&strRNTupleName, strRNTupleName.GetSize());
1398 fFileSimple.Write(&strEmpty, strEmpty.GetSize());
1399 fFileSimple.fControlBlock->fFileRecord.fNBytesKeys =
1400 fFileSimple.fFilePos - fFileSimple.fControlBlock->fFileRecord.GetSeekKeys();
1405 fFileSimple.fControlBlock->fHeader.SetSeekFree(fFileSimple.fFilePos);
1407 RTFString strFileName{fFileName};
1408 RTFFreeEntry freeEntry;
1409 RTFKey keyFreeList(fFileSimple.fControlBlock->fHeader.GetSeekFree(), 100, strEmpty, strFileName, strEmpty,
1410 freeEntry.GetSize());
1411 std::uint64_t firstFree = fFileSimple.fControlBlock->fHeader.GetSeekFree() + keyFreeList.GetSize();
1412 freeEntry.Set(firstFree, std::max(2000000000ULL, ((firstFree / 1000000000ULL) + 1) * 1000000000ULL));
1413 fFileSimple.WriteKey(&freeEntry, freeEntry.GetSize(), freeEntry.GetSize(),
1414 fFileSimple.fControlBlock->fHeader.GetSeekFree(), 100,
"", fFileName,
"");
1415 fFileSimple.fControlBlock->fHeader.SetNbytesFree(fFileSimple.fFilePos -
1416 fFileSimple.fControlBlock->fHeader.GetSeekFree());
1417 fFileSimple.fControlBlock->fHeader.SetEnd(fFileSimple.fFilePos);
1422 RTFString strRNTupleClass{
"ROOT::Experimental::RNTuple"};
1423 RTFString strRNTupleName{fNTupleName};
1426 RTFNTuple ntupleOnDisk(fNTupleAnchor);
1427 fFileSimple.fControlBlock->fSeekNTuple = fFileSimple.fFilePos;
1428 fFileSimple.WriteKey(&ntupleOnDisk, ntupleOnDisk.GetSize(), ntupleOnDisk.GetSize(),
1429 fFileSimple.fControlBlock->fSeekNTuple, 100,
"ROOT::Experimental::RNTuple", fNTupleName,
"");
1434 RTFString strTFile{
"TFile"};
1435 RTFString strFileName{fFileName};
1438 fFileSimple.fControlBlock->fHeader = RTFHeader(defaultCompression);
1443 RTFKey keyRoot(100, 0, strTFile, strFileName, strEmpty,
1444 sizeof(RTFFile) + strFileName.GetSize() + strEmpty.GetSize() + uuid.GetSize());
1445 std::uint32_t nbytesName = keyRoot.fKeyLen + strFileName.GetSize() + 1;
1446 fFileSimple.fControlBlock->fFileRecord.fNBytesName = nbytesName;
1447 fFileSimple.fControlBlock->fHeader.SetNbytesName(nbytesName);
1449 fFileSimple.Write(&keyRoot, keyRoot.fKeyHeaderSize, 100);
1450 fFileSimple.Write(&strTFile, strTFile.GetSize());
1451 fFileSimple.Write(&strFileName, strFileName.GetSize());
1452 fFileSimple.Write(&strEmpty, strEmpty.GetSize());
1453 fFileSimple.Write(&strFileName, strFileName.GetSize());
1454 fFileSimple.Write(&strEmpty, strEmpty.GetSize());
1456 fFileSimple.fControlBlock->fSeekFileRecord = fFileSimple.fFilePos;
1457 fFileSimple.Write(&fFileSimple.fControlBlock->fFileRecord, fFileSimple.fControlBlock->fFileRecord.GetSize());
1458 fFileSimple.Write(&uuid, uuid.GetSize());
1461 RUInt32BE padding{0};
1462 for (
int i = 0; i < 3; ++i)
1463 fFileSimple.Write(&padding,
sizeof(padding));
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
#define ROOT_VERSION_CODE
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 id
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 UChar_t len
Binding & operator=(OUT(*fun)(void))
void ReadBuffer(char *&buffer) override
Helper class to compress data blocks in the ROOT compression frame format.
size_t Zip(const void *from, size_t nbytes, int compression, Writer_t fnWriter)
Returns the size of the compressed data.
Helper class to uncompress data blocks in the ROOT compression frame format.
void Unzip(const void *from, size_t nbytes, size_t dataLen, void *to)
The nbytes parameter provides the size ls of the from buffer.
RResult< RFileNTupleAnchor > GetNTupleProper(std::string_view ntupleName)
Used when the file turns out to be a TFile container.
RResult< RFileNTupleAnchor > GetNTuple(std::string_view ntupleName)
Extracts header and footer location for the RNTuple identified by ntupleName.
RMiniFileReader()=default
void ReadBuffer(void *buffer, size_t nbytes, std::uint64_t offset)
Reads a given byte range from the file into the provided memory buffer.
RResult< RFileNTupleAnchor > GetNTupleBare(std::string_view ntupleName)
Used when the file container turns out to be a bare file.
Write RNTuple data blocks in a TFile or a bare file container.
std::uint64_t WriteBlob(const void *data, size_t nbytes, size_t len)
Writes a new record as an RBlob key into the file.
std::uint64_t WriteNTupleFooter(const void *data, size_t nbytes, size_t lenFooter)
Writes the compressed footer and registeres its location; lenFooter is the size of the uncompressed f...
void WriteTFileKeysList()
Write the TList with the RNTuple key.
void Commit()
Writes the RNTuple key to the file so that the header and footer keys can be found.
RFileSimple fFileSimple
For simple use cases, survives without libRIO dependency.
static RNTupleFileWriter * Append(std::string_view ntupleName, TFile &file)
Add a new RNTuple identified by ntupleName to the existing TFile.
void WriteTFileNTupleKey()
The only key that will be visible in file->ls()
void WriteTFileFreeList()
Last record in the file.
static RNTupleFileWriter * Recreate(std::string_view ntupleName, std::string_view path, int defaultCompression, ENTupleContainerFormat containerFormat)
Create or truncate the local file given by path with the new empty RNTuple identified by ntupleName.
RNTupleFileWriter(std::string_view name)
void WriteTFileSkeleton(int defaultCompression)
For a TFile container written by a C file stream, write the header and TFile object.
void WriteBareFileSkeleton(int defaultCompression)
For a bare file, which is necessarily written by a C file stream, write file header.
void WriteTFileStreamerInfo()
Write the compressed streamer info record with the description of the RNTuple class.
std::uint64_t WriteNTupleHeader(const void *data, size_t nbytes, size_t lenHeader)
Writes the compressed header and registeres its location; lenHeader is the size of the uncompressed h...
Representation of an RNTuple data set in a ROOT file.
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
The RRawFile provides read-only access to local and remote files.
A ROOT file is composed of a header, followed by consecutive data records (TKey instances) with a wel...
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
Book space in a file, create I/O buffers, to fill them, (un)compress them.
Int_t Sizeof() const override
Return the size in bytes of the key header structure.
Long64_t fSeekKey
Location of object on file.
virtual void Create(Int_t nbytes, TFile *f=nullptr)
Create a TKey object of specified size.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Entry point for an RNTuple in a ROOT file.
std::uint32_t fNBytesFooter
The size of the compressed ntuple footer.
std::int32_t fChecksum
The ROOT streamer info checksum.
std::uint64_t fSeekFooter
The file offset of the footer excluding the TKey part.
std::uint32_t fSize
Allows for skipping the struct.
std::uint32_t fNBytesHeader
The size of the compressed ntuple header.
std::uint32_t fLenFooter
The size of the uncompressed ntuple footer.
std::uint64_t fSeekHeader
The file offset of the header excluding the TKey part.
std::uint32_t fLenHeader
The size of the uncompressed ntuple header.
std::uint64_t fReserved
Currently unused, reserved for later use.
std::uint32_t fVersion
Allows for evolving the struct in future versions.
void Write(const void *buffer, size_t nbytes, std::int64_t offset)
Low-level writing using a TFile.
std::uint64_t WriteKey(const void *buffer, size_t nbytes, size_t len)
Writes an RBlob opaque key with the provided buffer as data record and returns the offset of the reco...
std::unique_ptr< ROOT::Experimental::Internal::RTFileControlBlock > fControlBlock
Keeps track of TFile control structures, which need to be updated on committing the data set.
void Write(const void *buffer, size_t nbytes, std::int64_t offset=-1)
Writes bytes in the open stream, either at fFilePos or at the given offset.
std::uint64_t WriteKey(const void *buffer, std::size_t nbytes, std::size_t len, std::int64_t offset=-1, std::uint64_t directoryOffset=100, const std::string &className="", const std::string &objectName="", const std::string &title="")
Writes a TKey including the data record, given by buffer, into fFile; returns the file offset to the ...
If a TFile container is written by a C stream (simple file), on dataset commit, the file header and t...
std::uint64_t fSeekNTuple
std::uint64_t fSeekFileRecord