18 "std::array<" +
itemField->GetTypeName() +
"," +
30 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
37 if (fSubfields[0]->IsSimple()) {
38 GetPrincipalColumnOf(*fSubfields[0])->AppendV(from, fArrayLength);
39 nbytes += fArrayLength * GetPrincipalColumnOf(*fSubfields[0])->GetElement()->GetPackedSize();
41 auto arrayPtr =
static_cast<const unsigned char *
>(from);
42 for (
unsigned i = 0; i < fArrayLength; ++i) {
43 nbytes += CallAppendOn(*fSubfields[0],
arrayPtr + (i * fItemSize));
51 if (fSubfields[0]->IsSimple()) {
52 GetPrincipalColumnOf(*fSubfields[0])->ReadV(
globalIndex * fArrayLength, fArrayLength, to);
54 auto arrayPtr =
static_cast<unsigned char *
>(to);
55 for (
unsigned i = 0; i < fArrayLength; ++i) {
63 if (fSubfields[0]->IsSimple()) {
64 GetPrincipalColumnOf(*fSubfields[0])
68 auto arrayPtr =
static_cast<unsigned char *
>(to);
69 for (
unsigned i = 0; i < fArrayLength; ++i) {
70 CallReadOn(*fSubfields[0],
79 if (fSubfields[0]->GetTraits() & kTraitTriviallyConstructible)
83 for (
unsigned i = 0; i < fArrayLength; ++i) {
84 CallConstructValueOn(*fSubfields[0],
arrayPtr + (i * fItemSize));
91 for (
unsigned i = 0; i < fArrayLength; ++i) {
92 fItemDeleter->operator()(
reinterpret_cast<unsigned char *
>(
objPtr) + i * fItemSize,
true );
100 if (!(fSubfields[0]->GetTraits() & kTraitTriviallyDestructible))
101 return std::make_unique<RArrayDeleter>(fItemSize, fArrayLength, GetDeleterOf(*fSubfields[0]));
102 return std::make_unique<RDeleter>();
109 std::vector<RValue>
result;
110 result.reserve(fArrayLength);
111 for (
unsigned i = 0; i < fArrayLength; ++i) {
112 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<void>(
valuePtr,
arrayPtr + (i * fItemSize))));
119 visitor.VisitArrayField(*
this);
130 void **begin =
reinterpret_cast<void **
>(
rvecPtr);
132 std::int32_t *
size =
reinterpret_cast<std::int32_t *
>(begin + 1);
135 std::int32_t *capacity =
size + 1;
137 return {begin,
size, capacity};
159 constexpr auto dataMemberSz =
sizeof(
void *) + 2 *
sizeof(std::int32_t);
165 constexpr unsigned maxInlineByteSize = 1024;
167 elementsPerCacheLine >= 8 ? elementsPerCacheLine : (
sizeOfT * 8 > maxInlineByteSize ? 0 : 8);
189 return std::max({
alignof(
void *),
alignof(std::int32_t),
alignOfSubfield});
196 constexpr auto dataMemberSz =
sizeof(
void *) + 2 *
sizeof(std::int32_t);
203 if (!isSmall &&
owns)
223 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
232 if (fSubfields[0]->IsSimple() && *
sizePtr) {
234 nbytes += *
sizePtr * GetPrincipalColumnOf(*fSubfields[0])->GetElement()->GetPackedSize();
236 auto begin =
reinterpret_cast<const char *
>(*beginPtr);
237 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
238 nbytes += CallAppendOn(*fSubfields[0], begin + i * fItemSize);
243 fPrincipalColumn->Append(&fNWritten);
244 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
258 char *begin =
reinterpret_cast<char *
>(*beginPtr);
264 const bool needsConstruct = !(fSubfields[0]->GetTraits() & kTraitTriviallyConstructible);
270 fItemDeleter->operator()(begin + (i * fItemSize),
true );
279 for (std::size_t i = 0
u; i <
oldSize; ++i) {
280 fItemDeleter->operator()(begin + (i * fItemSize),
true );
293 begin =
reinterpret_cast<char *
>(*beginPtr);
298 for (std::size_t i = 0
u; i <
oldSize; ++i)
299 CallConstructValueOn(*fSubfields[0], begin + (i * fItemSize));
307 CallConstructValueOn(*fSubfields[0], begin + (i * fItemSize));
310 if (fSubfields[0]->IsSimple() &&
nItems) {
316 for (std::size_t i = 0; i <
nItems; ++i) {
317 CallReadOn(*fSubfields[0],
collectionStart + i, begin + (i * fItemSize));
323 if (!fSubfields[0]->IsSimple())
329 bulkSpec.fAuxData->resize(
sizeof(std::size_t));
330 *
reinterpret_cast<std::size_t *
>(
bulkSpec.fAuxData->data()) = fSubfields[0]->GetValueSize();
356 for (std::size_t i = 0; i <
nBatch; ++i) {
376 for (std::size_t i = 0; i <
bulkSpec.fCount; ++i) {
383 return RBulkSpec::kAllSet;
411 std::int32_t *
sizePtr =
new (
reinterpret_cast<void *
>(
beginPtr + 1)) std::int32_t(0);
412 new (
sizePtr + 1) std::int32_t(-1);
419 char *begin =
reinterpret_cast<char *
>(*beginPtr);
421 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
422 fItemDeleter->operator()(begin + i * fItemSize,
true );
433 return std::make_unique<RRVecDeleter>(fSubfields[0]->GetAlignment(), fItemSize, GetDeleterOf(*fSubfields[0]));
434 return std::make_unique<RRVecDeleter>(fSubfields[0]->GetAlignment());
441 std::vector<RValue>
result;
442 char *begin =
reinterpret_cast<char *
>(*beginPtr);
444 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
445 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), begin + i * fItemSize)));
487std::unique_ptr<ROOT::RVectorField>
495 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
496 auto isUntyped = GetTypeName().empty() || ((fTraits & kTraitEmulatedField) != 0);
503 auto typedValue =
static_cast<const std::vector<char> *
>(from);
512 if (fSubfields[0]->IsSimple() && count) {
513 GetPrincipalColumnOf(*fSubfields[0])->AppendV(
typedValue->data(), count);
514 nbytes += count * GetPrincipalColumnOf(*fSubfields[0])->GetElement()->GetPackedSize();
516 for (
unsigned i = 0; i < count; ++i) {
517 nbytes += CallAppendOn(*fSubfields[0],
typedValue->data() + (i * fItemSize));
522 fPrincipalColumn->Append(&fNWritten);
523 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
528 auto typedValue =
static_cast<std::vector<char> *
>(to);
534 if (fSubfields[0]->IsSimple()) {
549 fItemDeleter->operator()(
typedValue->data() + (i * fItemSize),
true );
553 if (!(fSubfields[0]->GetTraits() & kTraitTriviallyConstructible)) {
555 CallConstructValueOn(*fSubfields[0],
typedValue->data() + (i * fItemSize));
559 for (std::size_t i = 0; i <
nItems; ++i) {
591 for (std::size_t i = 0; i <
nItems; ++i) {
592 fItemDeleter->operator()(
vecPtr->data() + (i * fItemSize),
true );
602 return std::make_unique<RVectorDeleter>(fItemSize, GetDeleterOf(*fSubfields[0]));
603 return std::make_unique<RVectorDeleter>();
609 auto *
vec =
static_cast<std::vector<char> *
>(
valuePtr.get());
613 std::vector<RValue>
result;
615 for (
unsigned i = 0; i <
nItems; ++i) {
616 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<void>(
valuePtr,
vec->data() + (i * fItemSize))));
623 visitor.VisitVectorField(*
this);
636 auto typedValue =
static_cast<const std::vector<bool> *
>(from);
638 for (
unsigned i = 0; i < count; ++i) {
639 bool bval = (*typedValue)[i];
640 CallAppendOn(*fSubfields[0], &
bval);
643 fPrincipalColumn->Append(&fNWritten);
644 return count + fPrincipalColumn->GetElement()->GetPackedSize();
649 auto typedValue =
static_cast<std::vector<bool> *
>(to);
656 for (
unsigned i = 0; i <
nItems; ++i) {
659 (*typedValue)[i] =
bval;
687 std::vector<RValue>
result;
689 for (
unsigned i = 0; i < count; ++i) {
691 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<bool>(
new bool(
true))));
693 result.emplace_back(fSubfields[0]->BindValue(std::shared_ptr<bool>(
new bool(
false))));
700 visitor.VisitVectorBoolField(*
this);
720 auto newItemField = fSubfields[0]->Clone(fSubfields[0]->GetFieldName());
721 return std::make_unique<RArrayAsRVecField>(
newName, std::move(
newItemField), fArrayLength);
728 std::int32_t *
sizePtr =
new (
reinterpret_cast<void *
>(
beginPtr + 1)) std::int32_t(0);
733 char *begin =
reinterpret_cast<char *
>(*beginPtr);
736 if (*
sizePtr == std::int32_t(fArrayLength))
743 const bool needsConstruct = !(fSubfields[0]->GetTraits() & kTraitTriviallyConstructible);
749 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
750 fItemDeleter->operator()(begin + (i * fItemSize),
true );
763 begin =
reinterpret_cast<char *
>(*beginPtr);
770 for (std::size_t i = 0; i < fArrayLength; ++i)
771 CallConstructValueOn(*fSubfields[0], begin + (i * fItemSize));
778 return std::make_unique<RRVecField::RRVecDeleter>(fSubfields[0]->GetAlignment(), fItemSize,
779 GetDeleterOf(*fSubfields[0]));
781 return std::make_unique<RRVecField::RRVecDeleter>(fSubfields[0]->GetAlignment());
788 auto rvecBeginPtr =
reinterpret_cast<char *
>(*beginPtr);
790 if (fSubfields[0]->IsSimple()) {
796 for (std::size_t i = 0; i < fArrayLength; ++i) {
804 auto rvecBeginPtr =
reinterpret_cast<char *
>(*beginPtr);
809 if (fSubfields[0]->IsSimple()) {
810 GetPrincipalColumnOf(*fSubfields[0])
816 for (std::size_t i = 0; i < fArrayLength; ++i) {
830 std::vector<ROOT::RFieldBase::RValue>
result;
831 result.reserve(fArrayLength);
832 for (
unsigned i = 0; i < fArrayLength; ++i) {
834 fSubfields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(),
arrayPtr + (i * fItemSize))));
841 visitor.VisitArrayAsRVecField(*
this);
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
#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.
The in-memory representation of a 32bit or 64bit on-disk index column.
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
As a rule of thumb, the alignment is equal to the size of the type.
std::unique_ptr< RDeleter > GetDeleter() const final
Returns an RRVecField::RRVecDeleter.
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.
std::size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
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...
void operator()(void *objPtr, bool dtorOnly) final
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
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
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.
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.
The list of column representations a field can have.
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
A field translates read and write calls from/to underlying columns to/from tree values.
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
std::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
static std::unique_ptr< RDeleter > GetDeleterOf(const RFieldBase &other)
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
std::uint32_t GetTraits() const
@ 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.
virtual std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec)
General implementation of bulk read.
Classes with dictionaries that can be inspected by TClass.
The on-storage metadata of an RNTuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
void operator()(void *objPtr, bool dtorOnly) final
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
As a rule of thumb, the alignment is equal to the size of the type.
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
RRVecField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
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::unique_ptr< RDeleter > fItemDeleter
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 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
void operator()(void *objPtr, bool dtorOnly) final
Template specializations for C++ std::vector.
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 ...
void AcceptVisitor(ROOT::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.
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::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
std::unique_ptr< RDeleter > GetDeleter() const final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
std::string GetNormalizedInteger(const std::string &intTemplateArg)
Appends 'll' or 'ull' to the where necessary and strips the suffix if not needed.
Namespace for new ROOT classes and functions.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleStructure
The fields in the RNTuple data model tree can carry different structural information about the type s...
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().