Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RField.cxx
Go to the documentation of this file.
1/// \file RField.cxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-15
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#include <ROOT/RColumn.hxx>
17#include <ROOT/REntry.hxx>
18#include <ROOT/RError.hxx>
19#include <ROOT/RField.hxx>
21#include <ROOT/RLogger.hxx>
22#include <ROOT/RNTupleModel.hxx>
24#include <ROOT/RNTupleUtil.hxx>
25
26#include <algorithm>
27#include <cstdint>
28#include <exception>
29#include <functional>
30#include <iostream>
31#include <memory>
32#include <type_traits>
33
34std::unique_ptr<ROOT::Experimental::RFieldBase>
35ROOT::Experimental::RFieldZero::CloneImpl(std::string_view /*newName*/) const
36{
37 auto result = std::make_unique<RFieldZero>();
38 for (auto &f : fSubFields)
39 result->Attach(f->Clone(f->GetFieldName()));
40 return result;
41}
42
44{
45 visitor.VisitFieldZero(*this);
46}
47
48//------------------------------------------------------------------------------
49
52{
53 static RColumnRepresentations representations(
55 {});
56 return representations;
57}
58
60{
61 GenerateColumnsImpl<ClusterSize_t>(desc);
62}
63
65{
66 visitor.VisitCardinalityField(*this);
67}
68
71{
72 return dynamic_cast<const RField<RNTupleCardinality<std::uint32_t>> *>(this);
73}
74
77{
78 return dynamic_cast<const RField<RNTupleCardinality<std::uint64_t>> *>(this);
79}
80
81//------------------------------------------------------------------------------
82
84
87{
103 return representations;
104}
105
107{
108 visitor.VisitCharField(*this);
109}
110
111//------------------------------------------------------------------------------
112
114
117{
118 static RColumnRepresentations representations({{EColumnType::kByte}}, {});
119 return representations;
120}
121
122void ROOT::Experimental::RField<std::byte>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
123{
124 visitor.VisitByteField(*this);
125}
126
127//------------------------------------------------------------------------------
128
130
133{
134 static RColumnRepresentations representations({{EColumnType::kInt8}}, {{EColumnType::kChar},
149 return representations;
150}
151
152void ROOT::Experimental::RIntegralField<std::int8_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
153{
154 visitor.VisitInt8Field(*this);
155}
156
157//------------------------------------------------------------------------------
158
160
163{
164 static RColumnRepresentations representations({{EColumnType::kUInt8}}, {{EColumnType::kChar},
179 return representations;
180}
181
182void ROOT::Experimental::RIntegralField<std::uint8_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
183{
184 visitor.VisitUInt8Field(*this);
185}
186
187//------------------------------------------------------------------------------
188
190
193{
194 static RColumnRepresentations representations({{EColumnType::kBit}}, {{EColumnType::kChar},
209 return representations;
210}
211
213{
214 visitor.VisitBoolField(*this);
215}
216
217//------------------------------------------------------------------------------
218
220
223{
224 static RColumnRepresentations representations({{EColumnType::kSplitReal32},
230 return representations;
231}
232
234{
235 visitor.VisitFloatField(*this);
236}
237
238//------------------------------------------------------------------------------
239
241
244{
245 static RColumnRepresentations representations({{EColumnType::kSplitReal64},
252 {});
253 return representations;
254}
255
257{
258 visitor.VisitDoubleField(*this);
259}
260
262{
263 fTypeAlias = "Double32_t";
264}
265
266//------------------------------------------------------------------------------
267
269
272{
273 static RColumnRepresentations representations({{EColumnType::kSplitInt16}, {EColumnType::kInt16}},
288 return representations;
289}
290
291void ROOT::Experimental::RIntegralField<std::int16_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
292{
293 visitor.VisitInt16Field(*this);
294}
295
296//------------------------------------------------------------------------------
297
299
302{
303 static RColumnRepresentations representations({{EColumnType::kSplitUInt16}, {EColumnType::kUInt16}},
318 return representations;
319}
320
321void ROOT::Experimental::RIntegralField<std::uint16_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
322{
323 visitor.VisitUInt16Field(*this);
324}
325
326//------------------------------------------------------------------------------
327
329
332{
333 static RColumnRepresentations representations({{EColumnType::kSplitInt32}, {EColumnType::kInt32}},
348 return representations;
349}
350
351void ROOT::Experimental::RIntegralField<std::int32_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
352{
353 visitor.VisitInt32Field(*this);
354}
355
356//------------------------------------------------------------------------------
357
359
362{
363 static RColumnRepresentations representations({{EColumnType::kSplitUInt32}, {EColumnType::kUInt32}},
378 return representations;
379}
380
381void ROOT::Experimental::RIntegralField<std::uint32_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
382{
383 visitor.VisitUInt32Field(*this);
384}
385
386//------------------------------------------------------------------------------
387
389
392{
393 static RColumnRepresentations representations({{EColumnType::kSplitUInt64}, {EColumnType::kUInt64}},
408 return representations;
409}
410
411void ROOT::Experimental::RIntegralField<std::uint64_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
412{
413 visitor.VisitUInt64Field(*this);
414}
415
416//------------------------------------------------------------------------------
417
419
422{
423 static RColumnRepresentations representations({{EColumnType::kSplitInt64}, {EColumnType::kInt64}},
438 return representations;
439}
440
441void ROOT::Experimental::RIntegralField<std::int64_t>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
442{
443 visitor.VisitInt64Field(*this);
444}
445
446//------------------------------------------------------------------------------
447
450{
451 static RColumnRepresentations representations({{EColumnType::kSplitIndex64, EColumnType::kChar},
455 {});
456 return representations;
457}
458
460{
461 GenerateColumnsImpl<ClusterSize_t, char>();
462}
463
464void ROOT::Experimental::RField<std::string>::GenerateColumns(const RNTupleDescriptor &desc)
465{
466 GenerateColumnsImpl<ClusterSize_t, char>(desc);
467}
468
469std::size_t ROOT::Experimental::RField<std::string>::AppendImpl(const void *from)
470{
471 auto typedValue = static_cast<const std::string *>(from);
472 auto length = typedValue->length();
473 fAuxiliaryColumn->AppendV(typedValue->data(), length);
474 fIndex += length;
475 fPrincipalColumn->Append(&fIndex);
476 return length + fPrincipalColumn->GetElement()->GetPackedSize();
477}
478
480{
481 auto typedValue = static_cast<std::string *>(to);
482 RClusterIndex collectionStart;
483 ClusterSize_t nChars;
484 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nChars);
485 if (nChars == 0) {
486 typedValue->clear();
487 } else {
488 typedValue->resize(nChars);
489 fAuxiliaryColumn->ReadV(collectionStart, nChars, const_cast<char *>(typedValue->data()));
490 }
491}
492
493void ROOT::Experimental::RField<std::string>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
494{
495 visitor.VisitStringField(*this);
496}
497
498//------------------------------------------------------------------------------
499
501 : ROOT::Experimental::RFieldBase(name, source.GetTypeName(), ENTupleStructure::kRecord, false /* isSimple */),
502 fMaxAlignment(source.fMaxAlignment),
503 fSize(source.fSize),
504 fOffsets(source.fOffsets)
505{
506 for (const auto &f : source.GetSubFields())
507 Attach(f->Clone(f->GetFieldName()));
508 fTraits = source.fTraits;
509}
510
511ROOT::Experimental::RRecordField::RRecordField(std::string_view fieldName, std::string_view typeName)
512 : ROOT::Experimental::RFieldBase(fieldName, typeName, ENTupleStructure::kRecord, false /* isSimple */)
513{
514}
515
516void ROOT::Experimental::RRecordField::RRecordField::AttachItemFields(
517 std::vector<std::unique_ptr<RFieldBase>> itemFields)
518{
519 fTraits |= kTraitTrivialType;
520 for (auto &item : itemFields) {
521 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
522 fSize += GetItemPadding(fSize, item->GetAlignment()) + item->GetValueSize();
523 fTraits &= item->GetTraits();
524 Attach(std::move(item));
525 }
526 // Trailing padding: although this is implementation-dependent, most add enough padding to comply with the
527 // requirements of the type with strictest alignment
528 fSize += GetItemPadding(fSize, fMaxAlignment);
529}
530
532 std::vector<std::unique_ptr<RFieldBase>> itemFields)
533 : ROOT::Experimental::RFieldBase(fieldName, "", ENTupleStructure::kRecord, false /* isSimple */)
534{
536 fOffsets.reserve(itemFields.size());
537 for (auto &item : itemFields) {
538 fSize += GetItemPadding(fSize, item->GetAlignment());
539 fOffsets.push_back(fSize);
540 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
541 fSize += item->GetValueSize();
542 fTraits &= item->GetTraits();
543 Attach(std::move(item));
544 }
545 // Trailing padding: although this is implementation-dependent, most add enough padding to comply with the
546 // requirements of the type with strictest alignment
548}
549
550std::size_t ROOT::Experimental::RRecordField::GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
551{
552 if (itemAlignment > 1) {
553 auto remainder = baseOffset % itemAlignment;
554 if (remainder != 0)
555 return itemAlignment - remainder;
556 }
557 return 0;
558}
559
560std::unique_ptr<ROOT::Experimental::RFieldBase>
561ROOT::Experimental::RRecordField::CloneImpl(std::string_view newName) const
562{
563 return std::unique_ptr<RRecordField>(new RRecordField(newName, *this));
564}
565
567{
568 std::size_t nbytes = 0;
569 for (unsigned i = 0; i < fSubFields.size(); ++i) {
570 nbytes += CallAppendOn(*fSubFields[i], static_cast<const unsigned char *>(from) + fOffsets[i]);
571 }
572 return nbytes;
573}
574
576{
577 for (unsigned i = 0; i < fSubFields.size(); ++i) {
578 CallReadOn(*fSubFields[i], globalIndex, static_cast<unsigned char *>(to) + fOffsets[i]);
579 }
580}
581
583{
584 for (unsigned i = 0; i < fSubFields.size(); ++i) {
585 CallReadOn(*fSubFields[i], clusterIndex, static_cast<unsigned char *>(to) + fOffsets[i]);
586 }
587}
588
590{
591 for (unsigned i = 0; i < fSubFields.size(); ++i) {
592 CallConstructValueOn(*fSubFields[i], static_cast<unsigned char *>(where) + fOffsets[i]);
593 }
594}
595
597{
598 for (unsigned i = 0; i < fItemDeleters.size(); ++i) {
599 fItemDeleters[i]->operator()(reinterpret_cast<unsigned char *>(objPtr) + fOffsets[i], true /* dtorOnly */);
600 }
601 RDeleter::operator()(objPtr, dtorOnly);
602}
603
604std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter> ROOT::Experimental::RRecordField::GetDeleter() const
605{
606 std::vector<std::unique_ptr<RDeleter>> itemDeleters;
607 itemDeleters.reserve(fOffsets.size());
608 for (const auto &f : fSubFields) {
609 itemDeleters.emplace_back(GetDeleterOf(*f));
610 }
611 return std::make_unique<RRecordDeleter>(std::move(itemDeleters), fOffsets);
612}
613
614std::vector<ROOT::Experimental::RFieldBase::RValue>
616{
617 auto basePtr = value.GetPtr<unsigned char>().get();
618 std::vector<RValue> result;
619 result.reserve(fSubFields.size());
620 for (unsigned i = 0; i < fSubFields.size(); ++i) {
621 result.emplace_back(fSubFields[i]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), basePtr + fOffsets[i])));
622 }
623 return result;
624}
625
627{
628 visitor.VisitRecordField(*this);
629}
630
631//------------------------------------------------------------------------------
632
633ROOT::Experimental::RBitsetField::RBitsetField(std::string_view fieldName, std::size_t N)
634 : ROOT::Experimental::RFieldBase(fieldName, "std::bitset<" + std::to_string(N) + ">", ENTupleStructure::kLeaf,
635 false /* isSimple */, N),
636 fN(N)
637{
639}
640
643{
644 static RColumnRepresentations representations({{EColumnType::kBit}}, {});
645 return representations;
646}
647
649{
650 GenerateColumnsImpl<bool>();
651}
652
654{
655 GenerateColumnsImpl<bool>(desc);
656}
657
659{
660 const auto *asULongArray = static_cast<const Word_t *>(from);
661 bool elementValue;
662 std::size_t i = 0;
663 for (std::size_t word = 0; word < (fN + kBitsPerWord - 1) / kBitsPerWord; ++word) {
664 for (std::size_t mask = 0; (mask < kBitsPerWord) && (i < fN); ++mask, ++i) {
665 elementValue = (asULongArray[word] & (static_cast<Word_t>(1) << mask)) != 0;
666 fPrincipalColumn->Append(&elementValue);
667 }
668 }
669 return fN;
670}
671
673{
674 auto *asULongArray = static_cast<Word_t *>(to);
675 bool elementValue;
676 for (std::size_t i = 0; i < fN; ++i) {
677 fPrincipalColumn->Read(globalIndex * fN + i, &elementValue);
678 Word_t mask = static_cast<Word_t>(1) << (i % kBitsPerWord);
679 Word_t bit = static_cast<Word_t>(elementValue) << (i % kBitsPerWord);
680 asULongArray[i / kBitsPerWord] = (asULongArray[i / kBitsPerWord] & ~mask) | bit;
681 }
682}
683
685{
686 auto *asULongArray = static_cast<Word_t *>(to);
687 bool elementValue;
688 for (std::size_t i = 0; i < fN; ++i) {
689 fPrincipalColumn->Read(RClusterIndex(clusterIndex.GetClusterId(), clusterIndex.GetIndex() * fN) + i,
690 &elementValue);
691 Word_t mask = static_cast<Word_t>(1) << (i % kBitsPerWord);
692 Word_t bit = static_cast<Word_t>(elementValue) << (i % kBitsPerWord);
693 asULongArray[i / kBitsPerWord] = (asULongArray[i / kBitsPerWord] & ~mask) | bit;
694 }
695}
696
698{
699 visitor.VisitBitsetField(*this);
700}
701
702//------------------------------------------------------------------------------
703
704ROOT::Experimental::RNullableField::RNullableField(std::string_view fieldName, std::string_view typeName,
705 std::unique_ptr<RFieldBase> itemField)
706 : ROOT::Experimental::RFieldBase(fieldName, typeName, ENTupleStructure::kCollection, false /* isSimple */)
707{
708 Attach(std::move(itemField));
709}
710
713{
714 static RColumnRepresentations representations(
716 {});
717 return representations;
718}
719
721{
722 GenerateColumnsImpl<ClusterSize_t>();
723}
724
726{
727 GenerateColumnsImpl<ClusterSize_t>(desc);
728}
729
731{
732 fPrincipalColumn->Append(&fNWritten);
733 return sizeof(ClusterSize_t);
734}
735
737{
738 auto nbytesItem = CallAppendOn(*fSubFields[0], from);
739 fNWritten++;
740 fPrincipalColumn->Append(&fNWritten);
741 return sizeof(ClusterSize_t) + nbytesItem;
742}
743
745{
746 RClusterIndex collectionStart;
747 ClusterSize_t collectionSize;
748 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &collectionSize);
749 return (collectionSize == 0) ? RClusterIndex() : collectionStart;
750}
751
753{
754 visitor.VisitNullableField(*this);
755}
756
757//------------------------------------------------------------------------------
758
759ROOT::Experimental::RUniquePtrField::RUniquePtrField(std::string_view fieldName, std::string_view typeName,
760 std::unique_ptr<RFieldBase> itemField)
761 : RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubFields[0]))
762{
763}
764
765std::unique_ptr<ROOT::Experimental::RFieldBase>
767{
768 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
769 return std::make_unique<RUniquePtrField>(newName, GetTypeName(), std::move(newItemField));
770}
771
773{
774 auto typedValue = static_cast<const std::unique_ptr<char> *>(from);
775 if (*typedValue) {
776 return AppendValue(typedValue->get());
777 } else {
778 return AppendNull();
779 }
780}
781
783{
784 auto ptr = static_cast<std::unique_ptr<char> *>(to);
785 bool isValidValue = static_cast<bool>(*ptr);
786
787 auto itemIndex = GetItemIndex(globalIndex);
788 bool isValidItem = itemIndex.GetIndex() != kInvalidClusterIndex;
789
790 void *valuePtr = nullptr;
791 if (isValidValue)
792 valuePtr = ptr->get();
793
794 if (isValidValue && !isValidItem) {
795 ptr->release();
796 fItemDeleter->operator()(valuePtr, false /* dtorOnly */);
797 return;
798 }
799
800 if (!isValidItem) // On-disk value missing; nothing else to do
801 return;
802
803 if (!isValidValue) {
804 valuePtr = CallCreateObjectRawPtrOn(*fSubFields[0]);
805 ptr->reset(reinterpret_cast<char *>(valuePtr));
806 }
807
808 CallReadOn(*fSubFields[0], itemIndex, valuePtr);
809}
810
812{
813 auto typedPtr = static_cast<std::unique_ptr<char> *>(objPtr);
814 if (*typedPtr) {
815 fItemDeleter->operator()(typedPtr->get(), false /* dtorOnly */);
816 typedPtr->release();
817 }
818 RDeleter::operator()(objPtr, dtorOnly);
819}
820
821std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter> ROOT::Experimental::RUniquePtrField::GetDeleter() const
822{
823 return std::make_unique<RUniquePtrDeleter>(GetDeleterOf(*fSubFields[0]));
824}
825
826std::vector<ROOT::Experimental::RFieldBase::RValue>
828{
829 std::vector<RValue> result;
830 const auto &ptr = value.GetRef<std::unique_ptr<char>>();
831 if (ptr) {
832 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), ptr.get())));
833 }
834 return result;
835}
836
837//------------------------------------------------------------------------------
838
839ROOT::Experimental::ROptionalField::ROptionalField(std::string_view fieldName, std::string_view typeName,
840 std::unique_ptr<RFieldBase> itemField)
841 : RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubFields[0]))
842{
845}
846
848{
849 return reinterpret_cast<bool *>(reinterpret_cast<unsigned char *>(optionalPtr) + fSubFields[0]->GetValueSize());
850}
851
852const bool *ROOT::Experimental::ROptionalField::GetEngagementPtr(const void *optionalPtr) const
853{
854 return GetEngagementPtr(const_cast<void *>(optionalPtr));
855}
856
857std::unique_ptr<ROOT::Experimental::RFieldBase>
859{
860 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
861 return std::make_unique<ROptionalField>(newName, GetTypeName(), std::move(newItemField));
862}
863
865{
866 if (*GetEngagementPtr(from)) {
867 return AppendValue(from);
868 } else {
869 return AppendNull();
870 }
871}
872
874{
875 auto engagementPtr = GetEngagementPtr(to);
876 auto itemIndex = GetItemIndex(globalIndex);
877 if (itemIndex.GetIndex() == kInvalidClusterIndex) {
878 if (*engagementPtr && !(fSubFields[0]->GetTraits() & kTraitTriviallyDestructible))
879 fItemDeleter->operator()(to, true /* dtorOnly */);
880 *engagementPtr = false;
881 } else {
882 if (!(*engagementPtr) && !(fSubFields[0]->GetTraits() & kTraitTriviallyConstructible))
883 CallConstructValueOn(*fSubFields[0], to);
884 CallReadOn(*fSubFields[0], itemIndex, to);
885 *engagementPtr = true;
886 }
887}
888
890{
891 *GetEngagementPtr(where) = false;
892}
893
895{
896 if (fItemDeleter) {
897 auto engagementPtr = reinterpret_cast<bool *>(reinterpret_cast<unsigned char *>(objPtr) + fEngagementPtrOffset);
898 if (*engagementPtr)
899 fItemDeleter->operator()(objPtr, true /* dtorOnly */);
900 }
901 RDeleter::operator()(objPtr, dtorOnly);
902}
903
904std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter> ROOT::Experimental::ROptionalField::GetDeleter() const
905{
906 return std::make_unique<ROptionalDeleter>(
907 (fSubFields[0]->GetTraits() & kTraitTriviallyDestructible) ? nullptr : GetDeleterOf(*fSubFields[0]),
908 fSubFields[0]->GetValueSize());
909}
910
911std::vector<ROOT::Experimental::RFieldBase::RValue>
913{
914 std::vector<RValue> result;
915 const auto valuePtr = value.GetPtr<void>().get();
916 if (*GetEngagementPtr(valuePtr)) {
917 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), valuePtr)));
918 }
919 return result;
920}
921
923{
924 const auto alignment = GetAlignment();
925 // real size is the sum of the value size and the engagement boolean
926 const auto actualSize = fSubFields[0]->GetValueSize() + sizeof(bool);
927 auto padding = 0;
928 if (alignment > 1) {
929 auto remainder = actualSize % alignment;
930 if (remainder != 0)
931 padding = alignment - remainder;
932 }
933 return actualSize + padding;
934}
935
937{
938 return fSubFields[0]->GetAlignment();
939}
940
941//------------------------------------------------------------------------------
942
943ROOT::Experimental::RAtomicField::RAtomicField(std::string_view fieldName, std::string_view typeName,
944 std::unique_ptr<RFieldBase> itemField)
945 : RFieldBase(fieldName, typeName, ENTupleStructure::kLeaf, false /* isSimple */)
946{
947 if (itemField->GetTraits() & kTraitTriviallyConstructible)
949 if (itemField->GetTraits() & kTraitTriviallyDestructible)
951 Attach(std::move(itemField));
952}
953
954std::unique_ptr<ROOT::Experimental::RFieldBase>
955ROOT::Experimental::RAtomicField::CloneImpl(std::string_view newName) const
956{
957 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
958 return std::make_unique<RAtomicField>(newName, GetTypeName(), std::move(newItemField));
959}
960
961std::vector<ROOT::Experimental::RFieldBase::RValue>
963{
964 std::vector<RValue> result;
965 result.emplace_back(fSubFields[0]->BindValue(value.GetPtr<void>()));
966 return result;
967}
968
970{
971 visitor.VisitAtomicField(*this);
972}
dim_t fSize
#define f(i)
Definition RSha256.hxx:104
#define N
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 mask
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 value
char name[80]
Definition TGX11.cxx:110
TCanvas * alignment()
Definition alignment.C:1
Abstract base class for classes implementing the visitor design pattern.
virtual void VisitBoolField(const RField< bool > &field)
virtual void VisitBitsetField(const RBitsetField &field)
virtual void VisitNullableField(const RNullableField &field)
virtual void VisitFieldZero(const RFieldZero &field)
virtual void VisitCardinalityField(const RCardinalityField &field)
virtual void VisitDoubleField(const RField< double > &field)
virtual void VisitCharField(const RField< char > &field)
virtual void VisitRecordField(const RRecordField &field)
virtual void VisitFloatField(const RField< float > &field)
virtual void VisitAtomicField(const RAtomicField &field)
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:955
RAtomicField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:943
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Definition RField.cxx:962
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:969
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:658
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:672
RBitsetField(std::string_view fieldName, std::size_t N)
Definition RField.cxx:633
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.cxx:648
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:642
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:697
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Definition RField.cxx:684
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:51
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:290
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:64
const RField< RNTupleCardinality< std::uint32_t > > * As32Bit() const
Definition RField.cxx:70
const RField< RNTupleCardinality< std::uint64_t > > * As64Bit() const
Definition RField.cxx:76
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
DescriptorId_t GetClusterId() const
ClusterSize_t::ValueType GetIndex() const
Some fields have multiple possible column representations, e.g.
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
A field translates read and write calls from/to underlying columns to/from tree values.
static constexpr int kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. the destructor performs a no-op.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponsing to the field type ...
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
std::vector< RFieldBase * > GetSubFields()
static constexpr int kTraitTriviallyConstructible
No constructor needs to be called, i.e.
int fTraits
Properties of the type that allow for optimizations of collections of that type.
std::unique_ptr< RFieldBase > Clone(std::string_view newName) const
Copies the field and its sub fields using a possibly new name and a new, unconnected set of columns.
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
static constexpr int kTraitTrivialType
Shorthand for types that are both trivially constructible and destructible.
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:43
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:35
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:242
The on-storage meta-data of an ntuple.
Template specializations for C++ std::optional and std::unique_ptr.
const RFieldBase::RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:712
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.cxx:720
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:752
RClusterIndex GetItemIndex(NTupleSize_t globalIndex)
Given the index of the nullable field, returns the corresponding global index of the subfield or,...
Definition RField.cxx:744
RNullableField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:704
std::size_t AppendValue(const void *from)
Definition RField.cxx:736
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:894
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:873
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.cxx:889
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:904
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.cxx:936
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:864
const bool * GetEngagementPtr(const void *optionalPtr) const
Given a pointer to an std::optional<T> in optionalPtr, extract a pointer to the engagement boolean.
Definition RField.cxx:852
ROptionalField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:839
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.cxx:922
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:858
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Definition RField.cxx:912
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:596
The field for an untyped record.
std::vector< std::size_t > fOffsets
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:561
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Definition RField.cxx:582
RRecordField(std::string_view name, const RRecordField &source)
Definition RField.cxx:500
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:575
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Definition RField.cxx:615
std::size_t GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
Definition RField.cxx:550
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:604
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:566
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:626
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.cxx:589
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:811
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:766
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:782
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Definition RField.cxx:827
RUniquePtrField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:759
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:821
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:772
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
RClusterSize ClusterSize_t
constexpr ClusterSize_t kInvalidClusterIndex(std::uint64_t(-1))
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.