34std::unique_ptr<ROOT::Experimental::RFieldBase>
37 auto result = std::make_unique<RFieldZero>();
39 result->Attach(
f->Clone(
f->GetFieldName()));
68 visitor.VisitCardinalityField(*
this);
186 visitor.VisitUInt8Field(*
this);
237 visitor.VisitFloatField(*
this);
260 visitor.VisitDoubleField(*
this);
265 fTypeAlias =
"Double32_t";
295 visitor.VisitInt16Field(*
this);
325 visitor.VisitUInt16Field(*
this);
355 visitor.VisitInt32Field(*
this);
385 visitor.VisitUInt32Field(*
this);
415 visitor.VisitUInt64Field(*
this);
445 visitor.VisitInt64Field(*
this);
473 auto typedValue =
static_cast<const std::string *
>(from);
477 fPrincipalColumn->Append(&fIndex);
478 return length + fPrincipalColumn->GetElement()->GetPackedSize();
483 auto typedValue =
static_cast<std::string *
>(to);
497 visitor.VisitStringField(*
this);
504 fMaxAlignment(
source.fMaxAlignment),
508 for (
const auto &
f :
source.GetSubFields())
509 Attach(
f->Clone(
f->GetFieldName()));
518void ROOT::Experimental::RRecordField::RRecordField::AttachItemFields(
519 std::vector<std::unique_ptr<RFieldBase>>
itemFields)
521 fTraits |= kTraitTrivialType;
523 fMaxAlignment = std::max(fMaxAlignment, item->GetAlignment());
524 fSize += GetItemPadding(
fSize, item->GetAlignment()) + item->GetValueSize();
525 fTraits &= item->GetTraits();
526 Attach(std::move(item));
530 fSize += GetItemPadding(
fSize, fMaxAlignment);
533std::unique_ptr<ROOT::Experimental::RFieldBase>
535 std::vector<std::unique_ptr<RFieldBase>>
itemFields,
542 std::vector<std::unique_ptr<RFieldBase>>
itemFields,
552 fSize += item->GetValueSize();
563 std::vector<std::unique_ptr<RFieldBase>>
itemFields)
578std::unique_ptr<ROOT::Experimental::RFieldBase>
587 for (
unsigned i = 0; i < fSubFields.size(); ++i) {
588 nbytes += CallAppendOn(*fSubFields[i],
static_cast<const unsigned char *
>(from) + fOffsets[i]);
595 for (
unsigned i = 0; i < fSubFields.size(); ++i) {
596 CallReadOn(*fSubFields[i],
globalIndex,
static_cast<unsigned char *
>(to) + fOffsets[i]);
602 for (
unsigned i = 0; i < fSubFields.size(); ++i) {
603 CallReadOn(*fSubFields[i],
localIndex,
static_cast<unsigned char *
>(to) + fOffsets[i]);
609 for (
unsigned i = 0; i < fSubFields.size(); ++i) {
610 CallConstructValueOn(*fSubFields[i],
static_cast<unsigned char *
>(
where) + fOffsets[i]);
616 for (
unsigned i = 0; i < fItemDeleters.size(); ++i) {
617 fItemDeleters[i]->operator()(
reinterpret_cast<unsigned char *
>(
objPtr) + fOffsets[i],
true );
626 for (
const auto &
f : fSubFields) {
629 return std::make_unique<RRecordDeleter>(std::move(
itemDeleters), fOffsets);
632std::vector<ROOT::Experimental::RFieldBase::RValue>
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])));
646 visitor.VisitRecordField(*
this);
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) {
694 for (std::size_t i = 0; i < fN; ++i) {
706 for (std::size_t i = 0; i < fN; ++i) {
717 visitor.VisitBitsetField(*
this);
752 fPrincipalColumn->Append(&fNWritten);
758 auto nbytesItem = CallAppendOn(*fSubFields[0], from);
760 fPrincipalColumn->Append(&fNWritten);
774 visitor.VisitNullableField(*
this);
785std::unique_ptr<ROOT::Experimental::RFieldBase>
788 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
794 auto typedValue =
static_cast<const std::unique_ptr<char> *
>(from);
804 auto ptr =
static_cast<std::unique_ptr<char> *
>(to);
816 fItemDeleter->operator()(
valuePtr,
false );
824 valuePtr = CallCreateObjectRawPtrOn(*fSubFields[0]);
825 ptr->reset(
reinterpret_cast<char *
>(
valuePtr));
835 fItemDeleter->operator()(
typedPtr->get(),
false );
843 return std::make_unique<RUniquePtrDeleter>(GetDeleterOf(*fSubFields[0]));
846std::vector<ROOT::Experimental::RFieldBase::RValue>
849 std::vector<RValue>
result;
850 const auto &ptr =
value.GetRef<std::unique_ptr<char>>();
852 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), ptr.get())));
869 return reinterpret_cast<bool *
>(
reinterpret_cast<unsigned char *
>(
optionalPtr) + fSubFields[0]->GetValueSize());
874 return GetEngagementPtr(
const_cast<void *
>(
optionalPtr));
877std::unique_ptr<ROOT::Experimental::RFieldBase>
880 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
886 if (*GetEngagementPtr(from)) {
887 return AppendValue(from);
898 if (*
engagementPtr && !(fSubFields[0]->GetTraits() & kTraitTriviallyDestructible))
899 fItemDeleter->operator()(to,
true );
902 if (!(*
engagementPtr) && !(fSubFields[0]->GetTraits() & kTraitTriviallyConstructible))
903 CallConstructValueOn(*fSubFields[0], to);
904 CallReadOn(*fSubFields[0],
itemIndex, to);
911 *GetEngagementPtr(
where) =
false;
917 auto engagementPtr =
reinterpret_cast<bool *
>(
reinterpret_cast<unsigned char *
>(
objPtr) + fEngagementPtrOffset);
919 fItemDeleter->operator()(
objPtr,
true );
926 return std::make_unique<ROptionalDeleter>(
927 (fSubFields[0]->GetTraits() & kTraitTriviallyDestructible) ?
nullptr : GetDeleterOf(*fSubFields[0]),
928 fSubFields[0]->GetValueSize());
931std::vector<ROOT::Experimental::RFieldBase::RValue>
934 std::vector<RValue>
result;
937 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(),
valuePtr)));
946 const auto actualSize = fSubFields[0]->GetValueSize() +
sizeof(
bool);
958 return fSubFields[0]->GetAlignment();
974std::unique_ptr<ROOT::Experimental::RFieldBase>
977 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
981std::vector<ROOT::Experimental::RFieldBase::RValue>
984 std::vector<RValue>
result;
985 result.emplace_back(fSubFields[0]->BindValue(
value.GetPtr<
void>()));
991 visitor.VisitAtomicField(*
this);
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
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.
RAtomicField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
RBitsetField(std::string_view fieldName, std::size_t N)
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
const RField< RNTupleCardinality< std::uint32_t > > * As32Bit() const
const RField< RNTupleCardinality< std::uint64_t > > * As64Bit() const
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
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Classes with dictionaries that can be inspected by TClass.
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.
RNTupleLocalIndex GetItemIndex(ROOT::NTupleSize_t globalIndex)
Given the index of the nullable field, returns the corresponding global index of the subfield or,...
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
RNullableField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
std::size_t AppendValue(const void *from)
void operator()(void *objPtr, bool dtorOnly) final
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
std::unique_ptr< RDeleter > GetDeleter() const final
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
const bool * GetEngagementPtr(const void *optionalPtr) const
Given a pointer to an std::optional<T> in optionalPtr, extract a pointer to the engagement boolean.
ROptionalField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void operator()(void *objPtr, bool dtorOnly) final
The field for an untyped record.
std::size_t fMaxAlignment
std::vector< std::size_t > fOffsets
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RRecordField(std::string_view name, const RRecordField &source)
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
std::size_t GetItemPadding(std::size_t baseOffset, std::size_t itemAlignment) const
std::unique_ptr< RDeleter > GetDeleter() const final
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(Detail::RFieldVisitor &visitor) const final
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void operator()(void *objPtr, bool dtorOnly) final
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
RUniquePtrField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
std::unique_ptr< RDeleter > GetDeleter() const final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
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)
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.