Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
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/RError.hxx>
20#include <ROOT/RFieldBase.hxx>
21#include <ROOT/RFieldUtils.hxx>
23#include <ROOT/RNTupleUtil.hxx>
24#include <ROOT/RSpan.hxx>
25#include <string_view>
26#include <ROOT/TypeTraits.hxx>
27
28#include <TGenericClassInfo.h>
29
30#include <algorithm>
31#include <array>
32#include <cstddef>
33#include <iostream>
34#include <memory>
35#include <string>
36#include <type_traits>
37#include <typeinfo>
38#include <vector>
39
40class TClass;
41class TEnum;
42class TObject;
44
45namespace ROOT {
46
47class TSchemaRule;
48class RNTupleCollectionView;
49
50namespace Detail {
51class RFieldVisitor;
52} // namespace Detail
53
54/// The container field for an ntuple model, which itself has no physical representation.
55/// Therefore, the zero field must not be connected to a page source or sink.
56class RFieldZero final : public RFieldBase {
57protected:
58 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
59 void ConstructValue(void *) const final {}
60
61public:
62 RFieldZero() : RFieldBase("", "", ROOT::ENTupleStructure::kRecord, false /* isSimple */) {}
63
65 size_t GetValueSize() const final { return 0; }
66 size_t GetAlignment() const final { return 0; }
67
69};
70
71/// Used in RFieldBase::Check() to record field creation failures.
72/// Also used when deserializing a field that contains unknown values that may come from
73/// future RNTuple versions (e.g. an unknown Structure)
75public:
76 enum class RCategory {
77 /// Generic unrecoverable error
79 /// The type given to RFieldBase::Create was invalid
81 /// The type given to RFieldBase::Create was unknown
83 /// The field could not be created because its descriptor had an unknown structural role
85 };
86
87private:
88 std::string fError;
90
91protected:
92 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final
93 {
94 return std::make_unique<RInvalidField>(newName, GetTypeName(), fError, fCategory);
95 }
96 void ConstructValue(void *) const final {}
97
98public:
99 RInvalidField(std::string_view name, std::string_view type, std::string_view error, RCategory category)
101 {
103 }
104
105 const std::string &GetError() const { return fError; }
106 RCategory GetCategory() const { return fCategory; }
107
108 size_t GetValueSize() const final { return 0; }
109 size_t GetAlignment() const final { return 0; }
110}; // RInvalidField
111
112/// The field for a class with dictionary
113class RClassField : public RFieldBase {
114private:
121 std::size_t fOffset;
122 };
123 // Information to read into the staging area a field that is used as an input to an I/O customization rule
125 /// The field used to read the on-disk data. The fields type may be different from the on-disk type as long
126 /// as the on-disk type can be converted to the fields type (through type cast / schema evolution).
127 std::unique_ptr<RFieldBase> fField;
128 std::size_t fOffset; ///< offset in fStagingArea
129 };
130 /// Prefix used in the subfield names generated for base classes
131 static constexpr const char *kPrefixInherited{":"};
132
133 class RClassDeleter : public RDeleter {
134 private:
136
137 public:
138 explicit RClassDeleter(TClass *cl) : fClass(cl) {}
139 void operator()(void *objPtr, bool dtorOnly) final;
140 };
141
143 /// Additional information kept for each entry in `fSubfields`
144 std::vector<RSubFieldInfo> fSubfieldsInfo;
145 std::size_t fMaxAlignment = 1;
146
147 /// The staging area stores inputs to I/O rules according to the offsets given by the streamer info of
148 /// "TypeName@@Version". The area is allocated depending on I/O rules resp. the source members of the I/O rules.
149 std::unique_ptr<unsigned char[]> fStagingArea;
150 /// The TClass instance that corresponds to the staging area.
151 /// The staging class exists as <class name>@@<on-disk version> if the on-disk version is different from the
152 /// current in-memory version, or it can be accessed by the first @@alloc streamer element of the current streamer
153 /// info.
155 std::unordered_map<std::string, RStagingItem> fStagingItems; ///< Lookup staging items by member name
156
157private:
158 RClassField(std::string_view fieldName, const RClassField &source); ///< Used by CloneImpl
159 RClassField(std::string_view fieldName, TClass *classp);
160 void Attach(std::unique_ptr<RFieldBase> child, RSubFieldInfo info);
161
162 /// Returns the id of member 'name' in the class field given by 'fieldId', or kInvalidDescriptorId if no such
163 /// member exist. Looks recursively in base classes.
166 /// Sets fStagingClass according to the given name and version
167 void SetStagingClass(const std::string &className, unsigned int classVersion);
168 /// If there are rules with inputs (source members), create the staging area according to the TClass instance
169 /// that corresponds to the on-disk field.
170 void PrepareStagingArea(const std::vector<const TSchemaRule *> &rules, const ROOT::RNTupleDescriptor &desc,
172 /// Register post-read callback corresponding to a ROOT I/O customization rules.
174 /// Given the on-disk information from the page source, find all the I/O customization rules that apply
175 /// to the class field at hand, to which the fieldDesc descriptor, if provided, must correspond.
176 /// Fields may not have an on-disk representation (e.g., when inserted by schema evolution), in which case the passed
177 /// field descriptor is nullptr.
178 std::vector<const TSchemaRule *> FindRules(const ROOT::RFieldDescriptor *fieldDesc);
179
180protected:
181 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
182
183 void ConstructValue(void *where) const final;
184 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RClassDeleter>(fClass); }
185
186 std::size_t AppendImpl(const void *from) final;
187 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
188 void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final;
190
191public:
192 RClassField(std::string_view fieldName, std::string_view className);
195 ~RClassField() override = default;
196
197 std::vector<RValue> SplitValue(const RValue &value) const final;
198 size_t GetValueSize() const final;
200 std::uint32_t GetTypeVersion() const final;
201 std::uint32_t GetTypeChecksum() const final;
203};
204
205/// The field for a class using ROOT standard streaming
207private:
209 private:
211
212 public:
213 explicit RStreamerFieldDeleter(TClass *cl) : fClass(cl) {}
214 void operator()(void *objPtr, bool dtorOnly) final;
215 };
216
217 TClass *fClass = nullptr;
219 fStreamerInfos; ///< streamer info records seen during writing
220 ROOT::Internal::RColumnIndex fIndex; ///< number of bytes written in the current cluster
221
222private:
223 RStreamerField(std::string_view fieldName, TClass *classp);
224
225protected:
226 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
227
229 void GenerateColumns() final;
231
232 void ConstructValue(void *where) const final;
233 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RStreamerFieldDeleter>(fClass); }
234
235 std::size_t AppendImpl(const void *from) final;
236 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
237
238 void CommitClusterImpl() final { fIndex = 0; }
239
240 bool HasExtraTypeInfo() const final { return true; }
241 // Returns the list of seen streamer infos
243
244public:
245 RStreamerField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
249
250 size_t GetValueSize() const final;
251 size_t GetAlignment() const final;
252 std::uint32_t GetTypeVersion() const final;
253 std::uint32_t GetTypeChecksum() const final;
255};
256
257/// The field for an unscoped or scoped enum with dictionary
259private:
260 REnumField(std::string_view fieldName, TEnum *enump);
261 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
262
263protected:
264 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
265
266 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubfields[0], where); }
267
268 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubfields[0], from); }
271
272public:
273 REnumField(std::string_view fieldName, std::string_view enumName);
276 ~REnumField() override = default;
277
278 std::vector<RValue> SplitValue(const RValue &value) const final;
279 size_t GetValueSize() const final { return fSubfields[0]->GetValueSize(); }
280 size_t GetAlignment() const final { return fSubfields[0]->GetAlignment(); }
282};
283
284/// Classes with dictionaries that can be inspected by TClass
285template <typename T, typename = void>
286class RField final : public RClassField {
287public:
288 static std::string TypeName() { return ROOT::Internal::GetRenormalizedDemangledTypeName(typeid(T)); }
289 RField(std::string_view name) : RClassField(name, TypeName())
290 {
291 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
292 }
293 RField(RField &&other) = default;
296};
297
300public:
301 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
302 RField(std::string_view name) : REnumField(name, TypeName()) {}
303 RField(RField &&other) = default;
304 RField &operator=(RField &&other) = default;
305 ~RField() final = default;
306};
307
308/// An artificial field that transforms an RNTuple column that contains the offset of collections into
309/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
310/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
311/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
312/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
314 friend class ROOT::RNTupleCollectionView; // to access GetCollectionInfo()
315
316private:
325
326protected:
327 RCardinalityField(std::string_view fieldName, std::string_view typeName)
328 : RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kLeaf, false /* isSimple */)
329 {
330 }
331
332 const RColumnRepresentations &GetColumnRepresentations() const final;
333 // Field is only used for reading
334 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
335 void GenerateColumns(const ROOT::RNTupleDescriptor &) final;
336
337public:
340 ~RCardinalityField() override = default;
341
342 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
343
344 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
345 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
346};
347
348template <typename T>
349class RSimpleField : public RFieldBase {
350protected:
353
354 void ConstructValue(void *where) const final { new (where) T{0}; }
355
356public:
357 RSimpleField(std::string_view name, std::string_view type)
358 : RFieldBase(name, type, ROOT::ENTupleStructure::kLeaf, true /* isSimple */)
359 {
360 fTraits |= kTraitTrivialType;
361 }
364 ~RSimpleField() override = default;
365
366 T *Map(ROOT::NTupleSize_t globalIndex) { return fPrincipalColumn->Map<T>(globalIndex); }
367 T *Map(RNTupleLocalIndex localIndex) { return fPrincipalColumn->Map<T>(localIndex); }
369 {
370 return fPrincipalColumn->MapV<T>(globalIndex, nItems);
371 }
373 {
374 return fPrincipalColumn->MapV<T>(localIndex, nItems);
375 }
376
377 size_t GetValueSize() const final { return sizeof(T); }
378 size_t GetAlignment() const final { return alignof(T); }
379};
380
381////////////////////////////////////////////////////////////////////////////////
382/// Template specializations for concrete C++ types
383////////////////////////////////////////////////////////////////////////////////
384
385} // namespace ROOT
386
392
393namespace ROOT {
394
395template <typename SizeT>
397protected:
398 std::unique_ptr<ROOT::RFieldBase> CloneImpl(std::string_view newName) const final
399 {
400 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
401 }
402 void ConstructValue(void *where) const final { new (where) RNTupleCardinality<SizeT>(0); }
403
404 /// Get the number of elements of the collection identified by globalIndex
406 {
409 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &size);
410 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
411 }
412
413 /// Get the number of elements of the collection identified by clusterIndex
415 {
418 fPrincipalColumn->GetCollectionInfo(localIndex, &collectionStart, &size);
419 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
420 }
421
422 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
423 {
426 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
427
428 auto typedValues = static_cast<RNTupleCardinality<SizeT> *>(bulkSpec.fValues);
430
431 auto lastOffset = collectionStart.GetIndexInCluster() + collectionSize;
433 std::size_t nEntries = 1;
434 while (nRemainingEntries > 0) {
436 auto offsets =
437 fPrincipalColumn->MapV<ROOT::Internal::RColumnIndex>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
438 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
439 for (std::size_t i = 0; i < nBatch; ++i) {
440 typedValues[nEntries + i] = offsets[i] - lastOffset;
441 lastOffset = offsets[i];
442 }
444 nEntries += nBatch;
445 }
446 return RBulkSpec::kAllSet;
447 }
448
449public:
450 static std::string TypeName() { return "ROOT::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
451 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
452 RField(RField &&other) = default;
455
456 size_t GetValueSize() const final { return sizeof(RNTupleCardinality<SizeT>); }
457 size_t GetAlignment() const final { return alignof(RNTupleCardinality<SizeT>); }
458};
459
460/// TObject requires special handling of the fBits and fUniqueID members
461template <>
463 static std::size_t GetOffsetOfMember(const char *name);
464 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
465 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
466
467private:
468 RField(std::string_view fieldName, const RField<TObject> &source); ///< Used by CloneImpl()
469
470protected:
471 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
472
473 void ConstructValue(void *where) const final;
474 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
475
476 std::size_t AppendImpl(const void *from) final;
477 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
478
479 void AfterConnectPageSource() final;
480
481public:
482 static std::string TypeName() { return "TObject"; }
483
484 RField(std::string_view fieldName);
485 RField(RField &&other) = default;
488
489 std::vector<RValue> SplitValue(const RValue &value) const final;
490 size_t GetValueSize() const final;
491 size_t GetAlignment() const final;
492 std::uint32_t GetTypeVersion() const final;
493 std::uint32_t GetTypeChecksum() const final;
494 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
495};
496
497// Has to be implemented after the definition of all RField<T> types
498// The void type is specialized in RField.cxx
499
501std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
502{
503 if (GetTypeName() != RField<T>::TypeName()) {
504 throw RException(
505 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
506 }
507 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
508}
509
510template <>
511struct RFieldBase::RCreateObjectDeleter<void> {
513 void operator()(void *);
514};
515
516template <>
517std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
518ROOT::RFieldBase::CreateObject<void>() const;
519
520namespace Experimental {
521// TODO(gparolini): remove before branching ROOT v6.36
522using RFieldZero [[deprecated("ROOT::Experimental::RFieldZero moved to ROOT::RFieldZero")]] = ROOT::RFieldZero;
523using RClassField [[deprecated("ROOT::Experimental::RClassField moved to ROOT::RClassField")]] = ROOT::RClassField;
524using REnumField [[deprecated("ROOT::Experimental::REnumField moved to ROOT::REnumField")]] = ROOT::REnumField;
525using RStreamerField [[deprecated("ROOT::Experimental::RStreamerField moved to ROOT::RStreamerField")]] =
527template <typename T>
528using RSimpleField [[deprecated("ROOT::Experimental::RSimpleField moved to ROOT::RSimpleField")]] =
530using RInvalidField [[deprecated("ROOT::Experimental::RInvalidField moved to ROOT::RInvalidField")]] =
532using RCardinalityField [[deprecated("ROOT::Experimental::RCardinalityField moved to ROOT::RCardinalityField")]] =
534template <typename T>
535using RField [[deprecated("ROOT::Experimental::RField moved to ROOT::RField")]] = ROOT::RField<T>;
536} // namespace Experimental
537
538} // namespace ROOT
539
540#endif
Cppyy::TCppType_t fClass
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:299
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
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
TRObject operator()(const T1 &t1) const
Binding & operator=(OUT(*fun)(void))
Abstract base class for classes implementing the visitor design pattern.
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
Abstract interface to read data from an ntuple.
The in-memory representation of a 32bit or 64bit on-disk index column.
An artificial field that transforms an RNTuple column that contains the offset of collections into co...
Definition RField.hxx:313
RCardinalityField(RCardinalityField &&other)=default
void GetCollectionInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:317
RCardinalityField & operator=(RCardinalityField &&other)=default
void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:321
~RCardinalityField() override=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:327
void operator()(void *objPtr, bool dtorOnly) final
The field for a class with dictionary.
Definition RField.hxx:113
void AddReadCallbacksFromIORule(const TSchemaRule *rule)
Register post-read callback corresponding to a ROOT I/O customization rules.
TClass * fStagingClass
The TClass instance that corresponds to the staging area.
Definition RField.hxx:154
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RClassField(RClassField &&other)=default
std::vector< RSubFieldInfo > fSubfieldsInfo
Additional information kept for each entry in fSubfields
Definition RField.hxx:144
std::size_t fMaxAlignment
Definition RField.hxx:145
std::unique_ptr< unsigned char[]> fStagingArea
The staging area stores inputs to I/O rules according to the offsets given by the streamer info of "T...
Definition RField.hxx:149
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:199
~RClassField() override=default
RClassField & operator=(RClassField &&other)=default
void BeforeConnectPageSource(ROOT::Experimental::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate.
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
void Attach(std::unique_ptr< RFieldBase > child, RSubFieldInfo info)
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
std::vector< const TSchemaRule * > FindRules(const ROOT::RFieldDescriptor *fieldDesc)
Given the on-disk information from the page source, find all the I/O customization rules that apply t...
ROOT::DescriptorId_t LookupMember(const ROOT::RNTupleDescriptor &desc, std::string_view memberName, ROOT::DescriptorId_t classFieldId)
Returns the id of member 'name' in the class field given by 'fieldId', or kInvalidDescriptorId if no ...
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
TClass * fClass
Definition RField.hxx:142
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void PrepareStagingArea(const std::vector< const TSchemaRule * > &rules, const ROOT::RNTupleDescriptor &desc, const ROOT::RFieldDescriptor &classFieldId)
If there are rules with inputs (source members), create the staging area according to the TClass inst...
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:184
std::unordered_map< std::string, RStagingItem > fStagingItems
Lookup staging items by member name.
Definition RField.hxx:155
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
Definition RField.hxx:131
void SetStagingClass(const std::string &className, unsigned int classVersion)
Sets fStagingClass according to the given name and version.
The field for an unscoped or scoped enum with dictionary.
Definition RField.hxx:258
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:279
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:280
~REnumField() override=default
REnumField(REnumField &&other)=default
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:266
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.hxx:270
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:269
REnumField & operator=(REnumField &&other)=default
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:268
Base class for all ROOT issued exceptions.
Definition RError.hxx:79
Field specific extra type information from the header / extenstion header.
The list of column representations a field can have.
A functor to release the memory acquired by CreateValue() (memory and constructor).
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
A field translates read and write calls from/to underlying columns to/from tree values.
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
std::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponding to the field type ...
friend class ROOT::RClassField
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append() and Read() on other (sub)fields.
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
@ kTraitInvalidField
This field is an instance of RInvalidField and can be safely static_cast to it.
const std::string & GetTypeName() const
static void CallReadOn(RFieldBase &other, RNTupleLocalIndex localIndex, void *to)
static void CallConstructValueOn(const RFieldBase &other, void *where)
Allow derived classes to call ConstructValue(void *) and GetDeleter() on other (sub)fields.
virtual ROOT::RExtraTypeInfoDescriptor GetExtraTypeInfo() const
Metadata stored for every field of an RNTuple.
The container field for an ntuple model, which itself has no physical representation.
Definition RField.hxx:56
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:42
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:65
void ConstructValue(void *) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.hxx:59
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:34
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:66
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
Definition RField.hxx:405
RField & operator=(RField &&other)=default
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
Definition RField.hxx:422
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:402
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:414
std::unique_ptr< ROOT::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:398
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:457
RField(RField &&other)=default
RField & operator=(RField &&other)=default
~RField() final=default
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:474
static std::size_t GetOffsetBits()
Definition RField.hxx:465
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:464
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:286
~RField() final=default
RField(RField &&other)=default
RField & operator=(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:288
RField(std::string_view name)
Definition RField.hxx:289
Used in RFieldBase::Check() to record field creation failures.
Definition RField.hxx:74
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:92
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:109
@ kGeneric
Generic unrecoverable error.
@ kUnknownType
The type given to RFieldBase::Create was unknown.
@ kTypeError
The type given to RFieldBase::Create was invalid.
@ kUnknownStructure
The field could not be created because its descriptor had an unknown structural role.
std::string fError
Definition RField.hxx:88
RCategory GetCategory() const
Definition RField.hxx:106
const std::string & GetError() const
Definition RField.hxx:105
RInvalidField(std::string_view name, std::string_view type, std::string_view error, RCategory category)
Definition RField.hxx:99
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:108
RCategory fCategory
Definition RField.hxx:89
void ConstructValue(void *) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.hxx:96
A view for a collection, that can itself generate new ntuple views for its nested fields.
The on-storage metadata of an RNTuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
void GenerateColumns() override
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.hxx:351
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:378
RSimpleField & operator=(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
Definition RField.hxx:357
T * Map(RNTupleLocalIndex localIndex)
Definition RField.hxx:367
~RSimpleField() override=default
T * Map(ROOT::NTupleSize_t globalIndex)
Definition RField.hxx:366
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:377
RSimpleField(RSimpleField &&other)=default
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:354
T * MapV(ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:368
void GenerateColumns(const ROOT::RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.hxx:352
T * MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:372
The field for a class using ROOT standard streaming.
Definition RField.hxx:206
ROOT::Internal::RColumnIndex fIndex
number of bytes written in the current cluster
Definition RField.hxx:220
bool HasExtraTypeInfo() const final
Definition RField.hxx:240
ROOT::Experimental::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:219
void CommitClusterImpl() final
Definition RField.hxx:238
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:84
The TEnum class implements the enum type.
Definition TEnum.h:33
Mother of all ROOT objects.
Definition TObject.h:41
Abstract Interface class describing Streamer information for one class.
std::string GetRenormalizedDemangledTypeName(const std::type_info &ti)
Given a type info ask ROOT meta to demangle it, then renormalize the resulting type name for RNTuple.
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...
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleStructure
The fields in the ntuple model tree can carry different structural information about the type system.
std::size_t fOffset
offset in fStagingArea
Definition RField.hxx:128
std::unique_ptr< RFieldBase > fField
The field used to read the on-disk data.
Definition RField.hxx:127
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().
Helper types to present an offset column as array of collection sizes.