13#ifndef ROOT_RField_SequenceContainer
14#define ROOT_RField_SequenceContainer
17#error "Please include RField.hxx!"
34namespace Experimental {
40 std::string_view emulatedFromType);
58 std::unique_ptr<RDeleter> itemDeleter)
62 void operator()(
void *objPtr,
bool dtorOnly)
final;
69 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
72 std::unique_ptr<RDeleter>
GetDeleter() const final;
74 std::
size_t AppendImpl(const
void *from) final;
82 RArrayField(std::string_view fieldName, std::unique_ptr<
RFieldBase> itemField, std::
size_t arrayLength);
94template <
typename ItemT, std::
size_t N>
95class RField<std::array<ItemT, N>> :
public RArrayField {
98 explicit RField(std::string_view
name) : RArrayField(
name, std::make_unique<
RField<ItemT>>(
"_0"),
N) {}
104template <
typename ItemT, std::
size_t N>
124 static unsigned char *
125 ResizeRVec(
void *rvec, std::size_t nItems, std::size_t itemSize,
const RFieldBase *itemField,
RDeleter *itemDeleter);
130 std::size_t fItemSize = 0;
138 RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr<RDeleter> itemDeleter)
140 fItemAlignment(itemAlignment),
142 fItemDeleter(std::move(itemDeleter))
145 void operator()(
void *objPtr,
bool dtorOnly)
final;
156 std::size_t fBulkNRepetition = 1;
160 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
168 std::
size_t AppendImpl(const
void *from) final;
178 RRVecField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
191template <typename ItemT>
194 RField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField)
215 friend std::unique_ptr<RFieldBase> Internal::CreateEmulatedVectorField(std::string_view fieldName,
216 std::unique_ptr<RFieldBase> itemField,
217 std::string_view emulatedFromType);
221 std::size_t fItemSize = 0;
222 std::size_t fItemAlignment = 0;
227 RVectorDeleter(std::size_t itemSize, std::size_t itemAlignment, std::unique_ptr<RDeleter> itemDeleter);
228 void operator()(
void *objPtr,
bool dtorOnly)
final;
236 static void ResizeVector(
void *vec, std::size_t nItems, std::size_t itemSize,
const RFieldBase &itemField,
243 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField,
244 std::optional<std::string_view> emulatedFromType);
246 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
249 void GenerateColumns() final;
252 void ConstructValue(
void *where) const final;
253 std::unique_ptr<
RDeleter> GetDeleter() const final;
255 std::
size_t AppendImpl(const
void *from) final;
261 void CommitClusterImpl() final { fNWritten = 0; }
265 static constexpr std::size_t kMaxItemAlignment = 4096;
267 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
272 static std::unique_ptr<RVectorField>
273 CreateUntyped(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
275 std::vector<RValue> SplitValue(
const RValue &
value)
const final;
276 std::size_t GetValueSize() const final;
277 std::
size_t GetAlignment() const final;
281template <typename ItemT>
286 RField(RField &&other) =
default;
287 RField &operator=(RField &&other) =
default;
288 ~RField() final = default;
293class RField<std::vector<
bool>> final : public RFieldBase {
298 std::size_t fOnDiskNRepetitions = 0;
301 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final
303 return std::make_unique<RField>(newName);
306 const RColumnRepresentations &GetColumnRepresentations() const final;
307 void GenerateColumns() final;
308 void GenerateColumns(const
ROOT::RNTupleDescriptor &desc) final;
310 void ConstructValue(
void *where) const final {
new (where) std::vector<bool>(); }
311 std::unique_ptr<RDeleter> GetDeleter() const final {
return std::make_unique<RTypedDeleter<std::vector<bool>>>(); }
313 std::size_t AppendImpl(
const void *from)
final;
317 void ReconcileOnDiskField(
const RNTupleDescriptor &desc)
final;
319 void CommitClusterImpl() final { fNWritten = 0; }
322 static std::string TypeName() {
return "std::vector<bool>"; }
323 explicit RField(std::string_view
name);
324 RField(RField &&other) =
default;
325 RField &operator=(RField &&other) =
default;
326 ~RField() final = default;
328 std::vector<RValue> SplitValue(const RValue &
value) const final;
330 std::
size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
331 std::size_t GetAlignment() const final {
return alignof(std::vector<bool>); }
354 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
357 using RFieldBase::GenerateColumns;
359 void ConstructValue(
void *where)
const final;
361 std::unique_ptr<RDeleter> GetDeleter() const final;
381 std::
size_t GetValueSize() const final {
return fValueSize; }
382 std::size_t GetAlignment() const final;
401 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
403 void GenerateColumns() final;
406 void ConstructValue(
void *where) const final;
408 std::unique_ptr<
RDeleter> GetDeleter() const final;
425 std::
size_t GetValueSize() const final;
426 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 SoA field provides I/O for an in-memory SoA layout linked to an on-disk collection of the underly...
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.
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
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, std::string_view emulatedFromType)
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().