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
47
48//------------------------------------------------------------------------------
49
60
65
70
76
82
83//------------------------------------------------------------------------------
84
86
107
112
113//------------------------------------------------------------------------------
114
116
119{
120 static RColumnRepresentations representations({{ENTupleColumnType::kByte}}, {});
121 return representations;
122}
123
124void ROOT::Experimental::RField<std::byte>::AcceptVisitor(Detail::RFieldVisitor &visitor) const
125{
126 visitor.VisitByteField(*this);
127}
128
129//------------------------------------------------------------------------------
130
132
135{
136 static RColumnRepresentations representations({{ENTupleColumnType::kInt8}}, {{ENTupleColumnType::kChar},
151 return representations;
152}
153
155{
156 visitor.VisitInt8Field(*this);
157}
158
159//------------------------------------------------------------------------------
160
162
165{
166 static RColumnRepresentations representations({{ENTupleColumnType::kUInt8}}, {{ENTupleColumnType::kChar},
181 return representations;
182}
183
185{
186 visitor.VisitUInt8Field(*this);
187}
188
189//------------------------------------------------------------------------------
190
192
213
218
219//------------------------------------------------------------------------------
220
222
234
239
240//------------------------------------------------------------------------------
241
243
257
262
264{
265 fTypeAlias = "Double32_t";
266}
267
268//------------------------------------------------------------------------------
269
271
274{
290 return representations;
291}
292
294{
295 visitor.VisitInt16Field(*this);
296}
297
298//------------------------------------------------------------------------------
299
301
304{
320 return representations;
321}
322
324{
325 visitor.VisitUInt16Field(*this);
326}
327
328//------------------------------------------------------------------------------
329
331
334{
350 return representations;
351}
352
354{
355 visitor.VisitInt32Field(*this);
356}
357
358//------------------------------------------------------------------------------
359
361
364{
380 return representations;
381}
382
384{
385 visitor.VisitUInt32Field(*this);
386}
387
388//------------------------------------------------------------------------------
389
391
394{
410 return representations;
411}
412
414{
415 visitor.VisitUInt64Field(*this);
416}
417
418//------------------------------------------------------------------------------
419
421
424{
440 return representations;
441}
442
444{
445 visitor.VisitInt64Field(*this);
446}
447
448//------------------------------------------------------------------------------
449
452{
457 {});
458 return representations;
459}
460
462{
464}
465
466void ROOT::Experimental::RField<std::string>::GenerateColumns(const RNTupleDescriptor &desc)
467{
469}
470
471std::size_t ROOT::Experimental::RField<std::string>::AppendImpl(const void *from)
472{
473 auto typedValue = static_cast<const std::string *>(from);
474 auto length = typedValue->length();
475 fAuxiliaryColumn->AppendV(typedValue->data(), length);
476 fIndex += length;
477 fPrincipalColumn->Append(&fIndex);
478 return length + fPrincipalColumn->GetElement()->GetPackedSize();
479}
480
482{
483 auto typedValue = static_cast<std::string *>(to);
484 RNTupleLocalIndex collectionStart;
486 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nChars);
487 if (nChars == 0) {
488 typedValue->clear();
489 } else {
490 typedValue->resize(nChars);
491 fAuxiliaryColumn->ReadV(collectionStart, nChars, const_cast<char *>(typedValue->data()));
492 }
493}
494
496{
497 visitor.VisitStringField(*this);
498}
499
500//------------------------------------------------------------------------------
501
503 : ROOT::Experimental::RFieldBase(name, source.GetTypeName(), ROOT::ENTupleStructure::kRecord, false /* isSimple */),
504 fMaxAlignment(source.fMaxAlignment),
506 fOffsets(source.fOffsets)
507{
508 for (const auto &f : source.GetSubFields())
509 Attach(f->Clone(f->GetFieldName()));
510 fTraits = source.fTraits;
511}
512
513ROOT::Experimental::RRecordField::RRecordField(std::string_view fieldName, std::string_view typeName)
514 : ROOT::Experimental::RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kRecord, false /* isSimple */)
515{
516}
517
518void ROOT::Experimental::RRecordField::RRecordField::AttachItemFields(
519 std::vector<std::unique_ptr<RFieldBase>> itemFields)
520{
521 fTraits |= kTraitTrivialType;
522 for (auto &item : itemFields) {
523 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
524 fSize += GetItemPadding(fSize, item->GetAlignment()) + item->GetValueSize();
525 fTraits &= item->GetTraits();
526 Attach(std::move(item));
527 }
528 // Trailing padding: although this is implementation-dependent, most add enough padding to comply with the
529 // requirements of the type with strictest alignment
530 fSize += GetItemPadding(fSize, fMaxAlignment);
531}
532
533std::unique_ptr<ROOT::Experimental::RFieldBase>
535 std::vector<std::unique_ptr<RFieldBase>> itemFields,
536 std::string_view emulatedFromType)
537{
538 return std::unique_ptr<RFieldBase>(new RRecordField(fieldName, std::move(itemFields), emulatedFromType));
539}
540
542 std::vector<std::unique_ptr<RFieldBase>> itemFields,
543 std::string_view emulatedFromType)
544 : ROOT::Experimental::RFieldBase(fieldName, emulatedFromType, ROOT::ENTupleStructure::kRecord, false /* isSimple */)
545{
547 fOffsets.reserve(itemFields.size());
548 for (auto &item : itemFields) {
549 fSize += GetItemPadding(fSize, item->GetAlignment());
550 fOffsets.push_back(fSize);
551 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
552 fSize += item->GetValueSize();
553 fTraits &= item->GetTraits();
554 Attach(std::move(item));
555 }
557 // Trailing padding: although this is implementation-dependent, most add enough padding to comply with the
558 // requirements of the type with strictest alignment
560}
561
563 std::vector<std::unique_ptr<RFieldBase>> itemFields)
564 : ROOT::Experimental::RRecordField(fieldName, std::move(itemFields), "")
565{
566}
567
569{
570 if (itemAlignment > 1) {
571 auto remainder = baseOffset % itemAlignment;
572 if (remainder != 0)
573 return itemAlignment - remainder;
574 }
575 return 0;
576}
577
578std::unique_ptr<ROOT::Experimental::RFieldBase>
580{
581 return std::unique_ptr<RRecordField>(new RRecordField(newName, *this));
582}
583
585{
586 std::size_t nbytes = 0;
587 for (unsigned i = 0; i < fSubFields.size(); ++i) {
588 nbytes += CallAppendOn(*fSubFields[i], static_cast<const unsigned char *>(from) + fOffsets[i]);
589 }
590 return nbytes;
591}
592
594{
595 for (unsigned i = 0; i < fSubFields.size(); ++i) {
596 CallReadOn(*fSubFields[i], globalIndex, static_cast<unsigned char *>(to) + fOffsets[i]);
597 }
598}
599
601{
602 for (unsigned i = 0; i < fSubFields.size(); ++i) {
603 CallReadOn(*fSubFields[i], localIndex, static_cast<unsigned char *>(to) + fOffsets[i]);
604 }
605}
606
608{
609 for (unsigned i = 0; i < fSubFields.size(); ++i) {
610 CallConstructValueOn(*fSubFields[i], static_cast<unsigned char *>(where) + fOffsets[i]);
611 }
612}
613
615{
616 for (unsigned i = 0; i < fItemDeleters.size(); ++i) {
617 fItemDeleters[i]->operator()(reinterpret_cast<unsigned char *>(objPtr) + fOffsets[i], true /* dtorOnly */);
618 }
619 RDeleter::operator()(objPtr, dtorOnly);
620}
621
622std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter> ROOT::Experimental::RRecordField::GetDeleter() const
623{
624 std::vector<std::unique_ptr<RDeleter>> itemDeleters;
625 itemDeleters.reserve(fOffsets.size());
626 for (const auto &f : fSubFields) {
627 itemDeleters.emplace_back(GetDeleterOf(*f));
628 }
629 return std::make_unique<RRecordDeleter>(std::move(itemDeleters), fOffsets);
630}
631
632std::vector<ROOT::Experimental::RFieldBase::RValue>
634{
635 auto basePtr = value.GetPtr<unsigned char>().get();
636 std::vector<RValue> result;
637 result.reserve(fSubFields.size());
638 for (unsigned i = 0; i < fSubFields.size(); ++i) {
639 result.emplace_back(fSubFields[i]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), basePtr + fOffsets[i])));
640 }
641 return result;
642}
643
648
649//------------------------------------------------------------------------------
650
652 : ROOT::Experimental::RFieldBase(fieldName, "std::bitset<" + std::to_string(N) + ">", ROOT::ENTupleStructure::kLeaf,
653 false /* isSimple */, N),
654 fN(N)
655{
657}
658
665
670
675
677{
678 const auto *asULongArray = static_cast<const Word_t *>(from);
679 bool elementValue;
680 std::size_t i = 0;
681 for (std::size_t word = 0; word < (fN + kBitsPerWord - 1) / kBitsPerWord; ++word) {
682 for (std::size_t mask = 0; (mask < kBitsPerWord) && (i < fN); ++mask, ++i) {
683 elementValue = (asULongArray[word] & (static_cast<Word_t>(1) << mask)) != 0;
684 fPrincipalColumn->Append(&elementValue);
685 }
686 }
687 return fN;
688}
689
691{
692 auto *asULongArray = static_cast<Word_t *>(to);
693 bool elementValue;
694 for (std::size_t i = 0; i < fN; ++i) {
695 fPrincipalColumn->Read(globalIndex * fN + i, &elementValue);
696 Word_t mask = static_cast<Word_t>(1) << (i % kBitsPerWord);
697 Word_t bit = static_cast<Word_t>(elementValue) << (i % kBitsPerWord);
698 asULongArray[i / kBitsPerWord] = (asULongArray[i / kBitsPerWord] & ~mask) | bit;
699 }
700}
701
703{
704 auto *asULongArray = static_cast<Word_t *>(to);
705 bool elementValue;
706 for (std::size_t i = 0; i < fN; ++i) {
707 fPrincipalColumn->Read(RNTupleLocalIndex(localIndex.GetClusterId(), localIndex.GetIndexInCluster() * fN) + i,
708 &elementValue);
709 Word_t mask = static_cast<Word_t>(1) << (i % kBitsPerWord);
710 Word_t bit = static_cast<Word_t>(elementValue) << (i % kBitsPerWord);
711 asULongArray[i / kBitsPerWord] = (asULongArray[i / kBitsPerWord] & ~mask) | bit;
712 }
713}
714
719
720//------------------------------------------------------------------------------
721
722ROOT::Experimental::RNullableField::RNullableField(std::string_view fieldName, std::string_view typeName,
723 std::unique_ptr<RFieldBase> itemField)
724 : ROOT::Experimental::RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kCollection, false /* isSimple */)
725{
726 Attach(std::move(itemField));
727}
728
739
744
749
751{
752 fPrincipalColumn->Append(&fNWritten);
753 return sizeof(Internal::RColumnIndex);
754}
755
757{
758 auto nbytesItem = CallAppendOn(*fSubFields[0], from);
759 fNWritten++;
760 fPrincipalColumn->Append(&fNWritten);
761 return sizeof(Internal::RColumnIndex) + nbytesItem;
762}
763
771
776
777//------------------------------------------------------------------------------
778
779ROOT::Experimental::RUniquePtrField::RUniquePtrField(std::string_view fieldName, std::string_view typeName,
780 std::unique_ptr<RFieldBase> itemField)
781 : RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubFields[0]))
782{
783}
784
785std::unique_ptr<ROOT::Experimental::RFieldBase>
787{
788 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
789 return std::make_unique<RUniquePtrField>(newName, GetTypeName(), std::move(newItemField));
790}
791
793{
794 auto typedValue = static_cast<const std::unique_ptr<char> *>(from);
795 if (*typedValue) {
796 return AppendValue(typedValue->get());
797 } else {
798 return AppendNull();
799 }
800}
801
803{
804 auto ptr = static_cast<std::unique_ptr<char> *>(to);
805 bool isValidValue = static_cast<bool>(*ptr);
806
807 auto itemIndex = GetItemIndex(globalIndex);
808 bool isValidItem = itemIndex.GetIndexInCluster() != ROOT::kInvalidNTupleIndex;
809
810 void *valuePtr = nullptr;
811 if (isValidValue)
812 valuePtr = ptr->get();
813
814 if (isValidValue && !isValidItem) {
815 ptr->release();
816 fItemDeleter->operator()(valuePtr, false /* dtorOnly */);
817 return;
818 }
819
820 if (!isValidItem) // On-disk value missing; nothing else to do
821 return;
822
823 if (!isValidValue) {
824 valuePtr = CallCreateObjectRawPtrOn(*fSubFields[0]);
825 ptr->reset(reinterpret_cast<char *>(valuePtr));
826 }
827
828 CallReadOn(*fSubFields[0], itemIndex, valuePtr);
829}
830
832{
833 auto typedPtr = static_cast<std::unique_ptr<char> *>(objPtr);
834 if (*typedPtr) {
835 fItemDeleter->operator()(typedPtr->get(), false /* dtorOnly */);
836 typedPtr->release();
837 }
838 RDeleter::operator()(objPtr, dtorOnly);
839}
840
841std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter> ROOT::Experimental::RUniquePtrField::GetDeleter() const
842{
843 return std::make_unique<RUniquePtrDeleter>(GetDeleterOf(*fSubFields[0]));
844}
845
846std::vector<ROOT::Experimental::RFieldBase::RValue>
848{
849 std::vector<RValue> result;
850 const auto &ptr = value.GetRef<std::unique_ptr<char>>();
851 if (ptr) {
852 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), ptr.get())));
853 }
854 return result;
855}
856
857//------------------------------------------------------------------------------
858
859ROOT::Experimental::ROptionalField::ROptionalField(std::string_view fieldName, std::string_view typeName,
860 std::unique_ptr<RFieldBase> itemField)
861 : RNullableField(fieldName, typeName, std::move(itemField)), fItemDeleter(GetDeleterOf(*fSubFields[0]))
862{
865}
866
868{
869 return reinterpret_cast<bool *>(reinterpret_cast<unsigned char *>(optionalPtr) + fSubFields[0]->GetValueSize());
870}
871
873{
874 return GetEngagementPtr(const_cast<void *>(optionalPtr));
875}
876
877std::unique_ptr<ROOT::Experimental::RFieldBase>
879{
880 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
881 return std::make_unique<ROptionalField>(newName, GetTypeName(), std::move(newItemField));
882}
883
885{
886 if (*GetEngagementPtr(from)) {
887 return AppendValue(from);
888 } else {
889 return AppendNull();
890 }
891}
892
894{
895 auto engagementPtr = GetEngagementPtr(to);
896 auto itemIndex = GetItemIndex(globalIndex);
897 if (itemIndex.GetIndexInCluster() == ROOT::kInvalidNTupleIndex) {
898 if (*engagementPtr && !(fSubFields[0]->GetTraits() & kTraitTriviallyDestructible))
899 fItemDeleter->operator()(to, true /* dtorOnly */);
900 *engagementPtr = false;
901 } else {
902 if (!(*engagementPtr) && !(fSubFields[0]->GetTraits() & kTraitTriviallyConstructible))
903 CallConstructValueOn(*fSubFields[0], to);
904 CallReadOn(*fSubFields[0], itemIndex, to);
905 *engagementPtr = true;
906 }
907}
908
910{
911 *GetEngagementPtr(where) = false;
912}
913
915{
916 if (fItemDeleter) {
917 auto engagementPtr = reinterpret_cast<bool *>(reinterpret_cast<unsigned char *>(objPtr) + fEngagementPtrOffset);
918 if (*engagementPtr)
919 fItemDeleter->operator()(objPtr, true /* dtorOnly */);
920 }
921 RDeleter::operator()(objPtr, dtorOnly);
922}
923
924std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter> ROOT::Experimental::ROptionalField::GetDeleter() const
925{
926 return std::make_unique<ROptionalDeleter>(
927 (fSubFields[0]->GetTraits() & kTraitTriviallyDestructible) ? nullptr : GetDeleterOf(*fSubFields[0]),
928 fSubFields[0]->GetValueSize());
929}
930
931std::vector<ROOT::Experimental::RFieldBase::RValue>
933{
934 std::vector<RValue> result;
935 const auto valuePtr = value.GetPtr<void>().get();
936 if (*GetEngagementPtr(valuePtr)) {
937 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(value.GetPtr<void>(), valuePtr)));
938 }
939 return result;
940}
941
943{
944 const auto alignment = GetAlignment();
945 // real size is the sum of the value size and the engagement boolean
946 const auto actualSize = fSubFields[0]->GetValueSize() + sizeof(bool);
947 auto padding = 0;
948 if (alignment > 1) {
949 auto remainder = actualSize % alignment;
950 if (remainder != 0)
951 padding = alignment - remainder;
952 }
953 return actualSize + padding;
954}
955
957{
958 return fSubFields[0]->GetAlignment();
959}
960
961//------------------------------------------------------------------------------
962
963ROOT::Experimental::RAtomicField::RAtomicField(std::string_view fieldName, std::string_view typeName,
964 std::unique_ptr<RFieldBase> itemField)
965 : RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kLeaf, false /* isSimple */)
966{
967 if (itemField->GetTraits() & kTraitTriviallyConstructible)
969 if (itemField->GetTraits() & kTraitTriviallyDestructible)
971 Attach(std::move(itemField));
972}
973
974std::unique_ptr<ROOT::Experimental::RFieldBase>
976{
977 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
978 return std::make_unique<RAtomicField>(newName, GetTypeName(), std::move(newItemField));
979}
980
981std::vector<ROOT::Experimental::RFieldBase::RValue>
983{
984 std::vector<RValue> result;
985 result.emplace_back(fSubFields[0]->BindValue(value.GetPtr<void>()));
986 return result;
987}
988
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.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:975
RAtomicField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:963
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:982
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:989
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.cxx:702
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:676
RBitsetField(std::string_view fieldName, std::size_t N)
Definition RField.cxx:651
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.cxx:666
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:660
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:690
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:715
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:335
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:66
const RField< RNTupleCardinality< std::uint32_t > > * As32Bit() const
Definition RField.cxx:72
const RField< RNTupleCardinality< std::uint64_t > > * As64Bit() const
Definition RField.cxx:78
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
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.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponsing to the field type ...
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
@ kTraitTrivialType
Shorthand for types that are both trivially constructible and destructible.
@ kTraitEmulatedField
This field is a user defined type that was missing dictionaries and was reconstructed from the on-dis...
@ kTraitTriviallyConstructible
No constructor needs to be called, i.e.
@ kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. the destructor performs a no-op.
std::uint32_t GetTraits() const
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
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:287
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:730
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:764
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.cxx:740
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:772
RNullableField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:722
std::size_t AppendValue(const void *from)
Definition RField.cxx:756
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:914
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:909
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:924
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.cxx:956
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:884
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:872
ROptionalField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:859
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.cxx:942
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:878
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:932
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:893
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:614
The field for an untyped record.
std::vector< std::size_t > fOffsets
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.cxx:600
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:579
RRecordField(std::string_view name, const RRecordField &source)
Definition RField.cxx:502
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:633
std::size_t GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
Definition RField.cxx:568
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:622
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:584
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:593
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:644
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:607
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:831
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:786
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:802
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:847
RUniquePtrField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
Definition RField.cxx:779
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.cxx:841
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:792
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
std::unique_ptr< RFieldBase > CreateEmulatedField(std::string_view fieldName, std::vector< std::unique_ptr< RFieldBase > > itemFields, std::string_view emulatedFromType)
Definition RField.cxx:534
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.