13#ifndef ROOT_RField_SequenceContainer
14#define ROOT_RField_SequenceContainer
17#error "Please include RField.hxx!"
38 const RFieldDescriptor &emulatedFrom);
56 std::unique_ptr<RDeleter> itemDeleter)
60 void operator()(
void *objPtr,
bool dtorOnly)
final;
67 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
70 std::unique_ptr<RDeleter>
GetDeleter() const final;
72 std::
size_t AppendImpl(const
void *from) final;
80 RArrayField(std::string_view fieldName, std::unique_ptr<
RFieldBase> itemField, std::
size_t arrayLength);
92template <
typename ItemT, std::
size_t N>
93class RField<std::array<ItemT, N>> :
public RArrayField {
96 explicit RField(std::string_view
name) : RArrayField(
name, std::make_unique<
RField<ItemT>>(
"_0"),
N) {}
102template <
typename ItemT, std::
size_t N>
122 static unsigned char *
123 ResizeRVec(
void *rvec, std::size_t nItems, std::size_t itemSize,
const RFieldBase *itemField,
RDeleter *itemDeleter);
128 std::size_t fItemSize = 0;
136 RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr<RDeleter> itemDeleter)
138 fItemAlignment(itemAlignment),
140 fItemDeleter(std::move(itemDeleter))
143 void operator()(
void *objPtr,
bool dtorOnly)
final;
154 std::size_t fBulkNRepetition = 1;
158 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
166 std::
size_t AppendImpl(const
void *from) final;
176 RRVecField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
189template <typename ItemT>
192 RField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField)
213 friend std::unique_ptr<RFieldBase> Internal::CreateEmulatedVectorField(std::string_view fieldName,
214 std::unique_ptr<RFieldBase> itemField,
219 std::size_t fItemSize = 0;
220 std::size_t fItemAlignment = 0;
225 RVectorDeleter(std::size_t itemSize, std::size_t itemAlignment, std::unique_ptr<RDeleter> itemDeleter);
226 void operator()(
void *objPtr,
bool dtorOnly)
final;
233 std::uint32_t fEmulatedTypeVersion = 0;
234 std::uint32_t fEmulatedTypeChecksum = 0;
237 static void ResizeVector(
void *vec, std::size_t nItems, std::size_t itemSize,
const RFieldBase &itemField,
244 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField,
247 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
250 void GenerateColumns() final;
253 void ConstructValue(
void *where) const final;
254 std::unique_ptr<
RDeleter> GetDeleter() const final;
256 std::
size_t AppendImpl(const
void *from) final;
262 void CommitClusterImpl() final { fNWritten = 0; }
266 static constexpr std::size_t kMaxItemAlignment = 4096;
268 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
273 static std::unique_ptr<RVectorField>
274 CreateUntyped(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
276 std::vector<RValue> SplitValue(
const RValue &
value)
const final;
277 std::size_t GetValueSize() const final;
278 std::
size_t GetAlignment() const final;
282template <typename ItemT>
287 RField(RField &&other) =
default;
288 RField &operator=(RField &&other) =
default;
289 ~RField() final = default;
294class RField<std::vector<
bool>> final : public RFieldBase {
299 std::size_t fOnDiskNRepetitions = 0;
302 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final
304 return std::make_unique<RField>(newName);
307 const RColumnRepresentations &GetColumnRepresentations() const final;
308 void GenerateColumns() final;
309 void GenerateColumns(const
ROOT::RNTupleDescriptor &desc) final;
311 void ConstructValue(
void *where) const final {
new (where) std::vector<bool>(); }
312 std::unique_ptr<RDeleter> GetDeleter() const final {
return std::make_unique<RTypedDeleter<std::vector<bool>>>(); }
314 std::size_t AppendImpl(
const void *from)
final;
318 void ReconcileOnDiskField(
const RNTupleDescriptor &desc)
final;
320 void CommitClusterImpl() final { fNWritten = 0; }
323 static std::string TypeName() {
return "std::vector<bool>"; }
324 explicit RField(std::string_view
name);
325 RField(RField &&other) =
default;
326 RField &operator=(RField &&other) =
default;
327 ~RField() final = default;
329 std::vector<RValue> SplitValue(const RValue &
value) const final;
331 std::
size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
332 std::size_t GetAlignment() const final {
return alignof(std::vector<bool>); }
355 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
358 using RFieldBase::GenerateColumns;
360 void ConstructValue(
void *where)
const final;
362 std::unique_ptr<RDeleter> GetDeleter() const final;
382 std::
size_t GetValueSize() const final {
return fValueSize; }
383 std::size_t GetAlignment() const final;
402 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
404 void GenerateColumns() final;
407 void ConstructValue(
void *where) const final;
409 std::unique_ptr<
RDeleter> GetDeleter() const final;
426 std::
size_t GetValueSize() const final;
427 std::
size_t GetAlignment() const final;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
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.
Abstract interface to read data from an ntuple.
Additional classes related to sequence containers.
std::unique_ptr< RDeleter > fItemDeleter
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 GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
std::size_t fValueSize
The length of the arrays in this field.
A field for fixed-size arrays that are represented as std::vector in memory.
std::unique_ptr< RDeleter > fItemDeleter
std::size_t fArrayLength
The size of a child field's item.
std::size_t fItemSize
Sub field deleter or nullptr for simple fields.
std::unique_ptr< RDeleter > fItemDeleter
void operator()(void *objPtr, bool dtorOnly) final
RArrayDeleter(std::size_t itemSize, std::size_t arrayLength, std::size_t alignment, std::unique_ptr< RDeleter > itemDeleter)
Template specializations for C++ std::array and C-style arrays.
std::unique_ptr< RDeleter > GetDeleter() const final
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.
std::unique_ptr< RFieldBase > BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
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
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(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.
std::unique_ptr< RDeleter > GetDeleter() const final
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).
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::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponding to the field type ...
virtual void CommitClusterImpl()
virtual std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec)
General implementation of bulk read.
Metadata stored for every field of an RNTuple.
RField(std::string_view name)
RField(RField &&other)=default
RField & operator=(RField &&other)=default
RField(RField &&other)=default
RField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
RField(std::string_view name)
RField & operator=(RField &&other)=default
Classes with dictionaries that can be inspected by TClass.
RField & operator=(RField &&other)=default
static std::string TypeName()
RField(std::string_view name)
The on-storage metadata of an RNTuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr< RDeleter > itemDeleter)
std::unique_ptr< RDeleter > fItemDeleter
RRVecDeleter(std::size_t itemAlignment)
std::size_t fItemAlignment
Template specializations for ROOT's RVec.
RRVecField & operator=(RRVecField &&)=default
~RRVecField() override=default
RRVecField(const RRVecField &)=delete
ROOT::Internal::RColumnIndex fNWritten
std::unique_ptr< RDeleter > fItemDeleter
RRVecField(RRVecField &&)=default
RRVecField & operator=(RRVecField &)=delete
The SoA field provides I/O for an in-memory SoA layout linked to an on-disk collection of the underly...
std::unique_ptr< RDeleter > fItemDeleter
Template specializations for C++ std::vector.
RVectorField(RVectorField &&other)=default
~RVectorField() override=default
std::unique_ptr< RDeleter > fItemDeleter
ROOT::Internal::RColumnIndex fNWritten
RVectorField & operator=(RVectorField &&other)=default
A "std::vector"-like collection of values implementing handy operation to analyse them.
std::unique_ptr< RFieldBase > CreateEmulatedVectorField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, const RFieldDescriptor &emulatedFrom)
std::size_t EvalRVecAlignment(std::size_t alignOfSubfield)
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().