Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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::RFieldBase> ROOT::RFieldZero::CloneImpl(std::string_view /*newName*/) const
35{
36 auto result = std::make_unique<RFieldZero>();
37 for (auto &f : fSubfields)
38 result->Attach(f->Clone(f->GetFieldName()));
39 return result;
40}
41
43{
44 visitor.VisitFieldZero(*this);
45}
46
47//------------------------------------------------------------------------------
48
58
63
65{
66 visitor.VisitCardinalityField(*this);
67}
68
73
78
79//------------------------------------------------------------------------------
80
81template class ROOT::RSimpleField<char>;
82
102
104{
105 visitor.VisitCharField(*this);
106}
107
108//------------------------------------------------------------------------------
109
110template class ROOT::RSimpleField<std::byte>;
111
113{
114 static RColumnRepresentations representations({{ENTupleColumnType::kByte}}, {});
115 return representations;
116}
117
119{
120 visitor.VisitByteField(*this);
121}
122
123//------------------------------------------------------------------------------
124
125template class ROOT::RSimpleField<int8_t>;
126
128{
129 static RColumnRepresentations representations({{ENTupleColumnType::kInt8}}, {{ENTupleColumnType::kChar},
144 return representations;
145}
146
148{
149 visitor.VisitInt8Field(*this);
150}
151
152//------------------------------------------------------------------------------
153
154template class ROOT::RSimpleField<uint8_t>;
155
157{
158 static RColumnRepresentations representations({{ENTupleColumnType::kUInt8}}, {{ENTupleColumnType::kChar},
173 return representations;
174}
175
177{
178 visitor.VisitUInt8Field(*this);
179}
180
181//------------------------------------------------------------------------------
182
183template class ROOT::RSimpleField<bool>;
184
204
206{
207 visitor.VisitBoolField(*this);
208}
209
210//------------------------------------------------------------------------------
211
212template class ROOT::RSimpleField<float>;
213
224
226{
227 visitor.VisitFloatField(*this);
228}
229
230//------------------------------------------------------------------------------
231
232template class ROOT::RSimpleField<double>;
233
246
248{
249 visitor.VisitDoubleField(*this);
250}
251
253{
254 fTypeAlias = "Double32_t";
255}
256
257//------------------------------------------------------------------------------
258
259template class ROOT::RSimpleField<int16_t>;
260
262{
278 return representations;
279}
280
282{
283 visitor.VisitInt16Field(*this);
284}
285
286//------------------------------------------------------------------------------
287
288template class ROOT::RSimpleField<uint16_t>;
289
291{
307 return representations;
308}
309
311{
312 visitor.VisitUInt16Field(*this);
313}
314
315//------------------------------------------------------------------------------
316
317template class ROOT::RSimpleField<int32_t>;
318
320{
336 return representations;
337}
338
340{
341 visitor.VisitInt32Field(*this);
342}
343
344//------------------------------------------------------------------------------
345
346template class ROOT::RSimpleField<uint32_t>;
347
349{
365 return representations;
366}
367
369{
370 visitor.VisitUInt32Field(*this);
371}
372
373//------------------------------------------------------------------------------
374
375template class ROOT::RSimpleField<uint64_t>;
376
378{
394 return representations;
395}
396
398{
399 visitor.VisitUInt64Field(*this);
400}
401
402//------------------------------------------------------------------------------
403
404template class ROOT::RSimpleField<int64_t>;
405
407{
423 return representations;
424}
425
427{
428 visitor.VisitInt64Field(*this);
429}
430
431//------------------------------------------------------------------------------
432
434{
439 {});
440 return representations;
441}
442
444{
446}
447
449{
451}
452
453std::size_t ROOT::RField<std::string>::AppendImpl(const void *from)
454{
455 auto typedValue = static_cast<const std::string *>(from);
456 auto length = typedValue->length();
457 fAuxiliaryColumn->AppendV(typedValue->data(), length);
458 fIndex += length;
459 fPrincipalColumn->Append(&fIndex);
460 return length + fPrincipalColumn->GetElement()->GetPackedSize();
461}
462
464{
465 auto typedValue = static_cast<std::string *>(to);
466 RNTupleLocalIndex collectionStart;
468 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nChars);
469 if (nChars == 0) {
470 typedValue->clear();
471 } else {
472 typedValue->resize(nChars);
473 fAuxiliaryColumn->ReadV(collectionStart, nChars, const_cast<char *>(typedValue->data()));
474 }
475}
476
478{
479 visitor.VisitStringField(*this);
480}
481
482//------------------------------------------------------------------------------
483
485 : ROOT::RFieldBase(name, source.GetTypeName(), ROOT::ENTupleStructure::kRecord, false /* isSimple */),
486 fMaxAlignment(source.fMaxAlignment),
488 fOffsets(source.fOffsets)
489{
490 for (const auto &f : source.GetConstSubfields())
491 Attach(f->Clone(f->GetFieldName()));
492 fTraits = source.fTraits;
493}
494
495ROOT::RRecordField::RRecordField(std::string_view fieldName, std::string_view typeName)
496 : ROOT::RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kRecord, false /* isSimple */)
497{
498}
499
500void ROOT::RRecordField::AttachItemFields(std::vector<std::unique_ptr<RFieldBase>> itemFields)
501{
502 fTraits |= kTraitTrivialType;
503 for (auto &item : itemFields) {
504 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
505 fSize += GetItemPadding(fSize, item->GetAlignment()) + item->GetValueSize();
506 fTraits &= item->GetTraits();
507 Attach(std::move(item));
508 }
509 // Trailing padding: although this is implementation-dependent, most add enough padding to comply with the
510 // requirements of the type with strictest alignment
511 fSize += GetItemPadding(fSize, fMaxAlignment);
512}
513
514std::unique_ptr<ROOT::RFieldBase>
515ROOT::Internal::CreateEmulatedField(std::string_view fieldName, std::vector<std::unique_ptr<RFieldBase>> itemFields,
516 std::string_view emulatedFromType)
517{
518 return std::unique_ptr<RFieldBase>(new RRecordField(fieldName, std::move(itemFields), emulatedFromType));
519}
520
521ROOT::RRecordField::RRecordField(std::string_view fieldName, std::vector<std::unique_ptr<RFieldBase>> itemFields,
522 std::string_view emulatedFromType)
524{
526 fOffsets.reserve(itemFields.size());
527 for (auto &item : itemFields) {
528 fSize += GetItemPadding(fSize, item->GetAlignment());
529 fOffsets.push_back(fSize);
530 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
531 fSize += item->GetValueSize();
532 fTraits &= item->GetTraits();
533 Attach(std::move(item));
534 }
536 // Trailing padding: although this is implementation-dependent, most add enough padding to comply with the
537 // requirements of the type with strictest alignment
539}
540
541ROOT::RRecordField::RRecordField(std::string_view fieldName, std::vector<std::unique_ptr<RFieldBase>> itemFields)
543{
544}
545
546std::size_t ROOT::RRecordField::GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
547{
548 if (itemAlignment > 1) {
549 auto remainder = baseOffset % itemAlignment;
550 if (remainder != 0)
551 return itemAlignment - remainder;
552 }
553 return 0;
554}
555
556std::unique_ptr<ROOT::RFieldBase> ROOT::RRecordField::CloneImpl(std::string_view newName) const
557{
558 return std::unique_ptr<RRecordField>(new RRecordField(newName, *this));
559}
560
561std::size_t ROOT::RRecordField::AppendImpl(const void *from)
562{
563 std::size_t nbytes = 0;
564 for (unsigned i = 0; i < fSubfields.size(); ++i) {
565 nbytes += CallAppendOn(*fSubfields[i], static_cast<const unsigned char *>(from) + fOffsets[i]);
566 }
567 return nbytes;
568}
569
571{
572 for (unsigned i = 0; i < fSubfields.size(); ++i) {
573 CallReadOn(*fSubfields[i], globalIndex, static_cast<unsigned char *>(to) + fOffsets[i]);
574 }
575}
576
578{
579 for (unsigned i = 0; i < fSubfields.size(); ++i) {
580 CallReadOn(*fSubfields[i], localIndex, static_cast<unsigned char *>(to) + fOffsets[i]);
581 }
582}
583
585{
586 for (unsigned i = 0; i < fSubfields.size(); ++i) {
587 CallConstructValueOn(*fSubfields[i], static_cast<unsigned char *>(where) + fOffsets[i]);
588 }
589}
590
592{
593 for (unsigned i = 0; i < fItemDeleters.size(); ++i) {
594 fItemDeleters[i]->operator()(reinterpret_cast<unsigned char *>(objPtr) + fOffsets[i], true /* dtorOnly */);
595 }
596 RDeleter::operator()(objPtr, dtorOnly);
597}
598
599std::unique_ptr<ROOT::RFieldBase::RDeleter> ROOT::RRecordField::GetDeleter() const
600{
601 std::vector<std::unique_ptr<RDeleter>> itemDeleters;
602 itemDeleters.reserve(fOffsets.size());
603 for (const auto &f : fSubfields) {
604 itemDeleters.emplace_back(GetDeleterOf(*f));
605 }
606 return std::make_unique<RRecordDeleter>(std::move(itemDeleters), fOffsets);
607}
608
609std::vector<ROOT::RFieldBase::RValue> ROOT::RRecordField::SplitValue(const RValue &value) const
610{
611 auto basePtr = value.GetPtr<unsigned char>().get();
612 std::vector<RValue> result;
613 result.reserve(fSubfields.size());
614 for (unsigned i = 0; i < fSubfields.size(); ++i) {
615 result.emplace_back(fSubfields[i]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), basePtr + fOffsets[i])));
616 }
617 return result;
618}
619
621{
622 visitor.VisitRecordField(*this);
623}
624
625//------------------------------------------------------------------------------
626
627ROOT::RBitsetField::RBitsetField(std::string_view fieldName, std::size_t N)
628 : ROOT::RFieldBase(fieldName, "std::bitset<" + std::to_string(N) + ">", ROOT::ENTupleStructure::kLeaf,
629 false /* isSimple */, N),
630 fN(N)
631{
633}
634
640
645
650
651std::size_t ROOT::RBitsetField::AppendImpl(const void *from)
652{
653 const auto *asULongArray = static_cast<const Word_t *>(from);
654 bool elementValue;
655 std::size_t i = 0;
656 for (std::size_t word = 0; word < (fN + kBitsPerWord - 1) / kBitsPerWord; ++word) {
657 for (std::size_t mask = 0; (mask < kBitsPerWord) && (i < fN); ++mask, ++i) {
658 elementValue = (asULongArray[word] & (static_cast<Word_t>(1) << mask)) != 0;
659 fPrincipalColumn->Append(&elementValue);
660 }
661 }
662 return fN;
663}
664
666{
667 auto *asULongArray = static_cast<Word_t *>(to);
668 bool elementValue;
669 for (std::size_t i = 0; i < fN; ++i) {
670 fPrincipalColumn->Read(globalIndex * fN + i, &elementValue);
671 Word_t mask = static_cast<Word_t>(1) << (i % kBitsPerWord);
672 Word_t bit = static_cast<Word_t>(elementValue) << (i % kBitsPerWord);
673 asULongArray[i / kBitsPerWord] = (asULongArray[i / kBitsPerWord] & ~mask) | bit;
674 }
675}
676
678{
679 auto *asULongArray = static_cast<Word_t *>(to);
680 bool elementValue;
681 for (std::size_t i = 0; i < fN; ++i) {
682 fPrincipalColumn->Read(RNTupleLocalIndex(localIndex.GetClusterId(), localIndex.GetIndexInCluster() * fN) + i,
683 &elementValue);
684 Word_t mask = static_cast<Word_t>(1) << (i % kBitsPerWord);
685 Word_t bit = static_cast<Word_t>(elementValue) << (i % kBitsPerWord);
686 asULongArray[i / kBitsPerWord] = (asULongArray[i / kBitsPerWord] & ~mask) | bit;
687 }
688}
689
691{
692 visitor.VisitBitsetField(*this);
693}
694
695//------------------------------------------------------------------------------
696
697ROOT::RNullableField::RNullableField(std::string_view fieldName, std::string_view typeName,
698 std::unique_ptr<RFieldBase> itemField)
699 : ROOT::RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kCollection, false /* isSimple */)
700{
701 Attach(std::move(itemField));
702}
703
713
718
723
725{
726 fPrincipalColumn->Append(&fNWritten);
727 return sizeof(ROOT::Internal::RColumnIndex);
728}
729
730std::size_t ROOT::RNullableField::AppendValue(const void *from)
731{
732 auto nbytesItem = CallAppendOn(*fSubfields[0], from);
733 fNWritten++;
734 fPrincipalColumn->Append(&fNWritten);
736}
737
745
747{
748 visitor.VisitNullableField(*this);
749}
750
751//------------------------------------------------------------------------------
752
753ROOT::RUniquePtrField::RUniquePtrField(std::string_view fieldName, std::string_view typeName,
754 std::unique_ptr<RFieldBase> itemField)
755 : RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubfields[0]))
756{
757}
758
759std::unique_ptr<ROOT::RFieldBase> ROOT::RUniquePtrField::CloneImpl(std::string_view newName) const
760{
761 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
762 return std::make_unique<RUniquePtrField>(newName, GetTypeName(), std::move(newItemField));
763}
764
765std::size_t ROOT::RUniquePtrField::AppendImpl(const void *from)
766{
767 auto typedValue = static_cast<const std::unique_ptr<char> *>(from);
768 if (*typedValue) {
769 return AppendValue(typedValue->get());
770 } else {
771 return AppendNull();
772 }
773}
774
776{
777 auto ptr = static_cast<std::unique_ptr<char> *>(to);
778 bool isValidValue = static_cast<bool>(*ptr);
779
780 auto itemIndex = GetItemIndex(globalIndex);
781 bool isValidItem = itemIndex.GetIndexInCluster() != ROOT::kInvalidNTupleIndex;
782
783 void *valuePtr = nullptr;
784 if (isValidValue)
785 valuePtr = ptr->get();
786
787 if (isValidValue && !isValidItem) {
788 ptr->release();
789 fItemDeleter->operator()(valuePtr, false /* dtorOnly */);
790 return;
791 }
792
793 if (!isValidItem) // On-disk value missing; nothing else to do
794 return;
795
796 if (!isValidValue) {
797 valuePtr = CallCreateObjectRawPtrOn(*fSubfields[0]);
798 ptr->reset(reinterpret_cast<char *>(valuePtr));
799 }
800
801 CallReadOn(*fSubfields[0], itemIndex, valuePtr);
802}
803
805{
806 auto typedPtr = static_cast<std::unique_ptr<char> *>(objPtr);
807 if (*typedPtr) {
808 fItemDeleter->operator()(typedPtr->get(), false /* dtorOnly */);
809 typedPtr->release();
810 }
811 RDeleter::operator()(objPtr, dtorOnly);
812}
813
814std::unique_ptr<ROOT::RFieldBase::RDeleter> ROOT::RUniquePtrField::GetDeleter() const
815{
816 return std::make_unique<RUniquePtrDeleter>(GetDeleterOf(*fSubfields[0]));
817}
818
819std::vector<ROOT::RFieldBase::RValue> ROOT::RUniquePtrField::SplitValue(const RValue &value) const
820{
821 std::vector<RValue> result;
822 const auto &ptr = value.GetRef<std::unique_ptr<char>>();
823 if (ptr) {
824 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), ptr.get())));
825 }
826 return result;
827}
828
829//------------------------------------------------------------------------------
830
831ROOT::ROptionalField::ROptionalField(std::string_view fieldName, std::string_view typeName,
832 std::unique_ptr<RFieldBase> itemField)
833 : RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubfields[0]))
834{
837}
838
840{
841 return reinterpret_cast<bool *>(reinterpret_cast<unsigned char *>(optionalPtr) + fSubfields[0]->GetValueSize());
842}
843
845{
846 return GetEngagementPtr(const_cast<void *>(optionalPtr));
847}
848
849std::unique_ptr<ROOT::RFieldBase> ROOT::ROptionalField::CloneImpl(std::string_view newName) const
850{
851 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
852 return std::make_unique<ROptionalField>(newName, GetTypeName(), std::move(newItemField));
853}
854
855std::size_t ROOT::ROptionalField::AppendImpl(const void *from)
856{
857 if (*GetEngagementPtr(from)) {
858 return AppendValue(from);
859 } else {
860 return AppendNull();
861 }
862}
863
865{
866 auto engagementPtr = GetEngagementPtr(to);
867 auto itemIndex = GetItemIndex(globalIndex);
868 if (itemIndex.GetIndexInCluster() == ROOT::kInvalidNTupleIndex) {
869 if (*engagementPtr && !(fSubfields[0]->GetTraits() & kTraitTriviallyDestructible))
870 fItemDeleter->operator()(to, true /* dtorOnly */);
871 *engagementPtr = false;
872 } else {
873 if (!(*engagementPtr) && !(fSubfields[0]->GetTraits() & kTraitTriviallyConstructible))
874 CallConstructValueOn(*fSubfields[0], to);
875 CallReadOn(*fSubfields[0], itemIndex, to);
876 *engagementPtr = true;
877 }
878}
879
881{
882 *GetEngagementPtr(where) = false;
883}
884
886{
887 if (fItemDeleter) {
888 auto engagementPtr = reinterpret_cast<bool *>(reinterpret_cast<unsigned char *>(objPtr) + fEngagementPtrOffset);
889 if (*engagementPtr)
890 fItemDeleter->operator()(objPtr, true /* dtorOnly */);
891 }
892 RDeleter::operator()(objPtr, dtorOnly);
893}
894
895std::unique_ptr<ROOT::RFieldBase::RDeleter> ROOT::ROptionalField::GetDeleter() const
896{
897 return std::make_unique<ROptionalDeleter>(
898 (fSubfields[0]->GetTraits() & kTraitTriviallyDestructible) ? nullptr : GetDeleterOf(*fSubfields[0]),
899 fSubfields[0]->GetValueSize());
900}
901
902std::vector<ROOT::RFieldBase::RValue> ROOT::ROptionalField::SplitValue(const RValue &value) const
903{
904 std::vector<RValue> result;
905 const auto valuePtr = value.GetPtr<void>().get();
906 if (*GetEngagementPtr(valuePtr)) {
907 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), valuePtr)));
908 }
909 return result;
910}
911
913{
914 const auto alignment = GetAlignment();
915 // real size is the sum of the value size and the engagement boolean
916 const auto actualSize = fSubfields[0]->GetValueSize() + sizeof(bool);
917 auto padding = 0;
918 if (alignment > 1) {
919 auto remainder = actualSize % alignment;
920 if (remainder != 0)
921 padding = alignment - remainder;
922 }
923 return actualSize + padding;
924}
925
927{
928 return fSubfields[0]->GetAlignment();
929}
930
931//------------------------------------------------------------------------------
932
933ROOT::RAtomicField::RAtomicField(std::string_view fieldName, std::string_view typeName,
934 std::unique_ptr<RFieldBase> itemField)
935 : RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kLeaf, false /* isSimple */)
936{
937 if (itemField->GetTraits() & kTraitTriviallyConstructible)
939 if (itemField->GetTraits() & kTraitTriviallyDestructible)
941 Attach(std::move(itemField));
942}
943
944std::unique_ptr<ROOT::RFieldBase> ROOT::RAtomicField::CloneImpl(std::string_view newName) const
945{
946 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
947 return std::make_unique<RAtomicField>(newName, GetTypeName(), std::move(newItemField));
948}
949
950std::vector<ROOT::RFieldBase::RValue> ROOT::RAtomicField::SplitValue(const RValue &value) const
951{
952 std::vector<RValue> result;
953 result.emplace_back(fSubfields[0]->BindValue(value.GetPtr<void>()));
954 return result;
955}
956
958{
959 visitor.VisitAtomicField(*this);
960}
dim_t fSize
#define f(i)
Definition RSha256.hxx:104
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#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.
The in-memory representation of a 32bit or 64bit on-disk index column.
RAtomicField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:933
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:957
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:944
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Definition RField.cxx:950
RBitsetField(std::string_view fieldName, std::size_t N)
Definition RField.cxx:627
unsigned long Word_t
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.cxx:677
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.cxx:641
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:665
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:651
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:635
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:690
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:64
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:49
const RField< RNTupleCardinality< std::uint32_t > > * As32Bit() const
Definition RField.cxx:69
const RField< RNTupleCardinality< std::uint64_t > > * As64Bit() const
Definition RField.cxx:74
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.hxx:340
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
The list of column representations a field can have.
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.
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
std::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponding to the field type ...
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
@ kTraitEmulatedField
This field is a user defined type that was missing dictionaries and was reconstructed from the on-dis...
@ kTraitTrivialType
Shorthand for types that are both trivially constructible and destructible.
@ kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. the destructor performs a no-op.
@ kTraitTriviallyConstructible
No constructor needs to be called, i.e.
std::uint32_t GetTraits() const
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:42
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:34
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:292
The on-storage metadata of an RNTuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Template specializations for C++ std::optional and std::unique_ptr.
std::size_t AppendNull()
Definition RField.cxx:724
RNTupleLocalIndex GetItemIndex(ROOT::NTupleSize_t globalIndex)
Given the index of the nullable field, returns the corresponding global index of the subfield or,...
Definition RField.cxx:738
RNullableField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:697
std::size_t AppendValue(const void *from)
Definition RField.cxx:730
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.cxx:714
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:746
const RFieldBase::RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:704
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:885
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:880
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.cxx:926
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:895
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:849
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:844
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:864
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:855
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Definition RField.cxx:902
ROptionalField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:831
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.cxx:912
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:591
The field for an untyped record.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Definition RField.cxx:609
std::size_t fMaxAlignment
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:556
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.cxx:577
RRecordField(std::string_view name, const RRecordField &source)
Definition RField.cxx:484
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:620
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:599
void AttachItemFields(std::vector< std::unique_ptr< RFieldBase > > itemFields)
Definition RField.cxx:500
std::size_t GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
Definition RField.cxx:546
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:570
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:584
std::vector< std::size_t > fOffsets
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:561
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:804
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Definition RField.cxx:819
RUniquePtrField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:753
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:814
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:775
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:759
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:765
std::unique_ptr< RFieldBase > CreateEmulatedField(std::string_view fieldName, std::vector< std::unique_ptr< RFieldBase > > itemFields, std::string_view emulatedFromType)
Definition RField.cxx:515
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.