14#ifndef ROOT_RField_STLMisc
15#define ROOT_RField_STLMisc
18#error "Please include RField.hxx!"
34namespace Experimental {
71template <
typename ItemT>
72class RField<std::atomic<ItemT>>
final :
public RAtomicField {
97 return std::make_unique<RBitsetField>(
newName, fN);
103 std::size_t
AppendImpl(
const void *from)
final;
110 const size_t wordSize = (fN <=
sizeof(
unsigned long) * 8) ?
sizeof(
unsigned long) :
sizeof(
unsigned long long);
112 const size_t wordSize =
sizeof(
unsigned long);
135 return WordSize() ==
sizeof(
unsigned long) ?
alignof(
unsigned long) :
alignof(
unsigned long long);
137 return alignof(
unsigned long);
144 std::size_t
GetN()
const {
return fN; }
147template <std::
size_t N>
148class RField<std::bitset<N>>
final :
public RBitsetField {
150 static std::string
TypeName() {
return "std::bitset<" + std::to_string(
N) +
">"; }
168 return std::make_unique<RField>(
newName);
200 std::
size_t AppendNull();
201 std::
size_t AppendValue(
const void *from);
222 std::size_t fEngagementPtrOffset = 0;
234 const bool *GetEngagementPtr(
const void *
optionalPtr)
const;
239 std::unique_ptr<RFieldBase> CloneImpl(std::string_view
newName)
const final;
241 void ConstructValue(
void *
where)
const final;
242 std::unique_ptr<RDeleter> GetDeleter()
const final;
244 std::
size_t AppendImpl(
const void *from)
final;
281 std::unique_ptr<RFieldBase> CloneImpl(std::string_view
newName)
const final;
284 std::unique_ptr<RDeleter> GetDeleter()
const final;
286 std::
size_t AppendImpl(
const void *from)
final;
296 size_t GetValueSize()
const final {
return sizeof(std::unique_ptr<char>); }
300template <
typename ItemT>
301class RField<std::unique_ptr<ItemT>>
final :
public RUniquePtrField {
303 static std::string TypeName() {
return "std::unique_ptr<" + RField<ItemT>::TypeName() +
">"; }
304 explicit RField(std::string_view
name) : RUniquePtrField(
name, TypeName(), std::make_unique<RField<
ItemT>>(
"_0")) {}
305 RField(RField &&
other) =
default;
319 std::unique_ptr<RFieldBase> CloneImpl(std::string_view
newName)
const final
321 return std::make_unique<RField>(
newName);
324 const RColumnRepresentations &GetColumnRepresentations()
const final;
325 void GenerateColumns()
final;
329 std::unique_ptr<RDeleter> GetDeleter()
const final {
return std::make_unique<RTypedDeleter<std::string>>(); }
331 std::size_t AppendImpl(
const void *from)
final;
334 void CommitClusterImpl()
final { fIndex = 0; }
337 static std::string TypeName() {
return "std::string"; }
338 explicit RField(std::string_view
name)
342 RField(RField &&
other) =
default;
346 size_t GetValueSize()
const final {
return sizeof(std::string); }
347 size_t GetAlignment()
const final {
return std::alignment_of<std::string>(); }
362 static constexpr std::size_t kMaxVariants = 125;
379 size_t fMaxItemSize = 0;
380 size_t fMaxAlignment = 1;
382 size_t fTagOffset = 0;
384 size_t fVariantOffset = 0;
385 std::vector<ROOT::Internal::RColumnIndex::ValueType>
fNWritten;
387 static std::string GetTypeList(
const std::vector<std::unique_ptr<RFieldBase>> &
itemFields);
398 std::unique_ptr<RFieldBase> CloneImpl(std::string_view
newName)
const final;
401 void GenerateColumns()
final;
407 std::
size_t AppendImpl(
const void *from)
final;
410 void CommitClusterImpl()
final;
426 static std::string BuildItemTypes()
429 if constexpr (
sizeof...(TailTs) > 0)
435 static void _BuildItemFields(std::vector<std::unique_ptr<RFieldBase>> &
itemFields,
unsigned int index = 0)
438 if constexpr (
sizeof...(TailTs) > 0)
441 static std::vector<std::unique_ptr<RFieldBase>> BuildItemFields()
443 std::vector<std::unique_ptr<RFieldBase>>
result;
449 static std::string TypeName() {
return "std::variant<" + BuildItemTypes<
ItemTs...>() +
">"; }
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t result
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
TRObject operator()(const T1 &t1) const
Binding & operator=(OUT(*fun)(void))
Abstract base class for classes implementing the visitor design pattern.
The in-memory representation of a 32bit or 64bit on-disk index column.
Template specializations for C++ std::atomic.
RAtomicField(RAtomicField &&other)=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RAtomicField(std::string_view fieldName, std::string_view typeName, std::unique_ptr< RFieldBase > itemField)
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(ROOT::Detail::RFieldVisitor &visitor) const final
void ReadGlobalImpl(ROOT::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 ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RDeleter > GetDeleter() const final
~RAtomicField() override=default
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
RAtomicField & operator=(RAtomicField &&other)=default
Template specializations for C++ std::bitset.
std::size_t GetN() const
Get the number of bits in the bitset, i.e. the N in std::bitset<N>
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
~RBitsetField() override=default
RBitsetField & operator=(RBitsetField &&other)=default
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RBitsetField(RBitsetField &&other)=default
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 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.
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 ...
static std::unique_ptr< RDeleter > GetDeleterOf(const RFieldBase &other)
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append() and Read() on other (sub)fields.
virtual void CommitClusterImpl()
static void CallReadOn(RFieldBase &other, RNTupleLocalIndex localIndex, void *to)
static void CallConstructValueOn(const RFieldBase &other, void *where)
Allow derived classes to call ConstructValue(void *) and GetDeleter() on other (sub)fields.
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...
Template specializations for C++ std::optional and std::unique_ptr.
~RNullableField() override=default
RNullableField & operator=(RNullableField &&other)=default
RNullableField(RNullableField &&other)=default
ROptionalDeleter(std::unique_ptr< RDeleter > itemDeleter, std::size_t engagementPtrOffset)
std::unique_ptr< RDeleter > fItemDeleter
std::size_t GetEngagementPtrOffset() const
std::unique_ptr< RDeleter > fItemDeleter
std::unique_ptr< RDeleter > fItemDeleter
RUniquePtrDeleter(std::unique_ptr< RDeleter > itemDeleter)
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 > fItemDeleter
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::vector< std::unique_ptr< RDeleter > > fItemDeleters
std::size_t fVariantOffset
RVariantDeleter(std::size_t tagOffset, std::size_t variantOffset, std::vector< std::unique_ptr< RDeleter > > itemDeleters)
Template specializations for C++ std::variant.
std::vector< ROOT::Internal::RColumnIndex::ValueType > fNWritten
Namespace for new ROOT classes and functions.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.