28std::unique_ptr<ROOT::Experimental::RFieldBase>
31 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
38 if (fSubFields[0]->IsSimple()) {
39 GetPrincipalColumnOf(*fSubFields[0])->AppendV(from, fArrayLength);
40 nbytes += fArrayLength * GetPrincipalColumnOf(*fSubFields[0])->GetElement()->GetPackedSize();
42 auto arrayPtr =
static_cast<const unsigned char *
>(from);
43 for (
unsigned i = 0; i < fArrayLength; ++i) {
44 nbytes += CallAppendOn(*fSubFields[0],
arrayPtr + (i * fItemSize));
52 if (fSubFields[0]->IsSimple()) {
53 GetPrincipalColumnOf(*fSubFields[0])->ReadV(
globalIndex * fArrayLength, fArrayLength, to);
55 auto arrayPtr =
static_cast<unsigned char *
>(to);
56 for (
unsigned i = 0; i < fArrayLength; ++i) {
64 if (fSubFields[0]->IsSimple()) {
65 GetPrincipalColumnOf(*fSubFields[0])
69 auto arrayPtr =
static_cast<unsigned char *
>(to);
70 for (
unsigned i = 0; i < fArrayLength; ++i) {
71 CallReadOn(*fSubFields[0],
80 if (fSubFields[0]->GetTraits() & kTraitTriviallyConstructible)
84 for (
unsigned i = 0; i < fArrayLength; ++i) {
85 CallConstructValueOn(*fSubFields[0],
arrayPtr + (i * fItemSize));
92 for (
unsigned i = 0; i < fArrayLength; ++i) {
93 fItemDeleter->operator()(
reinterpret_cast<unsigned char *
>(
objPtr) + i * fItemSize,
true );
101 if (!(fSubFields[0]->GetTraits() & kTraitTriviallyDestructible))
102 return std::make_unique<RArrayDeleter>(fItemSize, fArrayLength, GetDeleterOf(*fSubFields[0]));
103 return std::make_unique<RDeleter>();
106std::vector<ROOT::Experimental::RFieldBase::RValue>
110 std::vector<RValue>
result;
111 result.reserve(fArrayLength);
112 for (
unsigned i = 0; i < fArrayLength; ++i) {
114 fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(),
arrayPtr + (i * fItemSize))));
121 visitor.VisitArrayField(*
this);
132 void **begin =
reinterpret_cast<void **
>(
rvecPtr);
134 std::int32_t *
size =
reinterpret_cast<std::int32_t *
>(begin + 1);
137 std::int32_t *capacity =
size + 1;
139 return {begin,
size, capacity};
161 constexpr auto dataMemberSz =
sizeof(
void *) + 2 *
sizeof(std::int32_t);
165#ifdef R__HAS_HARDWARE_INTERFERENCE_SIZE
167 constexpr unsigned cacheLineSize = std::hardware_destructive_interference_size;
169 constexpr unsigned cacheLineSize = 64u;
172 constexpr unsigned maxInlineByteSize = 1024;
174 elementsPerCacheLine >= 8 ? elementsPerCacheLine : (
sizeOfT * 8 > maxInlineByteSize ? 0 : 8);
196 return std::max({
alignof(
void *),
alignof(std::int32_t),
alignOfSubField});
203 constexpr auto dataMemberSz =
sizeof(
void *) + 2 *
sizeof(std::int32_t);
210 if (!isSmall &&
owns)
228std::unique_ptr<ROOT::Experimental::RFieldBase>
231 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
240 if (fSubFields[0]->IsSimple() && *
sizePtr) {
242 nbytes += *
sizePtr * GetPrincipalColumnOf(*fSubFields[0])->GetElement()->GetPackedSize();
244 auto begin =
reinterpret_cast<const char *
>(*beginPtr);
245 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
246 nbytes += CallAppendOn(*fSubFields[0], begin + i * fItemSize);
251 fPrincipalColumn->Append(&fNWritten);
252 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
266 char *begin =
reinterpret_cast<char *
>(*beginPtr);
272 const bool needsConstruct = !(fSubFields[0]->GetTraits() & kTraitTriviallyConstructible);
278 fItemDeleter->operator()(begin + (i * fItemSize),
true );
287 for (std::size_t i = 0
u; i <
oldSize; ++i) {
288 fItemDeleter->operator()(begin + (i * fItemSize),
true );
301 begin =
reinterpret_cast<char *
>(*beginPtr);
306 for (std::size_t i = 0
u; i <
oldSize; ++i)
307 CallConstructValueOn(*fSubFields[0], begin + (i * fItemSize));
315 CallConstructValueOn(*fSubFields[0], begin + (i * fItemSize));
318 if (fSubFields[0]->IsSimple() &&
nItems) {
324 for (std::size_t i = 0; i <
nItems; ++i) {
325 CallReadOn(*fSubFields[0],
collectionStart + i, begin + (i * fItemSize));
331 if (!fSubFields[0]->IsSimple())
337 bulkSpec.fAuxData->resize(
sizeof(std::size_t));
338 *
reinterpret_cast<std::size_t *
>(
bulkSpec.fAuxData->data()) = fSubFields[0]->GetValueSize();
364 for (std::size_t i = 0; i <
nBatch; ++i) {
384 for (std::size_t i = 0; i <
bulkSpec.fCount; ++i) {
391 return RBulkSpec::kAllSet;
420 std::int32_t *
sizePtr =
new (
reinterpret_cast<void *
>(
beginPtr + 1)) std::int32_t(0);
421 new (
sizePtr + 1) std::int32_t(-1);
428 char *begin =
reinterpret_cast<char *
>(*beginPtr);
430 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
431 fItemDeleter->operator()(begin + i * fItemSize,
true );
442 return std::make_unique<RRVecDeleter>(fSubFields[0]->GetAlignment(), fItemSize, GetDeleterOf(*fSubFields[0]));
443 return std::make_unique<RRVecDeleter>(fSubFields[0]->GetAlignment());
446std::vector<ROOT::Experimental::RFieldBase::RValue>
451 std::vector<RValue>
result;
452 char *begin =
reinterpret_cast<char *
>(*beginPtr);
454 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
455 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(), begin + i * fItemSize)));
494std::unique_ptr<ROOT::Experimental::RVectorField>
500std::unique_ptr<ROOT::Experimental::RFieldBase>
503 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
504 return std::unique_ptr<ROOT::Experimental::RVectorField>(
510 auto typedValue =
static_cast<const std::vector<char> *
>(from);
519 if (fSubFields[0]->IsSimple() && count) {
520 GetPrincipalColumnOf(*fSubFields[0])->AppendV(
typedValue->data(), count);
521 nbytes += count * GetPrincipalColumnOf(*fSubFields[0])->GetElement()->GetPackedSize();
523 for (
unsigned i = 0; i < count; ++i) {
524 nbytes += CallAppendOn(*fSubFields[0],
typedValue->data() + (i * fItemSize));
529 fPrincipalColumn->Append(&fNWritten);
530 return nbytes + fPrincipalColumn->GetElement()->GetPackedSize();
535 auto typedValue =
static_cast<std::vector<char> *
>(to);
541 if (fSubFields[0]->IsSimple()) {
556 fItemDeleter->operator()(
typedValue->data() + (i * fItemSize),
true );
560 if (!(fSubFields[0]->GetTraits() & kTraitTriviallyConstructible)) {
562 CallConstructValueOn(*fSubFields[0],
typedValue->data() + (i * fItemSize));
566 for (std::size_t i = 0; i <
nItems; ++i) {
599 for (std::size_t i = 0; i <
nItems; ++i) {
600 fItemDeleter->operator()(
vecPtr->data() + (i * fItemSize),
true );
610 return std::make_unique<RVectorDeleter>(fItemSize, GetDeleterOf(*fSubFields[0]));
611 return std::make_unique<RVectorDeleter>();
614std::vector<ROOT::Experimental::RFieldBase::RValue>
617 auto vec =
value.GetPtr<std::vector<char>>();
621 std::vector<RValue>
result;
623 for (
unsigned i = 0; i <
nItems; ++i) {
625 fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(),
vec->data() + (i * fItemSize))));
632 visitor.VisitVectorField(*
this);
645 auto typedValue =
static_cast<const std::vector<bool> *
>(from);
647 for (
unsigned i = 0; i < count; ++i) {
648 bool bval = (*typedValue)[i];
649 CallAppendOn(*fSubFields[0], &
bval);
652 fPrincipalColumn->Append(&fNWritten);
653 return count + fPrincipalColumn->GetElement()->GetPackedSize();
658 auto typedValue =
static_cast<std::vector<bool> *
>(to);
665 for (
unsigned i = 0; i <
nItems; ++i) {
668 (*typedValue)[i] =
bval;
693std::vector<ROOT::Experimental::RFieldBase::RValue>
698 std::vector<RValue>
result;
700 for (
unsigned i = 0; i < count; ++i) {
702 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<bool>(
new bool(
true))));
704 result.emplace_back(fSubFields[0]->BindValue(std::shared_ptr<bool>(
new bool(
false))));
711 visitor.VisitVectorBoolField(*
this);
717 std::unique_ptr<ROOT::Experimental::RFieldBase>
itemField,
730std::unique_ptr<ROOT::Experimental::RFieldBase>
733 auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetFieldName());
734 return std::make_unique<RArrayAsRVecField>(
newName, std::move(
newItemField), fArrayLength);
741 std::int32_t *
sizePtr =
new (
reinterpret_cast<void *
>(
beginPtr + 1)) std::int32_t(0);
746 char *begin =
reinterpret_cast<char *
>(*beginPtr);
749 if (*
sizePtr == std::int32_t(fArrayLength))
756 const bool needsConstruct = !(fSubFields[0]->GetTraits() & kTraitTriviallyConstructible);
762 for (std::int32_t i = 0; i < *
sizePtr; ++i) {
763 fItemDeleter->operator()(begin + (i * fItemSize),
true );
776 begin =
reinterpret_cast<char *
>(*beginPtr);
783 for (std::size_t i = 0; i < fArrayLength; ++i)
784 CallConstructValueOn(*fSubFields[0], begin + (i * fItemSize));
791 return std::make_unique<RRVecField::RRVecDeleter>(fSubFields[0]->GetAlignment(), fItemSize,
792 GetDeleterOf(*fSubFields[0]));
794 return std::make_unique<RRVecField::RRVecDeleter>(fSubFields[0]->GetAlignment());
801 auto rvecBeginPtr =
reinterpret_cast<char *
>(*beginPtr);
803 if (fSubFields[0]->IsSimple()) {
809 for (std::size_t i = 0; i < fArrayLength; ++i) {
817 auto rvecBeginPtr =
reinterpret_cast<char *
>(*beginPtr);
822 if (fSubFields[0]->IsSimple()) {
823 GetPrincipalColumnOf(*fSubFields[0])
829 for (std::size_t i = 0; i < fArrayLength; ++i) {
840std::vector<ROOT::Experimental::RFieldBase::RValue>
844 std::vector<ROOT::Experimental::RFieldBase::RValue>
result;
845 result.reserve(fArrayLength);
846 for (
unsigned i = 0; i < fArrayLength; ++i) {
848 fSubFields[0]->BindValue(std::shared_ptr<void>(
value.GetPtr<
void>(),
arrayPtr + (i * fItemSize))));
855 visitor.VisitArrayAsRVecField(*
this);
ROOT::Experimental::RField< T > RField
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< RFieldBase > CloneImpl(std::string_view newName) const final
The size of a value of this field, i.e. an RVec.
std::size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::size_t fValueSize
The length of the arrays in this field.
std::unique_ptr< RDeleter > GetDeleter() const final
Returns an RRVecField::RRVecDeleter.
RArrayAsRVecField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::size_t arrayLength)
Constructor of the 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 AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
std::vector< RFieldBase::RValue > SplitValue(const RFieldBase::RValue &value) const final
Creates the list of direct child values given a value for this field.
std::unique_ptr< RDeleter > fItemDeleter
void operator()(void *objPtr, bool dtorOnly) final
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for 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::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
std::unique_ptr< RDeleter > GetDeleter() const final
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
RArrayField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::size_t arrayLength)
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.
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.
@ kTraitTriviallyDestructible
The type is cleaned up just by freeing its memory. I.e. the destructor performs a no-op.
static std::unique_ptr< RDeleter > GetDeleterOf(const RFieldBase &other)
virtual std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec)
General implementation of bulk read.
std::uint32_t GetTraits() const
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
Classes with dictionaries that can be inspected by TClass.
The on-storage meta-data of an ntuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
void operator()(void *objPtr, bool dtorOnly) final
std::unique_ptr< RDeleter > fItemDeleter
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadGlobalImpl(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 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.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
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 ...
RRVecField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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)
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
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RDeleter > fItemDeleter
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
std::unique_ptr< RDeleter > GetDeleter() const final
RVectorField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, bool isUntyped)
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(NTupleSize_t globalIndex, void *to) final
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.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...