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/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;
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;
200 /// Return the TClass instance backing this field.
201 const TClass *GetClass() const { return fClass; }
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
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;
255 TClass *GetClass() const { return fClass; }
257};
258
259/// The field for an unscoped or scoped enum with dictionary
260class REnumField : public RFieldBase {
261private:
262 REnumField(std::string_view fieldName, TEnum *enump);
263 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
264
265protected:
266 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
267
268 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubfields[0], where); }
269
270 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubfields[0], from); }
273
274public:
275 REnumField(std::string_view fieldName, std::string_view enumName);
278 ~REnumField() override = default;
279
280 std::vector<RValue> SplitValue(const RValue &value) const final;
281 size_t GetValueSize() const final { return fSubfields[0]->GetValueSize(); }
282 size_t GetAlignment() const final { return fSubfields[0]->GetAlignment(); }
284};
285
286/// Classes with dictionaries that can be inspected by TClass
287template <typename T, typename = void>
288class RField final : public RClassField {
289public:
290 static std::string TypeName() { return ROOT::Internal::GetRenormalizedDemangledTypeName(typeid(T)); }
291 RField(std::string_view name) : RClassField(name, Internal::GetDemangledTypeName(typeid(T)))
292 {
293 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
294 }
295 RField(RField &&other) = default;
298};
299
302public:
303 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
304 RField(std::string_view name) : REnumField(name, TypeName()) {}
305 RField(RField &&other) = default;
306 RField &operator=(RField &&other) = default;
307 ~RField() final = default;
308};
309
310/// An artificial field that transforms an RNTuple column that contains the offset of collections into
311/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
312/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
313/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
314/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
316 friend class ROOT::RNTupleCollectionView; // to access GetCollectionInfo()
317
318private:
327
328protected:
329 RCardinalityField(std::string_view fieldName, std::string_view typeName)
330 : RFieldBase(fieldName, typeName, ROOT::ENTupleStructure::kLeaf, false /* isSimple */)
331 {
332 }
333
334 const RColumnRepresentations &GetColumnRepresentations() const final;
335 // Field is only used for reading
336 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
337 void GenerateColumns(const ROOT::RNTupleDescriptor &) final;
338
339public:
342 ~RCardinalityField() override = default;
343
344 void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final;
345
346 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
347 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
348};
349
350template <typename T>
351class RSimpleField : public RFieldBase {
352protected:
355
356 void ConstructValue(void *where) const final { new (where) T{0}; }
357
358public:
359 RSimpleField(std::string_view name, std::string_view type)
360 : RFieldBase(name, type, ROOT::ENTupleStructure::kLeaf, true /* isSimple */)
361 {
362 fTraits |= kTraitTrivialType;
363 }
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>
399protected:
400 std::unique_ptr<ROOT::RFieldBase> CloneImpl(std::string_view newName) const final
401 {
402 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
403 }
404 void ConstructValue(void *where) const final { new (where) RNTupleCardinality<SizeT>(0); }
405
406 /// Get the number of elements of the collection identified by globalIndex
414
415 /// Get the number of elements of the collection identified by clusterIndex
423
424 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
425 {
429
430 auto typedValues = static_cast<RNTupleCardinality<SizeT> *>(bulkSpec.fValues);
432
433 auto lastOffset = collectionStart.GetIndexInCluster() + collectionSize;
435 std::size_t nEntries = 1;
436 while (nRemainingEntries > 0) {
438 auto offsets =
440 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
441 for (std::size_t i = 0; i < nBatch; ++i) {
442 typedValues[nEntries + i] = offsets[i] - lastOffset;
443 lastOffset = offsets[i];
444 }
446 nEntries += nBatch;
447 }
448 return RBulkSpec::kAllSet;
449 }
450
451public:
452 static std::string TypeName() { return "ROOT::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
453 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
454 RField(RField &&other) = default;
457
459 size_t GetAlignment() const final { return alignof(RNTupleCardinality<SizeT>); }
460};
461
462/// TObject requires special handling of the fBits and fUniqueID members
463template <>
465 static std::size_t GetOffsetOfMember(const char *name);
466 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
467 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
468
469private:
470 RField(std::string_view fieldName, const RField<TObject> &source); ///< Used by CloneImpl()
471
472protected:
473 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
474
475 void ConstructValue(void *where) const final;
476 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
477
478 std::size_t AppendImpl(const void *from) final;
479 void ReadTObject(void *to, UInt_t uniqueID, UInt_t bits);
480 void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final;
481 void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final;
482
484
485public:
486 static std::string TypeName() { return "TObject"; }
487
488 RField(std::string_view fieldName);
489 RField(RField &&other) = default;
492
494 size_t GetValueSize() const final;
495 size_t GetAlignment() const final;
496 std::uint32_t GetTypeVersion() const final;
497 std::uint32_t GetTypeChecksum() const final;
499};
500
501// Has to be implemented after the definition of all RField<T> types
502// The void type is specialized in RField.cxx
503
505std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
506{
507 if (GetTypeName() != RField<T>::TypeName()) {
508 throw RException(
509 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
510 }
511 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
512}
513
514template <>
519
520template <>
521std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
522ROOT::RFieldBase::CreateObject<void>() const;
523
524} // namespace ROOT
525
526#endif
#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
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.
void GetCollectionInfo(const ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *collectionSize)
For offset columns only, look at the two adjacent values that define a collection's coordinates.
Definition RColumn.hxx:283
CppT * MapV(const ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
Definition RColumn.hxx:241
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:315
RCardinalityField(RCardinalityField &&other)=default
void GetCollectionInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:319
RCardinalityField & operator=(RCardinalityField &&other)=default
void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
Definition RField.hxx:323
~RCardinalityField() override=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:329
void operator()(void *objPtr, bool dtorOnly) final
The field for a class with dictionary.
Definition RField.hxx:111
const TClass * GetClass() const
Return the TClass instance backing this field.
Definition RField.hxx:201
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 & 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.
~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: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:260
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:281
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:282
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
~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:268
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Definition RField.hxx:272
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:271
REnumField & operator=(REnumField &&other)=default
REnumField(std::string_view fieldName, TEnum *enump)
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:270
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.
ROOT::Internal::RColumn * fPrincipalColumn
All fields that have columns have a distinct main column.
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.
std::unique_ptr< T, typename RCreateObjectDeleter< T >::deleter > CreateObject() const
Generates an object of the field type and allocates new initialized memory according to the type.
Definition RField.hxx:505
virtual void AfterConnectPageSource()
Called by ConnectPageSource() once connected; derived classes may override this as appropriate.
const std::string & GetFieldName() const
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.
void * CreateObjectRawPtr() const
Factory method for the field's type. The caller owns the returned pointer.
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:407
RField & operator=(RField &&other)=default
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
Definition RField.hxx:424
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:404
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:416
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:400
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:459
RField(RField &&other)=default
RField & operator=(RField &&other)=default
~RField() final=default
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:476
static std::size_t GetOffsetBits()
Definition RField.hxx:467
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:466
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:288
~RField() final=default
RField(RField &&other)=default
RField & operator=(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:290
RField(std::string_view name)
Definition RField.hxx:291
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:353
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:359
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:356
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:354
T * MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
Definition RField.hxx:374
void operator()(void *objPtr, bool dtorOnly) final
The field for a class using ROOT standard streaming.
Definition RField.hxx:206
ROOT::RExtraTypeInfoDescriptor GetExtraTypeInfo() const final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:218
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate.
ROOT::Internal::RColumnIndex fIndex
number of bytes written in the current cluster
Definition RField.hxx:219
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
bool HasExtraTypeInfo() const final
Definition RField.hxx:239
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
void CommitClusterImpl() final
Definition RField.hxx:237
RStreamerField(std::string_view fieldName, TClass *classp)
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:232
TClass * GetClass() const
Definition RField.hxx:255
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
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.