14#ifndef ROOT_RField_ProxiedCollection
15#define ROOT_RField_ProxiedCollection
18#error "Please include RField.hxx!"
32#include <unordered_map>
33#include <unordered_set>
72 auto fnNext_Contig = [&]() {
75 auto &iter =
reinterpret_cast<unsigned char *&
>(
fIterator), p = iter;
112 std::size_t stride = 0U)
125 std::shared_ptr<TVirtualCollectionProxy>
fProxy;
138 void operator()(
void *objPtr,
bool dtorOnly)
final;
142 std::shared_ptr<TVirtualCollectionProxy>
fProxy;
157 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const override;
165 std::
size_t AppendImpl(const
void *from) final;
180 size_t GetAlignment() const final {
return alignof(std::max_align_t); }
188template <
typename T,
typename =
void>
193 T, typename std::enable_if<std::is_same<typename T::IsCollectionProxy, std::true_type>::value>
::type>
236template <
typename T,
typename =
void>
260 static_assert(std::is_class<T>::value,
"collection proxy unsupported for fundamental types");
285 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
289 RMapField(std::string_view fieldName,
EMapType mapType, std::unique_ptr<RFieldBase> itemField);
295template <
typename KeyT,
typename ValueT>
304 : RMapField(
name, EMapType::kMap, std::make_unique<
RField<std::
pair<KeyT, ValueT>>>(
"_0"))
312template <typename KeyT, typename ValueT>
313class
RField<std::unordered_map<KeyT, ValueT>> final : public RMapField {
329template <typename KeyT, typename ValueT>
330class
RField<std::multimap<KeyT, ValueT>> final : public RMapField {
338 : RMapField(
name, EMapType::
kMultiMap, std::make_unique<
RField<std::pair<KeyT, ValueT>>>(
"_0"))
346template <typename KeyT, typename ValueT>
347class
RField<std::unordered_multimap<KeyT, ValueT>> final : public RMapField {
381 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
385 RSetField(std::string_view fieldName,
ESetType setType, std::unique_ptr<RFieldBase> itemField);
391template <
typename ItemT>
396 explicit RField(std::string_view
name) : RSetField(
name, ESetType::kSet, std::make_unique<RField<ItemT>>(
"_0")) {}
397 RField(RField &&other) =
default;
398 RField &
operator=(RField &&other) =
default;
399 ~RField() final = default;
402template <typename ItemT>
403class RField<std::unordered_set<ItemT>> final : public RSetField {
405 static std::string TypeName() {
return "std::unordered_set<" + RField<ItemT>::TypeName() +
">"; }
407 explicit RField(std::string_view
name)
408 : RSetField(
name, ESetType::
kUnorderedSet, std::make_unique<RField<ItemT>>(
"_0"))
411 RField(RField &&other) =
default;
412 RField &
operator=(RField &&other) =
default;
413 ~RField() final = default;
416template <typename ItemT>
417class RField<std::multiset<ItemT>> final : public RSetField {
419 static std::string TypeName() {
return "std::multiset<" + RField<ItemT>::TypeName() +
">"; }
421 explicit RField(std::string_view
name) : RSetField(
name, ESetType::
kMultiSet, std::make_unique<RField<ItemT>>(
"_0"))
424 RField(RField &&other) =
default;
425 RField &
operator=(RField &&other) =
default;
426 ~RField() final = default;
429template <typename ItemT>
430class RField<std::unordered_multiset<ItemT>> final : public RSetField {
432 static std::string TypeName() {
return "std::unordered_multiset<" + RField<ItemT>::TypeName() +
">"; }
434 explicit RField(std::string_view
name)
438 RField(RField &&other) =
default;
439 RField &
operator=(RField &&other) =
default;
440 ~RField() final = default;
RInterface & operator=(const RInterface &)=default
Copy-assignment operator for RInterface.
int Int_t
Signed integer 4 bytes (int)
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
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 Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
Abstract base class for classes implementing the visitor design pattern.
The in-memory representation of a 32bit or 64bit on-disk index column.
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.
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.
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.
Classes with dictionaries that can be inspected by TClass.
RField & operator=(RField &&other)=default
static std::string TypeName()
RField(std::string_view name)
Template specializations for C++ std::[unordered_][multi]map.
RMapField(RMapField &&other)=default
RMapField(std::string_view fieldName, EMapType mapType, std::unique_ptr< RFieldBase > itemField)
~RMapField() override=default
RMapField & operator=(RMapField &&other)=default
The on-storage metadata of an RNTuple.
RIterator(const RCollectionIterableOnce &owner)
bool operator!=(const iterator &rh) const
RIterator(const RCollectionIterableOnce &owner, void *iter)
std::forward_iterator_tag iterator_category
const RCollectionIterableOnce & fOwner
std::ptrdiff_t difference_type
bool operator==(const iterator &rh) const
pointer operator*() const
~RCollectionIterableOnce()
unsigned char fEndSmallBuf[TVirtualCollectionProxy::fgIteratorArenaSize]
const std::size_t fStride
const RIteratorFuncs & fIFuncs
RCollectionIterableOnce(void *collection, const RIteratorFuncs &ifuncs, TVirtualCollectionProxy *proxy, std::size_t stride=0U)
Construct a RCollectionIterableOnce that iterates over collection.
static RIteratorFuncs GetIteratorFuncs(TVirtualCollectionProxy *proxy, bool readFromDisk)
unsigned char fBeginSmallBuf[TVirtualCollectionProxy::fgIteratorArenaSize]
std::shared_ptr< TVirtualCollectionProxy > fProxy
RCollectionIterableOnce::RIteratorFuncs fIFuncsWrite
RProxiedCollectionDeleter(std::shared_ptr< TVirtualCollectionProxy > proxy, std::unique_ptr< RDeleter > itemDeleter, size_t itemSize)
std::unique_ptr< RDeleter > fItemDeleter
RProxiedCollectionDeleter(std::shared_ptr< TVirtualCollectionProxy > proxy)
void operator()(void *objPtr, bool dtorOnly) final
The field for a class representing a collection of elements via TVirtualCollectionProxy.
RProxiedCollectionField & operator=(RProxiedCollectionField &&other)=default
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
~RProxiedCollectionField() override=default
void CommitClusterImpl() final
RProxiedCollectionField(RProxiedCollectionField &&other)=default
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
RProxiedCollectionField(std::string_view fieldName, TClass *classp)
Constructor used when the value type of the collection is not known in advance, i....
RCollectionIterableOnce::RIteratorFuncs fIFuncsWrite
ROOT::Internal::RColumnIndex fNWritten
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
RCollectionIterableOnce::RIteratorFuncs fIFuncsRead
Two sets of functions to operate on iterators, to be used depending on the access type.
std::shared_ptr< TVirtualCollectionProxy > fProxy
The collection proxy is needed by the deleters and thus defined as a shared pointer.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, 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
void ReconcileOnDiskField(const RNTupleDescriptor &desc) override
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.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
Template specializations for C++ std::[unordered_][multi]set.
RSetField & operator=(RSetField &&other)=default
~RSetField() override=default
RSetField(RSetField &&other)=default
RSetField(std::string_view fieldName, ESetType setType, std::unique_ptr< RFieldBase > itemField)
TClass instances represent classes, structs and namespaces in the ROOT type system.
Defines a common interface to inspect/change the contents of an object that represents a collection.
void(* CreateIterators_t)(void *collection, void **begin_arena, void **end_arena, TVirtualCollectionProxy *proxy)
*begin_arena and *end_arena should contain the location of a memory arena of size fgIteratorArenaSize...
void *(* Next_t)(void *iter, const void *end)
iter and end should be pointers to an iterator to be incremented and an iterator that points to the e...
void(* DeleteTwoIterators_t)(void *begin, void *end)
static const Int_t fgIteratorArenaSize
The size of a small buffer that can be allocated on the stack to store iterator-specific information.
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
std::string GetDemangledTypeName(const std::type_info &t)
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
Template specializations for classes with collection proxies.
Helper type trait for marking classes as a collection proxy.
TVirtualCollectionProxy::Next_t fNext
TVirtualCollectionProxy::CreateIterators_t fCreateIterators
TVirtualCollectionProxy::DeleteTwoIterators_t fDeleteTwoIterators