48#include <unordered_set>
55 fSubFieldsInfo(source.fSubFieldsInfo),
56 fMaxAlignment(source.fMaxAlignment)
74 throw RException(
R__FAIL(
"RField: no I/O support for type " + std::string(className)));
80 if (className ==
"TObject") {
85 R__FAIL(std::string(className) +
" has an associated collection proxy; use RProxiedCollectionField instead"));
91 throw RException(
R__FAIL(std::string(className) +
" cannot be stored natively in RNTuple"));
95 R__FAIL(std::string(className) +
" has streamer mode enforced, not supported as native RNTuple class"));
105 if (baseClass->GetDelta() < 0) {
106 throw RException(
R__FAIL(std::string(
"virtual inheritance is not supported: ") + std::string(className) +
107 " virtually inherits from " + baseClass->GetName()));
109 TClass *
c = baseClass->GetClassPointer();
112 fTraits &= subField->GetTraits();
121 if (!dataMember->IsPersistent()) {
131 if (dataMember->Property() &
kIsArray) {
132 for (
int dim = 0,
n = dataMember->GetArrayDim(); dim <
n; ++dim)
133 typeName +=
"[" + std::to_string(dataMember->GetMaxIndex(dim)) +
"]";
136 std::unique_ptr<RFieldBase> subField;
139 fTraits &= subField->GetTraits();
147 fMaxAlignment = std::max(fMaxAlignment,
child->GetAlignment());
148 fSubFieldsInfo.push_back(info);
155 for (
const auto rule : rules) {
160 auto func = rule->GetReadFunctionPointer();
162 fReadCallbacks.emplace_back([func, classp](
void *
target) {
166 func(
static_cast<char *
>(
target), &oldObj);
167 oldObj.fClass =
nullptr;
172std::unique_ptr<ROOT::Experimental::RFieldBase>
175 return std::unique_ptr<RClassField>(
new RClassField(newName, *
this));
180 std::size_t nbytes = 0;
181 for (
unsigned i = 0; i < fSubFields.size(); i++) {
182 nbytes += CallAppendOn(*fSubFields[i],
static_cast<const unsigned char *
>(from) + fSubFieldsInfo[i].fOffset);
189 for (
unsigned i = 0; i < fSubFields.size(); i++) {
190 CallReadOn(*fSubFields[i], globalIndex,
static_cast<unsigned char *
>(to) + fSubFieldsInfo[i].fOffset);
196 for (
unsigned i = 0; i < fSubFields.size(); i++) {
197 CallReadOn(*fSubFields[i], clusterIndex,
static_cast<unsigned char *
>(to) + fSubFieldsInfo[i].fOffset);
208 std::unordered_set<std::string> knownSubFields;
214 if (GetTypeName() != fieldDesc.GetTypeName())
215 throw RException(
R__FAIL(
"incompatible type name for field " + GetFieldName() +
": " + GetTypeName() +
216 " vs. " + fieldDesc.GetTypeName()));
218 for (
auto linkId : fieldDesc.GetLinkIds()) {
220 knownSubFields.insert(subFieldDesc.GetFieldName());
225 for (
auto &field : fSubFields) {
226 if (knownSubFields.count(field->GetFieldName()) == 0) {
227 field->SetArtificial();
236 const auto ruleset =
fClass->GetSchemaRules();
240 if (rule->GetTarget() ==
nullptr)
243 const auto dataMember = klass->GetDataMember(
target->GetString());
244 if (!dataMember || dataMember->IsPersistent()) {
246 << dataMember->GetName();
253 auto rules = ruleset->FindRules(
fClass->GetName(),
static_cast<Int_t>(GetOnDiskTypeVersion()),
254 static_cast<UInt_t>(GetOnDiskTypeChecksum()));
255 rules.erase(std::remove_if(rules.begin(), rules.end(), referencesNonTransientMembers), rules.end());
256 AddReadCallbacksFromIORules(rules,
fClass);
266 fClass->Destructor(objPtr,
true );
267 RDeleter::operator()(objPtr, dtorOnly);
270std::vector<ROOT::Experimental::RFieldBase::RValue>
273 std::vector<RValue>
result;
274 auto basePtr =
value.GetPtr<
unsigned char>().get();
275 result.reserve(fSubFields.size());
276 for (
unsigned i = 0; i < fSubFields.size(); i++) {
278 fSubFields[i]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), basePtr + fSubFieldsInfo[i].fOffset)));
285 return fClass->GetClassSize();
290 return fClass->GetClassVersion();
295 return fClass->GetCheckSum();
306 :
REnumField(fieldName, enumName,
TEnum::GetEnum(std::string(enumName).c_str()))
313 if (enump ==
nullptr) {
314 throw RException(
R__FAIL(
"RField: no I/O support for enum type " + std::string(enumName)));
332 default:
throw RException(
R__FAIL(
"Unsupported underlying integral type for enum type " + std::string(enumName)));
339 std::unique_ptr<RFieldBase> intField)
342 Attach(std::move(intField));
346std::unique_ptr<ROOT::Experimental::RFieldBase>
349 auto newIntField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
350 return std::unique_ptr<REnumField>(
new REnumField(newName, GetTypeName(), std::move(newIntField)));
353std::vector<ROOT::Experimental::RFieldBase::RValue>
356 std::vector<RValue>
result;
357 result.emplace_back(fSubFields[0]->BindValue(
value.GetPtr<
void>()));
369ROOT::Experimental::RPairField::RPairField::GetTypeList(
const std::array<std::unique_ptr<RFieldBase>, 2> &itemFields)
371 return itemFields[0]->GetTypeName() +
"," + itemFields[1]->GetTypeName();
375 std::array<std::unique_ptr<RFieldBase>, 2> itemFields,
376 const std::array<std::size_t, 2> &offsets)
377 :
ROOT::Experimental::
RRecordField(fieldName,
"std::pair<" + GetTypeList(itemFields) +
">")
385 std::array<std::unique_ptr<RFieldBase>, 2> itemFields)
386 :
ROOT::Experimental::
RRecordField(fieldName,
"std::pair<" + GetTypeList(itemFields) +
">")
396 auto firstElem =
c->GetRealData(
"first");
399 fOffsets.push_back(firstElem->GetThisOffset());
401 auto secondElem =
c->GetRealData(
"second");
404 fOffsets.push_back(secondElem->GetThisOffset());
418 (ifuncs.
fNext !=
nullptr));
423 std::string_view typeName,
TClass *classp)
426 if (classp ==
nullptr)
427 throw RException(
R__FAIL(
"RField: no I/O support for collection proxy type " + std::string(typeName)));
429 throw RException(
R__FAIL(std::string(typeName) +
" has no associated collection proxy"));
434 if (
fProxy->HasPointers())
435 throw RException(
R__FAIL(
"collection proxies whose value type is a pointer are not supported"));
436 if (!
fProxy->GetCollectionClass()->HasDictionary()) {
446 std::string_view typeName,
447 std::unique_ptr<RFieldBase> itemField)
451 Attach(std::move(itemField));
455 std::string_view typeName)
460 throw RException(
R__FAIL(
"custom associative collection proxies not supported"));
462 std::unique_ptr<ROOT::Experimental::RFieldBase> itemField;
464 if (
auto valueClass =
fProxy->GetValueClass()) {
468 switch (
fProxy->GetType()) {
473 case EDataType::kInt_t: itemField = std::make_unique<RField<std::int32_t>>(
"_0");
break;
474 case EDataType::kUInt_t: itemField = std::make_unique<RField<std::uint32_t>>(
"_0");
break;
487 Attach(std::move(itemField));
490std::unique_ptr<ROOT::Experimental::RFieldBase>
493 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
494 return std::unique_ptr<RProxiedCollectionField>(
500 std::size_t nbytes = 0;
504 (fCollectionType ==
kSTLvector ? fItemSize : 0U)}) {
505 nbytes += CallAppendOn(*fSubFields[0], ptr);
510 fPrincipalColumn->Append(&fNWritten);
511 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
518 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
526 (fCollectionType ==
kSTLvector || obj != to ? fItemSize : 0U)}) {
527 CallReadOn(*fSubFields[0], collectionStart + (i++), elementPtr);
539 return representations;
544 GenerateColumnsImpl<Internal::RColumnIndex>();
549 GenerateColumnsImpl<Internal::RColumnIndex>(desc);
557std::unique_ptr<ROOT::Experimental::RFieldBase::RDeleter>
561 std::size_t itemSize = fCollectionType ==
kSTLvector ? fItemSize : 0U;
562 return std::make_unique<RProxiedCollectionDeleter>(fProxy, GetDeleterOf(*fSubFields[0]), itemSize);
564 return std::make_unique<RProxiedCollectionDeleter>(fProxy);
572 fItemDeleter->operator()(ptr,
true );
575 fProxy->Destructor(objPtr,
true );
576 RDeleter::operator()(objPtr, dtorOnly);
579std::vector<ROOT::Experimental::RFieldBase::RValue>
582 std::vector<RValue>
result;
583 auto valueRawPtr =
value.GetPtr<
void>().get();
586 (fCollectionType ==
kSTLvector ? fItemSize : 0U)}) {
587 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), ptr)));
600 std::unique_ptr<RFieldBase> itemField)
603 if (!
dynamic_cast<RPairField *
>(itemField.get()))
606 auto *itemClass =
fProxy->GetValueClass();
609 Attach(std::move(itemField));
615 std::unique_ptr<RFieldBase> itemField)
630 RCallbackStreamerInfo fCallbackStreamerInfo;
634 :
TBufferFile(
mode, bufsiz), fCallbackStreamerInfo(callbackStreamerInfo)
643 std::string_view typeAlias)
656 throw RException(
R__FAIL(
"RStreamerField: no I/O support for type " + std::string(className)));
666std::unique_ptr<ROOT::Experimental::RFieldBase>
669 return std::unique_ptr<RStreamerField>(
new RStreamerField(newName, GetTypeName(), GetTypeAlias()));
676 fClass->Streamer(
const_cast<void *
>(from), buffer);
678 auto nbytes = buffer.Length();
679 fAuxiliaryColumn->AppendV(buffer.Buffer(), buffer.Length());
681 fPrincipalColumn->Append(&fIndex);
682 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
689 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nbytes);
692 fAuxiliaryColumn->ReadV(collectionStart, nbytes, buffer.
Buffer());
693 fClass->Streamer(to, buffer);
704 return representations;
709 GenerateColumnsImpl<Internal::RColumnIndex, std::byte>();
714 GenerateColumnsImpl<Internal::RColumnIndex, std::byte>(desc);
724 fClass->Destructor(objPtr,
true );
725 RDeleter::operator()(objPtr, dtorOnly);
740 return std::min(
alignof(std::max_align_t), GetValueSize());
745 return fClass->GetClassSize();
750 return fClass->GetClassVersion();
755 return fClass->GetCheckSum();
768 return dataMember->GetOffset();
791std::unique_ptr<ROOT::Experimental::RFieldBase>
794 return std::unique_ptr<RField<TObject>>(
new RField<TObject>(newName, *
this));
801 auto *obj =
static_cast<const TObject *
>(from);
806 std::size_t nbytes = 0;
807 nbytes += CallAppendOn(*fSubFields[0],
reinterpret_cast<const unsigned char *
>(from) + GetOffsetUniqueID());
809 UInt_t bits = *
reinterpret_cast<const UInt_t *
>(
reinterpret_cast<const unsigned char *
>(from) + GetOffsetBits());
811 nbytes += CallAppendOn(*fSubFields[1], &bits);
820 auto *obj =
static_cast<TObject *
>(to);
825 CallReadOn(*fSubFields[0], globalIndex,
static_cast<unsigned char *
>(to) + GetOffsetUniqueID());
829 CallReadOn(*fSubFields[1], globalIndex, &bits);
831 *
reinterpret_cast<UInt_t *
>(
reinterpret_cast<unsigned char *
>(to) + GetOffsetBits()) = bits;
836 if (GetTypeVersion() != 1) {
837 throw RException(
R__FAIL(
"unsupported on-disk version of TObject: " + std::to_string(GetTypeVersion())));
856std::vector<ROOT::Experimental::RFieldBase::RValue>
859 std::vector<RValue>
result;
860 auto basePtr =
value.GetPtr<
unsigned char>().get();
862 fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), basePtr + GetOffsetUniqueID())));
864 fSubFields[1]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), basePtr + GetOffsetBits())));
886ROOT::Experimental::RTupleField::RTupleField::GetTypeList(
const std::vector<std::unique_ptr<RFieldBase>> &itemFields)
889 if (itemFields.empty())
890 throw RException(
R__FAIL(
"the type list for std::tuple must have at least one element"));
891 for (
size_t i = 0; i < itemFields.size(); ++i) {
892 result += itemFields[i]->GetTypeName() +
",";
899 std::vector<std::unique_ptr<RFieldBase>> itemFields,
900 const std::vector<std::size_t> &offsets)
901 :
ROOT::Experimental::
RRecordField(fieldName,
"std::tuple<" + GetTypeList(itemFields) +
">")
908 std::vector<std::unique_ptr<RFieldBase>> itemFields)
909 :
ROOT::Experimental::
RRecordField(fieldName,
"std::tuple<" + GetTypeList(itemFields) +
">")
923 for (
unsigned i = 0; i <
fSubFields.size(); ++i) {
924 std::string memberName(
"_" + std::to_string(i));
925 auto member =
c->GetRealData(memberName.c_str());
928 fOffsets.push_back(member->GetThisOffset());
937constexpr std::size_t GetVariantTagSize()
940 std::variant<char> t;
941 constexpr auto sizeOfT =
sizeof(t);
943 static_assert(sizeOfT == 2 || sizeOfT == 8,
"unsupported std::variant layout");
944 return sizeOfT == 2 ? 1 : 4;
947template <std::
size_t VariantSizeT>
949 using ValueType_t =
typename std::conditional_t<VariantSizeT == 1, std::uint8_t,
950 typename std::conditional_t<VariantSizeT == 4, std::uint32_t, void>>;
958 for (
size_t i = 0; i < itemFields.size(); ++i) {
959 result += itemFields[i]->GetTypeName() +
",";
968 fMaxItemSize(source.fMaxItemSize),
969 fMaxAlignment(source.fMaxAlignment),
970 fTagOffset(source.fTagOffset),
971 fVariantOffset(source.fVariantOffset),
972 fNWritten(source.fNWritten.
size(), 0)
975 Attach(
f->Clone(
f->GetFieldName()));
980 std::vector<std::unique_ptr<RFieldBase>> itemFields)
981 :
ROOT::Experimental::
RFieldBase(fieldName,
"std::variant<" + GetTypeList(itemFields) +
">",
987 auto nFields = itemFields.size();
992 for (
unsigned int i = 0; i < nFields; ++i) {
995 fTraits &= itemFields[i]->GetTraits();
996 Attach(std::move(itemFields[i]));
1003 auto dm =
reinterpret_cast<TDataMember *
>(cl->GetListOfDataMembers()->First());
1007 const auto tagSize = GetVariantTagSize();
1008 const auto padding = tagSize - (
fMaxItemSize % tagSize);
1012std::unique_ptr<ROOT::Experimental::RFieldBase>
1015 return std::unique_ptr<RVariantField>(
new RVariantField(newName, *
this));
1020 using TagType_t = RVariantTag<GetVariantTagSize()>::ValueType_t;
1021 auto tag = *
reinterpret_cast<const TagType_t *
>(
reinterpret_cast<const unsigned char *
>(variantPtr) + tagOffset);
1022 return (tag == TagType_t(-1)) ? 0 : tag + 1;
1027 using TagType_t = RVariantTag<GetVariantTagSize()>::ValueType_t;
1028 auto tagPtr =
reinterpret_cast<TagType_t *
>(
reinterpret_cast<unsigned char *
>(variantPtr) + tagOffset);
1029 *tagPtr = (tag == 0) ? TagType_t(-1) :
static_cast<TagType_t
>(tag - 1);
1034 auto tag = GetTag(from, fTagOffset);
1035 std::size_t nbytes = 0;
1038 nbytes += CallAppendOn(*fSubFields[tag - 1],
reinterpret_cast<const unsigned char *
>(from) + fVariantOffset);
1039 index = fNWritten[tag - 1]++;
1042 fPrincipalColumn->Append(&varSwitch);
1050 fPrincipalColumn->GetSwitchInfo(globalIndex, &variantIndex, &tag);
1057 void *varPtr =
reinterpret_cast<unsigned char *
>(to) + fVariantOffset;
1058 CallConstructValueOn(*fSubFields[tag - 1], varPtr);
1059 CallReadOn(*fSubFields[tag - 1], variantIndex, varPtr);
1061 SetTag(to, fTagOffset, tag);
1068 return representations;
1073 GenerateColumnsImpl<Internal::RColumnSwitch>();
1078 GenerateColumnsImpl<Internal::RColumnSwitch>(desc);
1083 memset(where, 0, GetValueSize());
1084 CallConstructValueOn(*fSubFields[0],
reinterpret_cast<unsigned char *
>(where) + fVariantOffset);
1085 SetTag(where, fTagOffset, 1);
1090 auto tag = GetTag(objPtr, fTagOffset);
1092 fItemDeleters[tag - 1]->operator()(
reinterpret_cast<unsigned char *
>(objPtr) + fVariantOffset,
true );
1094 RDeleter::operator()(objPtr, dtorOnly);
1099 std::vector<std::unique_ptr<RDeleter>> itemDeleters;
1100 itemDeleters.reserve(fSubFields.size());
1101 for (
const auto &
f : fSubFields) {
1102 itemDeleters.emplace_back(GetDeleterOf(*
f));
1104 return std::make_unique<RVariantDeleter>(fTagOffset, fVariantOffset, std::move(itemDeleters));
1109 return std::max(fMaxAlignment,
alignof(RVariantTag<GetVariantTagSize()>::ValueType_t));
1115 const auto actualSize = fTagOffset + GetVariantTagSize();
1117 return actualSize + ((padding ==
alignment) ? 0 : padding);
1122 std::fill(fNWritten.begin(), fNWritten.end(), 0);
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
#define R__LOG_WARNING(...)
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t target
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 index
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 child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char mode
Abstract base class for classes implementing the visitor design pattern.
virtual void VisitProxiedCollectionField(const RProxiedCollectionField &field)
virtual void VisitStreamerField(const RStreamerField &field)
virtual void VisitTObjectField(const RField< TObject > &field)
virtual void VisitEnumField(const REnumField &field)
virtual void VisitClassField(const RClassField &field)
Holds the index and the tag of a kSwitch column.
static std::string SerializeStreamerInfos(const StreamerInfoMap_t &infos)
Abstract interface to read data from an ntuple.
const RSharedDescriptorGuard GetSharedDescriptorGuard() const
Takes the read lock for the descriptor.
void operator()(void *objPtr, bool dtorOnly) final
The field for a class with dictionary.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
void Attach(std::unique_ptr< RFieldBase > child, RSubFieldInfo info)
void OnConnectPageSource() final
Called by ConnectPageSource() once connected; derived classes may override this as appropriate.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void BeforeConnectPageSource(Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void AddReadCallbacksFromIORules(const std::span< const TSchemaRule * > rules, TClass *classp=nullptr)
Register post-read callbacks corresponding to a list of ROOT I/O customization rules.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
The field for an unscoped or scoped enum with dictionary.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
REnumField(std::string_view fieldName, std::string_view enumName, TEnum *enump)
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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.
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.
std::string fTypeAlias
A typedef or using name that was used when creating the field.
const std::string & GetTypeName() const
int fTraits
Properties of the type that allow for optimizations of collections of that type.
static constexpr int kTraitTypeChecksum
The TClass checksum is set and valid.
friend class ROOT::Experimental::RClassField
static RResult< std::unique_ptr< RFieldBase > > Create(const std::string &fieldName, const std::string &canonicalType, const std::string &typeAlias, bool continueOnError=false)
Factory method to resurrect a field from the stored on-disk type information.
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
Classes with dictionaries that can be inspected by TClass.
RField(std::string_view name)
RMapField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
The on-storage meta-data of an ntuple.
const RFieldDescriptor & GetFieldDescriptor(DescriptorId_t fieldId) const
Template specializations for C++ std::pair.
RPairField(std::string_view fieldName, std::array< std::unique_ptr< RFieldBase >, 2 > itemFields, const std::array< std::size_t, 2 > &offsets)
Allows for iterating over the elements of a proxied collection.
static RIteratorFuncs GetIteratorFuncs(TVirtualCollectionProxy *proxy, bool readFromDisk)
void operator()(void *objPtr, bool dtorOnly) final
The field for a class representing a collection of elements via TVirtualCollectionProxy.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::shared_ptr< TVirtualCollectionProxy > fProxy
The collection proxy is needed by the deleters and thus defined as a shared pointer.
RCollectionIterableOnce::RIteratorFuncs fIFuncsRead
Two sets of functions to operate on iterators, to be used depending on the access type.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
RProxiedCollectionField(std::string_view fieldName, std::string_view typeName, TClass *classp)
Constructor used when the value type of the collection is not known in advance, i....
std::unique_ptr< RDeleter > GetDeleter() const final
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
RCollectionIterableOnce::RIteratorFuncs fIFuncsWrite
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
The field for an untyped record.
std::vector< std::size_t > fOffsets
void AttachItemFields(std::vector< std::unique_ptr< RFieldBase > > itemFields)
RSetField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
void operator()(void *objPtr, bool dtorOnly) final
The field for a class using ROOT standard streaming.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
RStreamerField(std::string_view fieldName, std::string_view className, TClass *classp)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
RExtraTypeInfoDescriptor GetExtraTypeInfo() const final
RTupleField(std::string_view fieldName, std::vector< std::unique_ptr< RFieldBase > > itemFields, const std::vector< std::size_t > &offsets)
void operator()(void *objPtr, bool dtorOnly) final
Template specializations for C++ std::variant.
std::vector< Internal::RColumnIndex::ValueType > fNWritten
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
static void SetTag(void *variantPtr, std::size_t tagOffset, std::uint8_t tag)
static std::string GetTypeList(const std::vector< std::unique_ptr< RFieldBase > > &itemFields)
size_t fTagOffset
In the std::variant memory layout, at which byte number is the index stored.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void CommitClusterImpl() final
static constexpr std::size_t kMaxVariants
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
static std::uint8_t GetTag(const void *variantPtr, std::size_t tagOffset)
Extracts the index from an std::variant and transforms it into the 1-based index used for the switch ...
RVariantField(std::string_view name, const RVariantField &source)
size_t fVariantOffset
In the std::variant memory layout, the actual union of types may start at an offset > 0.
std::unique_ptr< RDeleter > GetDeleter() const final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Base class for all ROOT issued exceptions.
The concrete implementation of TBuffer for writing/reading to/from a ROOT file or socket.
TClass instances represent classes, structs and namespaces in the ROOT type system.
UInt_t GetCheckSum(ECheckSum code=kCurrentCheckSum) const
Call GetCheckSum with validity check.
Bool_t CanSplit() const
Return true if the data member of this TClass can be saved separately.
TList * GetListOfDataMembers(Bool_t load=kTRUE)
Return list containing the TDataMembers of a class.
Int_t Size() const
Return size of object of this class.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
TVirtualCollectionProxy * GetCollectionProxy() const
Return the proxy describing the collection (if any).
Long_t ClassProperty() const
Return the C++ property of this class, eg.
Long_t Property() const override
Returns the properties of the TClass as a bit field stored as a Long_t value.
Version_t GetClassVersion() const
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
All ROOT classes may have RTTI (run time type identification) support added.
Longptr_t GetOffset() const
Get offset from "this".
The TEnum class implements the enum type.
EDataType GetUnderlyingType() const
Get the underlying integer type of the enum: enum E { kOne }; // ==> int enum F: long; // ==> long Re...
Long_t Property() const override
Get property description word. For meaning of bits see EProperty.
Mother of all ROOT objects.
@ kIsOnHeap
object is on heap
@ kNotDeleted
object has not been deleted
@ kIsReferenced
if object is referenced by a TRef or TRefArray
RAII helper class that ensures that PushProxy() / PopProxy() are called when entering / leaving a C++...
Defines a common interface to inspect/change the contents of an object that represents a collection.
@ kNeedDelete
The collection contains directly or indirectly (via other collection) some pointers that need explici...
virtual Next_t GetFunctionNext(Bool_t read=kTRUE)=0
Return a pointer to a function that can advance an iterator (see Next_t).
virtual DeleteTwoIterators_t GetFunctionDeleteTwoIterators(Bool_t read=kTRUE)=0
virtual TVirtualCollectionProxy * Generate() const =0
Returns a clean object of the actual class that derives from TVirtualCollectionProxy.
virtual CreateIterators_t GetFunctionCreateIterators(Bool_t read=kTRUE)=0
Return a pointer to a function that can create an iterator pair, where each iterator points to the be...
Wrapper around an object and giving indirect access to its content even if the object is not of a cla...
Abstract Interface class describing Streamer information for one class.
virtual Int_t GetNumber() const =0
std::string GetNormalizedTypeName(const std::string &typeName)
Applies type name normalization rules that lead to the final name used to create a RField,...
ERNTupleSerializationMode GetRNTupleSerializationMode(TClass *cl)
RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
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.
constexpr DescriptorId_t kInvalidDescriptorId
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
TVirtualCollectionProxy::Next_t fNext
TVirtualCollectionProxy::DeleteTwoIterators_t fDeleteTwoIterators
TVirtualCollectionProxy::CreateIterators_t fCreateIterators