48namespace Experimental {
50class RNTupleCollectionWriter;
61 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const override;
79 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
117 void operator()(
void *objPtr,
bool dtorOnly)
final;
126 RClassField(std::string_view fieldName, std::string_view className,
TClass *classp);
133 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
136 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RClassDeleter>(
fClass); }
138 std::size_t
AppendImpl(
const void *from)
final;
144 RClassField(std::string_view fieldName, std::string_view className);
154 void AcceptVisitor(Detail::RFieldVisitor &visitor) const override;
166 void operator()(
void *objPtr,
bool dtorOnly)
final;
179 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
188 std::size_t
AppendImpl(
const void *from)
final;
198 RUnsplitField(std::string_view fieldName, std::string_view className, std::string_view typeAlias = "");
207 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
213 REnumField(std::string_view fieldName, std::string_view enumName,
TEnum *enump);
214 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
217 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
226 REnumField(std::string_view fieldName, std::string_view enumName);
238template <
typename T,
typename =
void>
243 if constexpr (std::is_default_constructible_v<T>) {
247 new (where) T(
static_cast<TRootIOCtor *
>(
nullptr));
255 static_assert(std::is_class_v<T>,
"no I/O support for this basic C++ type");
279 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
285 std::size_t
AppendImpl(
const void *from)
final;
291 static std::
string TypeName() {
return ""; }
292 RCollectionField(std::string_view
name, std::shared_ptr<RNTupleCollectionWriter> collectionWriter,
293 std::unique_ptr<RFieldZero> collectionParent);
314 const RColumnRepresentations &GetColumnRepresentations() const final;
316 void GenerateColumns() final {
throw RException(
R__FAIL(
"Cardinality fields must only be used for reading")); }
342 fTraits |= kTraitTrivialType;
371namespace Experimental {
376 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
378 return std::make_unique<RField>(newName);
384 static std::
string TypeName() {
return "ROOT::Experimental::ClusterSize_t"; }
393 fPrincipalColumn->GetCollectionInfo(globalIndex, collectionStart,
size);
397 fPrincipalColumn->GetCollectionInfo(clusterIndex, collectionStart,
size);
402template <
typename SizeT>
405 std::unique_ptr<ROOT::Experimental::RFieldBase>
CloneImpl(std::string_view newName)
const final
407 return std::make_unique<RField<RNTupleCardinality<SizeT>>>(newName);
426 fPrincipalColumn->GetCollectionInfo(globalIndex, &collectionStart, &
size);
435 fPrincipalColumn->GetCollectionInfo(clusterIndex, &collectionStart, &
size);
443 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
446 typedValues[0] = collectionSize;
448 auto lastOffset = collectionStart.
GetIndex() + collectionSize;
450 std::size_t nEntries = 1;
451 while (nRemainingEntries > 0) {
453 auto offsets = fPrincipalColumn->MapV<
ClusterSize_t>(bulkSpec.fFirstIndex + nEntries, nItemsUntilPageEnd);
454 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
455 for (std::size_t i = 0; i < nBatch; ++i) {
456 typedValues[nEntries + i] = offsets[i] - lastOffset;
457 lastOffset = offsets[i];
459 nRemainingEntries -= nBatch;
462 return RBulkSpec::kAllSet;
469 static std::size_t GetOffsetOfMember(
const char *
name);
474 std::unique_ptr<RFieldBase> CloneImpl(std::string_view newName)
const final;
476 void ConstructValue(
void *where)
const override;
477 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<TObject>>(); }
479 std::size_t AppendImpl(
const void *from)
final;
480 void ReadGlobalImpl(
NTupleSize_t globalIndex,
void *to)
final;
482 void OnConnectPageSource() final;
485 static std::
string TypeName() {
return "TObject"; }
487 RField(std::string_view fieldName);
492 std::vector<RValue> SplitValue(
const RValue &
value)
const final;
493 size_t GetValueSize() const final;
494 size_t GetAlignment() const final;
495 std::uint32_t GetTypeVersion() const final;
496 std::uint32_t GetTypeChecksum() const final;
497 void AcceptVisitor(Detail::RFieldVisitor &visitor) const final;
510 return std::unique_ptr<T>(
static_cast<T *
>(CreateObjectRawPtr()));
520std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
521ROOT::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::unordered_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 collection field is only used for writing; when reading, untyped collections are projected to an ...
RCollectionField & operator=(RCollectionField &&other)=default
std::shared_ptr< RNTupleCollectionWriter > fCollectionWriter
Save the link to the collection ntuple in order to reset the offset counter when committing the clust...
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
~RCollectionField() override=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
RCollectionField(RCollectionField &&other)=default
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
friend class ROOT::Experimental::RCollectionField
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append and Read on other (sub) fields.
virtual std::size_t AppendImpl(const void *from)
Operations on values of complex types, e.g.
virtual RExtraTypeInfoDescriptor GetExtraTypeInfo() const
virtual std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const =0
Called by Clone(), which additionally copies the on-disk ID.
static void CallReadOn(RFieldBase &other, RClusterIndex clusterIndex, void *to)
virtual void ConstructValue(void *where) const =0
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
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 void ReadGlobalImpl(NTupleSize_t globalIndex, void *to)
virtual void CommitClusterImpl()
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() final
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)
void GenerateColumns(const RNTupleDescriptor &desc) final
Implementations in derived classes should create the backing columns corresponsing to the field type ...
RSimpleField(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view 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.
RClusterSize ClusterSize_t
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.
Input parameter to ReadBulk() and ReadBulkImpl(). See RBulk class for more information.
Helper types to present an offset column as array of collection sizes.