Logo ROOT  
Reference Guide
 
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/RNTupleTypes.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 ECategory {
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
85 using RCategory R__DEPRECATED(6, 42, "enum renamed to ECategory") = ECategory;
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, ECategory category)
101 {
103 }
104
105 const std::string &GetError() const { return fError; }
106 ECategory 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;
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;
218 ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos; ///< streamer info records seen during writing
219 ROOT::Internal::RColumnIndex fIndex; ///< number of bytes written in the current cluster
220
221private:
222 RStreamerField(std::string_view fieldName, TClass *classp);
223
224protected:
225 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
226
228 void GenerateColumns() final;
230
231 void ConstructValue(void *where) const final;
232 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RStreamerFieldDeleter>(fClass); }
233
234 std::size_t AppendImpl(const void *from) final;
235 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
236
237 void CommitClusterImpl() final { fIndex = 0; }
238
239 bool HasExtraTypeInfo() const final { return true; }
240 // Returns the list of seen streamer infos
242
244
245public:
246 RStreamerField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
250
251 size_t GetValueSize() const final;
252 size_t GetAlignment() const final;
253 std::uint32_t GetTypeVersion() const final;
254 std::uint32_t GetTypeChecksum() const final;
256};
257
258/// The field for an unscoped or scoped enum with dictionary
260private:
261 REnumField(std::string_view fieldName, TEnum *enump);
262 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
263
264protected:
265 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
266
267 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubfields[0], where); }
268
269 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubfields[0], from); }
272
273public:
274 REnumField(std::string_view fieldName, std::string_view enumName);
277 ~REnumField() override = default;
278
279 std::vector<RValue> SplitValue(const RValue &value) const final;
280 size_t GetValueSize() const final { return fSubfields[0]->GetValueSize(); }
281 size_t GetAlignment() const final { return fSubfields[0]->GetAlignment(); }
283};
284
285/// Classes with dictionaries that can be inspected by TClass
286template <typename T, typename = void>
287class RField final : public RClassField {
288public:
289 static std::string TypeName() { return ROOT::Internal::GetRenormalizedTypeName(typeid(T)); }
290 RField(std::string_view name) : RClassField(name, TypeName())
291 {
292 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
293 }
294 RField(RField &&other) = default;
297};
298
301public:
302 static std::string TypeName() { return ROOT::Internal::GetRenormalizedTypeName(typeid(T)); }
303 RField(std::string_view name) : REnumField(name, TypeName()) {}
304 RField(RField &&other) = default;
305 RField &operator=(RField &&other) = default;
306 ~RField() final = default;
307};
308
309/// An artificial field that transforms an RNTuple column that contains the offset of collections into
310/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
311/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
312/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
313/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
315 friend class ROOT::RNTupleCollectionView; // to access GetCollectionInfo()
316
317private:
326
327protected:
328 RCardinalityField(std::string_view fieldName, std::string_view typeName)
329 : RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kPlain, false /* isSimple */)
330 {
331 }
332
333 const RColumnRepresentations &GetColumnRepresentations() const final;
334 // Field is only used for reading
335 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
336 void GenerateColumns(const ROOT::RNTupleDescriptor &) final;
337
338public:
341 ~RCardinalityField() override = default;
342
343 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
344
345 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
346 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
347};
348
349template <typename T>
350class RSimpleField : public RFieldBase {
351protected:
354
355 void ConstructValue(void *where) const final { new (where) T{0}; }
356
357 RSimpleField(std::string_view name, std::string_view type)
358 : RFieldBase(name, type, ROOT::ENTupleStructure::kPlain, true /* isSimple */)
359 {
360 fTraits |= kTraitTrivialType;
361 }
362
363public:
366 ~RSimpleField() override = default;
367
368 T *Map(ROOT::NTupleSize_t globalIndex) { return fPrincipalColumn->Map<T>(globalIndex); }
369 T *Map(RNTupleLocalIndex localIndex) { return fPrincipalColumn->Map<T>(localIndex); }
371 {
372 return fPrincipalColumn->MapV<T>(globalIndex, nItems);
373 }
375 {
376 return fPrincipalColumn->MapV<T>(localIndex, nItems);
377 }
378
379 size_t GetValueSize() const final { return sizeof(T); }
380 size_t GetAlignment() const final { return alignof(T); }
381};
382
383////////////////////////////////////////////////////////////////////////////////
384/// Template specializations for concrete C++ types
385////////////////////////////////////////////////////////////////////////////////
386
387} // namespace ROOT
388
394
395namespace ROOT {
396
397template <typename SizeT>
400
401protected:
402 std::unique_ptr<ROOT::RFieldBase> CloneImpl(std::string_view newName) const final
403 {
404 return std::make_unique<RField>(newName);
405 }
406 void ConstructValue(void *where) const final { new (where) CardinalityType(0); }
407
408 /// Get the number of elements of the collection identified by globalIndex
410 {
413 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &size);
414 *static_cast<CardinalityType *>(to) = size;
415 }
416
417 /// Get the number of elements of the collection identified by clusterIndex
419 {
422 fPrincipalColumn->GetCollectionInfo(localIndex, &collectionStart, &size);
423 *static_cast<CardinalityType *>(to) = size;
424 }
425
426 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
427 {
430 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
431
432 auto typedValues = static_cast<CardinalityType *>(bulkSpec.fValues);
434
435 auto lastOffset = collectionStart.GetIndexInCluster() + collectionSize;
437 std::size_t nEntries = 1;
438 while (nRemainingEntries > 0) {
440 auto offsets =
441 fPrincipalColumn->MapV<ROOT::Internal::RColumnIndex>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
442 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
443 for (std::size_t i = 0; i < nBatch; ++i) {
444 typedValues[nEntries + i] = offsets[i] - lastOffset;
445 lastOffset = offsets[i];
446 }
448 nEntries += nBatch;
449 }
450 return RBulkSpec::kAllSet;
451 }
452
453public:
454 static std::string TypeName() { return "ROOT::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
455 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
456 RField(RField &&other) = default;
459
460 size_t GetValueSize() const final { return sizeof(CardinalityType); }
461 size_t GetAlignment() const final { return alignof(CardinalityType); }
462};
463
464/// TObject requires special handling of the fBits and fUniqueID members
465template <>
467 static std::size_t GetOffsetOfMember(const char *name);
468 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
469 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
470
471private:
472 RField(std::string_view fieldName, const RField<TObject> &source); ///< Used by CloneImpl()
473
474protected:
475 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
476
477 void ConstructValue(void *where) const final;
478 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
479
480 std::size_t AppendImpl(const void *from) final;
481 void ReadTObject(void *to, UInt_t uniqueID, UInt_t bits);
482 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
483 void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final;
484
485 void AfterConnectPageSource() final;
486
487public:
488 static std::string TypeName() { return "TObject"; }
489
490 RField(std::string_view fieldName);
491 RField(RField &&other) = default;
494
495 std::vector<RValue> SplitValue(const RValue &value) const final;
496 size_t GetValueSize() const final;
497 size_t GetAlignment() const final;
498 std::uint32_t GetTypeVersion() const final;
499 std::uint32_t GetTypeChecksum() const final;
500 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
501};
502
503// Have to be implemented after the definition of all RField<T> types
504
505namespace Internal {
506
507/// Helper to check if a given type name is the one expected of Field<T>. Usually, this check can be done by
508/// type renormalization of the demangled type name T. The failure case, however, needs to additionally check for
509/// ROOT-specific special cases.
510template <class T>
511bool IsMatchingFieldType(const std::string &actualTypeName)
512{
514}
515
516} // namespace Internal
517
518template <typename T>
519std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
520{
521 if (!Internal::IsMatchingFieldType<T>(GetTypeName())) {
522 throw RException(
523 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
524 }
525 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
526}
527
528// The void type is specialized in RField.cxx
529
530template <>
535
536template <>
537std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
538ROOT::RFieldBase::CreateObject<void>() const;
539
540} // namespace ROOT
541
542#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:300
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int)
Definition RtypesCore.h:60
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.
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:314
RCardinalityField(RCardinalityField &&other)=default
void GetCollectionInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:318
RCardinalityField & operator=(RCardinalityField &&other)=default
void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:322
~RCardinalityField() override=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:328
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 & 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: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.
~RClassField() override
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.
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:259
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:280
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:281
~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:267
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.hxx:271
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:270
REnumField & operator=(REnumField &&other)=default
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:269
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.
const std::string & GetTypeName() const
@ kTraitInvalidField
This field is an instance of RInvalidField and can be safely static_cast to it.
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:409
RField & operator=(RField &&other)=default
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
Definition RField.hxx:426
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:406
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:418
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:402
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:461
RField(RField &&other)=default
RField & operator=(RField &&other)=default
~RField() final=default
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:478
static std::size_t GetOffsetBits()
Definition RField.hxx:469
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:468
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:287
~RField() final=default
RField(RField &&other)=default
RField & operator=(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:289
RField(std::string_view name)
Definition RField.hxx:290
Used in RFieldBase::Check() to record field creation failures.
Definition RField.hxx:72
RInvalidField(std::string_view name, std::string_view type, std::string_view error, ECategory category)
Definition RField.hxx:99
@ 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::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:92
ECategory fCategory
Definition RField.hxx:89
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:109
std::string fError
Definition RField.hxx:88
const std::string & GetError() const
Definition RField.hxx:105
ECategory GetCategory() const
Definition RField.hxx:106
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:108
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:352
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:380
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:369
~RSimpleField() override=default
T * Map(ROOT::NTupleSize_t globalIndex)
Definition RField.hxx:368
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:379
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:355
T * MapV(ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:370
void GenerateColumns(const ROOT::RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponding to the field type ...
Definition RField.hxx:353
T * MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:374
The field for a class using ROOT standard streaming.
Definition RField.hxx:206
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:218
ROOT::Internal::RColumnIndex fIndex
number of bytes written in the current cluster
Definition RField.hxx:219
bool HasExtraTypeInfo() const final
Definition RField.hxx:239
void CommitClusterImpl() final
Definition RField.hxx:237
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.
bool IsMatchingFieldType(const std::string &actualTypeName)
Helper to check if a given type name is the one expected of Field<T>.
Definition RField.hxx:511
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
Namespace for new ROOT classes and functions.
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 RNTuple data model tree can carry different structural information about the type s...
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.