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 ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2018-10-09
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#ifndef ROOT7_RField
17#define ROOT7_RField
18
19#include <ROOT/RError.hxx>
20#include <ROOT/RFieldBase.hxx>
22#include <ROOT/RNTupleUtil.hxx>
23#include <ROOT/RSpan.hxx>
24#include <string_view>
25#include <ROOT/TypeTraits.hxx>
26
27#include <TGenericClassInfo.h>
28
29#include <algorithm>
30#include <array>
31#include <cstddef>
32#include <iostream>
33#include <memory>
34#include <string>
35#include <type_traits>
36#include <typeinfo>
37#include <vector>
38
39class TClass;
40class TEnum;
41class TObject;
43
44namespace ROOT {
45
46class TSchemaRule;
47
48namespace Experimental {
49
50class REntry;
51
52namespace Detail {
53class RFieldVisitor;
54} // namespace Detail
55
56/// The container field for an ntuple model, which itself has no physical representation.
57/// Therefore, the zero field must not be connected to a page source or sink.
58class RFieldZero final : public RFieldBase {
59protected:
60 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
61 void ConstructValue(void *) const final {}
62
63public:
64 RFieldZero() : RFieldBase("", "", ENTupleStructure::kRecord, false /* isSimple */) {}
65
67 size_t GetValueSize() const final { return 0; }
68 size_t GetAlignment() const final { return 0; }
69
70 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
71};
72
73/// Used in RFieldBase::Check() to record field creation failures.
74/// Also used when deserializing a field that contains unknown values that may come from
75/// future RNTuple versions (e.g. an unknown Structure)
76class RInvalidField final : public RFieldBase {
77 std::string fError;
78
79protected:
80 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final
81 {
82 return std::make_unique<RInvalidField>(newName, GetTypeName(), fError);
83 }
84 void ConstructValue(void *) const final {}
85
86public:
87 RInvalidField(std::string_view name, std::string_view type, std::string_view error)
88 : RFieldBase(name, type, ENTupleStructure::kLeaf, false /* isSimple */), fError(error)
89 {
90 }
91
92 const std::string &GetError() const { return fError; }
93
94 size_t GetValueSize() const final { return 0; }
95 size_t GetAlignment() const final { return 0; }
96}; // RInvalidField
97
98/// The field for a class with dictionary
99class RClassField : public RFieldBase {
100private:
104 };
107 std::size_t fOffset;
108 };
109 /// Prefix used in the subfield names generated for base classes
110 static constexpr const char *kPrefixInherited{":"};
111
112 class RClassDeleter : public RDeleter {
113 private:
115
116 public:
117 explicit RClassDeleter(TClass *cl) : fClass(cl) {}
118 void operator()(void *objPtr, bool dtorOnly) final;
119 };
120
122 /// Additional information kept for each entry in `fSubFields`
123 std::vector<RSubFieldInfo> fSubFieldsInfo;
124 std::size_t fMaxAlignment = 1;
125
126private:
127 RClassField(std::string_view fieldName, const RClassField &source); ///< Used by CloneImpl
128 RClassField(std::string_view fieldName, std::string_view className, TClass *classp);
129 void Attach(std::unique_ptr<RFieldBase> child, RSubFieldInfo info);
130 /// Register post-read callbacks corresponding to a list of ROOT I/O customization rules. `classp` is used to
131 /// fill the `TVirtualObject` instance passed to the user function.
132 void AddReadCallbacksFromIORules(const std::span<const TSchemaRule *> rules, TClass *classp = nullptr);
133
134protected:
135 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
136
137 void ConstructValue(void *where) const final;
138 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RClassDeleter>(fClass); }
139
140 std::size_t AppendImpl(const void *from) final;
141 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
142 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final;
143 void OnConnectPageSource() final;
144
145public:
146 RClassField(std::string_view fieldName, std::string_view className);
147 RClassField(RClassField &&other) = default;
148 RClassField &operator=(RClassField &&other) = default;
149 ~RClassField() override = default;
150
151 std::vector<RValue> SplitValue(const RValue &value) const final;
152 size_t GetValueSize() const final;
153 size_t GetAlignment() const final { return fMaxAlignment; }
154 std::uint32_t GetTypeVersion() const final;
155 std::uint32_t GetTypeChecksum() const final;
156 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
157};
158
159/// The field for a class using ROOT standard streaming
160class RStreamerField final : public RFieldBase {
161private:
163 private:
165
166 public:
167 explicit RStreamerFieldDeleter(TClass *cl) : fClass(cl) {}
168 void operator()(void *objPtr, bool dtorOnly) final;
169 };
170
171 TClass *fClass = nullptr;
172 Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos; ///< streamer info records seen during writing
173 ClusterSize_t fIndex; ///< number of bytes written in the current cluster
174
175private:
176 // Note that className may be different from classp->GetName(), e.g. through different canonicalization of RNTuple
177 // vs. TClass. Also, classp may be nullptr for types unsupported by the ROOT I/O.
178 RStreamerField(std::string_view fieldName, std::string_view className, TClass *classp);
179
180protected:
181 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
182
184 void GenerateColumns() final;
185 void GenerateColumns(const RNTupleDescriptor &) final;
186
187 void ConstructValue(void *where) const final;
188 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RStreamerFieldDeleter>(fClass); }
189
190 std::size_t AppendImpl(const void *from) final;
191 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
192
193 void CommitClusterImpl() final { fIndex = 0; }
194
195 bool HasExtraTypeInfo() const final { return true; }
196 // Returns the list of seen streamer infos
198
199public:
200 RStreamerField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
201 RStreamerField(RStreamerField &&other) = default;
202 RStreamerField &operator=(RStreamerField &&other) = default;
203 ~RStreamerField() final = default;
204
205 size_t GetValueSize() const final;
206 size_t GetAlignment() const final;
207 std::uint32_t GetTypeVersion() const final;
208 std::uint32_t GetTypeChecksum() const final;
209 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
210};
211
212/// The field for an unscoped or scoped enum with dictionary
213class REnumField : public RFieldBase {
214private:
215 REnumField(std::string_view fieldName, std::string_view enumName, TEnum *enump);
216 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
217
218protected:
219 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
220
221 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubFields[0], where); }
222
223 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubFields[0], from); }
224 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final { CallReadOn(*fSubFields[0], globalIndex, to); }
225 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final { CallReadOn(*fSubFields[0], clusterIndex, to); }
226
227public:
228 REnumField(std::string_view fieldName, std::string_view enumName);
229 REnumField(REnumField &&other) = default;
230 REnumField &operator=(REnumField &&other) = default;
231 ~REnumField() override = default;
232
233 std::vector<RValue> SplitValue(const RValue &value) const final;
234 size_t GetValueSize() const final { return fSubFields[0]->GetValueSize(); }
235 size_t GetAlignment() const final { return fSubFields[0]->GetAlignment(); }
236 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
237};
238
239/// Classes with dictionaries that can be inspected by TClass
240template <typename T, typename = void>
241class RField final : public RClassField {
242public:
243 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
244 RField(std::string_view name) : RClassField(name, TypeName())
245 {
246 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
247 }
248 RField(RField &&other) = default;
249 RField &operator=(RField &&other) = default;
250 ~RField() final = default;
251};
252
253template <typename T>
254class RField<T, typename std::enable_if<std::is_enum_v<T>>::type> final : public REnumField {
255public:
256 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
257 RField(std::string_view name) : REnumField(name, TypeName()) {}
258 RField(RField &&other) = default;
259 RField &operator=(RField &&other) = default;
260 ~RField() final = default;
261};
262
263/// An artificial field that transforms an RNTuple column that contains the offset of collections into
264/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
265/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
266/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
267/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
269 friend class RNTupleCollectionView; // to access GetCollectionInfo()
270
271private:
272 void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
273 {
274 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
275 }
276 void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
277 {
278 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
279 }
280
281protected:
282 RCardinalityField(std::string_view fieldName, std::string_view typeName)
283 : RFieldBase(fieldName, typeName, ENTupleStructure::kLeaf, false /* isSimple */)
284 {
285 }
286
287 const RColumnRepresentations &GetColumnRepresentations() const final;
288 // Field is only used for reading
289 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
290 void GenerateColumns(const RNTupleDescriptor &) final;
291
292public:
295 ~RCardinalityField() override = default;
296
297 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
298
299 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
300 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
301};
302
303template <typename T>
304class RSimpleField : public RFieldBase {
305protected:
306 void GenerateColumns() override { GenerateColumnsImpl<T>(); }
307 void GenerateColumns(const RNTupleDescriptor &desc) override { GenerateColumnsImpl<T>(desc); }
308
309 void ConstructValue(void *where) const final { new (where) T{0}; }
310
311public:
312 RSimpleField(std::string_view name, std::string_view type)
313 : RFieldBase(name, type, ENTupleStructure::kLeaf, true /* isSimple */)
314 {
315 fTraits |= kTraitTrivialType;
316 }
317 RSimpleField(RSimpleField &&other) = default;
319 ~RSimpleField() override = default;
320
321 T *Map(NTupleSize_t globalIndex) { return fPrincipalColumn->Map<T>(globalIndex); }
322 T *Map(RClusterIndex clusterIndex) { return fPrincipalColumn->Map<T>(clusterIndex); }
323 T *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) { return fPrincipalColumn->MapV<T>(globalIndex, nItems); }
324 T *MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems) { return fPrincipalColumn->MapV<T>(clusterIndex, nItems); }
325
326 size_t GetValueSize() const final { return sizeof(T); }
327 size_t GetAlignment() const final { return alignof(T); }
328};
329
330////////////////////////////////////////////////////////////////////////////////
331/// Template specializations for concrete C++ types
332////////////////////////////////////////////////////////////////////////////////
333
334} // namespace Experimental
335} // namespace ROOT
336
342
343namespace ROOT {
344namespace Experimental {
345
346template <typename SizeT>
347class RField<RNTupleCardinality<SizeT>> final : public RCardinalityField {
348protected:
349 std::unique_ptr<ROOT::Experimental::RFieldBase> CloneImpl(std::string_view newName) const final
350 {
351 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
352 }
353 void ConstructValue(void *where) const final { new (where) RNTupleCardinality<SizeT>(0); }
354
355public:
356 static std::string TypeName() { return "ROOT::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
357 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
358 RField(RField &&other) = default;
359 RField &operator=(RField &&other) = default;
360 ~RField() final = default;
361
362 size_t GetValueSize() const final { return sizeof(RNTupleCardinality<SizeT>); }
363 size_t GetAlignment() const final { return alignof(RNTupleCardinality<SizeT>); }
364
365 /// Get the number of elements of the collection identified by globalIndex
366 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
367 {
368 RClusterIndex collectionStart;
370 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &size);
371 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
372 }
373
374 /// Get the number of elements of the collection identified by clusterIndex
375 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
376 {
377 RClusterIndex collectionStart;
379 fPrincipalColumn->GetCollectionInfo(clusterIndex, &collectionStart, &size);
380 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
381 }
382
383 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
384 {
385 RClusterIndex collectionStart;
386 ClusterSize_t collectionSize;
387 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
388
389 auto typedValues = static_cast<RNTupleCardinality<SizeT> *>(bulkSpec.fValues);
390 typedValues[0] = collectionSize;
391
392 auto lastOffset = collectionStart.GetIndex() + collectionSize;
393 ClusterSize_t::ValueType nRemainingEntries = bulkSpec.fCount - 1;
394 std::size_t nEntries = 1;
395 while (nRemainingEntries > 0) {
396 NTupleSize_t nItemsUntilPageEnd;
397 auto offsets = fPrincipalColumn->MapV<ClusterSize_t>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
398 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
399 for (std::size_t i = 0; i < nBatch; ++i) {
400 typedValues[nEntries + i] = offsets[i] - lastOffset;
401 lastOffset = offsets[i];
402 }
403 nRemainingEntries -= nBatch;
404 nEntries += nBatch;
405 }
406 return RBulkSpec::kAllSet;
407 }
408};
409
410/// TObject requires special handling of the fBits and fUniqueID members
411template <>
412class RField<TObject> final : public RFieldBase {
413 static std::size_t GetOffsetOfMember(const char *name);
414 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
415 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
416
417private:
418 RField(std::string_view fieldName, const RField<TObject> &source); ///< Used by CloneImpl()
419
420protected:
421 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
422
423 void ConstructValue(void *where) const final;
424 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
425
426 std::size_t AppendImpl(const void *from) final;
427 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
428
429 void OnConnectPageSource() final;
430
431public:
432 static std::string TypeName() { return "TObject"; }
433
434 RField(std::string_view fieldName);
435 RField(RField &&other) = default;
436 RField &operator=(RField &&other) = default;
437 ~RField() final = default;
438
439 std::vector<RValue> SplitValue(const RValue &value) const final;
440 size_t GetValueSize() const final;
441 size_t GetAlignment() const final;
442 std::uint32_t GetTypeVersion() const final;
443 std::uint32_t GetTypeChecksum() const final;
444 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
445};
446
447// Has to be implemented after the definition of all RField<T> types
448// The void type is specialized in RField.cxx
449
450template <typename T>
451std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
452{
453 if (GetTypeName() != RField<T>::TypeName()) {
454 throw RException(
455 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
456 }
457 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
458}
459
460template <>
463 void operator()(void *);
464};
465
466template <>
467std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
468ROOT::Experimental::RFieldBase::CreateObject<void>() const;
469
470} // namespace Experimental
471} // namespace ROOT
472
473#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:290
ROOT::Experimental::RField< T > RField
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t child
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char name[80]
Definition TGX11.cxx:110
TRObject operator()(const T1 &t1) const
Binding & operator=(OUT(*fun)(void))
Abstract base class for classes implementing the visitor design pattern.
std::map< Int_t, TVirtualStreamerInfo * > StreamerInfoMap_t
An artificial field that transforms an RNTuple column that contains the offset of collections into co...
Definition RField.hxx:268
RCardinalityField & operator=(RCardinalityField &&other)=default
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Definition RField.hxx:276
RCardinalityField(RCardinalityField &&other)=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:282
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Definition RField.hxx:272
void operator()(void *objPtr, bool dtorOnly) final
The field for a class with dictionary.
Definition RField.hxx:99
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
Definition RField.hxx:110
void Attach(std::unique_ptr< RFieldBase > child, RSubFieldInfo info)
void OnConnectPageSource() final
Called by ConnectPageSource() once connected; derived classes may override this as appropriate.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
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.
void AddReadCallbacksFromIORules(const std::span< const TSchemaRule * > rules, TClass *classp=nullptr)
Register post-read callbacks corresponding to a list of ROOT I/O customization rules.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:153
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
std::vector< RSubFieldInfo > fSubFieldsInfo
Additional information kept for each entry in fSubFields
Definition RField.hxx:123
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:138
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
ClusterSize_t::ValueType GetIndex() const
The field for an unscoped or scoped enum with dictionary.
Definition RField.hxx:213
~REnumField() override=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:234
REnumField & operator=(REnumField &&other)=default
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Definition RField.hxx:225
REnumField(REnumField &&other)=default
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:235
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:223
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:224
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:221
Base class for all ROOT issued exceptions.
Definition RError.hxx:78
Field specific extra type information from the header / extenstion header.
Some fields have multiple possible column representations, e.g.
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.
virtual void GenerateColumns()
Implementations in derived classes should create the backing columns corresponsing to the field type ...
void Attach(std::unique_ptr< RFieldBase > child)
Add a new subfield to the list of nested fields.
const std::string & GetTypeName() const
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append and Read on other (sub) fields.
virtual RExtraTypeInfoDescriptor GetExtraTypeInfo() const
static void CallReadOn(RFieldBase &other, RClusterIndex clusterIndex, void *to)
static void CallConstructValueOn(const RFieldBase &other, void *where)
Allow derived classes to call ConstructValue(void *) and GetDeleter on other (sub) fields.
std::vector< std::unique_ptr< RFieldBase > > fSubFields
Collections and classes own sub fields.
virtual const RColumnRepresentations & GetColumnRepresentations() const
Implementations in derived classes should return a static RColumnRepresentations object.
The container field for an ntuple model, which itself has no physical representation.
Definition RField.hxx:58
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
Definition RField.cxx:43
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:68
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:35
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:67
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:61
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
Definition RField.hxx:383
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:353
std::unique_ptr< ROOT::Experimental::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:349
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:375
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
Definition RField.hxx:366
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:363
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:424
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:414
RField(RField &&other)=default
static std::size_t GetOffsetBits()
Definition RField.hxx:415
RField & operator=(RField &&other)=default
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:241
RField(std::string_view name)
Definition RField.hxx:244
RField & operator=(RField &&other)=default
RField(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:243
Used in RFieldBase::Check() to record field creation failures.
Definition RField.hxx:76
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:94
const std::string & GetError() const
Definition RField.hxx:92
RInvalidField(std::string_view name, std::string_view type, std::string_view error)
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:84
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:80
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:95
A view for a collection, that can itself generate new ntuple views for its nested fields.
The on-storage meta-data of an ntuple.
T * Map(RClusterIndex clusterIndex)
Definition RField.hxx:322
T * MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems)
Definition RField.hxx:324
RSimpleField & operator=(RSimpleField &&other)=default
T * Map(NTupleSize_t globalIndex)
Definition RField.hxx:321
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:309
void GenerateColumns(const RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:307
~RSimpleField() override=default
T * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
Definition RField.hxx:323
RSimpleField(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
Definition RField.hxx:312
void GenerateColumns() override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:306
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:327
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:326
The field for a class using ROOT standard streaming.
Definition RField.hxx:160
ClusterSize_t fIndex
number of bytes written in the current cluster
Definition RField.hxx:173
bool HasExtraTypeInfo() const final
Definition RField.hxx:195
Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:172
TClass instances represent classes, structs and namespaces in the ROOT type system.
Definition TClass.h:81
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::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::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...
Wrap the integer in a struct in order to avoid template specialization clash with std::uint64_t.
Helper types to present an offset column as array of collection sizes.