18std::vector<ROOT::RFieldBase::RValue> SplitVector(std::shared_ptr<void> valuePtr,
ROOT::RFieldBase &itemField)
20 auto *
vec =
static_cast<std::vector<char> *
>(valuePtr.get());
24 const auto nItems =
vec->size() / itemSize;
25 std::vector<ROOT::RFieldBase::RValue>
result;
27 for (
unsigned i = 0; i < nItems; ++i) {
28 result.emplace_back(itemField.
BindValue(std::shared_ptr<void>(valuePtr,
vec->data() + (i * itemSize))));
33std::size_t GetSizeOfVector()
35 return sizeof(std::vector<char>);
38std::size_t GetAlignOfVector()
40 return alignof(std::vector<char>);
43void ConstructVector(
void *where, std::size_t alignOfValue)
47 switch (alignOfValue) {
61 default:
throw ROOT::RException(
R__FAIL(std::string(
"Unsupported alignment: ") + std::to_string(alignOfValue)));
69 std::size_t arrayLength)
78 if (!itemField->GetTypeAlias().empty()) {
79 fTypeAlias =
"std::array<" + itemField->GetTypeAlias() +
"," +
80 Internal::GetNormalizedInteger(static_cast<unsigned long long>(arrayLength)) +
">";
82 Attach(std::move(itemField),
"_0");
88 return std::make_unique<RArrayField>(newName, std::move(newItemField),
fArrayLength);
93 std::size_t nbytes = 0;
98 auto arrayPtr =
static_cast<const unsigned char *
>(from);
111 auto arrayPtr =
static_cast<unsigned char *
>(to);
123 auto arrayPtr =
static_cast<unsigned char *
>(to);
137 return RBulkSpec::kAllSet;
142 static const std::vector<std::string> prefixes = {
"std::array<"};
153 auto arrayPtr =
reinterpret_cast<unsigned char *
>(where);
166 RDeleter::operator()(objPtr, dtorOnly);
178 auto valuePtr =
value.GetPtr<
void>();
179 auto arrayPtr =
static_cast<unsigned char *
>(valuePtr.get());
180 std::vector<RValue>
result;
201 if (itemField->GetAlignment() >
sizeof(std::max_align_t)) {
203 throw RException(R__FAIL(
"RVec does not support over-aligned types"));
208 if (!itemField->GetTypeAlias().empty())
209 fTypeAlias =
"ROOT::VecOps::RVec<" + itemField->GetTypeAlias() +
">";
210 Attach(std::move(itemField),
"_0");
219 auto grandChildFields =
fSubfields[0]->GetMutableSubfields();
220 if (grandChildFields[0]->
IsSimple()) {
231 return std::make_unique<RRVecField>(newName, std::move(newItemField));
238 std::size_t nbytes = 0;
243 for (std::int32_t i = 0; i < *sizePtr; ++i) {
257 if (nItems >
static_cast<std::size_t
>(std::numeric_limits<std::int32_t>::max())) {
262 const std::size_t oldSize = *sizePtr;
264 if (oldSize == nItems) {
273 const bool owns = (*capacityPtr != -1);
275 const bool needsDestruct = owns && itemDeleter;
279 for (std::size_t i = nItems; i < oldSize; ++i) {
280 itemDeleter->operator()(*beginPtr + (i * itemSize),
true );
285 if (std::int32_t(nItems) > *capacityPtr) {
289 for (std::size_t i = 0u; i < oldSize; ++i) {
290 itemDeleter->operator()(*beginPtr + (i * itemSize),
true );
301 *beginPtr =
static_cast<unsigned char *
>(
malloc(nItems * itemSize));
303 *capacityPtr = nItems;
306 if (needsConstruct) {
307 for (std::size_t i = 0u; i < oldSize; ++i)
314 if (needsConstruct) {
315 for (std::size_t i = oldSize; i < nItems; ++i)
330 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
340 for (std::size_t i = 0; i < nItems; ++i) {
353 bulkSpec.
fAuxData->resize(
sizeof(std::size_t));
356 const auto itemValueSize = *
reinterpret_cast<std::size_t *
>(bulkSpec.
fAuxData->data());
357 unsigned char *itemValueArray = bulkSpec.
fAuxData->data() +
sizeof(std::size_t);
364 *beginPtr = itemValueArray;
365 *sizePtr = collectionSize;
373 std::size_t nValues = 1;
374 std::size_t nItems = collectionSize;
375 while (nRemainingValues > 0) {
379 const std::size_t nBatch = std::min(nRemainingValues, nElementsUntilPageEnd);
380 for (std::size_t i = 0; i < nBatch; ++i) {
381 const auto size = offsets[i] - lastOffset;
383 reinterpret_cast<unsigned char *
>(bulkSpec.
fValues) + (nValues + i) *
fValueSize);
384 *beginPtr = itemValueArray + nItems * itemValueSize;
389 lastOffset = offsets[i];
391 nRemainingValues -= nBatch;
395 bulkSpec.
fAuxData->resize(
sizeof(std::size_t) + nItems * itemValueSize);
397 const auto delta = itemValueArray - (bulkSpec.
fAuxData->data() +
sizeof(std::size_t));
399 auto beginPtrAsUChar =
reinterpret_cast<unsigned char *
>(bulkSpec.
fValues);
400 for (std::size_t i = 0; i < bulkSpec.
fCount; ++i) {
401 *
reinterpret_cast<unsigned char **
>(beginPtrAsUChar) -= delta;
408 return RBulkSpec::kAllSet;
418 return representations;
438 if (fieldDesc.GetTypeName().rfind(
"std::array<", 0) == 0) {
439 auto substitute = std::make_unique<RArrayAsRVecField>(
456 void **beginPtr =
new (where)(
void *)(
nullptr);
457 std::int32_t *sizePtr =
new (
reinterpret_cast<void *
>(beginPtr + 1)) std::int32_t(0);
458 new (sizePtr + 1) std::int32_t(-1);
466 for (std::int32_t i = 0; i < *sizePtr; ++i) {
472 RDeleter::operator()(objPtr, dtorOnly);
486 std::vector<RValue>
result;
488 for (std::int32_t i = 0; i < *sizePtr; ++i) {
513 std::optional<std::string_view> emulatedFromType)
521 R__FAIL(std::string(
"Unsupported vector item alignment: ") + std::to_string(itemField->GetAlignment())));
524 if (emulatedFromType && !emulatedFromType->empty())
527 if (!itemField->GetTypeAlias().empty())
528 fTypeAlias =
"std::vector<" + itemField->GetTypeAlias() +
">";
532 Attach(std::move(itemField),
"_0");
540std::unique_ptr<ROOT::RVectorField>
543 return std::unique_ptr<ROOT::RVectorField>(
new RVectorField(fieldName, itemField->Clone(
"_0"),
""));
550 auto emulatedFromType = isUntyped ? std::make_optional(
GetTypeName()) : std::nullopt;
551 return std::unique_ptr<ROOT::RVectorField>(
new RVectorField(newName, std::move(newItemField), emulatedFromType));
556 auto typedValue =
static_cast<const std::vector<char> *
>(from);
561 auto count = typedValue->size() /
fItemSize;
563 std::size_t nbytes = 0;
569 for (
unsigned i = 0; i < count; ++i) {
582 auto typedValue =
static_cast<std::vector<char> *
>(
vec);
585 assert(itemSize > 0);
586 const auto oldNItems = typedValue->size() / itemSize;
587 const auto availNItems = typedValue->capacity() / itemSize;
588 assert((typedValue->size() % itemSize == 0) && (typedValue->capacity() % itemSize == 0));
590 const bool canRealloc = availNItems < nItems;
591 bool allDeallocated =
false;
593 allDeallocated = canRealloc;
594 for (std::size_t i = allDeallocated ? 0 : nItems; i < oldNItems; ++i) {
595 itemDeleter->operator()(typedValue->data() + (i * itemSize),
true );
601 const auto nbytes = nItems * itemSize;
603 auto fnAlignedResize = [](
auto &vecOfAlignedStorage, std::size_t targetSize) {
604 constexpr auto valueTypeSize =
sizeof(
typename std::decay_t<
decltype(vecOfAlignedStorage)>::value_type);
605 constexpr auto valueTypeAlignment =
alignof(
typename std::decay_t<
decltype(vecOfAlignedStorage)>::value_type);
608 static_assert(valueTypeSize == valueTypeAlignment);
609 assert(targetSize % valueTypeAlignment == 0);
610 vecOfAlignedStorage.resize(targetSize / valueTypeSize);
615 switch (itemAlignment) {
616 case 1: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 1>
> *>(
vec), nbytes);
break;
617 case 2: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 2>
> *>(
vec), nbytes);
break;
618 case 4: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 4>
> *>(
vec), nbytes);
break;
619 case 8: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 8>
> *>(
vec), nbytes);
break;
620 case 16: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 16>
> *>(
vec), nbytes);
break;
621 case 32: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 32>
> *>(
vec), nbytes);
break;
622 case 64: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 64>
> *>(
vec), nbytes);
break;
623 case 128: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 128>
> *>(
vec), nbytes);
break;
624 case 256: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 256>
> *>(
vec), nbytes);
break;
625 case 512: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage< 512>
> *>(
vec), nbytes);
break;
626 case 1024: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage<1024>
> *>(
vec), nbytes);
break;
627 case 2048: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage<2048>
> *>(
vec), nbytes);
break;
628 case 4096: fnAlignedResize(*
static_cast<std::vector<Internal::RAlignedStorage<4096>
> *>(
vec), nbytes);
break;
629 default:
throw RException(
R__FAIL(std::string(
"Unsupported alignment: ") + std::to_string(itemAlignment)));
634 for (std::size_t i = allDeallocated ? 0 : oldNItems; i < nItems; ++i) {
642 auto typedValue =
static_cast<std::vector<char> *
>(to);
646 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
657 for (std::size_t i = 0; i < nItems; ++i) {
669 return representations;
689 if (fieldDesc.GetTypeName().rfind(
"std::array<", 0) == 0) {
690 auto substitute = std::make_unique<RArrayAsVectorField>(
714 std::unique_ptr<RDeleter> itemDeleter)
724 auto vecPtr =
static_cast<std::vector<char> *
>(objPtr);
727 auto nItems = vecPtr->size() /
fItemSize;
728 assert((vecPtr->size() %
fItemSize) == 0);
729 for (std::size_t i = 0; i < nItems; ++i) {
737 case 1: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 1>
> *>(objPtr));
break;
738 case 2: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 2>
> *>(objPtr));
break;
739 case 4: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 4>
> *>(objPtr));
break;
740 case 8: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 8>
> *>(objPtr));
break;
741 case 16: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 16>
> *>(objPtr));
break;
742 case 32: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 32>
> *>(objPtr));
break;
743 case 64: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 64>
> *>(objPtr));
break;
744 case 128: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 128>
> *>(objPtr));
break;
745 case 256: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 256>
> *>(objPtr));
break;
746 case 512: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage< 512>
> *>(objPtr));
break;
747 case 1024: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage<1024>
> *>(objPtr));
break;
748 case 2048: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage<2048>
> *>(objPtr));
break;
749 case 4096: std::destroy_at(
static_cast<std::vector<Internal::RAlignedStorage<4096>
> *>(objPtr));
break;
754 RDeleter::operator()(objPtr, dtorOnly);
771 return GetSizeOfVector();
776 return GetAlignOfVector();
794 auto typedValue =
static_cast<const std::vector<bool> *
>(from);
795 auto count = typedValue->size();
796 for (
unsigned i = 0; i < count; ++i) {
797 bool bval = (*typedValue)[i];
798 CallAppendOn(*fSubfields[0], &bval);
801 fPrincipalColumn->
Append(&fNWritten);
802 return count + fPrincipalColumn->GetElement()->GetPackedSize();
805void ROOT::RField<std::vector<bool>>::ReadGlobalImpl(
ROOT::NTupleSize_t globalIndex,
void *to)
807 auto typedValue =
static_cast<std::vector<bool> *
>(to);
809 if (fOnDiskNRepetitions == 0) {
812 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
813 typedValue->resize(nItems);
814 for (std::size_t i = 0; i < nItems; ++i) {
816 CallReadOn(*fSubfields[0], collectionStart + i, &bval);
817 (*typedValue)[i] = bval;
820 typedValue->resize(fOnDiskNRepetitions);
821 for (std::size_t i = 0; i < fOnDiskNRepetitions; ++i) {
823 CallReadOn(*fSubfields[0], globalIndex * fOnDiskNRepetitions + i, &bval);
824 (*typedValue)[i] = bval;
829void ROOT::RField<std::vector<bool>>::ReadInClusterImpl(ROOT::RNTupleLocalIndex localIndex,
void *to)
831 auto typedValue =
static_cast<std::vector<bool> *
>(to);
833 if (fOnDiskNRepetitions == 0) {
836 fPrincipalColumn->GetCollectionInfo(localIndex, &collectionStart, &nItems);
837 typedValue->resize(nItems);
838 for (std::size_t i = 0; i < nItems; ++i) {
840 CallReadOn(*fSubfields[0], collectionStart + i, &bval);
841 (*typedValue)[i] = bval;
844 typedValue->resize(fOnDiskNRepetitions);
845 for (std::size_t i = 0; i < fOnDiskNRepetitions; ++i) {
847 CallReadOn(*fSubfields[0], localIndex * fOnDiskNRepetitions + i, &bval);
848 (*typedValue)[i] = bval;
853const ROOT::RFieldBase::RColumnRepresentations &ROOT::RField<std::vector<bool>>::GetColumnRepresentations()
const
860 return representations;
863void ROOT::RField<std::vector<bool>>::GenerateColumns()
866 GenerateColumnsImpl<ROOT::Internal::RColumnIndex>();
869void ROOT::RField<std::vector<bool>>::GenerateColumns(
const ROOT::RNTupleDescriptor &desc)
871 if (fOnDiskNRepetitions == 0)
872 GenerateColumnsImpl<ROOT::Internal::RColumnIndex>(desc);
875void ROOT::RField<std::vector<bool>>::ReconcileOnDiskField(
const RNTupleDescriptor &desc)
877 const auto &fieldDesc = desc.GetFieldDescriptor(GetOnDiskId());
879 if (fieldDesc.GetTypeName().rfind(
"std::array<", 0) == 0) {
880 EnsureMatchingOnDiskField(desc, kDiffTypeName | kDiffStructure | kDiffNRepetitions).ThrowOnError();
882 if (fieldDesc.GetNRepetitions() == 0) {
883 throw RException(
R__FAIL(
"fixed-size array --> std::vector<bool>: expected repetition count > 0\n" +
887 throw RException(
R__FAIL(
"fixed-size array --> std::vector<bool>: expected plain on-disk field\n" +
890 fOnDiskNRepetitions = fieldDesc.GetNRepetitions();
892 EnsureMatchingOnDiskCollection(desc).ThrowOnError();
896std::vector<ROOT::RFieldBase::RValue> ROOT::RField<std::vector<bool>>::SplitValue(
const RValue &
value)
const
898 const auto &typedValue =
value.GetRef<std::vector<bool>>();
899 auto count = typedValue.size();
900 std::vector<RValue>
result;
902 for (
unsigned i = 0; i < count; ++i) {
904 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<bool>(
new bool(
true))));
906 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<bool>(
new bool(
false))));
912void ROOT::RField<std::vector<bool>>::AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor)
const
920 std::size_t arrayLength)
926 if (!itemField->GetTypeAlias().empty())
927 fTypeAlias =
"ROOT::VecOps::RVec<" + itemField->GetTypeAlias() +
">";
928 Attach(std::move(itemField),
"_0");
938 return std::make_unique<RArrayAsRVecField>(newName, std::move(newItemField),
fArrayLength);
945 void **beginPtr =
new (where)(
void *)(
nullptr);
946 std::int32_t *sizePtr =
new (
static_cast<void *
>(beginPtr + 1)) std::int32_t(0);
947 new (sizePtr + 1) std::int32_t(-1);
993 if (fieldDesc.GetTypeName().rfind(
"std::array<", 0) != 0) {
1006 auto arrayPtr =
value.GetPtr<
unsigned char>().get();
1007 std::vector<ROOT::RFieldBase::RValue>
result;
1024 std::size_t arrayLength)
1030 if (!itemField->GetTypeAlias().empty())
1031 fTypeAlias =
"std::vector<" + itemField->GetTypeAlias() +
">";
1032 Attach(std::move(itemField),
"_0");
1040 return std::make_unique<RArrayAsVectorField>(newName, std::move(newItemField),
fArrayLength);
1045 throw RException(
R__FAIL(
"RArrayAsVectorField fields must only be used for reading"));
1064 auto typedValue =
static_cast<std::vector<char> *
>(to);
1081 auto typedValue =
static_cast<std::vector<char> *
>(to);
1101 if (fieldDesc.GetTypeName().rfind(
"std::array<", 0) != 0) {
1114 return GetSizeOfVector();
1119 return GetAlignOfVector();
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
if(isa< VarDecl >(D)||isa< FieldDecl >(D)||isa< EnumConstantDecl >(D))
#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 result
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.
virtual void VisitVectorField(const ROOT::RVectorField &field)
virtual void VisitVectorBoolField(const ROOT::RField< std::vector< bool > > &field)
virtual void VisitRVecField(const ROOT::RRVecField &field)
virtual void VisitArrayAsRVecField(const ROOT::RArrayAsRVecField &field)
virtual void VisitArrayAsVectorField(const ROOT::RArrayAsVectorField &field)
virtual void VisitArrayField(const ROOT::RArrayField &field)
The in-memory representation of a 32bit or 64bit on-disk index column.
Abstract interface to read data from an ntuple.
const RSharedDescriptorGuard GetSharedDescriptorGuard() const
Takes the read lock for the descriptor. Multiple threads can take the lock concurrently....
std::unique_ptr< RDeleter > fItemDeleter
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
RArrayAsRVecField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::size_t arrayLength)
Constructor of the field.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
std::unique_ptr< RDeleter > GetDeleter() const final
Returns an RRVecField::RRVecDeleter.
std::size_t fArrayLength
The size of a child field's item.
std::size_t fItemSize
Sub field deleter or nullptr for simple fields.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
The size of a value of this field, i.e. an RVec.
std::vector< RFieldBase::RValue > SplitValue(const RFieldBase::RValue &value) const final
Creates the list of direct child values given an existing value for this field.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
std::size_t fValueSize
The length of the arrays in this field.
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
Returns an RVectorField::RVectorDeleter.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
std::unique_ptr< RDeleter > fItemDeleter
std::size_t fArrayLength
The size of a child field's item.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
RArrayAsVectorField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::size_t arrayLength)
The itemField argument represents the inner item of the on-disk array, i.e.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) 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::vector< RFieldBase::RValue > SplitValue(const RFieldBase::RValue &value) const final
Creates the list of direct child values given an existing value for this field.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
The length of the arrays in this field.
std::size_t fItemSize
Sub field deleter or nullptr for simple fields.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
std::unique_ptr< RDeleter > fItemDeleter
void operator()(void *objPtr, bool dtorOnly) final
Template specializations for C++ std::array and C-style arrays.
std::unique_ptr< RDeleter > GetDeleter() const final
RArrayField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::size_t arrayLength)
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
size_t GetValueSize() const final
What sizeof(T) for this type returns.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
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.
size_t GetAlignment() const final
What alignof(T) for this type returns.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Base class for all ROOT issued exceptions.
The list of column representations a field can have.
A functor to release the memory acquired by CreateValue() (memory and constructor).
RDeleter(std::size_t align)
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 size_t GetValueSize() const =0
What sizeof(T) for this type returns.
void Attach(std::unique_ptr< RFieldBase > child, std::string_view expectedChildName="")
Add a new subfield to the list of nested fields.
ROOT::Internal::RColumn * fPrincipalColumn
All fields that have columns have a distinct main column.
virtual size_t GetAlignment() const =0
What alignof(T) for this type returns.
std::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
@ kTraitEmulatedField
This field is a user defined type that was missing dictionaries and was reconstructed from the on-dis...
@ 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.
@ kTraitMappable
A field of a fundamental type that can be directly mapped via RField<T>::Map(), i....
static std::unique_ptr< RDeleter > GetDeleterOf(const RFieldBase &other)
static ROOT::Internal::RColumn * GetPrincipalColumnOf(const RFieldBase &other)
Fields may need direct access to the principal column of their subfields, e.g. in RRVecField::ReadBul...
RResult< void > EnsureMatchingOnDiskCollection(const RNTupleDescriptor &desc) const
Convenience wrapper for the common case of calling EnsureMatchinOnDiskField() for collections.
std::size_t Append(const void *from)
Write the given value into columns.
std::string GetQualifiedFieldName() const
Returns the field name and parent field names separated by dots (grandparent.parent....
const std::string & GetFieldName() const
RResult< void > EnsureMatchingOnDiskField(const RNTupleDescriptor &desc, std::uint32_t ignoreBits=0) const
Compares the field to the corresponding on-disk field information in the provided descriptor.
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append() and Read() on other (sub)fields.
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
RFieldBase(std::string_view name, std::string_view type, ROOT::ENTupleStructure structure, bool isSimple, std::size_t nRepetitions=0)
The constructor creates the underlying column objects and connects them to either a sink or a source.
std::string fTypeAlias
A typedef or using name that was used when creating the field.
std::uint32_t GetTraits() const
const std::string & GetTypeName() const
void GenerateColumnsImpl(const ColumnRepresentation_t &representation, std::uint16_t representationIndex)
Helpers for generating columns.
RValue BindValue(std::shared_ptr< void > objPtr)
Creates a value from a memory location with an already constructed object.
static void CallReadOn(RFieldBase &other, RNTupleLocalIndex localIndex, void *to)
ROOT::DescriptorId_t GetOnDiskId() const
std::unique_ptr< RFieldBase > Clone(std::string_view newName) const
Copies the field and its subfields using a possibly new name and a new, unconnected set of columns.
static void CallConstructValueOn(const RFieldBase &other, void *where)
Allow derived classes to call ConstructValue(void *) and GetDeleter() on other (sub)fields.
RResult< void > EnsureMatchingTypePrefix(const RNTupleDescriptor &desc, const std::vector< std::string > &prefixes) const
Many fields accept a range of type prefixes for schema evolution, e.g.
virtual std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec)
General implementation of bulk read.
@ kDiffStructure
The in-memory field and the on-disk field differ in their structural roles.
@ kDiffTypeName
The in-memory field and the on-disk field have different type names.
@ kDiffNRepetitions
The in-memory field and the on-disk field have different repetition counts.
Classes with dictionaries that can be inspected by TClass.
The on-storage metadata of an RNTuple.
const RFieldDescriptor & GetFieldDescriptor(ROOT::DescriptorId_t fieldId) const
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
ROOT::NTupleSize_t GetIndexInCluster() const
void operator()(void *objPtr, bool dtorOnly) final
std::unique_ptr< RDeleter > fItemDeleter
std::size_t fItemAlignment
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
size_t GetAlignment() const final
What alignof(T) for this type returns.
std::size_t fBulkNRepetition
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
ROOT::Internal::RColumnIndex fNWritten
RRVecField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::unique_ptr< RFieldBase > BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
size_t GetValueSize() const final
What sizeof(T) for this type returns.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
static unsigned char * ResizeRVec(void *rvec, std::size_t nItems, std::size_t itemSize, const RFieldBase *itemField, RDeleter *itemDeleter)
std::unique_ptr< RDeleter > fItemDeleter
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
RFieldBase * fBulkSubfield
May be a direct PoD subfield or a sub-subfield of a fixed-size array of PoD.
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
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
std::size_t fItemAlignment
void operator()(void *objPtr, bool dtorOnly) final
RVectorDeleter(std::size_t itemAlignment)
std::unique_ptr< RDeleter > fItemDeleter
static std::unique_ptr< RVectorField > CreateUntyped(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
std::unique_ptr< RFieldBase > BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
static void ResizeVector(void *vec, std::size_t nItems, std::size_t itemSize, const RFieldBase &itemField, RDeleter *itemDeleter)
RVectorField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::optional< std::string_view > emulatedFromType)
Creates a possibly-untyped VectorField.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
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 an existing value for this field.
std::unique_ptr< RDeleter > fItemDeleter
ROOT::Internal::RColumnIndex fNWritten
static constexpr std::size_t kMaxItemAlignment
Maximum alignment of the vector's value type.
std::unique_ptr< RDeleter > GetDeleter() const final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
std::tuple< unsigned char **, std::int32_t *, std::int32_t * > GetRVecDataMembers(void *rvecPtr)
Retrieve the addresses of the data members of a generic RVec from a pointer to the beginning of the R...
void DestroyRVecWithChecks(std::size_t alignOfT, unsigned char **beginPtr, std::int32_t *capacityPtr)
std::string GetNormalizedInteger(const std::string &intTemplateArg)
Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed.
std::string GetTypeTraceReport(const RFieldBase &field, const RNTupleDescriptor &desc)
Prints the hierarchy of types with their field names and field IDs for the given in-memory field and ...
std::size_t EvalRVecAlignment(std::size_t alignOfSubfield)
std::size_t EvalRVecValueSize(std::size_t alignOfT, std::size_t sizeOfT, std::size_t alignOfRVecT)
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
constexpr DescriptorId_t kInvalidDescriptorId
ENTupleStructure
The fields in the RNTuple data model tree can carry different structural information about the type s...
Storage type whose alignment matches AlignT bytes.
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().
RNTupleLocalIndex fFirstIndex
Start of the bulk range.
void * fValues
The destination area, which has to be an array of valid objects of the correct type large enough to h...
std::size_t fCount
Size of the bulk range.
std::vector< unsigned char > * fAuxData
Reference to memory owned by the RBulkValues class.