13#ifndef ROOT_RField_ProxiedCollection
14#define ROOT_RField_ProxiedCollection
17#error "Please include RField.hxx!"
31#include <unordered_map>
32#include <unordered_set>
74 auto &iter =
reinterpret_cast<unsigned char *&
>(
fIterator),
p = iter;
124 std::shared_ptr<TVirtualCollectionProxy>
fProxy;
137 std::shared_ptr<TVirtualCollectionProxy>
fProxy;
152 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view
newName)
const override;
231template <
typename T,
typename =
void>
253 RField(std::string_view
name) : RProxiedCollectionField(
name, Internal::GetDemangledTypeName(
typeid(T)))
255 static_assert(std::is_class<T>::value,
"collection proxy unsupported for fundamental types");
257 RField(RField &&
other) =
default;
258 RField &operator=(RField &&
other) =
default;
280 std::unique_ptr<RFieldBase> CloneImpl(std::string_view
newName)
const final;
290template <
typename KeyT,
typename ValueT>
293 static std::string TypeName()
298 explicit RField(std::string_view
name)
299 : RMapField(
name, EMapType::kMap, std::make_unique<RField<std::pair<
KeyT,
ValueT>>>(
"_0"))
302 RField(RField &&
other) =
default;
303 RField &operator=(RField &&
other) =
default;
310 static std::string TypeName()
312 return "std::unordered_map<" + RField<KeyT>::TypeName() +
"," + RField<ValueT>::TypeName() +
">";
315 explicit RField(std::string_view
name)
319 RField(RField &&
other) =
default;
320 RField &operator=(RField &&
other) =
default;
327 static std::string TypeName()
329 return "std::multimap<" + RField<KeyT>::TypeName() +
"," + RField<ValueT>::TypeName() +
">";
332 explicit RField(std::string_view
name)
336 RField(RField &&
other) =
default;
337 RField &operator=(RField &&
other) =
default;
344 static std::string TypeName()
346 return "std::unordered_multimap<" + RField<KeyT>::TypeName() +
"," + RField<ValueT>::TypeName() +
">";
349 explicit RField(std::string_view
name)
353 RField(RField &&
other) =
default;
354 RField &operator=(RField &&
other) =
default;
376 std::unique_ptr<RFieldBase> CloneImpl(std::string_view
newName)
const final;
386template <
typename ItemT>
391 explicit RField(std::string_view
name) : RSetField(
name, ESetType::kSet, std::make_unique<RField<
ItemT>>(
"_0")) {}
392 RField(RField &&
other) =
default;
393 RField &operator=(RField &&
other) =
default;
400 static std::string TypeName() {
return "std::unordered_set<" + RField<ItemT>::TypeName() +
">"; }
402 explicit RField(std::string_view
name)
406 RField(RField &&
other) =
default;
407 RField &operator=(RField &&
other) =
default;
414 static std::string TypeName() {
return "std::multiset<" + RField<ItemT>::TypeName() +
">"; }
416 explicit RField(std::string_view
name) : RSetField(
name, ESetType::
kMultiSet, std::make_unique<RField<
ItemT>>(
"_0"))
419 RField(RField &&
other) =
default;
420 RField &operator=(RField &&
other) =
default;
427 static std::string TypeName() {
return "std::unordered_multiset<" + RField<ItemT>::TypeName() +
">"; }
429 explicit RField(std::string_view
name)
433 RField(RField &&
other) =
default;
434 RField &operator=(RField &&
other) =
default;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
winID h TVirtualViewer3D TVirtualGLPainter p
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.
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.
Classes with dictionaries that can be inspected by TClass.
Template specializations for C++ std::[unordered_][multi]map.
RMapField(RMapField &&other)=default
~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
Allows for iterating over the elements of a proxied collection.
~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
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
std::size_t GetValueSize() const final
What sizeof(T) for this type returns.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field 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.
std::size_t GetAlignment() const final
What alignof(T) for this type returns.
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
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.
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::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