74 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
82 void Attach(std::unique_ptr<RFieldBase> child);
114 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final
161 void operator()(
void *objPtr,
bool dtorOnly)
final;
189 void SetStagingClass(
const std::string &className,
unsigned int classVersion);
203 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
206 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RClassDeleter>(
fClass); }
208 std::size_t
AppendImpl(
const void *from)
final;
216 RClassField(std::string_view fieldName, std::string_view className);
243 void operator()(
void *objPtr,
bool dtorOnly)
final;
254 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
263 std::size_t
AppendImpl(
const void *from)
final;
293 REnumField(std::string_view fieldName, std::string_view enumName, std::unique_ptr<RFieldBase> intField);
296 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
307 REnumField(std::string_view fieldName, std::string_view enumName);
319template <
typename T,
typename =
void>
325 static_assert(std::is_class_v<T>,
"no I/O support for this basic C++ type");
366 const RColumnRepresentations &GetColumnRepresentations() const final;
397 if constexpr (std::is_integral_v<T>) {
399 }
else if constexpr (std::is_floating_point_v<T>) {
447template <
typename SizeT>
452 std::unique_ptr<ROOT::RFieldBase>
CloneImpl(std::string_view newName)
const final
454 return std::make_unique<RField>(newName);
480 fPrincipalColumn->GetCollectionInfo(bulkSpec.fFirstIndex, &collectionStart, &collectionSize);
483 typedValues[0] = collectionSize;
487 std::size_t nEntries = 1;
488 while (nRemainingEntries > 0) {
492 std::size_t nBatch = std::min(nRemainingEntries, nItemsUntilPageEnd);
493 for (std::size_t i = 0; i < nBatch; ++i) {
494 typedValues[nEntries + i] = offsets[i] - lastOffset;
495 lastOffset = offsets[i];
497 nRemainingEntries -= nBatch;
500 return RBulkSpec::kAllSet;
525 std::unique_ptr<RFieldBase>
CloneImpl(std::string_view newName)
const final;
528 std::unique_ptr<RDeleter>
GetDeleter() const final {
return std::make_unique<RTypedDeleter<TObject>>(); }
530 std::size_t
AppendImpl(
const void *from)
final;
531 void ReadTObject(
void *to,
UInt_t uniqueID,
UInt_t bits);
536 static std::string
TypeName() {
return "TObject"; }
538 RField(std::string_view fieldName);
585std::unique_ptr<void, typename RFieldBase::RCreateObjectDeleter<void>::deleter>
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
TRObject operator()(const T1 &t1) const
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.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
RCardinalityField(RCardinalityField &&other)=default
void GetCollectionInfo(ROOT::NTupleSize_t globalIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
const RField< RNTupleCardinality< std::uint32_t > > * As32Bit() const
RCardinalityField & operator=(RCardinalityField &&other)=default
void GetCollectionInfo(RNTupleLocalIndex localIndex, RNTupleLocalIndex *collectionStart, ROOT::NTupleSize_t *size)
~RCardinalityField() override=default
const RField< RNTupleCardinality< std::uint64_t > > * As64Bit() const
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
RCardinalityField(std::string_view fieldName, std::string_view typeName)
void operator()(void *objPtr, bool dtorOnly) final
RClassDeleter(TClass *cl)
const TClass * GetClass() const
Return the TClass instance backing this field.
std::unique_ptr< RFieldBase > BeforeConnectPageSource(ROOT::Internal::RPageSource &pageSource) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
void AddReadCallbacksFromIORule(const TSchemaRule *rule)
Register post-read callback corresponding to a ROOT I/O customization rules.
TClass * fStagingClass
The TClass instance that corresponds to the staging area.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
RClassField(RClassField &&other)=default
std::size_t fMaxAlignment
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::vector< RSubfieldInfo > fSubfieldsInfo
Additional information kept for each entry in fSubfields.
void Attach(std::unique_ptr< RFieldBase > child, RSubfieldInfo info)
std::unique_ptr< unsigned char[]> fStagingArea
The staging area stores inputs to I/O rules according to the offsets given by the streamer info of "T...
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
RClassField & operator=(RClassField &&other)=default
void ReadGlobalImpl(ROOT::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...
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
std::vector< const TSchemaRule * > FindRules(const ROOT::RFieldDescriptor *fieldDesc)
Given the on-disk information from the page source, find all the I/O customization rules that apply t...
ROOT::DescriptorId_t LookupMember(const ROOT::RNTupleDescriptor &desc, std::string_view memberName, ROOT::DescriptorId_t classFieldId)
Returns the id of member 'name' in the class field given by 'fieldId', or kInvalidDescriptorId if no ...
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
RClassField(std::string_view fieldName, const RClassField &source)
Used by CloneImpl.
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void PrepareStagingArea(const std::vector< const TSchemaRule * > &rules, const ROOT::RNTupleDescriptor &desc, const ROOT::RFieldDescriptor &classFieldId)
If there are rules with inputs (source members), create the staging area according to the TClass inst...
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
const std::type_info * GetPolymorphicTypeInfo() const
For polymorphic classes (that declare or inherit at least one virtual method), return the expected dy...
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::unique_ptr< RDeleter > GetDeleter() const final
std::unordered_map< std::string, RStagingItem > fStagingItems
Lookup staging items by member name.
static constexpr const char * kPrefixInherited
Prefix used in the subfield names generated for base classes.
void SetStagingClass(const std::string &className, unsigned int classVersion)
Sets fStagingClass according to the given name and version.
The field for an unscoped or scoped enum with dictionary.
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
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.
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
~REnumField() override=default
REnumField(REnumField &&other)=default
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
REnumField & operator=(REnumField &&other)=default
REnumField(std::string_view fieldName, TEnum *enump)
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
Base class for all ROOT issued exceptions.
The list of column representations a field can have.
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.
ROOT::Internal::RColumn * fPrincipalColumn
All fields that have columns have a distinct main column.
virtual void ReconcileOnDiskField(const RNTupleDescriptor &desc)
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::vector< std::unique_ptr< RFieldBase > > fSubfields
Collections and classes own subfields.
std::unique_ptr< T, typename RCreateObjectDeleter< T >::deleter > CreateObject() const
Generates an object of the field type and allocates new initialized memory according to the type.
@ kTraitTrivialType
Shorthand for types that are both trivially constructible and destructible.
@ kTraitInvalidField
This field is an instance of RInvalidField and can be safely static_cast to it.
const std::string & GetFieldName() const
static std::size_t CallAppendOn(RFieldBase &other, const void *from)
Allow derived classes to call Append() and Read() on other (sub)fields.
std::uint32_t fTraits
Properties of the type that allow for optimizations of collections of that type.
RFieldBase(std::string_view name, std::string_view type, ROOT::ENTupleStructure structure, bool isSimple, std::size_t nRepetitions=0)
The constructor creates the underlying column objects and connects them to either a sink or a source.
const std::string & GetTypeName() const
void GenerateColumnsImpl(const ColumnRepresentation_t &representation, std::uint16_t representationIndex)
Helpers for generating columns.
static void CallReadOn(RFieldBase &other, RNTupleLocalIndex localIndex, void *to)
static void CallConstructValueOn(const RFieldBase &other, void *where)
Allow derived classes to call ConstructValue(void *) and GetDeleter() on other (sub)fields.
void * CreateObjectRawPtr() const
Factory method for the field's type. The caller owns the returned pointer.
Metadata stored for every field of an RNTuple.
The container field for an ntuple model, which itself has no physical representation.
std::unordered_set< std::string > fSubfieldNames
Efficient detection of duplicate field names.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
bool GetAllowFieldSubstitutions() const
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.
std::vector< std::unique_ptr< RFieldBase > > ReleaseSubfields()
Moves all subfields into the returned vector.
bool fAllowFieldSubstitutions
If field substitutions are allowed, upon connecting to a page source the field hierarchy will replace...
void Attach(std::unique_ptr< RFieldBase > child)
A public version of the Attach method that allows piece-wise construction of the zero field.
RField(std::string_view name)
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
Get the number of elements of the collection identified by globalIndex.
RField & operator=(RField &&other)=default
RNTupleCardinality< SizeT > CardinalityType
std::size_t ReadBulkImpl(const RBulkSpec &bulkSpec) final
General implementation of bulk read.
RField(RField &&other)=default
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void ReadInClusterImpl(RNTupleLocalIndex localIndex, void *to) final
Get the number of elements of the collection identified by clusterIndex.
std::unique_ptr< ROOT::RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
static std::string TypeName()
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
RField(RField &&other)=default
RField & operator=(RField &&other)=default
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
static std::string TypeName()
std::uint32_t GetTypeChecksum() const final
Return the current TClass reported checksum of this class. Only valid if kTraitTypeChecksum is set.
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
static std::size_t GetOffsetOfMember(const char *name)
std::unique_ptr< RDeleter > GetDeleter() const final
std::vector< RValue > SplitValue(const RValue &value) const final
Creates the list of direct child values given an existing value for this field.
RField(std::string_view fieldName, const RField< TObject > &source)
Used by CloneImpl().
static std::size_t GetOffsetBits()
static std::size_t GetOffsetUniqueID()
Classes with dictionaries that can be inspected by TClass.
RField(RField &&other)=default
RField & operator=(RField &&other)=default
static std::string TypeName()
RField(std::string_view name)
RInvalidField(std::string_view name, std::string_view type, std::string_view error, ECategory category)
@ kGeneric
Generic unrecoverable error.
@ kUnknownType
The type given to RFieldBase::Create was unknown.
@ kTypeError
The type given to RFieldBase::Create was invalid.
@ kUnknownStructure
The field could not be created because its descriptor had an unknown structural role.
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.
const std::string & GetError() const
ECategory GetCategory() const
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void ConstructValue(void *) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
A view for a collection, that can itself generate new ntuple views for its nested fields.
The on-storage metadata of an RNTuple.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
ROOT::NTupleSize_t GetIndexInCluster() const
void GenerateColumns() override
Implementations in derived classes should create the backing columns corresponding to the field type ...
void ReconcileIntegralField(const RNTupleDescriptor &desc)
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
RSimpleField & operator=(RSimpleField &&other)=default
RSimpleField(std::string_view name, std::string_view type)
T * Map(RNTupleLocalIndex localIndex)
~RSimpleField() override=default
T * Map(ROOT::NTupleSize_t globalIndex)
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
void ReconcileOnDiskField(const RNTupleDescriptor &desc) override
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
RSimpleField(RSimpleField &&other)=default
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
void ReconcileFloatingPointField(const RNTupleDescriptor &desc)
T * MapV(ROOT::NTupleSize_t globalIndex, ROOT::NTupleSize_t &nItems)
void GenerateColumns(const ROOT::RNTupleDescriptor &desc) override
Implementations in derived classes should create the backing columns corresponding to the field type ...
T * MapV(RNTupleLocalIndex localIndex, ROOT::NTupleSize_t &nItems)
void operator()(void *objPtr, bool dtorOnly) final
RStreamerFieldDeleter(TClass *cl)
The field for a class using ROOT standard streaming.
ROOT::RExtraTypeInfoDescriptor GetExtraTypeInfo() const final
void ReadGlobalImpl(ROOT::NTupleSize_t globalIndex, void *to) final
ROOT::Internal::RNTupleSerializer::StreamerInfoMap_t fStreamerInfos
streamer info records seen during writing
void ReconcileOnDiskField(const RNTupleDescriptor &desc) final
For non-artificial fields, check compatibility of the in-memory field and the on-disk field.
std::uint32_t GetTypeVersion() const final
Indicates an evolution of the C++ type itself.
void GenerateColumns() final
Implementations in derived classes should create the backing columns corresponding to the field type ...
void ConstructValue(void *where) const final
Constructs value in a given location of size at least GetValueSize(). Called by the base class' Creat...
ROOT::Internal::RColumnIndex fIndex
number of bytes written in the current cluster
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 > BeforeConnectPageSource(ROOT::Internal::RPageSource &source) final
Called by ConnectPageSource() before connecting; derived classes may override this as appropriate,...
std::unique_ptr< RFieldBase > CloneImpl(std::string_view newName) const final
Called by Clone(), which additionally copies the on-disk ID.
bool HasExtraTypeInfo() const final
std::size_t AppendImpl(const void *from) final
Operations on values of complex types, e.g.
void AcceptVisitor(ROOT::Detail::RFieldVisitor &visitor) const final
void CommitClusterImpl() final
RStreamerField(std::string_view fieldName, TClass *classp)
size_t GetAlignment() const final
As a rule of thumb, the alignment is equal to the size of the type.
const RColumnRepresentations & GetColumnRepresentations() const final
Implementations in derived classes should return a static RColumnRepresentations object.
std::unique_ptr< RDeleter > GetDeleter() const final
TClass * GetClass() const
size_t GetValueSize() const final
The number of bytes taken by a value of the appropriate type.
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.
Special implementation of ROOT::RRangeCast for TCollection, including a check that the cast target ty...
void SetAllowFieldSubstitutions(RFieldZero &fieldZero, bool val)
bool IsMatchingFieldType(const std::string &actualTypeName)
Helper to check if a given type name is the one expected of Field<T>.
std::string GetDemangledTypeName(const std::type_info &)
Returns a string with the demangled and normalized name for the given type.
std::string GetRenormalizedTypeName(const std::string &metaNormalizedName)
Given a type name normalized by ROOT meta, renormalize it for RNTuple. E.g., insert std::prefix.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
ENTupleStructure
The fields in the RNTuple data model tree can carry different structural information about the type s...
std::size_t fOffset
offset in fStagingArea
std::unique_ptr< RFieldBase > fField
The field used to read the on-disk data.
Input parameter to RFieldBase::ReadBulk() and RFieldBase::ReadBulkImpl().
RCreateObjectDeleter< void > deleter
Helper types to present an offset column as array of collection sizes.