13#ifndef ROOT_RField_SequenceContainer
14#define ROOT_RField_SequenceContainer
17#error "Please include RField.hxx!"
36 std::string_view emulatedFromType);
53 RArrayDeleter(std::size_t itemSize, std::size_t arrayLength, std::unique_ptr<RDeleter> itemDeleter)
57 void operator()(
void *objPtr,
bool dtorOnly)
final;
64 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
67 std::unique_ptr<RDeleter>
GetDeleter() const final;
69 std::
size_t AppendImpl(const
void *from) final;
89template <
typename ItemT, std::
size_t N>
90class RField<std::array<ItemT, N>> :
public RArrayField {
93 explicit RField(std::string_view
name) : RArrayField(
name, std::make_unique<
RField<ItemT>>(
"_0"),
N) {}
99template <
typename ItemT, std::
size_t N>
118 static unsigned char *
129 RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr<RDeleter> itemDeleter)
133 void operator()(
void *objPtr,
bool dtorOnly)
final;
148 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
156 std::
size_t AppendImpl(const
void *from) final;
166 RRVecField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
179template <typename ItemT>
182 RField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField)
204 std::unique_ptr<RFieldBase> itemField,
205 std::string_view emulatedFromType);
218 void operator()(
void *objPtr,
bool dtorOnly)
final;
233 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField,
234 std::optional<std::string_view> emulatedFromType);
236 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
242 void ConstructValue(
void *where) const final {
new (where) std::vector<char>(); }
243 std::unique_ptr<RDeleter> GetDeleter() const final;
245 std::
size_t AppendImpl(const
void *from) final;
254 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
259 static std::unique_ptr<RVectorField>
260 CreateUntyped(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
263 size_t GetValueSize() const final {
return sizeof(std::vector<char>); }
264 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
268template <
typename ItemT>
269class RField<std::
vector<ItemT>> final :
public RVectorField {
272 explicit RField(std::string_view
name) : RVectorField(
name, std::make_unique<
RField<ItemT>>(
"_0")) {}
282 ROOT::Internal::RColumnIndex fNWritten{0};
285 std::size_t fOnDiskNRepetitions = 0;
288 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
290 return std::make_unique<RField>(newName);
297 void ConstructValue(
void *where) const final {
new (where) std::vector<bool>(); }
298 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<std::vector<bool>>>(); }
300 std::size_t
AppendImpl(
const void *from)
final;
309 static std::string
TypeName() {
return "std::vector<bool>"; }
315 std::vector<RValue>
SplitValue(const RValue &value) const final;
317 size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
318 size_t GetAlignment() const final {
return std::alignment_of<std::vector<bool>>(); }
319 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor)
const final;
341 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
346 void ConstructValue(
void *where)
const final;
348 std::unique_ptr<RDeleter> GetDeleter() const final;
369 std::size_t GetAlignment() const final;
388 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
393 void ConstructValue(
void *where) const final {
new (where) std::vector<char>(); }
395 std::unique_ptr<RDeleter> GetDeleter() const final;
412 size_t GetValueSize() const final {
return sizeof(std::vector<char>); }
413 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
415 std::vector<RFieldBase::RValue> SplitValue(
const RFieldBase::RValue &value)
const final;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
TRObject operator()(const T1 &t1) const
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
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
The number of bytes taken by a value of the appropriate 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
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.
std::size_t fArrayLength
The size of a child field's item.
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 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< 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.
RArrayDeleter(std::size_t itemSize, std::size_t arrayLength, std::unique_ptr< RDeleter > itemDeleter)
std::unique_ptr< RDeleter > fItemDeleter
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
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::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
As a rule of thumb, the alignment is equal to the size of the type.
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::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.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
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
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
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()
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
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
As a rule of thumb, the alignment is equal to the size of the type.
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::unique_ptr< RDeleter > fItemDeleter
RVectorDeleter(std::size_t itemSize, std::unique_ptr< RDeleter > itemDeleter)
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 ...
RVectorField(RVectorField &&other)=default
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.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
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
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RVectorField & operator=(RVectorField &&other)=default
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...
std::unique_ptr< RFieldBase > CreateEmulatedVectorField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField, std::string_view emulatedFromType)
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().