Logo ROOT  
Reference Guide
RField.hxx
Go to the documentation of this file.
1 /// \file ROOT/RField.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
17 #define ROOT7_RField
18 
19 #include <ROOT/RColumn.hxx>
20 #include <ROOT/RError.hxx>
21 #include <ROOT/RColumnElement.hxx>
22 #include <ROOT/RField.hxx>
23 #include <ROOT/RFieldValue.hxx>
24 #include <ROOT/RNTupleUtil.hxx>
25 #include <ROOT/RSpan.hxx>
26 #include <ROOT/RStringView.hxx>
27 #include <ROOT/RVec.hxx>
28 #include <ROOT/TypeTraits.hxx>
29 
30 #include <TGenericClassInfo.h>
31 
32 #include <algorithm>
33 #include <array>
34 #include <iostream>
35 #include <iterator>
36 #include <memory>
37 #include <string>
38 #include <type_traits>
39 #include <typeinfo>
40 #if __cplusplus >= 201703L
41 #include <variant>
42 #endif
43 #include <vector>
44 #include <utility>
45 
46 class TClass;
47 
48 namespace ROOT {
49 namespace Experimental {
50 
51 class RCollectionNTuple;
52 class REntry;
53 class RCollectionField;
54 class RNTupleModel;
55 
56 namespace Detail {
57 
58 class RFieldFuse;
59 class RFieldVisitor;
60 class RPageStorage;
61 
62 // clang-format off
63 /**
64 \class ROOT::Experimental::RFieldBase
65 \ingroup NTuple
66 \brief A field translates read and write calls from/to underlying columns to/from tree values
67 
68 A field is a serializable C++ type or a container for a collection of sub fields. The RFieldBase and its
69 type-safe descendants provide the object to column mapper. They map C++ objects to primitive columns. The
70 mapping is trivial for simple types such as 'double'. Complex types resolve to multiple primitive columns.
71 The field knows based on its type and the field name the type(s) and name(s) of the columns.
72 */
73 // clang-format on
74 class RFieldBase {
75  friend class ROOT::Experimental::Detail::RFieldFuse; // to connect the columns to a page storage
76  friend class ROOT::Experimental::RCollectionField; // to change the field names when collections are attached
77 
78 private:
79  /// The field name relative to its parent field
80  std::string fName;
81  /// The C++ type captured by this field
82  std::string fType;
83  /// The role of this field in the data model structure
85  /// For fixed sized arrays, the array length
86  std::size_t fNRepetitions;
87  /// A field on a trivial type that maps as-is to a single column
88  bool fIsSimple;
89 
90 protected:
91  /// Collections and classes own sub fields
92  std::vector<std::unique_ptr<RFieldBase>> fSubFields;
93  /// Sub fields point to their mother field
95  /// Points into fColumns. All fields that have columns have a distinct main column. For simple fields
96  /// (float, int, ...), the principal column corresponds to the field type. For collection fields expect std::array,
97  /// the main column is the offset field. Class fields have no column of their own.
99  /// The columns are connected either to a sink or to a source (not to both); they are owned by the field.
100  std::vector<std::unique_ptr<RColumn>> fColumns;
101 
102  /// Creates the backing columns corresponsing to the field type and name
103  virtual void GenerateColumnsImpl() = 0;
104 
105  /// Operations on values of complex types, e.g. ones that involve multiple columns or for which no direct
106  /// column type exists.
107  virtual void AppendImpl(const RFieldValue &value);
108  virtual void ReadGlobalImpl(NTupleSize_t globalIndex, RFieldValue *value);
109  virtual void ReadInClusterImpl(const RClusterIndex &clusterIndex, RFieldValue *value) {
110  ReadGlobalImpl(fPrincipalColumn->GetGlobalIndex(clusterIndex), value);
111  }
112 
113 public:
114  /// Iterates over the sub tree of fields in depth-first search order
116  private:
117  struct Position {
118  Position() : fFieldPtr(nullptr), fIdxInParent(-1) { }
119  Position(RFieldBase *fieldPtr, int idxInParent) : fFieldPtr(fieldPtr), fIdxInParent(idxInParent) { }
122  };
123  /// The stack of nodes visited when walking down the tree of fields
124  std::vector<Position> fStack;
125  public:
127  using iterator_category = std::forward_iterator_tag;
129  using difference_type = std::ptrdiff_t;
130  using pointer = RFieldBase*;
132 
133  RSchemaIterator() { fStack.emplace_back(Position()); }
134  RSchemaIterator(pointer val, int idxInParent) { fStack.emplace_back(Position(val, idxInParent)); }
136  /// Given that the iterator points to a valid field which is not the end iterator, go to the next field
137  /// in depth-first search order
138  void Advance();
139 
140  iterator operator++(int) /* postfix */ { auto r = *this; Advance(); return r; }
141  iterator& operator++() /* prefix */ { Advance(); return *this; }
142  reference operator* () const { return *fStack.back().fFieldPtr; }
143  pointer operator->() const { return fStack.back().fFieldPtr; }
144  bool operator==(const iterator& rh) const { return fStack.back().fFieldPtr == rh.fStack.back().fFieldPtr; }
145  bool operator!=(const iterator& rh) const { return fStack.back().fFieldPtr != rh.fStack.back().fFieldPtr; }
146  };
147 
148  /// The constructor creates the underlying column objects and connects them to either a sink or a source.
150  std::size_t nRepetitions = 0);
151  RFieldBase(const RFieldBase&) = delete;
152  RFieldBase(RFieldBase&&) = default;
153  RFieldBase& operator =(const RFieldBase&) = delete;
154  RFieldBase& operator =(RFieldBase&&) = default;
155  virtual ~RFieldBase();
156 
157  ///// Copies the field and its sub fields using a possibly new name and a new, unconnected set of columns
158  virtual RFieldBase *Clone(std::string_view newName) = 0;
159 
160  /// Factory method to resurrect a field from the stored on-disk type information
161  static RFieldBase *Create(const std::string &fieldName, const std::string &typeName);
162  /// Check whether a given string is a valid field name
164 
165  /// Generates an object of the field type and allocates new initialized memory according to the type.
167  /// Generates a tree value in a given location of size at least GetValueSize(). Assumes that where has been
168  /// allocated by malloc().
169  virtual RFieldValue GenerateValue(void *where) = 0;
170  /// Releases the resources acquired during GenerateValue (memory and constructor)
171  /// This implementation works for simple types but needs to be overwritten for complex ones
172  virtual void DestroyValue(const RFieldValue &value, bool dtorOnly = false);
173  /// Creates a value from a memory location with an already constructed object
174  virtual RFieldValue CaptureValue(void *where) = 0;
175  /// Creates the list of direct child values given a value for this field. E.g. a single value for the
176  /// correct variant or all the elements of a collection. The default implementation assumes no sub values
177  /// and returns an empty vector.
178  virtual std::vector<RFieldValue> SplitValue(const RFieldValue &value) const;
179  /// The number of bytes taken by a value of the appropriate type
180  virtual size_t GetValueSize() const = 0;
181  /// For many types, the alignment requirement is equal to the size; otherwise override.
182  virtual size_t GetAlignment() const { return GetValueSize(); }
183 
184  /// Write the given value into columns. The value object has to be of the same type as the field.
185  void Append(const RFieldValue& value) {
186  if (!fIsSimple) {
187  AppendImpl(value);
188  return;
189  }
191  }
192 
193  /// Populate a single value with data from the tree, which needs to be of the fitting type.
194  /// Reading copies data into the memory wrapped by the ntuple value.
195  void Read(NTupleSize_t globalIndex, RFieldValue *value) {
196  if (!fIsSimple) {
197  ReadGlobalImpl(globalIndex, value);
198  return;
199  }
200  fPrincipalColumn->Read(globalIndex, &value->fMappedElement);
201  }
202 
203  void Read(const RClusterIndex &clusterIndex, RFieldValue *value) {
204  if (!fIsSimple) {
205  ReadInClusterImpl(clusterIndex, value);
206  return;
207  }
208  fPrincipalColumn->Read(clusterIndex, &value->fMappedElement);
209  }
210 
211  /// Ensure that all received items are written from page buffers to the storage.
212  void Flush() const;
213  /// Perform housekeeping tasks for global to cluster-local index translation
214  virtual void CommitCluster() {}
215 
216  /// Add a new subfield to the list of nested fields
217  void Attach(std::unique_ptr<Detail::RFieldBase> child);
218 
219  std::string GetName() const { return fName; }
220  std::string GetType() const { return fType; }
222  std::size_t GetNRepetitions() const { return fNRepetitions; }
224  const RFieldBase *GetParent() const { return fParent; }
225  std::vector<const RFieldBase *> GetSubFields() const;
226  bool IsSimple() const { return fIsSimple; }
227 
228  /// Indicates an evolution of the mapping scheme from C++ type to columns
229  virtual RNTupleVersion GetFieldVersion() const { return RNTupleVersion(); }
230  /// Indicates an evolution of the C++ type itself
231  virtual RNTupleVersion GetTypeVersion() const { return RNTupleVersion(); }
232 
233  RSchemaIterator begin();
234  RSchemaIterator end();
235 
236  virtual void AcceptVisitor(RFieldVisitor &visitor) const;
237 };
238 
239 // clang-format off
240 /**
241 \class ROOT::Experimental::RFieldFuse
242 \ingroup NTuple
243 \brief A friend of RFieldBase responsible for connecting a field's columns to the physical page storage
244 
245 Fields and their columns live in the void until connected to a physical page storage. Only once connected, data
246 can be read or written.
247 */
248 // clang-format on
249 class RFieldFuse {
250 public:
251  static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field);
252 };
253 
254 } // namespace Detail
255 
256 
257 
258 /// The container field for an ntuple model, which itself has no physical representation
260 public:
261  RFieldZero() : Detail::RFieldBase("", "", ENTupleStructure::kRecord, false /* isSimple */) { }
263 
264  void GenerateColumnsImpl() final {}
268  size_t GetValueSize() const final { return 0; }
269 
270  /// Generates managed values for the top-level sub fields
272  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
273 };
274 
275 /// The field for a class with dictionary
277 private:
279  std::size_t fMaxAlignment = 1;
280 
281 protected:
282  void AppendImpl(const Detail::RFieldValue& value) final;
283  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final;
284  void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final;
285 
286 public:
287  RClassField(std::string_view fieldName, std::string_view className);
288  RClassField(RClassField&& other) = default;
289  RClassField& operator =(RClassField&& other) = default;
290  ~RClassField() = default;
291  RFieldBase* Clone(std::string_view newName) final;
292 
293  void GenerateColumnsImpl() final;
294  using Detail::RFieldBase::GenerateValue;
295  Detail::RFieldValue GenerateValue(void* where) override;
296  void DestroyValue(const Detail::RFieldValue& value, bool dtorOnly = false) final;
297  Detail::RFieldValue CaptureValue(void *where) final;
298  std::vector<Detail::RFieldValue> SplitValue(const Detail::RFieldValue &value) const final;
299  size_t GetValueSize() const override;
300  size_t GetAlignment() const final { return fMaxAlignment; }
301  void AcceptVisitor(Detail::RFieldVisitor &visitor) const override;
302 };
303 
304 /// The generic field for a (nested) std::vector<Type> except for std::vector<bool>
306 private:
307  std::size_t fItemSize;
309 
310 protected:
311  void AppendImpl(const Detail::RFieldValue& value) final;
312  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final;
313 
314 public:
315  RVectorField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField);
316  RVectorField(RVectorField&& other) = default;
317  RVectorField& operator =(RVectorField&& other) = default;
318  ~RVectorField() = default;
319  RFieldBase* Clone(std::string_view newName) final;
320 
321  void GenerateColumnsImpl() final;
322  using Detail::RFieldBase::GenerateValue;
323  Detail::RFieldValue GenerateValue(void* where) override;
324  void DestroyValue(const Detail::RFieldValue& value, bool dtorOnly = false) final;
325  Detail::RFieldValue CaptureValue(void *where) override;
326  std::vector<Detail::RFieldValue> SplitValue(const Detail::RFieldValue &value) const final;
327  size_t GetValueSize() const override { return sizeof(std::vector<char>); }
328  size_t GetAlignment() const final { return std::alignment_of<std::vector<char>>(); }
329  void CommitCluster() final;
330  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
331  void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const {
332  fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
333  }
334  void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const {
335  fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
336  }
337 };
338 
339 
340 /// The generic field for fixed size arrays, which do not need an offset column
342 private:
343  std::size_t fItemSize;
344  std::size_t fArrayLength;
345 
346 protected:
347  void AppendImpl(const Detail::RFieldValue& value) final;
348  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final;
349  void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final;
350 
351 public:
352  RArrayField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField, std::size_t arrayLength);
353  RArrayField(RArrayField &&other) = default;
354  RArrayField& operator =(RArrayField &&other) = default;
355  ~RArrayField() = default;
356  RFieldBase *Clone(std::string_view newName) final;
357 
358  void GenerateColumnsImpl() final;
359  using Detail::RFieldBase::GenerateValue;
360  Detail::RFieldValue GenerateValue(void *where) override;
361  void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly = false) final;
362  Detail::RFieldValue CaptureValue(void *where) final;
363  std::vector<Detail::RFieldValue> SplitValue(const Detail::RFieldValue &value) const final;
364  size_t GetLength() const { return fArrayLength; }
365  size_t GetValueSize() const final { return fItemSize * fArrayLength; }
366  size_t GetAlignment() const final { return fSubFields[0]->GetAlignment(); }
367  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
368 };
369 
370 #if __cplusplus >= 201703L
371 /// The generic field for std::variant types
372 class RVariantField : public Detail::RFieldBase {
373 private:
374  size_t fMaxItemSize = 0;
375  size_t fMaxAlignment = 1;
376  /// In the std::variant memory layout, at which byte number is the index stored
377  size_t fTagOffset = 0;
378  std::vector<ClusterSize_t::ValueType> fNWritten;
379 
380  static std::string GetTypeList(const std::vector<Detail::RFieldBase *> &itemFields);
381  /// Extracts the index from an std::variant and transforms it into the 1-based index used for the switch column
382  std::uint32_t GetTag(void *variantPtr) const;
383  void SetTag(void *variantPtr, std::uint32_t tag) const;
384 
385 protected:
386  void AppendImpl(const Detail::RFieldValue& value) final;
387  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final;
388 
389 public:
390  // TODO(jblomer): use std::span in signature
391  RVariantField(std::string_view fieldName, const std::vector<Detail::RFieldBase *> &itemFields);
392  RVariantField(RVariantField &&other) = default;
393  RVariantField& operator =(RVariantField &&other) = default;
394  ~RVariantField() = default;
395  RFieldBase *Clone(std::string_view newName) final;
396 
397  void GenerateColumnsImpl() final;
398  using Detail::RFieldBase::GenerateValue;
399  Detail::RFieldValue GenerateValue(void *where) override;
400  void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly = false) final;
401  Detail::RFieldValue CaptureValue(void *where) final;
402  size_t GetValueSize() const final;
403  size_t GetAlignment() const final { return fMaxAlignment; }
404  void CommitCluster() final;
405 };
406 #endif
407 
408 
409 /// Classes with dictionaries that can be inspected by TClass
410 template <typename T, typename=void>
411 class RField : public RClassField {
412 public:
413  static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
415  static_assert(std::is_class<T>::value, "no I/O support for this basic C++ type");
416  }
417  RField(RField&& other) = default;
418  RField& operator =(RField&& other) = default;
419  ~RField() = default;
420 
422  template <typename... ArgsT>
424  {
425  return Detail::RFieldValue(this, static_cast<T*>(where), std::forward<ArgsT>(args)...);
426  }
427  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, T()); }
428 };
429 
430 
432 private:
433  /// Save the link to the collection ntuple in order to reset the offset counter when committing the cluster
434  std::shared_ptr<RCollectionNTuple> fCollectionNTuple;
435 public:
436  static std::string TypeName() { return ":RCollectionField:"; }
438  std::shared_ptr<RCollectionNTuple> collectionNTuple,
439  std::unique_ptr<RNTupleModel> collectionModel);
440  RCollectionField(RCollectionField&& other) = default;
441  RCollectionField& operator =(RCollectionField&& other) = default;
442  ~RCollectionField() = default;
443  RFieldBase* Clone(std::string_view newName) final;
444 
445  void GenerateColumnsImpl() final;
446 
447  using Detail::RFieldBase::GenerateValue;
448  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final {
449  return Detail::RFieldValue(
451  this, static_cast<ClusterSize_t*>(where));
452  }
453  Detail::RFieldValue CaptureValue(void* where) final {
454  return Detail::RFieldValue(true /* captureFlag */,
456  }
457  size_t GetValueSize() const final { return 0; }
458  void CommitCluster() final;
459 };
460 
461 
462 /// Template specializations for concrete C++ types
463 
464 
465 template <>
466 class RField<ClusterSize_t> : public Detail::RFieldBase {
467 public:
468  static std::string TypeName() { return "ROOT::Experimental::ClusterSize_t"; }
470  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
471  RField(RField&& other) = default;
472  RField& operator =(RField&& other) = default;
473  ~RField() = default;
474  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
475 
476  void GenerateColumnsImpl() final;
477 
479  return fPrincipalColumn->Map<ClusterSize_t, EColumnType::kIndex>(globalIndex);
480  }
481  ClusterSize_t *Map(const RClusterIndex &clusterIndex) {
482  return fPrincipalColumn->Map<ClusterSize_t, EColumnType::kIndex>(clusterIndex);
483  }
484 
486  template <typename... ArgsT>
488  {
489  return Detail::RFieldValue(
491  this, static_cast<ClusterSize_t*>(where), std::forward<ArgsT>(args)...);
492  }
493  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, 0); }
494  Detail::RFieldValue CaptureValue(void *where) final {
495  return Detail::RFieldValue(true /* captureFlag */,
497  }
498  size_t GetValueSize() const final { return sizeof(ClusterSize_t); }
499 
500  /// Special help for offset fields
501  void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) {
502  fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
503  }
504  void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) {
505  fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
506  }
507  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
508 };
509 
510 
511 template <>
512 class RField<bool> : public Detail::RFieldBase {
513 public:
514  static std::string TypeName() { return "bool"; }
516  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
517  RField(RField&& other) = default;
518  RField& operator =(RField&& other) = default;
519  ~RField() = default;
520  RFieldBase *Clone(std::string_view newName) final { return new RField(newName); }
521 
522  void GenerateColumnsImpl() final;
523 
524  bool *Map(NTupleSize_t globalIndex) {
525  return fPrincipalColumn->Map<bool, EColumnType::kBit>(globalIndex);
526  }
527  bool *Map(const RClusterIndex &clusterIndex) {
528  return fPrincipalColumn->Map<bool, EColumnType::kBit>(clusterIndex);
529  }
530 
532  template <typename... ArgsT>
534  {
535  return Detail::RFieldValue(
536  Detail::RColumnElement<bool, EColumnType::kBit>(static_cast<bool*>(where)),
537  this, static_cast<bool*>(where), std::forward<ArgsT>(args)...);
538  }
539  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, false); }
540  Detail::RFieldValue CaptureValue(void *where) final {
541  return Detail::RFieldValue(true /* captureFlag */,
542  Detail::RColumnElement<bool, EColumnType::kBit>(static_cast<bool*>(where)), this, where);
543  }
544  size_t GetValueSize() const final { return sizeof(bool); }
545  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
546 };
547 
548 template <>
549 class RField<float> : public Detail::RFieldBase {
550 public:
551  static std::string TypeName() { return "float"; }
553  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
554  RField(RField&& other) = default;
555  RField& operator =(RField&& other) = default;
556  ~RField() = default;
557  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
558 
559  void GenerateColumnsImpl() final;
560 
561  float *Map(NTupleSize_t globalIndex) {
562  return fPrincipalColumn->Map<float, EColumnType::kReal32>(globalIndex);
563  }
564  float *Map(const RClusterIndex &clusterIndex) {
565  return fPrincipalColumn->Map<float, EColumnType::kReal32>(clusterIndex);
566  }
567 
569  template <typename... ArgsT>
571  {
572  return Detail::RFieldValue(
573  Detail::RColumnElement<float, EColumnType::kReal32>(static_cast<float*>(where)),
574  this, static_cast<float*>(where), std::forward<ArgsT>(args)...);
575  }
576  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, 0.0); }
577  Detail::RFieldValue CaptureValue(void *where) final {
578  return Detail::RFieldValue(true /* captureFlag */,
579  Detail::RColumnElement<float, EColumnType::kReal32>(static_cast<float*>(where)), this, where);
580  }
581  size_t GetValueSize() const final { return sizeof(float); }
582  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
583 };
584 
585 
586 template <>
588 public:
589  static std::string TypeName() { return "double"; }
591  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
592  RField(RField&& other) = default;
593  RField& operator =(RField&& other) = default;
594  ~RField() = default;
595  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
596 
597  void GenerateColumnsImpl() final;
598 
599  double *Map(NTupleSize_t globalIndex) {
600  return fPrincipalColumn->Map<double, EColumnType::kReal64>(globalIndex);
601  }
602  double *Map(const RClusterIndex &clusterIndex) {
603  return fPrincipalColumn->Map<double, EColumnType::kReal64>(clusterIndex);
604  }
605 
607  template <typename... ArgsT>
609  {
610  return Detail::RFieldValue(
611  Detail::RColumnElement<double, EColumnType::kReal64>(static_cast<double*>(where)),
612  this, static_cast<double*>(where), std::forward<ArgsT>(args)...);
613  }
614  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, 0.0); }
615  Detail::RFieldValue CaptureValue(void *where) final {
616  return Detail::RFieldValue(true /* captureFlag */,
617  Detail::RColumnElement<double, EColumnType::kReal64>(static_cast<double*>(where)), this, where);
618  }
619  size_t GetValueSize() const final { return sizeof(double); }
620  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
621 };
622 
623 template <>
624 class RField<std::uint8_t> : public Detail::RFieldBase {
625 public:
626  static std::string TypeName() { return "std::uint8_t"; }
627  explicit RField(std::string_view name)
628  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
629  RField(RField&& other) = default;
630  RField& operator =(RField&& other) = default;
631  ~RField() = default;
632  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
633 
634  void GenerateColumnsImpl() final;
635 
636  std::uint8_t *Map(NTupleSize_t globalIndex) {
637  return fPrincipalColumn->Map<std::uint8_t, EColumnType::kByte>(globalIndex);
638  }
639  std::uint8_t *Map(const RClusterIndex &clusterIndex) {
640  return fPrincipalColumn->Map<std::uint8_t, EColumnType::kByte>(clusterIndex);
641  }
642 
644  template <typename... ArgsT>
645  ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT&&... args)
646  {
647  return Detail::RFieldValue(
648  Detail::RColumnElement<std::uint8_t, EColumnType::kByte>(static_cast<std::uint8_t*>(where)),
649  this, static_cast<std::uint8_t*>(where), std::forward<ArgsT>(args)...);
650  }
651  ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final { return GenerateValue(where, 0); }
652  Detail::RFieldValue CaptureValue(void *where) final {
653  return Detail::RFieldValue(true /* captureFlag */,
654  Detail::RColumnElement<std::uint8_t, EColumnType::kByte>(static_cast<std::uint8_t*>(where)), this, where);
655  }
656  size_t GetValueSize() const final { return sizeof(std::uint8_t); }
657  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
658 };
659 
660 template <>
661 class RField<std::int32_t> : public Detail::RFieldBase {
662 public:
663  static std::string TypeName() { return "std::int32_t"; }
664  explicit RField(std::string_view name)
665  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
666  RField(RField&& other) = default;
667  RField& operator =(RField&& other) = default;
668  ~RField() = default;
669  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
670 
671  void GenerateColumnsImpl() final;
672 
673  std::int32_t *Map(NTupleSize_t globalIndex) {
674  return fPrincipalColumn->Map<std::int32_t, EColumnType::kInt32>(globalIndex);
675  }
676  std::int32_t *Map(const RClusterIndex &clusterIndex) {
677  return fPrincipalColumn->Map<std::int32_t, EColumnType::kInt32>(clusterIndex);
678  }
679 
681  template <typename... ArgsT>
682  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where, ArgsT&&... args)
683  {
684  return Detail::RFieldValue(
685  Detail::RColumnElement<std::int32_t, EColumnType::kInt32>(static_cast<std::int32_t*>(where)),
686  this, static_cast<std::int32_t*>(where), std::forward<ArgsT>(args)...);
687  }
688  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, 0); }
689  Detail::RFieldValue CaptureValue(void *where) final {
690  return Detail::RFieldValue(true /* captureFlag */,
691  Detail::RColumnElement<std::int32_t, EColumnType::kInt32>(static_cast<std::int32_t*>(where)), this, where);
692  }
693  size_t GetValueSize() const final { return sizeof(std::int32_t); }
694  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
695 };
696 
697 template <>
698 class RField<std::uint32_t> : public Detail::RFieldBase {
699 public:
700  static std::string TypeName() { return "std::uint32_t"; }
701  explicit RField(std::string_view name)
702  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
703  RField(RField&& other) = default;
704  RField& operator =(RField&& other) = default;
705  ~RField() = default;
706  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
707 
708  void GenerateColumnsImpl() final;
709 
710  std::uint32_t *Map(NTupleSize_t globalIndex) {
711  return fPrincipalColumn->Map<std::uint32_t, EColumnType::kInt32>(globalIndex);
712  }
713  std::uint32_t *Map(const RClusterIndex clusterIndex) {
714  return fPrincipalColumn->Map<std::uint32_t, EColumnType::kInt32>(clusterIndex);
715  }
716 
718  template <typename... ArgsT>
719  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where, ArgsT&&... args)
720  {
721  return Detail::RFieldValue(
722  Detail::RColumnElement<std::uint32_t, EColumnType::kInt32>(static_cast<std::uint32_t*>(where)),
723  this, static_cast<std::uint32_t*>(where), std::forward<ArgsT>(args)...);
724  }
725  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, 0); }
726  Detail::RFieldValue CaptureValue(void *where) final {
727  return Detail::RFieldValue(true /* captureFlag */,
728  Detail::RColumnElement<std::uint32_t, EColumnType::kInt32>(static_cast<std::uint32_t*>(where)), this, where);
729  }
730  size_t GetValueSize() const final { return sizeof(std::uint32_t); }
731  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
732 };
733 
734 template <>
735 class RField<std::uint64_t> : public Detail::RFieldBase {
736 public:
737  static std::string TypeName() { return "std::uint64_t"; }
738  explicit RField(std::string_view name)
739  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, true /* isSimple */) {}
740  RField(RField&& other) = default;
741  RField& operator =(RField&& other) = default;
742  ~RField() = default;
743  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
744 
745  void GenerateColumnsImpl() final;
746 
747  std::uint64_t *Map(NTupleSize_t globalIndex) {
748  return fPrincipalColumn->Map<std::uint64_t, EColumnType::kInt64>(globalIndex);
749  }
750  std::uint64_t *Map(const RClusterIndex &clusterIndex) {
751  return fPrincipalColumn->Map<std::uint64_t, EColumnType::kInt64>(clusterIndex);
752  }
753 
755  template <typename... ArgsT>
756  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where, ArgsT&&... args)
757  {
758  return Detail::RFieldValue(
759  Detail::RColumnElement<std::uint64_t, EColumnType::kInt64>(static_cast<std::uint64_t*>(where)),
760  this, static_cast<std::uint64_t*>(where), std::forward<ArgsT>(args)...);
761  }
762  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, 0); }
763  Detail::RFieldValue CaptureValue(void *where) final {
764  return Detail::RFieldValue(true /* captureFlag */,
765  Detail::RColumnElement<std::uint64_t, EColumnType::kInt64>(static_cast<std::uint64_t*>(where)), this, where);
766  }
767  size_t GetValueSize() const final { return sizeof(std::uint64_t); }
768  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
769 };
770 
771 
772 template <>
773 class RField<std::string> : public Detail::RFieldBase {
774 private:
775  ClusterSize_t fIndex;
776  Detail::RColumnElement<ClusterSize_t, EColumnType::kIndex> fElemIndex;
777 
778  void AppendImpl(const ROOT::Experimental::Detail::RFieldValue& value) final;
779  void ReadGlobalImpl(ROOT::Experimental::NTupleSize_t globalIndex,
781 
782 public:
783  static std::string TypeName() { return "std::string"; }
784  explicit RField(std::string_view name)
785  : Detail::RFieldBase(name, TypeName(), ENTupleStructure::kLeaf, false /* isSimple */)
786  , fIndex(0), fElemIndex(&fIndex) {}
787  RField(RField&& other) = default;
788  RField& operator =(RField&& other) = default;
789  ~RField() = default;
790  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
791 
792  void GenerateColumnsImpl() final;
793 
794  using Detail::RFieldBase::GenerateValue;
795  template <typename... ArgsT>
796  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where, ArgsT&&... args)
797  {
798  return Detail::RFieldValue(this, static_cast<std::string*>(where), std::forward<ArgsT>(args)...);
799  }
800  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final { return GenerateValue(where, ""); }
801  void DestroyValue(const Detail::RFieldValue& value, bool dtorOnly = false) {
802  auto str = value.Get<std::string>();
803  str->~basic_string(); // TODO(jblomer) C++17 std::destroy_at
804  if (!dtorOnly)
805  free(str);
806  }
807  Detail::RFieldValue CaptureValue(void *where) {
808  return Detail::RFieldValue(true /* captureFlag */, this, where);
809  }
810  size_t GetValueSize() const final { return sizeof(std::string); }
811  size_t GetAlignment() const final { return std::alignment_of<std::string>(); }
812  void CommitCluster() final;
813  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
814 };
815 
816 
817 template <typename ItemT, std::size_t N>
818 class RField<std::array<ItemT, N>> : public RArrayField {
819  using ContainerT = typename std::array<ItemT, N>;
820 public:
821  static std::string TypeName() {
822  return "std::array<" + RField<ItemT>::TypeName() + "," + std::to_string(N) + ">";
823  }
824  explicit RField(std::string_view name)
825  : RArrayField(name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()), N)
826  {}
827  RField(RField&& other) = default;
828  RField& operator =(RField&& other) = default;
829  ~RField() = default;
830 
832  template <typename... ArgsT>
833  ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT&&... args)
834  {
835  return Detail::RFieldValue(this, static_cast<ContainerT*>(where), std::forward<ArgsT>(args)...);
836  }
837  ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final {
838  return GenerateValue(where, ContainerT());
839  }
840 };
841 
842 
843 #if __cplusplus >= 201703L
844 template <typename... ItemTs>
845 class RField<std::variant<ItemTs...>> : public RVariantField {
846  using ContainerT = typename std::variant<ItemTs...>;
847 private:
848  template <typename HeadT, typename... TailTs>
849  static std::string BuildItemTypes()
850  {
851  std::string result = RField<HeadT>::TypeName();
852  if constexpr(sizeof...(TailTs) > 0)
853  result += "," + BuildItemTypes<TailTs...>();
854  return result;
855  }
856 
857  template <typename HeadT, typename... TailTs>
858  static std::vector<Detail::RFieldBase *> BuildItemFields(unsigned int index = 0)
859  {
860  std::vector<Detail::RFieldBase *> result;
861  result.emplace_back(new RField<HeadT>("variant" + std::to_string(index)));
862  if constexpr(sizeof...(TailTs) > 0) {
863  auto tailFields = BuildItemFields<TailTs...>(index + 1);
864  result.insert(result.end(), tailFields.begin(), tailFields.end());
865  }
866  return result;
867  }
868 
869 public:
870  static std::string TypeName() { return "std::variant<" + BuildItemTypes<ItemTs...>() + ">"; }
871  explicit RField(std::string_view name) : RVariantField(name, BuildItemFields<ItemTs...>()) {}
872  RField(RField&& other) = default;
873  RField& operator =(RField&& other) = default;
874  ~RField() = default;
875 
877  template <typename... ArgsT>
878  ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT&&... args)
879  {
880  return Detail::RFieldValue(this, static_cast<ContainerT*>(where), std::forward<ArgsT>(args)...);
881  }
882  ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final {
883  return GenerateValue(where, ContainerT());
884  }
885 };
886 #endif
887 
888 template <typename ItemT>
889 class RField<std::vector<ItemT>> : public RVectorField {
890  using ContainerT = typename std::vector<ItemT>;
891 public:
892  static std::string TypeName() { return "std::vector<" + RField<ItemT>::TypeName() + ">"; }
893  explicit RField(std::string_view name)
894  : RVectorField(name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()))
895  {}
896  RField(RField&& other) = default;
897  RField& operator =(RField&& other) = default;
898  ~RField() = default;
899 
901  template <typename... ArgsT>
902  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where, ArgsT&&... args)
903  {
904  return Detail::RFieldValue(this, static_cast<ContainerT*>(where), std::forward<ArgsT>(args)...);
905  }
906  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final {
907  return GenerateValue(where, ContainerT());
908  }
909  Detail::RFieldValue CaptureValue(void *where) final {
910  return Detail::RFieldValue(true /* captureFlag */, this, where);
911  }
912  size_t GetValueSize() const final { return sizeof(ContainerT); }
913 };
914 
915 // std::vector<bool> is a template specialization and needs special treatment
916 template <>
917 class RField<std::vector<bool>> : public Detail::RFieldBase {
918 private:
919  ClusterSize_t fNWritten{0};
920 
921 protected:
922  void AppendImpl(const Detail::RFieldValue& value) final;
923  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final;
924  void GenerateColumnsImpl() final;
925 
926 public:
927  static std::string TypeName() { return "std::vector<bool>"; }
928  explicit RField(std::string_view name);
929  RField(RField&& other) = default;
930  RField& operator =(RField&& other) = default;
931  ~RField() = default;
932  RFieldBase* Clone(std::string_view newName) final { return new RField(newName); }
933 
935  template <typename... ArgsT>
936  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where, ArgsT&&... args)
937  {
938  return Detail::RFieldValue(this, static_cast<std::vector<bool>*>(where), std::forward<ArgsT>(args)...);
939  }
940  ROOT::Experimental::Detail::RFieldValue GenerateValue(void* where) final {
941  return GenerateValue(where, std::vector<bool>());
942  }
943  Detail::RFieldValue CaptureValue(void *where) final {
944  return Detail::RFieldValue(true /* captureFlag */, this, where);
945  }
946  std::vector<Detail::RFieldValue> SplitValue(const Detail::RFieldValue &value) const final;
947  void DestroyValue(const Detail::RFieldValue& value, bool dtorOnly = false) final;
948 
949  size_t GetValueSize() const final { return sizeof(std::vector<bool>); }
950  size_t GetAlignment() const final { return std::alignment_of<std::vector<bool>>(); }
951  void CommitCluster() final { fNWritten = 0; }
952  void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
953  void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const {
954  fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
955  }
956  void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const {
957  fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
958  }
959 };
960 
961 
962 /**
963  * The RVec type has different layouts depending on the item type, therefore we cannot go with a generic
964  * RVec implementation as we can with std::vector
965  */
966 template <typename ItemT>
967 class RField<ROOT::VecOps::RVec<ItemT>> : public Detail::RFieldBase {
969 private:
970  size_t fItemSize;
972 
973 protected:
974  void AppendImpl(const Detail::RFieldValue& value) final {
975  auto typedValue = value.Get<ContainerT>();
976  auto count = typedValue->size();
977  for (unsigned i = 0; i < count; ++i) {
978  auto itemValue = fSubFields[0]->CaptureValue(&typedValue->data()[i]);
979  fSubFields[0]->Append(itemValue);
980  }
982  fNWritten += count;
983  fColumns[0]->Append(elemIndex);
984  }
985  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final {
986  auto typedValue = value->Get<ContainerT>();
987  ClusterSize_t nItems;
988  RClusterIndex collectionStart;
989  fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
990  typedValue->resize(nItems);
991  for (unsigned i = 0; i < nItems; ++i) {
992  auto itemValue = fSubFields[0]->GenerateValue(&typedValue->data()[i]);
993  fSubFields[0]->Read(collectionStart + i, &itemValue);
994  }
995  }
996 
997 public:
998  RField(std::string_view fieldName, std::unique_ptr<Detail::RFieldBase> itemField)
999  : ROOT::Experimental::Detail::RFieldBase(
1000  fieldName, "ROOT::VecOps::RVec<" + itemField->GetType() + ">", ENTupleStructure::kCollection, false)
1001  , fItemSize(itemField->GetValueSize()), fNWritten(0)
1002  {
1003  Attach(std::move(itemField));
1004  }
1006  : RField(name, std::make_unique<RField<ItemT>>(RField<ItemT>::TypeName()))
1007  {
1008  }
1009  RField(RField&& other) = default;
1010  RField& operator =(RField&& other) = default;
1011  ~RField() = default;
1013  auto newItemField = fSubFields[0]->Clone(fSubFields[0]->GetName());
1014  return new RField<ROOT::VecOps::RVec<ItemT>>(newName, std::unique_ptr<Detail::RFieldBase>(newItemField));
1015  }
1016 
1017  void GenerateColumnsImpl() final {
1018  RColumnModel modelIndex(EColumnType::kIndex, true /* isSorted*/);
1019  fColumns.emplace_back(std::unique_ptr<Detail::RColumn>(
1020  Detail::RColumn::Create<ClusterSize_t, EColumnType::kIndex>(modelIndex, 0)));
1021  fPrincipalColumn = fColumns[0].get();
1022  }
1023  void DestroyValue(const Detail::RFieldValue& value, bool dtorOnly = false) final {
1024  auto vec = reinterpret_cast<ContainerT*>(value.GetRawPtr());
1025  auto nItems = vec->size();
1026  for (unsigned i = 0; i < nItems; ++i) {
1027  auto itemValue = fSubFields[0]->CaptureValue(vec->data() + (i * fItemSize));
1028  fSubFields[0]->DestroyValue(itemValue, true /* dtorOnly */);
1029  }
1030  vec->~RVec();
1031  if (!dtorOnly)
1032  free(vec);
1033  }
1034  void CommitCluster() final { fNWritten = 0; }
1035 
1036  static std::string TypeName() { return "ROOT::VecOps::RVec<" + RField<ItemT>::TypeName() + ">"; }
1037 
1039  template <typename... ArgsT>
1041  {
1042  return Detail::RFieldValue(this, static_cast<ContainerT*>(where), std::forward<ArgsT>(args)...);
1043  }
1045  return GenerateValue(where, ContainerT());
1046  }
1047  Detail::RFieldValue CaptureValue(void *where) final {
1048  return Detail::RFieldValue(true /* captureFlag */, this, static_cast<ContainerT*>(where));
1049  }
1050  size_t GetValueSize() const final { return sizeof(ContainerT); }
1051  size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
1052 };
1053 
1054 /**
1055  * RVec<bool> needs special treatment due to std::vector<bool> sepcialization
1056  */
1057 template <>
1058 class RField<ROOT::VecOps::RVec<bool>> : public Detail::RFieldBase {
1060 private:
1061  ClusterSize_t fNWritten{0};
1062 
1063 protected:
1064  void AppendImpl(const Detail::RFieldValue& value) final {
1065  auto typedValue = value.Get<ContainerT>();
1066  auto count = typedValue->size();
1067  for (unsigned i = 0; i < count; ++i) {
1068  bool bval = (*typedValue)[i];
1069  auto itemValue = fSubFields[0]->CaptureValue(&bval);
1070  fSubFields[0]->Append(itemValue);
1071  }
1073  fNWritten += count;
1074  fColumns[0]->Append(elemIndex);
1075  }
1076  void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final {
1077  auto typedValue = value->Get<ContainerT>();
1078  ClusterSize_t nItems;
1079  RClusterIndex collectionStart;
1080  fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &nItems);
1081  typedValue->resize(nItems);
1082  for (unsigned i = 0; i < nItems; ++i) {
1083  bool bval = (*typedValue)[i];
1084  auto itemValue = fSubFields[0]->GenerateValue(&bval);
1085  fSubFields[0]->Read(collectionStart + i, &itemValue);
1086  (*typedValue)[i] = bval;
1087  }
1088  }
1089 
1090 public:
1092  : ROOT::Experimental::Detail::RFieldBase(name, "ROOT::VecOps::RVec<bool>", ENTupleStructure::kCollection, false)
1093  {
1094  Attach(std::make_unique<RField<bool>>("bool"));
1095  }
1096  RField(RField&& other) = default;
1097  RField& operator =(RField&& other) = default;
1098  ~RField() = default;
1100  return new RField<ROOT::VecOps::RVec<bool>>(newName);
1101  }
1102 
1103  void GenerateColumnsImpl() final {
1104  RColumnModel modelIndex(EColumnType::kIndex, true /* isSorted*/);
1105  fColumns.emplace_back(std::unique_ptr<Detail::RColumn>(
1106  Detail::RColumn::Create<ClusterSize_t, EColumnType::kIndex>(modelIndex, 0)));
1107  fPrincipalColumn = fColumns[0].get();
1108  }
1109  void DestroyValue(const Detail::RFieldValue& value, bool dtorOnly = false) final {
1110  auto vec = reinterpret_cast<ContainerT*>(value.GetRawPtr());
1111  vec->~RVec();
1112  if (!dtorOnly)
1113  free(vec);
1114  }
1115  void CommitCluster() final { fNWritten = 0; }
1116 
1117  static std::string TypeName() { return "ROOT::VecOps::RVec<bool>"; }
1118 
1120  template <typename... ArgsT>
1122  {
1123  return Detail::RFieldValue(this, static_cast<ContainerT*>(where), std::forward<ArgsT>(args)...);
1124  }
1126  return GenerateValue(where, ContainerT());
1127  }
1128  Detail::RFieldValue CaptureValue(void *where) final {
1129  return Detail::RFieldValue(true /* captureFlag */, this, static_cast<ContainerT*>(where));
1130  }
1131  size_t GetValueSize() const final { return sizeof(ContainerT); }
1132  size_t GetAlignment() const final { return std::alignment_of<ContainerT>(); }
1133 };
1134 
1135 } // namespace Experimental
1136 } // namespace ROOT
1137 
1138 #endif
ROOT::Experimental::RArrayField::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.cxx:810
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.hxx:1012
ROOT::Experimental::RField< bool >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:539
ROOT::Experimental::RArrayField
The generic field for fixed size arrays, which do not need an offset column.
Definition: RField.hxx:341
ROOT::Experimental::RField< bool >::RField
RField(std::string_view name)
Definition: RField.hxx:515
ROOT::Experimental::RField< bool >::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:540
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::RField
RField(std::string_view name)
Definition: RField.hxx:1091
ROOT::Experimental::Detail::RFieldBase::fStructure
ENTupleStructure fStructure
The role of this field in the data model structure.
Definition: RField.hxx:84
ROOT::Experimental::RVectorField::ReadGlobalImpl
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Definition: RField.cxx:645
ROOT::Experimental::Detail::RFieldVisitor
Abstract base class for classes implementing the visitor design pattern.
Definition: RFieldVisitor.hxx:62
ROOT::Experimental::RClassField::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.cxx:530
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::RField
RField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
Definition: RField.hxx:998
ROOT::Experimental::Detail::RFieldBase::AppendImpl
virtual void AppendImpl(const RFieldValue &value)
Operations on values of complex types, e.g.
Definition: RField.cxx:205
ROOT::Experimental::Detail::RFieldBase
Definition: RField.hxx:74
ROOT::Experimental::EColumnType::kReal64
@ kReal64
ROOT::Experimental::RField< ClusterSize_t >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:493
ROOT::Experimental::Detail::RFieldBase::Attach
void Attach(std::unique_ptr< Detail::RFieldBase > child)
Add a new subfield to the list of nested fields.
Definition: RField.cxx:235
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::operator++
iterator operator++(int)
Definition: RField.hxx:140
ROOT::Experimental::RFieldZero::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:268
ROOT::Experimental::Detail::RFieldBase::end
RSchemaIterator end()
Definition: RField.cxx:275
ROOT::Experimental::EColumnType::kIndex
@ kIndex
ROOT::Experimental::RArrayField::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.cxx:867
ROOT::Experimental::kLeaf
@ kLeaf
Definition: RNTupleUtil.hxx:51
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::TypeName
static std::string TypeName()
Definition: RField.hxx:1036
ROOT::Experimental::RClassField::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.cxx:583
ROOT::Experimental::RFieldZero::Clone
RFieldBase * Clone(std::string_view newName)
Definition: RField.cxx:310
ROOT::Experimental::Detail::RColumn::GetCollectionInfo
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:214
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::Advance
void Advance()
Given that the iterator points to a valid field which is not the end iterator, go to the next field i...
Definition: RField.cxx:284
ROOT::Experimental::RField::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:423
ROOT::Experimental::RClassField::operator=
RClassField & operator=(RClassField &&other)=default
ROOT::Experimental::RField< ClusterSize_t >::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:494
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::AppendImpl
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
Definition: RField.hxx:974
ROOT::Experimental::Detail::RFieldBase::fIsSimple
bool fIsSimple
A field on a trivial type that maps as-is to a single column.
Definition: RField.hxx:88
ROOT::Experimental::RVectorField::GenerateColumnsImpl
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Definition: RField.cxx:660
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::operator++
iterator & operator++()
Definition: RField.hxx:141
ROOT::Experimental::RVectorField::AcceptVisitor
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition: RField.cxx:710
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:1128
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:1044
ROOT::Experimental::Detail::RFieldBase::AcceptVisitor
virtual void AcceptVisitor(RFieldVisitor &visitor) const
Definition: RField.cxx:262
ROOT::Experimental::RFieldZero::AcceptVisitor
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition: RField.cxx:330
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:1131
ROOT::Experimental::Detail::RFieldBase::Create
static RFieldBase * Create(const std::string &fieldName, const std::string &typeName)
Factory method to resurrect a field from the stored on-disk type information.
Definition: RField.cxx:140
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::GetAlignment
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Definition: RField.hxx:1051
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::fStack
std::vector< Position > fStack
The stack of nodes visited when walking down the tree of fields.
Definition: RField.hxx:124
ROOT::Experimental::Detail::RFieldValue::GetRawPtr
void * GetRawPtr() const
Definition: RFieldValue.hxx:99
ROOT::Experimental::Detail::RFieldBase::IsSimple
bool IsSimple() const
Definition: RField.hxx:226
ROOT::Experimental::RArrayField::GetAlignment
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Definition: RField.hxx:366
ROOT::Experimental::Detail::RFieldBase::GetNElements
NTupleSize_t GetNElements() const
Definition: RField.hxx:223
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::RSchemaIterator
RSchemaIterator(pointer val, int idxInParent)
Definition: RField.hxx:134
ROOT::Experimental::DescriptorId_t
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
Definition: RNTupleUtil.hxx:90
ROOT::Experimental::Detail::RFieldBase::GenerateColumnsImpl
virtual void GenerateColumnsImpl()=0
Creates the backing columns corresponsing to the field type and name.
r
ROOT::R::TRInterface & r
Definition: Object.C:4
ROOT::Experimental::Detail::RPageStorage
Common functionality of an ntuple storage for both reading and writing.
Definition: RPageStorage.hxx:72
ROOT::Experimental::Detail::RFieldBase::fNRepetitions
std::size_t fNRepetitions
For fixed sized arrays, the array length.
Definition: RField.hxx:86
RField.hxx
ROOT::Experimental::Detail::RColumnElement< bool, EColumnType::kBit >
Definition: RColumnElement.hxx:247
ROOT::Experimental::RVectorField::CaptureValue
Detail::RFieldValue CaptureValue(void *where) override
Creates a value from a memory location with an already constructed object.
Definition: RField.cxx:687
string_view
basic_string_view< char > string_view
Definition: libcpp_string_view.h:785
ROOT::Experimental::RClassField::~RClassField
~RClassField()=default
ROOT::Experimental::RFieldZero::GenerateValue
Detail::RFieldValue GenerateValue(void *)
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:266
ROOT::Experimental::Detail::RFieldValue::fMappedElement
RColumnElementBase fMappedElement
For simple types, the mapped element drills through the layers from the C++ data representation to th...
Definition: RFieldValue.hxx:71
operator=
Binding & operator=(OUT(*fun)(void))
Definition: TRInterface_Binding.h:11
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::DestroyValue
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Definition: RField.hxx:1023
ROOT::Experimental::RCollectionField::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:453
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::GenerateColumnsImpl
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Definition: RField.hxx:1103
ROOT::Experimental::RField< float >::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:581
ROOT::Experimental::RVectorField::fNWritten
ClusterSize_t fNWritten
Definition: RField.hxx:308
ROOT::Experimental::RClassField::fClass
TClass * fClass
Definition: RField.hxx:278
ROOT::Experimental::RField< float >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:576
ROOT::Experimental::Detail::RColumn::GetNElements
NTupleSize_t GetNElements() const
Definition: RColumn.hxx:247
N
#define N
uint8_t
uint8_t
Definition: Converters.cxx:858
ROOT::Experimental::RArrayField::AcceptVisitor
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition: RField.cxx:884
ROOT::Experimental::RClassField::AcceptVisitor
void AcceptVisitor(Detail::RFieldVisitor &visitor) const override
Definition: RField.cxx:609
ROOT::Experimental::RArrayField::ReadGlobalImpl
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Definition: RField.cxx:824
ROOT::Experimental::Detail::RFieldBase::GetValueSize
virtual size_t GetValueSize() const =0
The number of bytes taken by a value of the appropriate type.
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::Position::Position
Position()
Definition: RField.hxx:118
ROOT::Experimental::NTupleSize_t
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
Definition: RNTupleUtil.hxx:54
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::ContainerT
typename ROOT::VecOps::RVec< ItemT > ContainerT
Definition: RField.hxx:968
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::Position::fIdxInParent
int fIdxInParent
Definition: RField.hxx:121
ROOT::Experimental::Detail::RFieldBase::GetSubFields
std::vector< const RFieldBase * > GetSubFields() const
Definition: RField.cxx:244
ROOT::Experimental::RField< bool >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:533
ROOT::Experimental::Detail::RFieldBase::Clone
virtual RFieldBase * Clone(std::string_view newName)=0
ROOT::Experimental::RField< ClusterSize_t >::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.hxx:474
ROOT::Experimental::ENTupleStructure
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
Definition: RNTupleUtil.hxx:44
ROOT::Experimental::RField< double >::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:619
ROOT::Experimental::RClassField::GetValueSize
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
Definition: RField.cxx:604
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::ReadGlobalImpl
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Definition: RField.hxx:985
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::TypeName
static std::string TypeName()
Definition: RField.hxx:1117
ROOT::Experimental::RClassField::DestroyValue
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Definition: RField.cxx:576
ROOT::Experimental::RVectorField::SplitValue
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
Definition: RField.cxx:693
ROOT::Experimental::Detail::RFieldBase::GetType
std::string GetType() const
Definition: RField.hxx:220
ROOT::Experimental::Detail::RFieldBase::GetName
std::string GetName() const
Definition: RField.hxx:219
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::difference_type
std::ptrdiff_t difference_type
Definition: RField.hxx:129
RFieldFuse
A friend of RFieldBase responsible for connecting a field's columns to the physical page storage.
RVec.hxx
ROOT::Experimental::RClassField::GenerateColumnsImpl
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Definition: RField.cxx:567
ROOT::Experimental::Detail::RFieldValue
Definition: RFieldValue.hxx:59
ROOT::Internal::GetDemangledTypeName
std::string GetDemangledTypeName(const std::type_info &)
Returns a string with the demangled and normalized name for the given type.
Definition: TGenericClassInfo.cxx:42
ROOT::Experimental::RArrayField::GenerateColumnsImpl
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Definition: RField.cxx:843
ROOT::Experimental::REntry
The REntry is a collection of values in an ntuple corresponding to a complete row in the data set.
Definition: REntry.hxx:54
ROOT::Experimental::RField< double >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:614
ROOT::Experimental::RField< ClusterSize_t >::GetCollectionInfo
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Definition: RField.hxx:504
ROOT::Experimental::RField< float >::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:577
ROOT::Experimental::Detail::RFieldBase::GenerateValue
RFieldValue GenerateValue()
Generates an object of the field type and allocates new initialized memory according to the type.
Definition: RField.cxx:216
ROOT::Experimental::RCollectionField::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:457
ROOT::Experimental::Detail::RFieldBase::RFieldBase
RFieldBase(std::string_view name, std::string_view type, 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.
Definition: RField.cxx:128
ROOT::Experimental::RFieldZero::GenerateColumnsImpl
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Definition: RField.hxx:264
ROOT::Experimental::Detail::RColumn::Append
void Append(const RColumnElementBase &element)
Definition: RColumn.hxx:101
ROOT::Experimental::EColumnType::kInt64
@ kInt64
ROOT::Experimental::Detail::RFieldBase::fColumns
std::vector< std::unique_ptr< RColumn > > fColumns
The columns are connected either to a sink or to a source (not to both); they are owned by the field.
Definition: RField.hxx:100
ROOT::Experimental::Detail::RFieldBase::begin
RSchemaIterator begin()
Definition: RField.cxx:268
ROOT::Experimental::Detail::RFieldBase::operator=
RFieldBase & operator=(const RFieldBase &)=delete
ROOT::Experimental::RField< bool >::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:544
ROOT::Experimental::Detail::RFieldBase::fParent
RFieldBase * fParent
Sub fields point to their mother field.
Definition: RField.hxx:94
bool
ROOT::Experimental::EColumnType::kInt32
@ kInt32
ROOT::Experimental::Detail::RFieldBase::GetNRepetitions
std::size_t GetNRepetitions() const
Definition: RField.hxx:222
ROOT::Experimental::RClassField::SplitValue
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
Definition: RField.cxx:590
ROOT::Experimental::RVectorField::operator=
RVectorField & operator=(RVectorField &&other)=default
ROOT::Experimental::EColumnType::kBit
@ kBit
ROOT::Experimental::RVectorField::GetCollectionInfo
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
Definition: RField.hxx:331
ROOT::Experimental::RVectorField::AppendImpl
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
Definition: RField.cxx:632
ROOT::Experimental::Detail::RFieldBase::EnsureValidFieldName
static RResult< void > EnsureValidFieldName(std::string_view fieldName)
Check whether a given string is a valid field name.
Definition: RField.cxx:195
RFieldBase
A field translates read and write calls from/to underlying columns to/from tree values.
Definition: RField.hxx:60
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator
Iterates over the sub tree of fields in depth-first search order.
Definition: RField.hxx:115
ROOT::Experimental::RVectorField::fItemSize
std::size_t fItemSize
Definition: RField.hxx:307
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::~RSchemaIterator
~RSchemaIterator()
Definition: RField.hxx:135
ROOT::Experimental::RField< double >::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:615
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::Position
Definition: RField.hxx:117
ROOT::Experimental::RNTupleVersion
For forward and backward compatibility, attach version information to the consitituents of the file f...
Definition: RNTupleUtil.hxx:126
ROOT::Experimental::kCollection
@ kCollection
Definition: RNTupleUtil.hxx:52
ROOT::Experimental::Detail::RFieldBase::Flush
void Flush() const
Ensure that all received items are written from page buffers to the storage.
Definition: RField.cxx:254
ROOT::Experimental::RVectorField::GetCollectionInfo
void GetCollectionInfo(const RClusterIndex &clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size) const
Definition: RField.hxx:334
ROOT::Experimental::Detail::RFieldBase::fSubFields
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
Definition: RField.hxx:92
ROOT::Experimental::Detail::RColumn::GetGlobalIndex
NTupleSize_t GetGlobalIndex(const RClusterIndex &clusterIndex)
Definition: RColumn.hxx:198
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::fNWritten
ClusterSize_t fNWritten
Definition: RField.hxx:971
ROOT::Experimental::RFieldZero::RFieldZero
RFieldZero()
Definition: RField.hxx:261
ROOT::Experimental::RField< double >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:608
ROOT::Experimental::Detail::RFieldBase::GetTypeVersion
virtual RNTupleVersion GetTypeVersion() const
Indicates an evolution of the C++ type itself.
Definition: RField.hxx:231
ROOT::Experimental::EColumnType::kReal32
@ kReal32
ROOT::Experimental::RResult< void >
RResult<void> has no data member and no Inspect() method but instead a Success() factory method.
Definition: RError.hxx:259
ROOT::Experimental::RField< double >::TypeName
static std::string TypeName()
Definition: RField.hxx:589
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::ContainerT
typename ROOT::VecOps::RVec< bool > ContainerT
Definition: RField.hxx:1059
ROOT::Experimental::RField< bool >::TypeName
static std::string TypeName()
Definition: RField.hxx:514
ROOT::Experimental::RCollectionField::TypeName
static std::string TypeName()
Definition: RField.hxx:436
ROOT::Experimental::RClassField::fMaxAlignment
std::size_t fMaxAlignment
Definition: RField.hxx:279
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:1040
ROOT::Experimental::Detail::RFieldBase::fType
std::string fType
The C++ type captured by this field.
Definition: RField.hxx:82
RStringView.hxx
ROOT::Experimental::RClassField::ReadGlobalImpl
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Definition: RField.cxx:545
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::DestroyValue
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Definition: RField.hxx:1109
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::Position::fFieldPtr
RFieldBase * fFieldPtr
Definition: RField.hxx:120
ROOT::Experimental::RField< float >::Map
float * Map(const RClusterIndex &clusterIndex)
Definition: RField.hxx:564
ROOT::Experimental::RField< float >::TypeName
static std::string TypeName()
Definition: RField.hxx:551
RColumn.hxx
ROOT::Experimental::Detail::RFieldBase::~RFieldBase
virtual ~RFieldBase()
Definition: RField.cxx:135
ROOT::Experimental::Detail::RFieldBase::ReadGlobalImpl
virtual void ReadGlobalImpl(NTupleSize_t globalIndex, RFieldValue *value)
Definition: RField.cxx:209
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::iterator_category
std::forward_iterator_tag iterator_category
Definition: RField.hxx:127
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:1050
TypeTraits.hxx
ROOT::Experimental::EColumnType::kByte
@ kByte
ROOT::Experimental::Detail::RFieldBase::CommitCluster
virtual void CommitCluster()
Perform housekeeping tasks for global to cluster-local index translation.
Definition: RField.hxx:214
ROOT::Experimental::RFieldZero::CaptureValue
Detail::RFieldValue CaptureValue(void *) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:267
ROOT::Experimental::RArrayField::RArrayField
RArrayField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField, std::size_t arrayLength)
Definition: RField.cxx:800
ROOT::Experimental::Detail::RFieldFuse::Connect
static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field)
Definition: RField.cxx:116
double
double
Definition: Converters.cxx:921
ROOT::Experimental::kRecord
@ kRecord
Definition: RNTupleUtil.hxx:53
ROOT::Experimental::RColumnModel
Holds the static meta-data of a column in a tree.
Definition: RColumnModel.hxx:72
ROOT::Experimental::Detail::RFieldBase::GetParent
const RFieldBase * GetParent() const
Definition: RField.hxx:224
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::CommitCluster
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
Definition: RField.hxx:1115
RFieldValue
Represents transient storage of simple or complex C++ values.
Definition: RFieldValue.hxx:46
ROOT::Experimental::RVectorField::RVectorField
RVectorField(std::string_view fieldName, std::unique_ptr< Detail::RFieldBase > itemField)
Definition: RField.cxx:617
ROOT::Experimental::RField::TypeName
static std::string TypeName()
Definition: RField.hxx:413
ROOT::Experimental::RArrayField::fArrayLength
std::size_t fArrayLength
Definition: RField.hxx:344
ROOT::Experimental::RVectorField::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.cxx:626
ROOT::Experimental::RField< float >::RField
RField(std::string_view name)
Definition: RField.hxx:552
RNTupleUtil.hxx
ROOT::Experimental::RArrayField::operator=
RArrayField & operator=(RArrayField &&other)=default
ROOT::Experimental::RArrayField::SplitValue
std::vector< Detail::RFieldValue > SplitValue(const Detail::RFieldValue &value) const final
Creates the list of direct child values given a value for this field.
Definition: RField.cxx:873
ROOT::Experimental::RClusterIndex
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
Definition: RNTupleUtil.hxx:94
ROOT::Experimental::RArrayField::fItemSize
std::size_t fItemSize
Definition: RField.hxx:343
ROOT::Experimental::Detail::RFieldBase::CaptureValue
virtual RFieldValue CaptureValue(void *where)=0
Creates a value from a memory location with an already constructed object.
ROOT::Experimental::RClusterSize
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...
Definition: RNTupleUtil.hxx:57
ROOT::Experimental::RArrayField::DestroyValue
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Definition: RField.cxx:856
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::AppendImpl
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
Definition: RField.hxx:1064
ROOT::Experimental::RFieldZero::GenerateEntry
REntry * GenerateEntry()
Generates managed values for the top-level sub fields.
Definition: RField.cxx:321
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::CommitCluster
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
Definition: RField.hxx:1034
ROOT::Experimental::RField< float >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:570
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::operator==
bool operator==(const iterator &rh) const
Definition: RField.hxx:144
ROOT::Experimental::RField< ClusterSize_t >::RField
RField(std::string_view name)
Definition: RField.hxx:469
RColumnElement.hxx
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::operator!=
bool operator!=(const iterator &rh) const
Definition: RField.hxx:145
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::GetAlignment
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Definition: RField.hxx:1132
ROOT::Experimental::RVectorField::CommitCluster
void CommitCluster() final
Perform housekeeping tasks for global to cluster-local index translation.
Definition: RField.cxx:705
ROOT::Experimental::RVectorField::~RVectorField
~RVectorField()=default
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:1125
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::GenerateColumnsImpl
void GenerateColumnsImpl() final
Creates the backing columns corresponsing to the field type and name.
Definition: RField.hxx:1017
ROOT::Experimental::RArrayField::ReadInClusterImpl
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
Definition: RField.cxx:833
ROOT::Experimental::Detail::RFieldBase::fPrincipalColumn
RColumn * fPrincipalColumn
Points into fColumns.
Definition: RField.hxx:98
ROOT::Experimental::RFieldZero
The container field for an ntuple model, which itself has no physical representation.
Definition: RField.hxx:259
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::ReadGlobalImpl
void ReadGlobalImpl(NTupleSize_t globalIndex, Detail::RFieldValue *value) final
Definition: RField.hxx:1076
ROOT::Experimental::RVectorField::DestroyValue
void DestroyValue(const Detail::RFieldValue &value, bool dtorOnly=false) final
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Definition: RField.cxx:673
ROOT::Experimental::RField< ClusterSize_t >::Map
ClusterSize_t * Map(const RClusterIndex &clusterIndex)
Definition: RField.hxx:481
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::operator->
pointer operator->() const
Definition: RField.hxx:143
ROOT::Experimental::RCollectionField::fCollectionNTuple
std::shared_ptr< RCollectionNTuple > fCollectionNTuple
Save the link to the collection ntuple in order to reset the offset counter when committing the clust...
Definition: RField.hxx:434
TClass
Definition: TClass.h:80
ROOT::Experimental::RVectorField
The generic field for a (nested) std::vector<Type> except for std::vector<bool>
Definition: RField.hxx:305
ROOT::Experimental::Detail::RFieldBase::GetStructure
ENTupleStructure GetStructure() const
Definition: RField.hxx:221
ROOT::Experimental::ClusterSize_t
RClusterSize ClusterSize_t
Definition: RNTupleUtil.hxx:69
ROOT::Experimental::RField< bool >
Definition: RField.hxx:512
ROOT::Experimental::RClassField::AppendImpl
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
Definition: RField.cxx:535
ROOT::Experimental::Detail::RColumn
Definition: RColumn.hxx:61
ROOT::Experimental::RField< float >::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.hxx:557
ROOT::Experimental::RField< double >::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.hxx:595
name
char name[80]
Definition: TGX11.cxx:110
ROOT::Experimental::Detail::RColumn::Read
void Read(const NTupleSize_t globalIndex, RColumnElementBase *element)
Definition: RColumn.hxx:124
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:1121
ROOT::Experimental::RArrayField::~RArrayField
~RArrayField()=default
ROOT::Experimental::Detail::RColumnElement< double, EColumnType::kReal64 >
Definition: RColumnElement.hxx:148
ROOT::Experimental::RField< double >::RField
RField(std::string_view name)
Definition: RField.hxx:590
ROOT::Experimental::RClassField::RClassField
RClassField(std::string_view fieldName, std::string_view className)
Definition: RField.cxx:514
ROOT::Math::Chebyshev::T
double T(double x)
Definition: ChebyshevPol.h:52
ROOT::Experimental::RArrayField::GetLength
size_t GetLength() const
Definition: RField.hxx:364
ROOT::Experimental::Detail::RFieldBase::GetAlignment
virtual size_t GetAlignment() const
For many types, the alignment requirement is equal to the size; otherwise override.
Definition: RField.hxx:182
ROOT::Experimental::RArrayField::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:365
ROOT::Experimental::RArrayField::AppendImpl
void AppendImpl(const Detail::RFieldValue &value) final
Operations on values of complex types, e.g.
Definition: RField.cxx:816
RError.hxx
ROOT::Experimental::Detail::RFieldBase::Append
void Append(const RFieldValue &value)
Write the given value into columns. The value object has to be of the same type as the field.
Definition: RField.hxx:185
ROOT::Experimental::Detail::RFieldBase::SplitValue
virtual std::vector< RFieldValue > SplitValue(const RFieldValue &value) const
Creates the list of direct child values given a value for this field.
Definition: RField.cxx:230
ROOT::Experimental::Detail::RFieldBase::Read
void Read(const RClusterIndex &clusterIndex, RFieldValue *value)
Definition: RField.hxx:203
ROOT::Experimental::RField::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where) final
Generates a tree value in a given location of size at least GetValueSize().
Definition: RField.hxx:427
ROOT::Experimental::RField::RField
RField(std::string_view name)
Definition: RField.hxx:414
ROOT::Experimental::RCollectionField
Definition: RField.hxx:431
ROOT::Experimental::RField< ClusterSize_t >::GetCollectionInfo
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Special help for offset fields.
Definition: RField.hxx:501
type
int type
Definition: TGX11.cxx:121
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::fItemSize
size_t fItemSize
Definition: RField.hxx:970
ROOT::Experimental::RField< ROOT::VecOps::RVec< bool > >::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.hxx:1099
ROOT::Experimental::Detail::RFieldBase::DestroyValue
virtual void DestroyValue(const RFieldValue &value, bool dtorOnly=false)
Releases the resources acquired during GenerateValue (memory and constructor) This implementation wor...
Definition: RField.cxx:223
free
#define free
Definition: civetweb.c:1539
RSpan.hxx
ROOT::Experimental::RField< ClusterSize_t >::TypeName
static std::string TypeName()
Definition: RField.hxx:468
ROOT::Experimental::Detail::RFieldBase::Read
void Read(NTupleSize_t globalIndex, RFieldValue *value)
Populate a single value with data from the tree, which needs to be of the fitting type.
Definition: RField.hxx:195
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::RField
RField(std::string_view name)
Definition: RField.hxx:1005
ROOT::Experimental::RVectorField::GetAlignment
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Definition: RField.hxx:328
ROOT::Experimental::RField< ClusterSize_t >::GetValueSize
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:498
ROOT::Experimental::Detail::RFieldBase::fName
std::string fName
The field name relative to its parent field.
Definition: RField.hxx:80
ROOT::Experimental::Detail::RColumnElement< float, EColumnType::kReal32 >
Definition: RColumnElement.hxx:137
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::Position::Position
Position(RFieldBase *fieldPtr, int idxInParent)
Definition: RField.hxx:119
ROOT::Experimental::RField< ClusterSize_t >::GenerateValue
ROOT::Experimental::Detail::RFieldValue GenerateValue(void *where, ArgsT &&... args)
Definition: RField.hxx:487
ROOT::Experimental::RClassField::GetAlignment
size_t GetAlignment() const final
For many types, the alignment requirement is equal to the size; otherwise override.
Definition: RField.hxx:300
RooStats::HistFactory::Constraint::GetType
Type GetType(const std::string &Name)
Definition: Systematics.cxx:34
TGenericClassInfo.h
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::operator*
reference operator*() const
Definition: RField.hxx:142
ROOT::VecOps::Map
auto Map(Args &&... args) -> decltype(ROOT::Detail::VecOps::MapFromTuple(std::forward_as_tuple(args...), std::make_index_sequence< sizeof...(args) - 1 >()))
Create new collection applying a callable to the elements of the input collection.
Definition: RVec.hxx:909
ROOT::Experimental::RClassField
The field for a class with dictionary.
Definition: RField.hxx:276
ROOT
VSD Structures.
Definition: StringConv.hxx:21
ROOT::VecOps::RVec
A "std::vector"-like collection of values implementing handy operation to analyse them.
Definition: RVec.hxx:55
ROOT::Experimental::Detail::RFieldBase::RSchemaIterator::RSchemaIterator
RSchemaIterator()
Definition: RField.hxx:133
RFieldValue.hxx
ROOT::Experimental::RField< bool >::Clone
RFieldBase * Clone(std::string_view newName) final
Definition: RField.hxx:520
ROOT::Experimental::RField< bool >::Map
bool * Map(const RClusterIndex &clusterIndex)
Definition: RField.hxx:527
ROOT::Experimental::Detail::RFieldBase::GetFieldVersion
virtual RNTupleVersion GetFieldVersion() const
Indicates an evolution of the mapping scheme from C++ type to columns.
Definition: RField.hxx:229
ROOT::Experimental::Detail::RFieldFuse
Definition: RField.hxx:249
ROOT::Experimental::RClassField::ReadInClusterImpl
void ReadInClusterImpl(const RClusterIndex &clusterIndex, Detail::RFieldValue *value) final
Definition: RField.cxx:556
ROOT::Experimental::Detail::RColumnElement< ClusterSize_t, EColumnType::kIndex >
Definition: RColumnElement.hxx:214
ROOT::Experimental::RField
Classes with dictionaries that can be inspected by TClass.
Definition: RField.hxx:411
ROOT::Experimental::RField< ROOT::VecOps::RVec< ItemT > >::CaptureValue
Detail::RFieldValue CaptureValue(void *where) final
Creates a value from a memory location with an already constructed object.
Definition: RField.hxx:1047
ROOT::Experimental::RField< double >::Map
double * Map(const RClusterIndex &clusterIndex)
Definition: RField.hxx:602
ROOT::Experimental::RVectorField::GetValueSize
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
Definition: RField.hxx:327
ROOT::Experimental::Detail::RFieldBase::ReadInClusterImpl
virtual void ReadInClusterImpl(const RClusterIndex &clusterIndex, RFieldValue *value)
Definition: RField.hxx:109