48namespace Experimental {
60 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const override;
78 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
116 void operator()(
void *objPtr,
bool dtorOnly)
final;
125 RClassField(std::string_view fieldName, std::string_view className,
TClass *classp);
132 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
135 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RClassDeleter>(
fClass); }
137 std::size_t
AppendImpl(
const void *from)
final;
143 RClassField(std::string_view fieldName, std::string_view className);
153 void AcceptVisitor(Detail::RFieldVisitor &visitor) const override;
165 void operator()(
void *objPtr,
bool dtorOnly)
final;
178 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
187 std::size_t
AppendImpl(
const void *from)
final;
197 RUnsplitField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
206 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
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);
216 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
225 REnumField(std::string_view fieldName, std::string_view enumName);
237template <
typename T,
typename =
void>
242 if constexpr (std::is_default_constructible_v<T>) {
246 new (where) T(
static_cast<TRootIOCtor *
>(
nullptr));
254 static_assert(std::is_class_v<T>,
"no I/O support for this basic C++ type");
283 const RColumnRepresentations &GetColumnRepresentations() const final;
285 void GenerateColumns() final {
throw RException(
R__FAIL(
"Cardinality fields must only be used for reading")); }
311 fTraits |= kTraitTrivialType;
340namespace Experimental {
345 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
347 return std::make_unique<RField>(newName);
353 static std::
string TypeName() {
return "ROOT::Experimental::ClusterSize_t"; }
362 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart,
size);
366 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart,
size);
371template <
typename SizeT>
374 std::unique_ptr<ROOT::Experimental::RFieldBase>
CloneImpl(std::string_view newName)
const final
376 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
395 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &
size);
404 fPrincipalColumn->GetCollectionInfo(clusterIndex, &collectionStart, &
size);
412 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
415 typedValues[0] = collectionSize;
417 auto lastOffset = collectionStart.
GetIndex() + collectionSize;
419 std::size_t nEntries = 1;
420 while (nRemainingEntries > 0) {
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];
428 nRemainingEntries -= nBatch;
431 return RBulkSpec::kAllSet;
438 static std::size_t GetOffsetOfMember(
const char *
name);
443 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
445 void ConstructValue(
void *where)
const override;
446 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<TObject>>(); }
448 std::size_t AppendImpl(
const void *from)
final;
449 void ReadGlobalImpl(
NTupleSize_t globalIndex,
void *to)
final;
451 void OnConnectPageSource() final;
454 static std::
string TypeName() {
return "TObject"; }
456 RField(std::string_view fieldName);
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;
479 return std::unique_ptr<T>(
static_cast<T *
>(CreateObjectRawPtr()));
489std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
490ROOT::Experimental::RFieldBase::CreateObject<void>()
const;
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
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
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...
RCardinalityField & operator=(RCardinalityField &&other)=default
~RCardinalityField() override=default
RCardinalityField(RCardinalityField &&other)=default
RCardinalityField(std::string_view fieldName, std::string_view typeName)
void operator()(void *objPtr, bool dtorOnly) final
RClassDeleter(TClass *cl)
The field for a class with dictionary.
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
void Attach(std::unique_ptr< RFieldBase > child, RSubFieldInfo info)
void OnConnectPageSource() final
Called by ConnectPageSource() once connected; derived classes may override this as appropriate.
size_t GetValueSize() const override
The number of bytes taken by a value of the appropriate type.
void ConstructValue(void *where) const override
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
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 AcceptVisitor(Detail::RFieldVisitor &visitor) const override
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
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
std::size_t fMaxAlignment
std::unique_ptr< RDeleter > GetDeleter() const final
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.
~REnumField() override=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
REnumField & operator=(REnumField &&other)=default
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
REnumField(REnumField &&other)=default
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
Base class for all ROOT issued exceptions.
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.
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const override
Called by Clone(), which additionally copies the on-disk ID.
void ConstructValue(void *) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RField & operator=(RField &&other)=default
RField(std::string_view name)
~RField() override=default
void AcceptVisitor(Detail::RFieldVisitor &visitor) const final
RField(RField &&other)=default
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.
void GetCollectionInfo(RClusterIndex clusterIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
RField(std::string_view name)
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
std::unique_ptr< ROOT::Experimental::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RField(RField &&other)=default
void ReadInClusterImpl(RClusterIndex clusterIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
void ReadGlobalImpl(NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
RField & operator=(RField &&other)=default
~RField() override=default
static std::string TypeName()
std::unique_ptr< RDeleter > GetDeleter() const final
static std::size_t GetOffsetUniqueID()
RField(RField &&other)=default
static std::size_t GetOffsetBits()
~RField() override=default
RField & operator=(RField &&other)=default
Classes with dictionaries that can be inspected by TClass.
RField(std::string_view name)
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
RField & operator=(RField &&other)=default
RField(RField &&other)=default
static std::string TypeName()
~RField() override=default
Used in RFieldBase::Check() to record field creation failures.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
const std::string & GetError() const
RInvalidField(std::string_view name, std::string_view type, std::string_view error)
void ConstructValue(void *) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
The on-storage meta-data of an ntuple.
T * Map(RClusterIndex clusterIndex)
T * MapV(RClusterIndex clusterIndex, NTupleSize_t &nItems)
RSimpleField & operator=(RSimpleField &&other)=default
T * Map(NTupleSize_t globalIndex)
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void GenerateColumns(const RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
~RSimpleField() override=default
T * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
RSimpleField(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
void GenerateColumns() override
Implementations in derived classes should create the backing columns corresponsing to the field type ...
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RUnsplitDeleter(TClass *cl)
The field for a class in unsplit mode, which is using ROOT standard streaming.
Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
bool HasExtraTypeInfo() const final
void CommitClusterImpl() final
ClusterSize_t fIndex
number of bytes written in the current cluster
TClass instances represent classes, structs and namespaces in the ROOT type system.
The TEnum class implements the enum type.
Mother of all ROOT objects.
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.