Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RNTupleAttrSetReader Class Referencefinal

Class used to read a RNTupleAttrSet in the context of a RNTupleReader.

An RNTupleAttrSetReader is created via RNTupleReader::OpenAttributeSet. Once created, it may outlive its parent Reader. Reading Attributes works similarly to reading regular RNTuple entries: you can either create entries or just use the AttrSetReader Model's default entry and load data into it via LoadEntry.

~~ {.cpp}

Reading Attributes via RNTupleAttrSetReader

Assuming reader is a RNTupleReader: auto attrSet = reader->OpenAttributeSet("MyAttrSet");

Just like how you would read a regular RNTuple, first get the pointer to the fields you want to read: auto &attrEntry = attrSet->GetModel().GetDefaultEntry(); auto pAttr = attrEntry->GetPtr<std::string>("myAttr");

Then select which attributes you want to read. E.g. read all attributes linked to the entry at index 10: for (auto idx : attrSet->GetAttributes(10)) { attrSet->LoadEntry(idx); cout << "entry " << idx << " has attribute " << *pAttr << "\n"; } ~~

Definition at line 114 of file RNTupleAttrReading.hxx.

Public Member Functions

 RNTupleAttrSetReader (const RNTupleAttrSetReader &)=delete
 
 RNTupleAttrSetReader (RNTupleAttrSetReader &&)=default
 
 ~RNTupleAttrSetReader ()=default
 
std::unique_ptr< REntryCreateEntry ()
 Creates an entry suitable for use with LoadEntry.
 
RNTupleAttrEntryIterable GetAttributes ()
 Returns all the attributes in this Set. The returned attributes are sorted by entry range start.
 
RNTupleAttrEntryIterable GetAttributes (NTupleSize_t entryIndex)
 Returns all the attributes whose range contains index entryIndex.
 
RNTupleAttrEntryIterable GetAttributesContainingRange (NTupleSize_t startEntry, NTupleSize_t endEntry)
 Returns all the attributes whose range fully contains [startEntry, endEntry)
 
RNTupleAttrEntryIterable GetAttributesInRange (NTupleSize_t startEntry, NTupleSize_t endEntry)
 Returns all the attributes whose range is fully contained in [startEntry, endEntry)
 
const ROOT::RNTupleDescriptorGetDescriptor () const
 Returns the read-only descriptor of this attribute set.
 
const ROOT::RNTupleModelGetModel () const
 Returns the read-only model of this attribute set.
 
std::size_t GetNEntries () const
 Returns the number of all attribute entries in this attribute set.
 
RNTupleAttrRange LoadEntry (NTupleSize_t index)
 Loads the attribute entry at position index into the default entry.
 
RNTupleAttrRange LoadEntry (NTupleSize_t index, REntry &entry)
 Loads the attribute entry at position index into the given entry.
 
RNTupleAttrSetReaderoperator= (const RNTupleAttrSetReader &)=delete
 
RNTupleAttrSetReaderoperator= (RNTupleAttrSetReader &&)=default
 

Private Member Functions

 RNTupleAttrSetReader (std::unique_ptr< RNTupleReader > reader, std::uint16_t vSchemaMajor)
 

Private Attributes

std::vector< std::pair< RNTupleAttrRange, NTupleSize_t > > fEntryRanges
 List containing pairs { entryRange, entryIndex }, used to quickly find out which entries in the Attribute RNTuple contain entries that overlap a given range.
 
std::unique_ptr< RNTupleReaderfReader
 The internal Reader used to read the AttributeSet RNTuple.
 
std::unique_ptr< ROOT::RNTupleModelfUserModel
 The reconstructed user model.
 

Friends

class RNTupleAttrEntryIterable
 
class ROOT::RNTupleReader
 

#include <ROOT/RNTupleAttrReading.hxx>

Constructor & Destructor Documentation

◆ RNTupleAttrSetReader() [1/3]

ROOT::Experimental::RNTupleAttrSetReader::RNTupleAttrSetReader ( std::unique_ptr< RNTupleReader > reader,
std::uint16_t vSchemaMajor )
private

Definition at line 20 of file RNTupleAttrReading.cxx.

◆ RNTupleAttrSetReader() [2/3]

ROOT::Experimental::RNTupleAttrSetReader::RNTupleAttrSetReader ( const RNTupleAttrSetReader & )
delete

◆ RNTupleAttrSetReader() [3/3]

ROOT::Experimental::RNTupleAttrSetReader::RNTupleAttrSetReader ( RNTupleAttrSetReader && )
default

◆ ~RNTupleAttrSetReader()

ROOT::Experimental::RNTupleAttrSetReader::~RNTupleAttrSetReader ( )
default

Member Function Documentation

◆ CreateEntry()

std::unique_ptr< ROOT::REntry > ROOT::Experimental::RNTupleAttrSetReader::CreateEntry ( )

Creates an entry suitable for use with LoadEntry.

