13#ifndef ROOT_RField_SequenceContainer
14#define ROOT_RField_SequenceContainer
17#error "Please include RField.hxx!"
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;
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 *
138 RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr<RDeleter> itemDeleter)
145 void operator()(
void *objPtr,
bool dtorOnly)
final;
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)
216 std::unique_ptr<RFieldBase> itemField,
217 std::string_view emulatedFromType);
227 RVectorDeleter(std::size_t itemSize, std::size_t itemAlignment, std::unique_ptr<RDeleter> itemDeleter);
228 void operator()(
void *objPtr,
bool dtorOnly)
final;
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;
255 std::
size_t AppendImpl(const
void *from) final;
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);
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;
315 void ReadInClusterImpl(ROOT::RNTupleLocalIndex localIndex,
void *to)
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>); }
332 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor)
const final;
354 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
359 void ConstructValue(
void *where)
const final;
361 std::unique_ptr<RDeleter> GetDeleter() const final;
382 std::size_t GetAlignment() const final;
401 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
RInterface & operator=(const RInterface &)=default
Copy-assignment operator for RInterface.
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
RArrayAsRVecField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::size_t arrayLength)
Constructor of the field.
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< RFieldBase > CloneImpl(std::string_view newName) const final
The size of a value of this field, i.e. an RVec.
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::size_t fValueSize
The length of the arrays in this field.
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
RArrayDeleter(std::size_t itemSize, std::size_t arrayLength, std::size_t alignment, std::unique_ptr< RDeleter > itemDeleter)
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.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
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.
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 ...
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.
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)
static std::string TypeName()
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.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
RRVecField & operator=(RRVecField &&)=default
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
~RRVecField() override=default
size_t GetAlignment() const final
What alignof(T) for this type returns.
std::size_t fBulkNRepetition
RRVecField(const RRVecField &)=delete
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)
friend class RArrayAsRVecField
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
void CommitClusterImpl() final
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.
static unsigned char * ResizeRVec(void *rvec, std::size_t nItems, std::size_t itemSize, const RFieldBase *itemField, RDeleter *itemDeleter)
std::unique_ptr< RDeleter > fItemDeleter
RFieldBase * fBulkSubfield
May be a direct PoD subfield or a sub-subfield of a fixed-size array of PoD.
RRVecField(RRVecField &&)=default
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
RRVecField & operator=(RRVecField &)=delete
std::size_t fItemAlignment
void operator()(void *objPtr, bool dtorOnly) final
RVectorDeleter(std::size_t itemAlignment)
std::unique_ptr< RDeleter > fItemDeleter
Template specializations for C++ std::vector.
void CommitClusterImpl() final
static std::unique_ptr< RVectorField > CreateUntyped(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
friend class RArrayAsVectorField
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,...
RVectorField(RVectorField &&other)=default
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.
~RVectorField() override=default
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
RVectorField & operator=(RVectorField &&other)=default
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
A "std::vector"-like collection of values implementing handy operation to analyse them.
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
Namespace for ROOT features in testing.
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().