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
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-09
5
6/*************************************************************************
7 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
8 * All rights reserved. *
9 * *
10 * For the licensing terms see $ROOTSYS/LICENSE. *
11 * For the list of contributors see $ROOTSYS/README/CREDITS. *
12 *************************************************************************/
13
14#ifndef ROOT_RField
15#define ROOT_RField
16
17#include <ROOT/RError.hxx>
18#include <ROOT/RFieldBase.hxx>
19#include <ROOT/RFieldUtils.hxx>
21#include <ROOT/RNTupleUtil.hxx>
22#include <ROOT/RSpan.hxx>
23#include <string_view>
24#include <ROOT/TypeTraits.hxx>
25
26#include <TGenericClassInfo.h>
27
28#include <algorithm>
29#include <array>
30#include <cstddef>
31#include <iostream>
32#include <memory>
33#include <string>
34#include <type_traits>
35#include <typeinfo>
36#include <vector>
37
38class TClass;
39class TEnum;
40class TObject;
42
43namespace ROOT {
44
45class TSchemaRule;
46class RNTupleCollectionView;
47
48namespace Detail {
49class RFieldVisitor;
50} // namespace Detail
51
52/// The container field for an ntuple model, which itself has no physical representation.
53/// Therefore, the zero field must not be connected to a page source or sink.
54class RFieldZero final : public RFieldBase {
55protected:
56 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
57 void ConstructValue(void *) const final {}
58
59public:
60 RFieldZero() : RFieldBase("", "", ROOT::ENTupleStructure::kRecord, false /* isSimple */) {}
61
63 size_t GetValueSize() const final { return 0; }
64 size_t GetAlignment() const final { return 0; }
65
67};
68
69/// Used in RFieldBase::Check() to record field creation failures.
70/// Also used when deserializing a field that contains unknown values that may come from
71/// future RNTuple versions (e.g. an unknown Structure)
73public:
74 enum class RCategory {
75 /// Generic unrecoverable error
77 /// The type given to RFieldBase::Create was invalid
79 /// The type given to RFieldBase::Create was unknown
81 /// The field could not be created because its descriptor had an unknown structural role
83 };
84
85private:
86 std::string fError;
88
89protected:
90 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final
91 {
92 return std::make_unique<RInvalidField>(newName, GetTypeName(), fError, fCategory);
93 }
94 void ConstructValue(void *) const final {}
95
96public:
97 RInvalidField(std::string_view name, std::string_view type, std::string_view error, RCategory category)
99 {
101 }
102
103 const std::string &GetError() const { return fError; }
104 RCategory GetCategory() const { return fCategory; }
105
106 size_t GetValueSize() const final { return 0; }
107 size_t GetAlignment() const final { return 0; }
108}; // RInvalidField
109
110/// The field for a class with dictionary
111class RClassField : public RFieldBase {
112private:
119 std::size_t fOffset;
120 };
121 // Information to read into the staging area a field that is used as an input to an I/O customization rule
123 /// The field used to read the on-disk data. The fields type may be different from the on-disk type as long
124 /// as the on-disk type can be converted to the fields type (through type cast / schema evolution).
125 std::unique_ptr<RFieldBase> fField;
126 std::size_t fOffset; ///< offset in fStagingArea
127 };
128 /// Prefix used in the subfield names generated for base classes
129 static constexpr const char *kPrefixInherited{":"};
130
131 class RClassDeleter : public RDeleter {
132 private:
134
135 public:
136 explicit RClassDeleter(TClass *cl) : fClass(cl) {}
137 void operator()(void *objPtr, bool dtorOnly) final;
138 };
139
141 /// Additional information kept for each entry in `fSubfields`
142 std::vector<RSubFieldInfo> fSubfieldsInfo;
143 std::size_t fMaxAlignment = 1;
144
145 /// The staging area stores inputs to I/O rules according to the offsets given by the streamer info of
146 /// "TypeName@@Version". The area is allocated depending on I/O rules resp. the source members of the I/O rules.
147 std::unique_ptr<unsigned char[]> fStagingArea;
148 /// The TClass instance that corresponds to the staging area.
149 /// The staging class exists as <class name>@@<on-disk version> if the on-disk version is different from the
150 /// current in-memory version, or it can be accessed by the first @@alloc streamer element of the current streamer
151 /// info.
153 std::unordered_map<std::string, RStagingItem> fStagingItems; ///< Lookup staging items by member name
154
155private:
156 RClassField(std::string_view fieldName, const RClassField &source); ///< Used by CloneImpl
157 RClassField(std::string_view fieldName, TClass *classp);
158 void Attach(std::unique_ptr<RFieldBase> child, RSubFieldInfo info);
159
160 /// Returns the id of member 'name' in the class field given by 'fieldId', or kInvalidDescriptorId if no such
161 /// member exist. Looks recursively in base classes.
164 /// Sets fStagingClass according to the given name and version
165 void SetStagingClass(const std::string &className, unsigned int classVersion);
166 /// If there are rules with inputs (source members), create the staging area according to the TClass instance
167 /// that corresponds to the on-disk field.
168 void PrepareStagingArea(const std::vector<const TSchemaRule *> &rules, const ROOT::RNTupleDescriptor &desc,
170 /// Register post-read callback corresponding to a ROOT I/O customization rules.
172 /// Given the on-disk information from the page source, find all the I/O customization rules that apply
173 /// to the class field at hand, to which the fieldDesc descriptor, if provided, must correspond.
174 /// Fields may not have an on-disk representation (e.g., when inserted by schema evolution), in which case the passed
175 /// field descriptor is nullptr.
176 std::vector<const TSchemaRule *> FindRules(const ROOT::RFieldDescriptor *fieldDesc);
177
178protected:
179 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
180
181 void ConstructValue(void *where) const final;
182 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RClassDeleter>(fClass); }
183
184 std::size_t AppendImpl(const void *from) final;
185 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
186 void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final;
188
189public:
190 RClassField(std::string_view fieldName, std::string_view className);
193 ~RClassField() override = default;
194
195 std::vector<RValue> SplitValue(const RValue &value) const final;
196 size_t GetValueSize() const final;
198 std::uint32_t GetTypeVersion() const final;
199 std::uint32_t GetTypeChecksum() const final;
201};
202
203/// The field for a class using ROOT standard streaming
205private:
207 private:
209
210 public:
211 explicit RStreamerFieldDeleter(TClass *cl) : fClass(cl) {}
212 void operator()(void *objPtr, bool dtorOnly) final;
213 };
214
215 TClass *fClass = nullptr;
216 ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos; ///< streamer info records seen during writing
217 ROOT::Internal::RColumnIndex fIndex; ///< number of bytes written in the current cluster
218
219private:
220 RStreamerField(std::string_view fieldName, TClass *classp);
221
222protected:
223 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
224
226 void GenerateColumns() final;
228
229 void ConstructValue(void *where) const final;
230 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RStreamerFieldDeleter>(fClass); }
231
232 std::size_t AppendImpl(const void *from) final;
233 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
234
235 void CommitClusterImpl() final { fIndex = 0; }
236
237 bool HasExtraTypeInfo() const final { return true; }
238 // Returns the list of seen streamer infos
240
241public:
242 RStreamerField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
246
247 size_t GetValueSize() const final;
248 size_t GetAlignment() const final;
249 std::uint32_t GetTypeVersion() const final;
250 std::uint32_t GetTypeChecksum() const final;
252};
253
254/// The field for an unscoped or scoped enum with dictionary
256private:
257 REnumField(std::string_view fieldName, TEnum *enump);
258 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
259
260protected:
261 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
262
263 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubfields[0], where); }
264
265 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubfields[0], from); }
268
269public:
270 REnumField(std::string_view fieldName, std::string_view enumName);
273 ~REnumField() override = default;
274
275 std::vector<RValue> SplitValue(const RValue &value) const final;
276 size_t GetValueSize() const final { return fSubfields[0]->GetValueSize(); }
277 size_t GetAlignment() const final { return fSubfields[0]->GetAlignment(); }
279};
280
281/// Classes with dictionaries that can be inspected by TClass
282template <typename T, typename = void>
283class RField final : public RClassField {
284public:
285 static std::string TypeName() { return ROOT::Internal::GetRenormalizedDemangledTypeName(typeid(T)); }
286 RField(std::string_view name) : RClassField(name, TypeName())
287 {
288 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
289 }
290 RField(RField &&other) = default;
293};
294
297public:
298 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
299 RField(std::string_view name) : REnumField(name, TypeName()) {}
300 RField(RField &&other) = default;
301 RField &operator=(RField &&other) = default;
302 ~RField() final = default;
303};
304
305/// An artificial field that transforms an RNTuple column that contains the offset of collections into
306/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
307/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
308/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
309/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
311 friend class ROOT::RNTupleCollectionView; // to access GetCollectionInfo()
312
313private:
322
323protected:
324 RCardinalityField(std::string_view fieldName, std::string_view typeName)
325 : RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kLeaf, false /* isSimple */)
326 {
327 }
328
329 const RColumnRepresentations &GetColumnRepresentations() const final;
330 // Field is only used for reading
331 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
332 void GenerateColumns(const ROOT::RNTupleDescriptor &) final;
333
334public:
337 ~RCardinalityField() override = default;
338
339 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
340
341 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
342 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
343};
344
345template <typename T>
346class RSimpleField : public RFieldBase {
347protected:
350
351 void ConstructValue(void *where) const final { new (where) T{0}; }
352
353public:
354 RSimpleField(std::string_view name, std::string_view type)
355 : RFieldBase(name, type, ROOT::ENTupleStructure::kLeaf, true /* isSimple */)
356 {
357 fTraits |= kTraitTrivialType;
358 }
361 ~RSimpleField() override = default;
362
363 T *Map(ROOT::NTupleSize_t globalIndex) { return fPrincipalColumn->Map<T>(globalIndex); }
364 T *Map(RNTupleLocalIndex localIndex) { return fPrincipalColumn->Map<T>(localIndex); }
366 {
367 return fPrincipalColumn->MapV<T>(globalIndex, nItems);
368 }
370 {
371 return fPrincipalColumn->MapV<T>(localIndex, nItems);
372 }
373
374 size_t GetValueSize() const final { return sizeof(T); }
375 size_t GetAlignment() const final { return alignof(T); }
376};
377
378////////////////////////////////////////////////////////////////////////////////
379/// Template specializations for concrete C++ types
380////////////////////////////////////////////////////////////////////////////////
381
382} // namespace ROOT
383
389
390namespace ROOT {
391
392template <typename SizeT>
394protected:
395 std::unique_ptr<ROOT::RFieldBase> CloneImpl(std::string_view newName) const final
396 {
397 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
398 }
399 void ConstructValue(void *where) const final { new (where) RNTupleCardinality<SizeT>(0); }
400
401 /// Get the number of elements of the collection identified by globalIndex
403 {
406 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &size);
407 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
408 }
409
410 /// Get the number of elements of the collection identified by clusterIndex
412 {
415 fPrincipalColumn->GetCollectionInfo(localIndex, &collectionStart, &size);
416 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
417 }
418
419 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
420 {
423 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
424
425 auto typedValues = static_cast<RNTupleCardinality<SizeT> *>(bulkSpec.fValues);
427
428 auto lastOffset = collectionStart.GetIndexInCluster() + collectionSize;
430 std::size_t nEntries = 1;
431 while (nRemainingEntries > 0) {
433 auto offsets =
434 fPrincipalColumn->MapV<ROOT::Internal::RColumnIndex>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
435 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
436 for (std::size_t i = 0; i < nBatch; ++i) {
437 typedValues[nEntries + i] = offsets[i] - lastOffset;
438 lastOffset = offsets[i];
439 }
441 nEntries += nBatch;
442 }
443 return RBulkSpec::kAllSet;
444 }
445
446public:
447 static std::string TypeName() { return "ROOT::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
448 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
449 RField(RField &&other) = default;
452
453 size_t GetValueSize() const final { return sizeof(RNTupleCardinality<SizeT>); }
454 size_t GetAlignment() const final { return alignof(RNTupleCardinality<SizeT>); }
455};
456
457/// TObject requires special handling of the fBits and fUniqueID members
458template <>
460 static std::size_t GetOffsetOfMember(const char *name);
461 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
462 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
463
464private:
465 RField(std::string_view fieldName, const RField<TObject> &source); ///< Used by CloneImpl()
466
467protected:
468 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
469
470 void ConstructValue(void *where) const final;
471 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
472
473 std::size_t AppendImpl(const void *from) final;
474 void ReadTObject(void *to, UInt_t uniqueID, UInt_t bits);
475 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
476 void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final;
477
478 void AfterConnectPageSource() final;
479
480public:
481 static std::string TypeName() { return "TObject"; }
482
483 RField(std::string_view fieldName);
484 RField(RField &&other) = default;
487
488 std::vector<RValue> SplitValue(const RValue &value) const final;
489 size_t GetValueSize() const final;
490 size_t GetAlignment() const final;
491 std::uint32_t GetTypeVersion() const final;
492 std::uint32_t GetTypeChecksum() const final;
493 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
494};
495
496// Has to be implemented after the definition of all RField<T> types
497// The void type is specialized in RField.cxx
498
500std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
501{
502 if (GetTypeName() != RField<T>::TypeName()) {
503 throw RException(
504 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
505 }
506 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
507}
508
509template <>
514
515template <>
516std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
517ROOT::RFieldBase::CreateObject<void>() const;
518
519} // namespace ROOT
520
521#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
unsigned int UInt_t
Definition RtypesCore.h:46
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
void operator=(const TProof &)
TRObject operator()(const T1 &t1) const
Abstract base class for classes implementing the visitor design pattern.
The in-memory representation of a 32bit or 64bit on-disk index column.
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
Abstract interface to read data from an ntuple.
An artificial field that transforms an RNTuple column that contains the offset of collections into co...
Definition RField.hxx:310
RCardinalityField(RCardinalityField &&other)=default
void GetCollectionInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:314
RCardinalityField & operator=(RCardinalityField &&other)=default
void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:318
~RCardinalityField() override=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:324
void operator()(void *objPtr, bool dtorOnly) final
The field for a class with dictionary.
Definition RField.hxx:111
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:152
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:142
std::size_t fMaxAlignment
Definition RField.hxx:143
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:147
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:197
~RClassField() override=default
RClassField & operator=(RClassField &&other)=default
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:140
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:182
std::unordered_map< std::string, RStagingItem > fStagingItems
Lookup staging items by member name.
Definition RField.hxx:153
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
Definition RField.hxx:129
void SetStagingClass(const std::string &className, unsigned int classVersion)
Sets fStagingClass according to the given name and version.
void BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate.
The field for an unscoped or scoped enum with dictionary.
Definition RField.hxx:255
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:276
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:277
~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:263
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.hxx:267
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:266
REnumField & operator=(REnumField &&other)=default
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:265
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:54
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:40
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:63
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:57
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:32
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:64
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
Definition RField.hxx:402
RField & operator=(RField &&other)=default
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
Definition RField.hxx:419
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:399
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:411
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:395
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:454
RField(RField &&other)=default
RField & operator=(RField &&other)=default
~RField() final=default
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:471
static std::size_t GetOffsetBits()
Definition RField.hxx:462
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:461
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:283
~RField() final=default
RField(RField &&other)=default
RField & operator=(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:285
RField(std::string_view name)
Definition RField.hxx:286
Used in RFieldBase::Check() to record field creation failures.
Definition RField.hxx:72
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:90
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:107
@ 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:86
RCategory GetCategory() const
Definition RField.hxx:104
const std::string & GetError() const
Definition RField.hxx:103
RInvalidField(std::string_view name, std::string_view type, std::string_view error, RCategory category)
Definition RField.hxx:97
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:106
RCategory fCategory
Definition RField.hxx:87
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:94
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:348
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:375
RSimpleField & operator=(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
Definition RField.hxx:354
T * Map(RNTupleLocalIndex localIndex)
Definition RField.hxx:364
~RSimpleField() override=default
T * Map(ROOT::NTupleSize_t globalIndex)
Definition RField.hxx:363
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:374
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:351
T * MapV(ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:365
void GenerateColumns(const ROOT::RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.hxx:349
T * MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:369
The field for a class using ROOT standard streaming.
Definition RField.hxx:204
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:216
ROOT::Internal::RColumnIndex fIndex
number of bytes written in the current cluster
Definition RField.hxx:217
bool HasExtraTypeInfo() const final
Definition RField.hxx:237
void CommitClusterImpl() final
Definition RField.hxx:235
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:126
std::unique_ptr< RFieldBase > fField
The field used to read the on-disk data.
Definition RField.hxx:125
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().
Helper types to present an offset column as array of collection sizes.