16#ifndef ROOT7_RNTupleView
17#define ROOT7_RNTupleView
29#include <unordered_map>
32namespace Experimental {
41RNTupleGlobalRange
GetFieldRange(
const RFieldBase &field,
const RPageSource &pageSource);
69 std::unique_ptr<RFieldBase> field;
73 if constexpr (std::is_void_v<T>) {
76 field = std::make_unique<RField<T>>(fieldDesc.GetFieldName());
79 field->SetOnDiskId(fieldId);
231 throw RException(
R__FAIL(
"type mismatch for field " + fieldDesc.GetFieldName() +
": " +
234 RField<T> field(fieldDesc.GetFieldName());
274 fField.SetOnDiskId(fieldId);
280 std::string fieldName;
286 R__FAIL(
"invalid attemt to create collection view on non-collection field " + fieldDesc.GetFieldName()));
288 fieldName = fieldDesc.GetFieldName();
298 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in collection '" +
299 descGuard->GetQualifiedFieldName(
fField.GetOnDiskId()) +
"'"));
314 fField.GetCollectionInfo(globalIndex, &collectionStart, &
size);
322 fField.GetCollectionInfo(clusterIndex, &collectionStart, &
size);
328 template <
typename T>
337 template <
typename T>
#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
const RNTupleDescriptor & GetRef() const
Abstract interface to read data from an ntuple.
const RSharedDescriptorGuard GetSharedDescriptorGuard() const
Takes the read lock for the descriptor.
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
DescriptorId_t GetClusterId() const
ClusterSize_t::ValueType GetIndex() const
Similar to RValue but manages an array of consecutive values.
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
void Read(NTupleSize_t globalIndex)
void EmplaceNew()
Replace the current object pointer by a pointer to a new object constructed by the field.
void BindRawPtr(void *rawPtr)
void Bind(std::shared_ptr< void > objPtr)
A field translates read and write calls from/to underlying columns to/from tree values.
void SetOnDiskId(DescriptorId_t id)
std::unique_ptr< RFieldBase > CreateField(const RNTupleDescriptor &ntplDesc, bool continueOnError=false) const
In general, we create a field simply from the C++ type name.
Classes with dictionaries that can be inspected by TClass.
Used to loop over entries of collections in a single cluster.
A view for a collection, that can itself generate new ntuple views for its nested fields.
RNTupleCollectionView & operator=(RNTupleCollectionView &&other)=default
RNTupleClusterRange GetCollectionRange(RClusterIndex clusterIndex)
RNTupleCollectionView(RNTupleCollectionView &&other)=default
RNTupleCollectionView GetCollectionView(std::string_view fieldName)
Raises an exception if there is no field with the given name.
RNTupleCollectionView & operator=(const RNTupleCollectionView &other)=delete
RField< RNTupleCardinality< std::uint64_t > > fField
Internal::RPageSource * fSource
RNTupleView< T > GetView(std::string_view fieldName)
Raises an exception if there is no field with the given name.
~RNTupleCollectionView()=default
RFieldBase::RValue fValue
std::uint64_t operator()(RClusterIndex clusterIndex)
DescriptorId_t GetFieldId(std::string_view fieldName)
RNTupleDirectAccessView< T > GetDirectAccessView(std::string_view fieldName)
Raises an exception if there is no field with the given name.
RNTupleCollectionView(DescriptorId_t fieldId, const std::string &fieldName, Internal::RPageSource *source)
RNTupleClusterRange GetCollectionRange(NTupleSize_t globalIndex)
RNTupleCollectionView(const RNTupleCollectionView &other)=delete
std::uint64_t operator()(NTupleSize_t globalIndex)
static RNTupleCollectionView Create(DescriptorId_t fieldId, Internal::RPageSource *source)
DescriptorId_t FindFieldId(std::string_view fieldName, DescriptorId_t parentId) const
const RFieldDescriptor & GetFieldDescriptor(DescriptorId_t fieldId) const
A view variant that provides direct access to the I/O buffers.
const T & operator()(NTupleSize_t globalIndex)
RNTupleDirectAccessView & operator=(const RNTupleDirectAccessView &other)=delete
RNTupleDirectAccessView(RField< T > field, RNTupleGlobalRange range)
RNTupleGlobalRange GetFieldRange() const
static RField< T > CreateField(DescriptorId_t fieldId, Internal::RPageSource &pageSource)
const RFieldBase & GetField() const
RNTupleDirectAccessView(const RNTupleDirectAccessView &other)=delete
RNTupleDirectAccessView(RNTupleDirectAccessView &&other)=default
RNTupleDirectAccessView & operator=(RNTupleDirectAccessView &&other)=default
~RNTupleDirectAccessView()=default
const T & operator()(RClusterIndex clusterIndex)
RNTupleGlobalRange fFieldRange
Used to loop over indexes (entries or collections) between start and end.
An RNTuple that is used to read data from storage.
An RNTupleView provides read-only access to a single field of the ntuple.
const RFieldBase & GetField() const
RNTupleViewBase(const RNTupleViewBase &other)=delete
RNTupleViewBase & operator=(const RNTupleViewBase &other)=delete
RFieldBase::RValue fValue
RNTupleViewBase(RNTupleViewBase &&other)=default
void BindRawPtr(T *rawPtr)
std::unique_ptr< RFieldBase > fField
const RFieldBase::RValue & GetValue() const
RNTupleViewBase(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range, std::shared_ptr< T > objPtr)
RNTupleGlobalRange fFieldRange
RNTupleViewBase(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range)
void Bind(std::shared_ptr< T > objPtr)
RNTupleViewBase & operator=(RNTupleViewBase &&other)=default
RNTupleViewBase(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range, T *rawPtr)
RNTupleGlobalRange GetFieldRange() const
~RNTupleViewBase()=default
RFieldBase::RBulk CreateBulk()
static std::unique_ptr< RFieldBase > CreateField(DescriptorId_t fieldId, Internal::RPageSource &pageSource)
void operator()(NTupleSize_t globalIndex)
RNTupleView(RNTupleView &&other)=default
RNTupleView(const RNTupleView &other)=delete
RNTupleView(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range)
RNTupleView & operator=(RNTupleView &&other)=default
void operator()(RClusterIndex clusterIndex)
RNTupleView(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range, void *rawPtr)
RNTupleView & operator=(const RNTupleView &other)=delete
RNTupleView(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range, std::shared_ptr< void > objPtr)
An RNTupleView for a known type.
RNTupleView & operator=(RNTupleView &&other)=default
const T & operator()(RClusterIndex clusterIndex)
RNTupleView(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range)
RNTupleView & operator=(const RNTupleView &other)=delete
RNTupleView(RNTupleView &&other)=default
RNTupleView(const RNTupleView &other)=delete
RNTupleView(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range, std::shared_ptr< T > objPtr)
const T & operator()(NTupleSize_t globalIndex)
RNTupleView(std::unique_ptr< RFieldBase > field, RNTupleGlobalRange range, T *rawPtr)
Base class for all ROOT issued exceptions.
RNTupleGlobalRange GetFieldRange(const RFieldBase &field, const RPageSource &pageSource)
Helper to get the iteration space of the given field that needs to be connected to the given page sou...
void CallConnectPageSourceOnField(RFieldBase &, RPageSource &)
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr DescriptorId_t kInvalidDescriptorId
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.