16#ifndef ROOT7_RField_SequenceContainer
17#define ROOT7_RField_SequenceContainer
20#error "Please include RField.hxx!"
32namespace Experimental {
52 RArrayDeleter(std::size_t itemSize, std::size_t arrayLength, std::unique_ptr<RDeleter> itemDeleter)
56 void operator()(
void *objPtr,
bool dtorOnly)
final;
63 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
66 std::unique_ptr<RDeleter>
GetDeleter() const final;
68 std::
size_t AppendImpl(const
void *from) final;
73 RArrayField(std::string_view fieldName, std::unique_ptr<
RFieldBase> itemField, std::
size_t arrayLength);
85template <
typename ItemT, std::
size_t N>
86class RField<std::array<ItemT, N>> :
public RArrayField {
87 using ContainerT =
typename std::array<ItemT, N>;
90 void ConstructValue(
void *where)
const final {
new (where) ContainerT(); }
94 explicit RField(std::string_view
name) : RArrayField(
name, std::make_unique<
RField<ItemT>>(
"_0"),
N) {}
100template <
typename ItemT, std::
size_t N>
125 RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr<RDeleter> itemDeleter)
129 void operator()(
void *objPtr,
bool dtorOnly)
final;
139 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const override;
147 std::
size_t AppendImpl(const
void *from) override;
154 RRVecField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
175template <
typename ItemT>
180 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
183 return std::make_unique<RField<ROOT::VecOps::RVec<ItemT>>>(newName, std::move(newItemField));
187 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<ContainerT>>(); }
191 auto typedValue =
static_cast<const ContainerT *
>(from);
193 auto count = typedValue->size();
194 for (
unsigned i = 0; i < count; ++i) {
197 this->fNWritten += count;
203 auto typedValue =
static_cast<ContainerT *
>(to);
207 typedValue->resize(nItems);
208 for (
unsigned i = 0; i < nItems; ++i) {
214 RField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField)
227 size_t GetAlignment() const final {
return std::alignment_of<ContainerT>(); }
249 void operator()(
void *objPtr,
bool dtorOnly)
final;
257 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField,
bool isUntyped);
259 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const override;
265 void ConstructValue(
void *where)
const override {
new (where) std::vector<char>(); }
266 std::unique_ptr<RDeleter>
GetDeleter() const final;
268 std::
size_t AppendImpl(const
void *from) final;
274 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
279 static std::unique_ptr<RVectorField>
280 CreateUntyped(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
283 size_t GetValueSize()
const override {
return sizeof(std::vector<char>); }
284 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
296template <
typename ItemT>
297class RField<std::vector<ItemT>> final :
public RVectorField {
298 using ContainerT =
typename std::vector<ItemT>;
301 void ConstructValue(
void *where)
const final {
new (where) ContainerT(); }
305 explicit RField(std::string_view
name) : RVectorField(
name, std::make_unique<
RField<ItemT>>(
"_0")) {}
310 size_t GetValueSize() const final {
return sizeof(ContainerT); }
315class RField<std::vector<bool>> final :
public RFieldBase {
320 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
322 return std::make_unique<RField>(newName);
329 void ConstructValue(
void *where) const final {
new (where) std::vector<bool>(); }
330 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<std::vector<bool>>>(); }
332 std::size_t
AppendImpl(
const void *from)
final;
338 static std::string
TypeName() {
return "std::vector<bool>"; }
346 size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
347 size_t GetAlignment() const final {
return std::alignment_of<std::vector<bool>>(); }
348 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
353 void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart,
ClusterSize_t *
size)
const
378 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
385 std::unique_ptr<RDeleter>
GetDeleter() const final;
407 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
#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 value
Abstract base class for classes implementing the visitor design pattern.
std::size_t GetPackedSize(std::size_t nElements=1U) const
RColumnElementBase * GetElement() const
void Append(const void *from)
void GetCollectionInfo(const NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
Additional classes related to sequence containers.
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 fArrayLength
The size of a child field's item.
std::size_t fValueSize
The length of the arrays in this field.
std::unique_ptr< RDeleter > GetDeleter() const final
Returns an RRVecField::RRVecDeleter.
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 GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
std::size_t fItemSize
Sub field deleter or nullptr for simple fields.
void ReadInClusterImpl(RClusterIndex clusterIndex, 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
RArrayDeleter(std::size_t itemSize, std::size_t arrayLength, std::unique_ptr< RDeleter > itemDeleter)
std::unique_ptr< RDeleter > fItemDeleter
Template specializations for C++ std::array and C-style arrays.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) 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
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 ConstructValue(void *where) const override
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
size_t GetValueSize() const override
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.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const override
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
std::unique_ptr< RDeleter > GetDeleter() const final
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Some fields have multiple possible column representations, e.g.
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.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponsing to the field type ...
const std::string & GetFieldName() const
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append and Read on other (sub) fields.
static void CallReadOn(RFieldBase &other, RClusterIndex clusterIndex, void *to)
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
Internal::RColumn * fPrincipalColumn
All fields that have columns have a distinct main column.
virtual void CommitClusterImpl()
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
RField & operator=(RField &&other)=default
RField(RField &&other)=default
~RField() override=default
RField(std::string_view name)
RField & operator=(RField &&other)=default
RField(std::string_view name)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
typename ROOT::VecOps::RVec< ItemT > ContainerT
static std::string TypeName()
~RField() override=default
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RField(RField &&other)=default
std::unique_ptr< RDeleter > GetDeleter() const final
RField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
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...
Classes with dictionaries that can be inspected by TClass.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
RField & operator=(RField &&other)=default
static std::string TypeName()
~RField() override=default
The on-storage meta-data of an ntuple.
the RRVecDeleter is also used by RArrayAsRVecField and therefore declared public
std::size_t fItemAlignment
void operator()(void *objPtr, bool dtorOnly) final
RRVecDeleter(std::size_t itemAlignment)
RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr< RDeleter > itemDeleter)
std::unique_ptr< RDeleter > fItemDeleter
Template specializations for ROOT's RVec.
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
std::unique_ptr< RDeleter > fItemDeleter
std::unique_ptr< RDeleter > GetDeleter() const override
RRVecField(RRVecField &&)=default
~RRVecField() override=default
void ConstructValue(void *where) const override
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
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 GetAlignment() const override
As a rule of thumb, the alignment is equal to the size of the type.
RRVecField(const RRVecField &)=delete
RRVecField & operator=(RRVecField &&)=default
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
RRVecField & operator=(RRVecField &)=delete
void CommitClusterImpl() final
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.
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
std::size_t AppendImpl(const void *from) override
Operations on values of complex types, e.g.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) override
std::unique_ptr< RDeleter > fItemDeleter
RVectorDeleter(std::size_t itemSize, std::unique_ptr< RDeleter > itemDeleter)
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::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
~RVectorField() override=default
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
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
std::unique_ptr< RDeleter > GetDeleter() const final
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
RVectorField & operator=(RVectorField &&other)=default
void ConstructValue(void *where) const override
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
void CommitClusterImpl() final
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
RVectorField(RVectorField &&other)=default
A "std::vector"-like collection of values implementing handy operation to analyse them.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
RClusterSize ClusterSize_t
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.