This is a convenience method equivalent to GetModel().CreateEntry().

Definition at line 112 of file RNTupleAttrReading.cxx.

◆ GetAttributes() [1/2]

ROOT::Experimental::RNTupleAttrEntryIterable ROOT::Experimental::RNTupleAttrSetReader::GetAttributes ( )

Returns all the attributes in this Set. The returned attributes are sorted by entry range start.

Definition at line 159 of file RNTupleAttrReading.cxx.

◆ GetAttributes() [2/2]

ROOT::Experimental::RNTupleAttrEntryIterable ROOT::Experimental::RNTupleAttrSetReader::GetAttributes ( NTupleSize_t entryIndex)

Returns all the attributes whose range contains index entryIndex.

Definition at line 152 of file RNTupleAttrReading.cxx.

◆ GetAttributesContainingRange()

ROOT::Experimental::RNTupleAttrEntryIterable ROOT::Experimental::RNTupleAttrSetReader::GetAttributesContainingRange ( NTupleSize_t startEntry,
NTupleSize_t endEntry )

Returns all the attributes whose range fully contains [startEntry, endEntry)

Definition at line 118 of file RNTupleAttrReading.cxx.

◆ GetAttributesInRange()

ROOT::Experimental::RNTupleAttrEntryIterable ROOT::Experimental::RNTupleAttrSetReader::GetAttributesInRange ( NTupleSize_t startEntry,
NTupleSize_t endEntry )

Returns all the attributes whose range is fully contained in [startEntry, endEntry)

Definition at line 135 of file RNTupleAttrReading.cxx.

◆ GetDescriptor()

const ROOT::RNTupleDescriptor & ROOT::Experimental::RNTupleAttrSetReader::GetDescriptor ( ) const

Returns the read-only descriptor of this attribute set.

Definition at line 72 of file RNTupleAttrReading.cxx.

◆ GetModel()

const ROOT::RNTupleModel & ROOT::Experimental::RNTupleAttrSetReader::GetModel ( ) const
inline

Returns the read-only model of this attribute set.

Definition at line 139 of file RNTupleAttrReading.hxx.

◆ GetNEntries()

std::size_t ROOT::Experimental::RNTupleAttrSetReader::GetNEntries ( ) const
inline

Returns the number of all attribute entries in this attribute set.

Definition at line 153 of file RNTupleAttrReading.hxx.

◆ LoadEntry() [1/2]

ROOT::Experimental::RNTupleAttrRange ROOT::Experimental::RNTupleAttrSetReader::LoadEntry ( ROOT::NTupleSize_t index)

Loads the attribute entry at position index into the default entry.

Returns the range of main RNTuple entries that the loaded set of attributes refers to.

Definition at line 106 of file RNTupleAttrReading.cxx.

◆ LoadEntry() [2/2]

ROOT::Experimental::RNTupleAttrRange ROOT::Experimental::RNTupleAttrSetReader::LoadEntry ( ROOT::NTupleSize_t index,
REntry & entry )

Loads the attribute entry at position index into the given entry.

Returns the range of main RNTuple entries that the loaded set of attributes refers to.

Definition at line 78 of file RNTupleAttrReading.cxx.

◆ operator=() [1/2]

RNTupleAttrSetReader & ROOT::Experimental::RNTupleAttrSetReader::operator= ( const RNTupleAttrSetReader & )
delete

◆ operator=() [2/2]

RNTupleAttrSetReader & ROOT::Experimental::RNTupleAttrSetReader::operator= ( RNTupleAttrSetReader && )
default

Friends And Related Symbol Documentation

◆ RNTupleAttrEntryIterable

friend class RNTupleAttrEntryIterable
friend

Definition at line 116 of file RNTupleAttrReading.hxx.

◆ ROOT::RNTupleReader

friend class ROOT::RNTupleReader
friend

Definition at line 115 of file RNTupleAttrReading.hxx.

Member Data Documentation

◆ fEntryRanges

std::vector<std::pair<RNTupleAttrRange, NTupleSize_t> > ROOT::Experimental::RNTupleAttrSetReader::fEntryRanges
private

List containing pairs { entryRange, entryIndex }, used to quickly find out which entries in the Attribute RNTuple contain entries that overlap a given range.

The list is sorted by range start, i.e. entryRange.first.Start().

Definition at line 121 of file RNTupleAttrReading.hxx.

◆ fReader

std::unique_ptr<RNTupleReader> ROOT::Experimental::RNTupleAttrSetReader::fReader
private

The internal Reader used to read the AttributeSet RNTuple.

Definition at line 123 of file RNTupleAttrReading.hxx.

◆ fUserModel

std::unique_ptr<ROOT::RNTupleModel> ROOT::Experimental::RNTupleAttrSetReader::fUserModel
private

The reconstructed user model.

Definition at line 125 of file RNTupleAttrReading.hxx.

Libraries for ROOT::Experimental::RNTupleAttrSetReader:

The documentation for this class was generated from the following files: