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 BeforeConnectPageSource(Internal::RPageSource &pageSource) final;
144 void OnConnectPageSource() final;
145
146public:
147 RClassField(std::string_view fieldName, std::string_view className);
148 RClassField(RClassField &&other) = default;
149 RClassField &operator=(RClassField &&other) = default;
150 ~RClassField() override = default;
151
152 std::vector<RValue> SplitValue(const RValue &value) const final;
153 size_t GetValueSize() const final;
154 size_t GetAlignment() const final { return fMaxAlignment; }
155 std::uint32_t GetTypeVersion() const final;
156 std::uint32_t GetTypeChecksum() const final;
157 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
158};
159
160/// The field for a class using ROOT standard streaming
161class RStreamerField final : public RFieldBase {
162private:
164 private:
166
167 public:
168 explicit RStreamerFieldDeleter(TClass *cl) : fClass(cl) {}
169 void operator()(void *objPtr, bool dtorOnly) final;
170 };
171
172 TClass *fClass = nullptr;
173 Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos; ///< streamer info records seen during writing
174 Internal::RColumnIndex fIndex; ///< number of bytes written in the current cluster
175
176private:
177 // Note that className may be different from classp->GetName(), e.g. through different canonicalization of RNTuple
178 // vs. TClass. Also, classp may be nullptr for types unsupported by the ROOT I/O.
179 RStreamerField(std::string_view fieldName, std::string_view className, TClass *classp);
180
181protected:
182 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
183
185 void GenerateColumns() final;
186 void GenerateColumns(const RNTupleDescriptor &) final;
187
188 void ConstructValue(void *where) const final;
189 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RStreamerFieldDeleter>(fClass); }
190
191 std::size_t AppendImpl(const void *from) final;
192 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
193
194 void CommitClusterImpl() final { fIndex = 0; }
195
196 bool HasExtraTypeInfo() const final { return true; }
197 // Returns the list of seen streamer infos
199
200public:
201 RStreamerField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
202 RStreamerField(RStreamerField &&other) = default;
203 RStreamerField &operator=(RStreamerField &&other) = default;
204 ~RStreamerField() final = default;
205
206 size_t GetValueSize() const final;
207 size_t GetAlignment() const final;
208 std::uint32_t GetTypeVersion() const final;
209 std::uint32_t GetTypeChecksum() const final;
210 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
211};
212
213/// The field for an unscoped or scoped enum with dictionary
214class REnumField : public RFieldBase {
215private:
216 REnumField(std::string_view fieldName, std::string_view enumName, TEnum *enump);
217 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
218
219protected:
220 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
221
222 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubFields[0], where); }
223
224 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubFields[0], from); }
225 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final { CallReadOn(*fSubFields[0], globalIndex, to); }
226 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final { CallReadOn(*fSubFields[0], clusterIndex, to); }
227
228public:
229 REnumField(std::string_view fieldName, std::string_view enumName);
230 REnumField(REnumField &&other) = default;
231 REnumField &operator=(REnumField &&other) = default;
232 ~REnumField() override = default;
233
234 std::vector<RValue> SplitValue(const RValue &value) const final;
235 size_t GetValueSize() const final { return fSubFields[0]->GetValueSize(); }
236 size_t GetAlignment() const final { return fSubFields[0]->GetAlignment(); }
237 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
238};
239
240/// Classes with dictionaries that can be inspected by TClass
241template <typename T, typename = void>
242class RField final : public RClassField {
243public:
244 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
245 RField(std::string_view name) : RClassField(name, TypeName())
246 {
247 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
248 }
249 RField(RField &&other) = default;
250 RField &operator=(RField &&other) = default;
251 ~RField() final = default;
252};
253
254template <typename T>
255class RField<T, typename std::enable_if<std::is_enum_v<T>>::type> final : public REnumField {
256public:
257 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
258 RField(std::string_view name) : REnumField(name, TypeName()) {}
259 RField(RField &&other) = default;
260 RField &operator=(RField &&other) = default;
261 ~RField() final = default;
262};
263
264/// An artificial field that transforms an RNTuple column that contains the offset of collections into
265/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
266/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
267/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
268/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
270 friend class RNTupleCollectionView; // to access GetCollectionInfo()
271
272private:
273 void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, NTupleSize_t *size)
274 {
275 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
276 }
277 void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, NTupleSize_t *size)
278 {
279 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
280 }
281
282protected:
283 RCardinalityField(std::string_view fieldName, std::string_view typeName)
284 : RFieldBase(fieldName, typeName, ENTupleStructure::kLeaf, false /* isSimple */)
285 {
286 }
287
288 const RColumnRepresentations &GetColumnRepresentations() const final;
289 // Field is only used for reading
290 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
291 void GenerateColumns(const RNTupleDescriptor &) final;
292
293public:
296 ~RCardinalityField() override = default;
297
298 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
299
300 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
301 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
302};
303
304template <typename T>
305class RSimpleField : public RFieldBase {
306protected:
307 void GenerateColumns() override { GenerateColumnsImpl<T>(); }
308 void GenerateColumns(const RNTupleDescriptor &desc) override { GenerateColumnsImpl<T>(desc); }
309
310 void ConstructValue(void *where) const final { new (where) T{0}; }
311
312public:
313 RSimpleField(std::string_view name, std::string_view type)
314 : RFieldBase(name, type, ENTupleStructure::kLeaf, true /* isSimple */)
315 {
316 fTraits |= kTraitTrivialType;
317 }
318 RSimpleField(RSimpleField &&other) = default;
320 ~RSimpleField() override = default;
321
322 T *Map(NTupleSize_t globalIndex) { return fPrincipalColumn->Map<T>(globalIndex); }
323 T *Map(RClusterIndex clusterIndex) { return fPrincipalColumn->Map<T>(clusterIndex); }
324 T *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) { return fPrincipalColumn->MapV<T>(globalIndex, nItems); }
325 T *MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems) { return fPrincipalColumn->MapV<T>(clusterIndex, nItems); }
326
327 size_t GetValueSize() const final { return sizeof(T); }
328 size_t GetAlignment() const final { return alignof(T); }
329};
330
331////////////////////////////////////////////////////////////////////////////////
332/// Template specializations for concrete C++ types
333////////////////////////////////////////////////////////////////////////////////
334
335} // namespace Experimental
336} // namespace ROOT
337
343
344namespace ROOT {
345namespace Experimental {
346
347template <typename SizeT>
348class RField<RNTupleCardinality<SizeT>> final : public RCardinalityField {
349protected:
350 std::unique_ptr<ROOT::Experimental::RFieldBase> CloneImpl(std::string_view newName) const final
351 {
352 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
353 }
354 void ConstructValue(void *where) const final { new (where) RNTupleCardinality<SizeT>(0); }
355
356public:
357 static std::string TypeName() { return "ROOT::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
358 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
359 RField(RField &&other) = default;
360 RField &operator=(RField &&other) = default;
361 ~RField() final = default;
362
363 size_t GetValueSize() const final { return sizeof(RNTupleCardinality<SizeT>); }
364 size_t GetAlignment() const final { return alignof(RNTupleCardinality<SizeT>); }
365
366 /// Get the number of elements of the collection identified by globalIndex
367 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
368 {
369 RClusterIndex collectionStart;
371 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &size);
372 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
373 }
374
375 /// Get the number of elements of the collection identified by clusterIndex
376 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
377 {
378 RClusterIndex collectionStart;
380 fPrincipalColumn->GetCollectionInfo(clusterIndex, &collectionStart, &size);
381 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
382 }
383
384 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
385 {
386 RClusterIndex collectionStart;
387 NTupleSize_t collectionSize;
388 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
389
390 auto typedValues = static_cast<RNTupleCardinality<SizeT> *>(bulkSpec.fValues);
391 typedValues[0] = collectionSize;
392
393 auto lastOffset = collectionStart.GetIndex() + collectionSize;
394 NTupleSize_t nRemainingEntries = bulkSpec.fCount - 1;
395 std::size_t nEntries = 1;
396 while (nRemainingEntries > 0) {
397 NTupleSize_t nItemsUntilPageEnd;
398 auto offsets =
399 fPrincipalColumn->MapV<Internal::RColumnIndex>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
400 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
401 for (std::size_t i = 0; i < nBatch; ++i) {
402 typedValues[nEntries + i] = offsets[i] - lastOffset;
403 lastOffset = offsets[i];
404 }
405 nRemainingEntries -= nBatch;
406 nEntries += nBatch;
407 }
408 return RBulkSpec::kAllSet;
409 }
410};
411
412/// TObject requires special handling of the fBits and fUniqueID members
413template <>
414class RField<TObject> final : public RFieldBase {
415 static std::size_t GetOffsetOfMember(const char *name);
416 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
417 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
418
419private:
420 RField(std::string_view fieldName, const RField<TObject> &source); ///< Used by CloneImpl()
421
422protected:
423 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
424
425 void ConstructValue(void *where) const final;
426 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
427
428 std::size_t AppendImpl(const void *from) final;
429 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
430
431 void OnConnectPageSource() final;
432
433public:
434 static std::string TypeName() { return "TObject"; }
435
436 RField(std::string_view fieldName);
437 RField(RField &&other) = default;
438 RField &operator=(RField &&other) = default;
439 ~RField() final = default;
440
441 std::vector<RValue> SplitValue(const RValue &value) const final;
442 size_t GetValueSize() const final;
443 size_t GetAlignment() const final;
444 std::uint32_t GetTypeVersion() const final;
445 std::uint32_t GetTypeChecksum() const final;
446 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
447};
448
449// Has to be implemented after the definition of all RField<T> types
450// The void type is specialized in RField.cxx
451
452template <typename T>
453std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
454{
455 if (GetTypeName() != RField<T>::TypeName()) {
456 throw RException(
457 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
458 }
459 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
460}
461
462template <>
465 void operator()(void *);
466};
467
468template <>
469std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
470ROOT::Experimental::RFieldBase::CreateObject<void>() const;
471
472} // namespace Experimental
473} // namespace ROOT
474
475#endif
Cppyy::TCppType_t fClass
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:299
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.
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:269
RCardinalityField & operator=(RCardinalityField &&other)=default
RCardinalityField(RCardinalityField &&other)=default
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, NTupleSize_t *size)
Definition RField.hxx:277
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:283
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, NTupleSize_t *size)
Definition RField.hxx:273
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 BeforeConnectPageSource(Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate.
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:154
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...
The field for an unscoped or scoped enum with dictionary.
Definition RField.hxx:214
~REnumField() override=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:235
REnumField & operator=(REnumField &&other)=default
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Definition RField.hxx:226
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:236
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:224
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:225
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:222
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
friend class ROOT::Experimental::RClassField
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:384
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.hxx:354
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:350
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:376
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
Definition RField.hxx:367
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:364
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:426
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:416
RField(RField &&other)=default
static std::size_t GetOffsetBits()
Definition RField.hxx:417
RField & operator=(RField &&other)=default
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:242
RField(std::string_view name)
Definition RField.hxx:245
RField & operator=(RField &&other)=default
RField(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:244
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:323
T * MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems)
Definition RField.hxx:325
RSimpleField & operator=(RSimpleField &&other)=default
T * Map(NTupleSize_t globalIndex)
Definition RField.hxx:322
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:310
void GenerateColumns(const RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:308
~RSimpleField() override=default
T * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
Definition RField.hxx:324
RSimpleField(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
Definition RField.hxx:313
void GenerateColumns() override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:307
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:328
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:327
The field for a class using ROOT standard streaming.
Definition RField.hxx:161
bool HasExtraTypeInfo() const final
Definition RField.hxx:196
Internal::RColumnIndex fIndex
number of bytes written in the current cluster
Definition RField.hxx:174
Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:173
Base class for all ROOT issued exceptions.
Definition RError.hxx:79
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...
Helper types to present an offset column as array of collection sizes.