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 {
89 explicit RField(std::string_view
name) : RArrayField(
name, std::make_unique<
RField<ItemT>>(
"_0"),
N) {}
95template <
typename ItemT, std::
size_t N>
115 std::size_t fItemSize = 0;
119 explicit RRVecDeleter(std::size_t itemAlignment) : fItemAlignment(itemAlignment) {}
120 RRVecDeleter(std::size_t itemAlignment, std::size_t itemSize, std::unique_ptr<RDeleter> itemDeleter)
121 : fItemAlignment(itemAlignment), fItemSize(itemSize), fItemDeleter(std::move(itemDeleter))
124 void operator()(
void *objPtr,
bool dtorOnly)
final;
134 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
142 std::
size_t AppendImpl(const
void *from) final;
149 RRVecField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
159 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
170template <
typename ItemT>
173 RField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField)
196 std::size_t fItemSize = 0;
202 : fItemSize(itemSize), fItemDeleter(std::move(itemDeleter))
205 void operator()(
void *objPtr,
bool dtorOnly)
final;
213 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField,
bool isUntyped);
215 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
218 void GenerateColumns() final;
221 void ConstructValue(
void *where) const final {
new (where) std::vector<char>(); }
222 std::unique_ptr<RDeleter> GetDeleter() const final;
224 std::
size_t AppendImpl(const
void *from) final;
225 void ReadGlobalImpl(
NTupleSize_t globalIndex,
void *to) final;
227 void CommitClusterImpl() final { fNWritten = 0; }
230 RVectorField(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
235 static std::unique_ptr<RVectorField>
236 CreateUntyped(std::string_view fieldName, std::unique_ptr<RFieldBase> itemField);
238 std::vector<RValue> SplitValue(
const RValue &
value)
const final;
239 size_t GetValueSize() const final {
return sizeof(std::vector<char>); }
240 size_t GetAlignment() const final {
return std::alignment_of<std::vector<char>>(); }
244 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart,
size);
248 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart,
size);
252template <
typename ItemT>
253class RField<std::vector<ItemT>> final :
public RVectorField {
256 explicit RField(std::string_view
name) : RVectorField(
name, std::make_unique<
RField<ItemT>>(
"_0")) {}
264class
RField<std::vector<
bool>> final : public RFieldBase {
269 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
271 return std::make_unique<RField>(newName);
278 void ConstructValue(
void *where) const final {
new (where) std::vector<bool>(); }
279 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<std::vector<bool>>>(); }
281 std::size_t
AppendImpl(
const void *from)
final;
287 static std::string
TypeName() {
return "std::vector<bool>"; }
295 size_t GetValueSize() const final {
return sizeof(std::vector<bool>); }
296 size_t GetAlignment() const final {
return std::alignment_of<std::vector<bool>>(); }
297 void AcceptVisitor(Detail::RFieldVisitor &visitor)
const final;
302 void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart,
ClusterSize_t *
size)
const
327 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
330 using RFieldBase::GenerateColumns;
332 void ConstructValue(
void *where)
const final;
334 std::unique_ptr<RDeleter> GetDeleter() const final;
336 void ReadGlobalImpl(
NTupleSize_t globalIndex,
void *to) final;
337 void ReadInClusterImpl(
RClusterIndex clusterIndex,
void *to) final;
352 std::
size_t GetValueSize() const final {
return fValueSize; }
353 std::size_t GetAlignment() const final;
356 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
TRObject operator()(const T1 &t1) const
Abstract base class for classes implementing the visitor design pattern.
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::size_t fArrayLength
The size of a child field's item.
std::size_t fValueSize
The length of the arrays in this field.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
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::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.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
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.
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.
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 ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
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.
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 ...
virtual std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec)
General implementation of bulk read.
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(std::string_view name)
RField & operator=(RField &&other)=default
RField(std::string_view name)
RField(RField &&other)=default
RField(std::string_view fieldName, std::unique_ptr< RFieldBase > itemField)
Classes with dictionaries that can be inspected by TClass.
RField & operator=(RField &&other)=default
static std::string TypeName()
The on-storage meta-data of an ntuple.
the RRVecDeleter is also used by RArrayAsRVecField and therefore declared public
std::size_t fItemAlignment
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< RDeleter > fItemDeleter
RRVecField(RRVecField &&)=default
~RRVecField() override=default
RRVecField(const RRVecField &)=delete
RRVecField & operator=(RRVecField &&)=default
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.
~RVectorField() override=default
std::unique_ptr< RDeleter > fItemDeleter
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
RVectorField & operator=(RVectorField &&other)=default
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.
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.