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 override;
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.
74class RInvalidField final : public RFieldBase {
75 std::string fError;
76
77protected:
78 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final
79 {
80 return std::make_unique<RInvalidField>(newName, GetTypeName(), fError);
81 }
82 void ConstructValue(void *) const final {}
83
84public:
85 RInvalidField(std::string_view name, std::string_view type, std::string_view error)
86 : RFieldBase(name, type, ENTupleStructure::kLeaf, false /* isSimple */), fError(error)
87 {
88 }
89
90 const std::string &GetError() const { return fError; }
91
92 size_t GetValueSize() const final { return 0; }
93 size_t GetAlignment() const final { return 0; }
94}; // RInvalidField
95
96/// The field for a class with dictionary
97class RClassField : public RFieldBase {
98private:
102 };
105 std::size_t fOffset;
106 };
107 /// Prefix used in the subfield names generated for base classes
108 static constexpr const char *kPrefixInherited{":"};
109
110 class RClassDeleter : public RDeleter {
111 private:
113
114 public:
115 explicit RClassDeleter(TClass *cl) : fClass(cl) {}
116 void operator()(void *objPtr, bool dtorOnly) final;
117 };
118
120 /// Additional information kept for each entry in `fSubFields`
121 std::vector<RSubFieldInfo> fSubFieldsInfo;
122 std::size_t fMaxAlignment = 1;
123
124private:
125 RClassField(std::string_view fieldName, std::string_view className, TClass *classp);
126 void Attach(std::unique_ptr<RFieldBase> child, RSubFieldInfo info);
127 /// Register post-read callbacks corresponding to a list of ROOT I/O customization rules. `classp` is used to
128 /// fill the `TVirtualObject` instance passed to the user function.
129 void AddReadCallbacksFromIORules(const std::span<const TSchemaRule *> rules, TClass *classp = nullptr);
130
131protected:
132 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
133
134 void ConstructValue(void *where) const override;
135 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RClassDeleter>(fClass); }
136
137 std::size_t AppendImpl(const void *from) final;
138 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
139 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final;
140 void OnConnectPageSource() final;
141
142public:
143 RClassField(std::string_view fieldName, std::string_view className);
144 RClassField(RClassField &&other) = default;
145 RClassField &operator=(RClassField &&other) = default;
146 ~RClassField() override = default;
147
148 std::vector<RValue> SplitValue(const RValue &value) const final;
149 size_t GetValueSize() const override;
150 size_t GetAlignment() const final { return fMaxAlignment; }
151 std::uint32_t GetTypeVersion() const final;
152 std::uint32_t GetTypeChecksum() const final;
153 void AcceptVisitor(Detail::RFieldVisitor &visitor) const override;
154};
155
156/// The field for a class in unsplit mode, which is using ROOT standard streaming
157class RUnsplitField final : public RFieldBase {
158private:
159 class RUnsplitDeleter : public RDeleter {
160 private:
162
163 public:
164 explicit RUnsplitDeleter(TClass *cl) : fClass(cl) {}
165 void operator()(void *objPtr, bool dtorOnly) final;
166 };
167
168 TClass *fClass = nullptr;
169 Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos; ///< streamer info records seen during writing
170 ClusterSize_t fIndex; ///< number of bytes written in the current cluster
171
172private:
173 // Note that className may be different from classp->GetName(), e.g. through different canonicalization of RNTuple
174 // vs. TClass. Also, classp may be nullptr for types unsupported by the ROOT I/O.
175 RUnsplitField(std::string_view fieldName, std::string_view className, TClass *classp);
176
177protected:
178 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
179
181 void GenerateColumns() final;
182 void GenerateColumns(const RNTupleDescriptor &) final;
183
184 void ConstructValue(void *where) const final;
185 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RUnsplitDeleter>(fClass); }
186
187 std::size_t AppendImpl(const void *from) final;
188 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
189
190 void CommitClusterImpl() final { fIndex = 0; }
191
192 bool HasExtraTypeInfo() const final { return true; }
193 // Returns the list of seen streamer infos
195
196public:
197 RUnsplitField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
198 RUnsplitField(RUnsplitField &&other) = default;
199 RUnsplitField &operator=(RUnsplitField &&other) = default;
200 ~RUnsplitField() override = default;
201
202 size_t GetValueSize() const final;
203 size_t GetAlignment() const final;
204 std::uint32_t GetTypeVersion() const final;
205 std::uint32_t GetTypeChecksum() const final;
206 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
207};
208
209/// The field for an unscoped or scoped enum with dictionary
210class REnumField : public RFieldBase {
211private:
212 REnumField(std::string_view fieldName, std::string_view enumName, TEnum *enump);
213 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
214
215protected:
216 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
217
218 void ConstructValue(void *where) const final { CallConstructValueOn(*fSubFields[0], where); }
219
220 std::size_t AppendImpl(const void *from) final { return CallAppendOn(*fSubFields[0], from); }
221 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final { CallReadOn(*fSubFields[0], globalIndex, to); }
222 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final { CallReadOn(*fSubFields[0], clusterIndex, to); }
223
224public:
225 REnumField(std::string_view fieldName, std::string_view enumName);
226 REnumField(REnumField &&other) = default;
227 REnumField &operator=(REnumField &&other) = default;
228 ~REnumField() override = default;
229
230 std::vector<RValue> SplitValue(const RValue &value) const final;
231 size_t GetValueSize() const final { return fSubFields[0]->GetValueSize(); }
232 size_t GetAlignment() const final { return fSubFields[0]->GetAlignment(); }
233 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
234};
235
236/// Classes with dictionaries that can be inspected by TClass
237template <typename T, typename = void>
238class RField final : public RClassField {
239protected:
240 void ConstructValue(void *where) const final
241 {
242 if constexpr (std::is_default_constructible_v<T>) {
243 new (where) T();
244 } else {
245 // If there is no default constructor, try with the IO constructor
246 new (where) T(static_cast<TRootIOCtor *>(nullptr));
247 }
248 }
249
250public:
251 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
252 RField(std::string_view name) : RClassField(name, TypeName())
253 {
254 static_assert(std::is_class_v<T>, "no I/O support for this basic C++ type");
255 }
256 RField(RField &&other) = default;
257 RField &operator=(RField &&other) = default;
258 ~RField() override = default;
259};
260
261template <typename T>
262class RField<T, typename std::enable_if<std::is_enum_v<T>>::type> : public REnumField {
263public:
264 static std::string TypeName() { return ROOT::Internal::GetDemangledTypeName(typeid(T)); }
265 RField(std::string_view name) : REnumField(name, TypeName()) {}
266 RField(RField &&other) = default;
267 RField &operator=(RField &&other) = default;
268 ~RField() override = default;
269};
270
271/// An artificial field that transforms an RNTuple column that contains the offset of collections into
272/// collection sizes. It is only used for reading, e.g. as projected field or as an artificial field that provides the
273/// "number of" RDF columns for collections (e.g. `R_rdf_sizeof_jets` for a collection named `jets`).
274/// It is used in the templated RField<RNTupleCardinality<SizeT>> form, which represents the collection sizes either
275/// as 32bit unsigned int (std::uint32_t) or as 64bit unsigned int (std::uint64_t).
277protected:
278 RCardinalityField(std::string_view fieldName, std::string_view typeName)
279 : RFieldBase(fieldName, typeName, ENTupleStructure::kLeaf, false /* isSimple */)
280 {
281 }
282
283 const RColumnRepresentations &GetColumnRepresentations() const final;
284 // Field is only used for reading
285 void GenerateColumns() final { throw RException(R__FAIL("Cardinality fields must only be used for reading")); }
286 void GenerateColumns(const RNTupleDescriptor &) final;
287
288public:
291 ~RCardinalityField() override = default;
292
293 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
294
295 const RField<RNTupleCardinality<std::uint32_t>> *As32Bit() const;
296 const RField<RNTupleCardinality<std::uint64_t>> *As64Bit() const;
297};
298
299template <typename T>
300class RSimpleField : public RFieldBase {
301protected:
302 void GenerateColumns() override { GenerateColumnsImpl<T>(); }
303 void GenerateColumns(const RNTupleDescriptor &desc) override { GenerateColumnsImpl<T>(desc); }
304
305 void ConstructValue(void *where) const final { new (where) T{0}; }
306
307public:
308 RSimpleField(std::string_view name, std::string_view type)
309 : RFieldBase(name, type, ENTupleStructure::kLeaf, true /* isSimple */)
310 {
311 fTraits |= kTraitTrivialType;
312 }
313 RSimpleField(RSimpleField &&other) = default;
315 ~RSimpleField() override = default;
316
317 T *Map(NTupleSize_t globalIndex) { return fPrincipalColumn->Map<T>(globalIndex); }
318 T *Map(RClusterIndex clusterIndex) { return fPrincipalColumn->Map<T>(clusterIndex); }
319 T *MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems) { return fPrincipalColumn->MapV<T>(globalIndex, nItems); }
320 T *MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems) { return fPrincipalColumn->MapV<T>(clusterIndex, nItems); }
321
322 size_t GetValueSize() const final { return sizeof(T); }
323 size_t GetAlignment() const final { return alignof(T); }
324};
325
326////////////////////////////////////////////////////////////////////////////////
327/// Template specializations for concrete C++ types
328////////////////////////////////////////////////////////////////////////////////
329
330} // namespace Experimental
331} // namespace ROOT
332
338
339namespace ROOT {
340namespace Experimental {
341
342template <>
343class RField<ClusterSize_t> final : public RSimpleField<ClusterSize_t> {
344protected:
345 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final
346 {
347 return std::make_unique<RField>(newName);
348 }
349
351
352public:
353 static std::string TypeName() { return "ROOT::Experimental::ClusterSize_t"; }
354 explicit RField(std::string_view name) : RSimpleField(name, TypeName()) {}
355 RField(RField &&other) = default;
356 RField &operator=(RField &&other) = default;
357 ~RField() override = default;
358
359 /// Special help for offset fields
360 void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
361 {
362 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart, size);
363 }
364 void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
365 {
366 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart, size);
367 }
368 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
369};
370
371template <typename SizeT>
372class RField<RNTupleCardinality<SizeT>> final : public RCardinalityField {
373protected:
374 std::unique_ptr<ROOT::Experimental::RFieldBase> CloneImpl(std::string_view newName) const final
375 {
376 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
377 }
378 void ConstructValue(void *where) const final { new (where) RNTupleCardinality<SizeT>(0); }
379
380public:
381 static std::string TypeName() { return "ROOT::Experimental::RNTupleCardinality<" + RField<SizeT>::TypeName() + ">"; }
382 explicit RField(std::string_view name) : RCardinalityField(name, TypeName()) {}
383 RField(RField &&other) = default;
384 RField &operator=(RField &&other) = default;
385 ~RField() override = default;
386
387 size_t GetValueSize() const final { return sizeof(RNTupleCardinality<SizeT>); }
388 size_t GetAlignment() const final { return alignof(RNTupleCardinality<SizeT>); }
389
390 /// Get the number of elements of the collection identified by globalIndex
391 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
392 {
393 RClusterIndex collectionStart;
395 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &size);
396 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
397 }
398
399 /// Get the number of elements of the collection identified by clusterIndex
400 void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
401 {
402 RClusterIndex collectionStart;
404 fPrincipalColumn->GetCollectionInfo(clusterIndex, &collectionStart, &size);
405 *static_cast<RNTupleCardinality<SizeT> *>(to) = size;
406 }
407
408 std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
409 {
410 RClusterIndex collectionStart;
411 ClusterSize_t collectionSize;
412 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
413
414 auto typedValues = static_cast<RNTupleCardinality<SizeT> *>(bulkSpec.fValues);
415 typedValues[0] = collectionSize;
416
417 auto lastOffset = collectionStart.GetIndex() + collectionSize;
418 ClusterSize_t::ValueType nRemainingEntries = bulkSpec.fCount - 1;
419 std::size_t nEntries = 1;
420 while (nRemainingEntries > 0) {
421 NTupleSize_t nItemsUntilPageEnd;
422 auto offsets = fPrincipalColumn->MapV<ClusterSize_t>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
423 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
424 for (std::size_t i = 0; i < nBatch; ++i) {
425 typedValues[nEntries + i] = offsets[i] - lastOffset;
426 lastOffset = offsets[i];
427 }
428 nRemainingEntries -= nBatch;
429 nEntries += nBatch;
430 }
431 return RBulkSpec::kAllSet;
432 }
433};
434
435/// TObject requires special handling of the fBits and fUniqueID members
436template <>
437class RField<TObject> final : public RFieldBase {
438 static std::size_t GetOffsetOfMember(const char *name);
439 static std::size_t GetOffsetUniqueID() { return GetOffsetOfMember("fUniqueID"); }
440 static std::size_t GetOffsetBits() { return GetOffsetOfMember("fBits"); }
441
442protected:
443 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName) const final;
444
445 void ConstructValue(void *where) const override;
446 std::unique_ptr<RDeleter> GetDeleter() const final { return std::make_unique<RTypedDeleter<TObject>>(); }
447
448 std::size_t AppendImpl(const void *from) final;
449 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final;
450
451 void OnConnectPageSource() final;
452
453public:
454 static std::string TypeName() { return "TObject"; }
455
456 RField(std::string_view fieldName);
457 RField(RField &&other) = default;
458 RField &operator=(RField &&other) = default;
459 ~RField() override = default;
460
461 std::vector<RValue> SplitValue(const RValue &value) const final;
462 size_t GetValueSize() const final;
463 size_t GetAlignment() const final;
464 std::uint32_t GetTypeVersion() const final;
465 std::uint32_t GetTypeChecksum() const final;
466 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
467};
468
469// Has to be implemented after the definition of all RField<T> types
470// The void type is specialized in RField.cxx
471
472template <typename T>
473std::unique_ptr<T, typename RFieldBase::RCreateObjectDeleter<T>::deleter> RFieldBase::CreateObject() const
474{
475 if (GetTypeName() != RField<T>::TypeName()) {
476 throw RException(
477 R__FAIL("type mismatch for field " + GetFieldName() + ": " + GetTypeName() + " vs. " + RField<T>::TypeName()));
478 }
479 return std::unique_ptr<T>(static_cast<T *>(CreateObjectRawPtr()));
480}
481
482template <>
485 void operator()(void *);
486};
487
488template <>
489std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
490ROOT::Experimental::RFieldBase::CreateObject<void>() const;
491
492} // namespace Experimental
493} // namespace ROOT
494
495#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:276
RCardinalityField & operator=(RCardinalityField &&other)=default
RCardinalityField(RCardinalityField &&other)=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
Definition RField.hxx:278
void operator()(void *objPtr, bool dtorOnly) final
Definition RField.cxx:1971
The field for a class with dictionary.
Definition RField.hxx:97
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Definition RField.cxx:1932
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
Definition RField.hxx:108
void Attach(std::unique_ptr< RFieldBase > child, RSubFieldInfo info)
Definition RField.cxx:1881
void OnConnectPageSource() final
Called by ConnectPageSource() once connected; derived classes may override this as appropriate.
Definition RField.cxx:1939
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
Definition RField.cxx:1990
void ConstructValue(void *where) const override
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Definition RField.cxx:1966
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.cxx:1916
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.cxx:1925
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
Definition RField.cxx:2000
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:1909
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.
Definition RField.cxx:1888
void AcceptVisitor(Detail::RFieldVisitor &visitor) const override
Definition RField.cxx:2005
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:150
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
Definition RField.cxx:1995
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given a value for this field.
Definition RField.cxx:1978
std::vector< RSubFieldInfo > fSubFieldsInfo
Additional information kept for each entry in fSubFields
Definition RField.hxx:121
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:135
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:210
~REnumField() override=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:231
REnumField & operator=(REnumField &&other)=default
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Definition RField.hxx:222
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:232
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Definition RField.hxx:220
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Definition RField.hxx:221
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:218
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.
Definition RField.cxx:994
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.
Definition RField.cxx:921
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:1327
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:68
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:67
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.cxx:1319
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::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:345
RField & operator=(RField &&other)=default
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Special help for offset fields.
Definition RField.hxx:360
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Definition RField.hxx:364
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
Definition RField.hxx:408
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:378
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:374
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
Definition RField.hxx:400
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
Definition RField.hxx:391
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:387
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:388
std::unique_ptr< RDeleter > GetDeleter() const final
Definition RField.hxx:446
static std::size_t GetOffsetUniqueID()
Definition RField.hxx:439
RField(RField &&other)=default
static std::size_t GetOffsetBits()
Definition RField.hxx:440
RField & operator=(RField &&other)=default
Classes with dictionaries that can be inspected by TClass.
Definition RField.hxx:238
RField(std::string_view name)
Definition RField.hxx:252
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:240
RField & operator=(RField &&other)=default
RField(RField &&other)=default
static std::string TypeName()
Definition RField.hxx:251
~RField() override=default
Used in RFieldBase::Check() to record field creation failures.
Definition RField.hxx:74
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:92
const std::string & GetError() const
Definition RField.hxx:90
RInvalidField(std::string_view name, std::string_view type, std::string_view error)
Definition RField.hxx:85
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:82
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
Definition RField.hxx:78
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:93
The on-storage meta-data of an ntuple.
T * Map(RClusterIndex clusterIndex)
Definition RField.hxx:318
T * MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems)
Definition RField.hxx:320
RSimpleField & operator=(RSimpleField &&other)=default
T * Map(NTupleSize_t globalIndex)
Definition RField.hxx:317
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:305
void GenerateColumns(const RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:303
~RSimpleField() override=default
T * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
Definition RField.hxx:319
RSimpleField(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
Definition RField.hxx:308
void GenerateColumns() override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
Definition RField.hxx:302
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
Definition RField.hxx:323
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
Definition RField.hxx:322
The field for a class in unsplit mode, which is using ROOT standard streaming.
Definition RField.hxx:157
Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
Definition RField.hxx:169
bool HasExtraTypeInfo() const final
Definition RField.hxx:192
ClusterSize_t fIndex
number of bytes written in the current cluster
Definition RField.hxx:170
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.