Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RFieldProxiedCollection.hxx
Go to the documentation of this file.
1/// \file ROOT/RField/ProxiedCollection.hxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-09
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RField_ProxiedCollection
17#define ROOT7_RField_ProxiedCollection
18
19#ifndef ROOT7_RField
20#error "Please include RField.hxx!"
21#endif
22
23#include <ROOT/RFieldBase.hxx>
24#include <ROOT/RNTupleUtil.hxx>
25
27
28#include <iterator>
29#include <map>
30#include <set>
31#include <string>
32#include <string_view>
33#include <type_traits>
34#include <unordered_map>
35#include <unordered_set>
36#include <vector>
37
38namespace ROOT {
39namespace Experimental {
40
41namespace Detail {
42class RFieldVisitor;
43} // namespace Detail
44
45/// The field for a class representing a collection of elements via `TVirtualCollectionProxy`.
46/// Objects of such type behave as collections that can be accessed through the corresponding member functions in
47/// `TVirtualCollectionProxy`. For STL collections, these proxies are provided. Custom classes need to implement the
48/// corresponding member functions in `TVirtualCollectionProxy`. At a bare minimum, the user is required to provide an
49/// implementation for the following functions in `TVirtualCollectionProxy`: `HasPointers()`, `GetProperties()`,
50/// `GetValueClass()`, `GetType()`, `PushProxy()`, `PopProxy()`, `GetFunctionCreateIterators()`, `GetFunctionNext()`,
51/// and `GetFunctionDeleteTwoIterators()`.
52///
53/// The collection proxy for a given class can be set via `TClass::CopyCollectionProxy()`.
55protected:
56 /// Allows for iterating over the elements of a proxied collection. RCollectionIterableOnce avoids an additional
57 /// iterator copy (see `TVirtualCollectionProxy::GetFunctionCopyIterator`) and thus can only be iterated once.
59 public:
64 };
65 static RIteratorFuncs GetIteratorFuncs(TVirtualCollectionProxy *proxy, bool readFromDisk);
66
67 private:
68 class RIterator {
70 void *fIterator = nullptr;
71 void *fElementPtr = nullptr;
72
73 void Advance()
74 {
75 auto fnNext_Contig = [&]() {
76 // Array-backed collections (e.g. kSTLvector) directly use the pointer-to-iterator-data as a
77 // pointer-to-element, thus saving an indirection level (see documentation for TVirtualCollectionProxy)
78 auto &iter = reinterpret_cast<unsigned char *&>(fIterator), p = iter;
79 iter += fOwner.fStride;
80 return p;
81 };
83 }
84
85 public:
86 using iterator_category = std::forward_iterator_tag;
88 using difference_type = std::ptrdiff_t;
89 using pointer = void *;
90
91 RIterator(const RCollectionIterableOnce &owner) : fOwner(owner) {}
92 RIterator(const RCollectionIterableOnce &owner, void *iter) : fOwner(owner), fIterator(iter) { Advance(); }
94 {
95 Advance();
96 return *this;
97 }
98 pointer operator*() const { return fElementPtr; }
99 bool operator!=(const iterator &rh) const { return fElementPtr != rh.fElementPtr; }
100 bool operator==(const iterator &rh) const { return fElementPtr == rh.fElementPtr; }
101 };
102
104 const std::size_t fStride;
109
110 public:
111 /// Construct a `RCollectionIterableOnce` that iterates over `collection`. If elements are guaranteed to be
112 /// contiguous in memory (e.g. a vector), `stride` can be provided for faster iteration, i.e. the address of each
113 /// element is known given the base pointer.
114 RCollectionIterableOnce(void *collection, const RIteratorFuncs &ifuncs, TVirtualCollectionProxy *proxy,
115 std::size_t stride = 0U)
116 : fIFuncs(ifuncs), fStride(stride)
117 {
118 fIFuncs.fCreateIterators(collection, &fBegin, &fEnd, proxy);
119 }
121
122 RIterator begin() { return RIterator(*this, fBegin); }
123 RIterator end() { return fStride ? RIterator(*this, fEnd) : RIterator(*this); }
124 }; // class RCollectionIterableOnce
125
127 private:
128 std::shared_ptr<TVirtualCollectionProxy> fProxy;
129 std::unique_ptr<RDeleter> fItemDeleter;
130 std::size_t fItemSize = 0;
132
133 public:
134 explicit RProxiedCollectionDeleter(std::shared_ptr<TVirtualCollectionProxy> proxy) : fProxy(proxy) {}
135 RProxiedCollectionDeleter(std::shared_ptr<TVirtualCollectionProxy> proxy, std::unique_ptr<RDeleter> itemDeleter,
136 size_t itemSize)
137 : fProxy(proxy), fItemDeleter(std::move(itemDeleter)), fItemSize(itemSize)
138 {
139 fIFuncsWrite = RCollectionIterableOnce::GetIteratorFuncs(fProxy.get(), false /* readFromDisk */);
140 }
141 void operator()(void *objPtr, bool dtorOnly) final;
142 };
143
144 /// The collection proxy is needed by the deleters and thus defined as a shared pointer
145 std::shared_ptr<TVirtualCollectionProxy> fProxy;
148 /// Two sets of functions to operate on iterators, to be used depending on the access type. The direction preserves
149 /// the meaning from TVirtualCollectionProxy, i.e. read from disk / write to disk, respectively
152 std::size_t fItemSize;
154
155 /// Constructor used when the value type of the collection is not known in advance, i.e. in the case of custom
156 /// collections.
157 RProxiedCollectionField(std::string_view fieldName, std::string_view typeName, TClass *classp);
158 /// Constructor used when the value type of the collection is known in advance, e.g. in `RSetField`.
159 RProxiedCollectionField(std::string_view fieldName, std::string_view typeName,
160 std::unique_ptr<RFieldBase> itemField);
161
162protected:
163 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const override;
165 void GenerateColumns() final;
166 void GenerateColumns(const RNTupleDescriptor &desc) final;
167
168 void ConstructValue(void *where) const override;
169 std::unique_ptr<RDeleter> GetDeleter() const override;
170
171 std::size_t AppendImpl(const void *from) override;
172 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) override;
173
174 void CommitClusterImpl() final { fNWritten = 0; }
175
176public:
177 RProxiedCollectionField(std::string_view fieldName, std::string_view typeName);
180 ~RProxiedCollectionField() override = default;
181
182 std::vector<RValue> SplitValue(const RValue &value) const override;
183 size_t GetValueSize() const override { return fProxy->Sizeof(); }
184 size_t GetAlignment() const override { return alignof(std::max_align_t); }
185 void AcceptVisitor(Detail::RFieldVisitor &visitor) const override;
186 void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
187 {
188 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
189 }
190 void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
191 {
192 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
193 }
194};
195
196////////////////////////////////////////////////////////////////////////////////
197/// Template specializations for classes with collection proxies
198////////////////////////////////////////////////////////////////////////////////
199
200template <typename T, typename = void>
201struct HasCollectionProxyMemberType : std::false_type {
202};
203template <typename T>
205 T, typename std::enable_if<std::is_same<typename T::IsCollectionProxy, std::true_type>::value>::type>
206 : std::true_type {
207};
208
209/// The point here is that we can only tell at run time if a class has an associated collection proxy.
210/// For compile time, in the first iteration of this PR we had an extra template argument that acted as a "tag" to
211/// differentiate the RField specialization for classes with an associated collection proxy (inherits
212/// `RProxiedCollectionField`) from the RField primary template definition (`RClassField`-derived), as in:
213/// ```
214/// auto field = std::make_unique<RField<MyClass>>("klass");
215/// // vs
216/// auto otherField = std::make_unique<RField<MyClass, ROOT::Experimental::TagIsCollectionProxy>>("klass");
217/// ```
218///
219/// That is convenient only for non-nested types, i.e. it doesn't work with, e.g. `RField<std::vector<MyClass>,
220/// ROOT::Experimental::TagIsCollectionProxy>`, as the tag is not forwarded to the instantiation of the inner RField
221/// (that for the value type of the vector). The following two possible solutions were considered:
222/// - A wrapper type (much like `ntuple/v7/inc/ROOT/RNTupleUtil.hxx:49`), that helps to differentiate both cases.
223/// There we would have:
224/// ```
225/// auto field = std::make_unique<RField<RProxiedCollection<MyClass>>>("klass"); // Using collection proxy
226/// ```
227/// - A helper `IsCollectionProxy<T>` type, that can be used in a similar way to those in the `<type_traits>` header.
228/// We found this more convenient and is the implemented thing below. Here, classes can be marked as a
229/// collection proxy with either of the following two forms (whichever is more convenient for the user):
230/// ```
231/// template <>
232/// struct IsCollectionProxy<MyClass> : std::true_type {};
233/// ```
234/// or by adding a member type to the class as follows:
235/// ```
236/// class MyClass {
237/// public:
238/// using IsCollectionProxy = std::true_type;
239/// };
240/// ```
241///
242/// Of course, there is another possible solution which is to have a single `RClassField` that implements both
243/// the regular-class and the collection-proxy behaviors, and always chooses appropriately at run time.
244/// We found that less clean and probably has more overhead, as most probably it involves an additional branch + call
245/// in each of the member functions.
246template <typename T, typename = void>
248};
249
250/// Classes behaving as a collection of elements that can be queried via the `TVirtualCollectionProxy` interface
251/// The use of a collection proxy for a particular class can be enabled via:
252/// ```
253/// namespace ROOT::Experimental {
254/// template <> struct IsCollectionProxy<Classname> : std::true_type {};
255/// }
256/// ```
257/// Alternatively, this can be achieved by adding a member type to the class definition as follows:
258/// ```
259/// class Classname {
260/// public:
261/// using IsCollectionProxy = std::true_type;
262/// };
263/// ```
264template <typename T>
265class RField<T, typename std::enable_if<IsCollectionProxy<T>::value>::type> final : public RProxiedCollectionField {
266protected:
267 void ConstructValue(void *where) const final { new (where) T(); }
268
269public:
270 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
271 RField(std::string_view name) : RProxiedCollectionField(name, TypeName())
272 {
273 static_assert(std::is_class<T>::value, "collection proxy unsupported for fundamental types");
274 }
275 RField(RField &&other) = default;
276 RField &operator=(RField &&other) = default;
277 ~RField() override = default;
278};
279
280////////////////////////////////////////////////////////////////////////////////
281/// Template specializations for C++ std::[unordered_][multi]map
282////////////////////////////////////////////////////////////////////////////////
283
284/// The generic field for a std::map<KeyType, ValueType> and std::unordered_map<KeyType, ValueType>
286private:
288
289protected:
290 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
291
292 std::size_t AppendImpl(const void *from) final;
293 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
294
295public:
296 RMapField(std::string_view fieldName, std::string_view typeName, std::unique_ptr<RFieldBase> itemField);
297 RMapField(RMapField &&other) = default;
298 RMapField &operator=(RMapField &&other) = default;
299 ~RMapField() override = default;
300
301 std::vector<RValue> SplitValue(const RValue &value) const final;
302
303 size_t GetAlignment() const override { return std::alignment_of<std::map<std::max_align_t, std::max_align_t>>(); }
304};
305
306template <typename KeyT, typename ValueT>
307class RField<std::map<KeyT, ValueT>> final : public RMapField {
308 using ContainerT = typename std::map<KeyT, ValueT>;
309
310protected:
311 void ConstructValue(void *where) const final { new (where) ContainerT(); }
312 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
313
314public:
315 static std::string TypeName()
316 {
317 return "std::map<" + RField<KeyT>::TypeName() + "," + RField<ValueT>::TypeName() + ">";
318 }
319
320 explicit RField(std::string_view name)
321 : RMapField(name, TypeName(), std::make_unique<RField<std::pair<KeyT, ValueT>>>("_0"))
322 {
323 }
324 RField(RField &&other) = default;
325 RField &operator=(RField &&other) = default;
326 ~RField() override = default;
327
328 size_t GetValueSize() const final { return sizeof(ContainerT); }
329 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
330};
331
332template <typename KeyT, typename ValueT>
333class RField<std::unordered_map<KeyT, ValueT>> final : public RMapField {
334 using ContainerT = typename std::unordered_map<KeyT, ValueT>;
335
336protected:
337 void ConstructValue(void *where) const final { new (where) ContainerT(); }
338 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
339
340public:
341 static std::string TypeName()
342 {
343 return "std::unordered_map<" + RField<KeyT>::TypeName() + "," + RField<ValueT>::TypeName() + ">";
344 }
345
346 explicit RField(std::string_view name)
347 : RMapField(name, TypeName(), std::make_unique<RField<std::pair<KeyT, ValueT>>>("_0"))
348 {
349 }
350 RField(RField &&other) = default;
351 RField &operator=(RField &&other) = default;
352 ~RField() override = default;
353
354 size_t GetValueSize() const final { return sizeof(ContainerT); }
355 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
356};
357
358template <typename KeyT, typename ValueT>
359class RField<std::multimap<KeyT, ValueT>> final : public RMapField {
360 using ContainerT = typename std::multimap<KeyT, ValueT>;
361
362protected:
363 void ConstructValue(void *where) const final { new (where) ContainerT(); }
364 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
365
366public:
367 static std::string TypeName()
368 {
369 return "std::multimap<" + RField<KeyT>::TypeName() + "," + RField<ValueT>::TypeName() + ">";
370 }
371
372 explicit RField(std::string_view name)
373 : RMapField(name, TypeName(), std::make_unique<RField<std::pair<KeyT, ValueT>>>("_0"))
374 {
375 }
376 RField(RField &&other) = default;
377 RField &operator=(RField &&other) = default;
378 ~RField() override = default;
379
380 size_t GetValueSize() const final { return sizeof(ContainerT); }
381 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
382};
383
384template <typename KeyT, typename ValueT>
385class RField<std::unordered_multimap<KeyT, ValueT>> final : public RMapField {
386 using ContainerT = typename std::unordered_multimap<KeyT, ValueT>;
387
388protected:
389 void ConstructValue(void *where) const final { new (where) ContainerT(); }
390 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
391
392public:
393 static std::string TypeName()
394 {
395 return "std::unordered_multimap<" + RField<KeyT>::TypeName() + "," + RField<ValueT>::TypeName() + ">";
396 }
397
398 explicit RField(std::string_view name)
399 : RMapField(name, TypeName(), std::make_unique<RField<std::pair<KeyT, ValueT>>>("_0"))
400 {
401 }
402 RField(RField &&other) = default;
403 RField &operator=(RField &&other) = default;
404 ~RField() override = default;
405
406 size_t GetValueSize() const final { return sizeof(ContainerT); }
407 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
408};
409
410////////////////////////////////////////////////////////////////////////////////
411/// Template specializations for C++ std::[unordered_][multi]set
412////////////////////////////////////////////////////////////////////////////////
413
414/// The generic field for a std::set<Type> and std::unordered_set<Type>
416protected:
417 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
418
419public:
420 RSetField(std::string_view fieldName, std::string_view typeName, std::unique_ptr<RFieldBase> itemField);
421 RSetField(RSetField &&other) = default;
422 RSetField &operator=(RSetField &&other) = default;
423 ~RSetField() override = default;
424
425 size_t GetAlignment() const override { return std::alignment_of<std::set<std::max_align_t>>(); }
426};
427
428template <typename ItemT>
429class RField<std::set<ItemT>> : public RSetField {
430 using ContainerT = typename std::set<ItemT>;
431
432protected:
433 void ConstructValue(void *where) const final { new (where) ContainerT(); }
434 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
435
436public:
437 static std::string TypeName() { return "std::set<" + RField<ItemT>::TypeName() + ">"; }
438
439 explicit RField(std::string_view name) : RSetField(name, TypeName(), std::make_unique<RField<ItemT>>("_0")) {}
440 RField(RField &&other) = default;
441 RField &operator=(RField &&other) = default;
442 ~RField() override = default;
443
444 size_t GetValueSize() const final { return sizeof(ContainerT); }
445 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
446};
447
448template <typename ItemT>
449class RField<std::unordered_set<ItemT>> final : public RSetField {
450 using ContainerT = typename std::unordered_set<ItemT>;
451
452protected:
453 void ConstructValue(void *where) const final { new (where) ContainerT(); }
454 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
455
456public:
457 static std::string TypeName() { return "std::unordered_set<" + RField<ItemT>::TypeName() + ">"; }
458
459 explicit RField(std::string_view name) : RSetField(name, TypeName(), std::make_unique<RField<ItemT>>("_0")) {}
460 RField(RField &&other) = default;
461 RField &operator=(RField &&other) = default;
462 ~RField() override = default;
463
464 size_t GetValueSize() const final { return sizeof(ContainerT); }
465 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
466};
467
468template <typename ItemT>
469class RField<std::multiset<ItemT>> : public RSetField {
470 using ContainerT = typename std::multiset<ItemT>;
471
472protected:
473 void ConstructValue(void *where) const final { new (where) ContainerT(); }
474 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
475
476public:
477 static std::string TypeName() { return "std::multiset<" + RField<ItemT>::TypeName() + ">"; }
478
479 explicit RField(std::string_view name) : RSetField(name, TypeName(), std::make_unique<RField<ItemT>>("_0")) {}
480 RField(RField &&other) = default;
481 RField &operator=(RField &&other) = default;
482 ~RField() override = default;
483
484 size_t GetValueSize() const final { return sizeof(ContainerT); }
485 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
486};
487
488template <typename ItemT>
489class RField<std::unordered_multiset<ItemT>> : public RSetField {
490 using ContainerT = typename std::unordered_multiset<ItemT>;
491
492protected:
493 void ConstructValue(void *where) const final { new (where) ContainerT(); }
494 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<ContainerT>>(); }
495
496public:
497 static std::string TypeName() { return "std::unordered_multiset<" + RField<ItemT>::TypeName() + ">"; }
498
499 explicit RField(std::string_view name) : RSetField(name, TypeName(), std::make_unique<RField<ItemT>>("_0")) {}
500 RField(RField &&other) = default;
501 RField &operator=(RField &&other) = default;
502 ~RField() override = default;
503
504 size_t GetValueSize() const final { return sizeof(ContainerT); }
505 size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
506};
507
508} // namespace Experimental
509} // namespace ROOT
510
511#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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
char name[80]
Definition TGX11.cxx:110
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.
Definition RColumn.hxx:275
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
Definition RField.cxx:1990
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:150
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:135
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.
Internal::RColumn * fPrincipalColumn
All fields that have columns have a distinct main column.
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:238
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.hxx:240
RField & operator=(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:251
~RField() override=default
Template specializations for C++ std::[unordered_][multi]map.
size_t GetAlignment() const override
As a rule of thumb, the alignment is equal to the size of the type.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:3622
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:3636
RMapField(RMapField &&other)=default
~RMapField() override=default
RMapField & operator=(RMapField &&other)=default
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:3667
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Definition RField.cxx:3656
The on-storage meta-data of an ntuple.
Allows for iterating over the elements of a proxied collection.
unsigned char fEndSmallBuf[TVirtualCollectionProxy::fgIteratorArenaSize]
unsigned char fBeginSmallBuf[TVirtualCollectionProxy::fgIteratorArenaSize]
static RIteratorFuncs GetIteratorFuncs(TVirtualCollectionProxy *proxy, bool readFromDisk)
Definition RField.cxx:2313
RCollectionIterableOnce(void *collection, const RIteratorFuncs &ifuncs, TVirtualCollectionProxy *proxy, std::size_t stride=0U)
Construct a RCollectionIterableOnce that iterates over collection.
RProxiedCollectionDeleter(std::shared_ptr< TVirtualCollectionProxy > proxy, std::unique_ptr< RDeleter > itemDeleter, size_t itemSize)
RProxiedCollectionDeleter(std::shared_ptr< TVirtualCollectionProxy > proxy)
The field for a class representing a collection of elements via TVirtualCollectionProxy.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:2394
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
void ConstructValue(void *where) const override
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.cxx:2455
std::size_t AppendImpl(const void *from) override
Operations on values of complex types, e.g.
Definition RField.cxx:2401
std::shared_ptr< TVirtualCollectionProxy > fProxy
The collection proxy is needed by the deleters and thus defined as a shared pointer.
RCollectionIterableOnce::RIteratorFuncs fIFuncsRead
Two sets of functions to operate on iterators, to be used depending on the access type.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const override
Definition RField.cxx:2495
std::unique_ptr< RDeleter > GetDeleter() const override
Definition RField.cxx:2461
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
Definition RField.cxx:2437
RProxiedCollectionField(RProxiedCollectionField &&other)=default
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.cxx:2445
std::vector< RValue > SplitValue(const RValue &value) const override
Creates the list of direct child values given a value for this field.
Definition RField.cxx:2483
RCollectionIterableOnce::RIteratorFuncs fIFuncsWrite
size_t GetAlignment() const override
As a rule of thumb, the alignment is equal to the size of the type.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) override
Definition RField.cxx:2417
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
RProxiedCollectionField & operator=(RProxiedCollectionField &&other)=default
Template specializations for C++ std::[unordered_][multi]set.
RSetField(RSetField &&other)=default
RSetField & operator=(RSetField &&other)=default
size_t GetAlignment() const override
As a rule of thumb, the alignment is equal to the size of the type.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:3601
~RSetField() override=default
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
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::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
std::string GetDemangledTypeName(const std::type_info &t)
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Template specializations for classes with collection proxies.
The point here is that we can only tell at run time if a class has an associated collection proxy.
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.