16#ifndef ROOT7_RNTupleView
17#define ROOT7_RNTupleView
27#include <unordered_map>
30namespace Experimental {
119template <
typename FieldT,
typename SFINAE =
void>
122template <
typename FieldT>
123inline constexpr bool isMappable<FieldT, std::void_t<decltype(std::declval<FieldT>().Map(
NTupleSize_t{}))>> =
true;
156 :
fField(pageSource->GetSharedDescriptorGuard()->GetFieldDescriptor(fieldId).GetFieldName()),
159 fField.SetOnDiskId(fieldId);
160 fField.ConnectPageSource(*pageSource);
162 throw RException(
R__FAIL(
"view disallowed on field with mappable type and read callback"));
166 f.SetOnDiskId(subFieldId);
167 f.ConnectPageSource(*pageSource);
181 if constexpr (Internal::isMappable<FieldT>)
182 return *
fField.Map(globalIndex);
191 if constexpr (Internal::isMappable<FieldT>)
192 return *
fField.Map(clusterIndex);
200 template <
typename C = T, std::enable_if_t<Internal::isMappable<FieldT>, C*> =
nullptr>
203 return fField.MapV(globalIndex, nItems);
207 template <
typename C = T, std::enable_if_t<Internal::isMappable<FieldT>, C*> =
nullptr>
210 return fField.MapV(clusterIndex, nItems);
258 template <
typename T>
262 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
271 throw RException(
R__FAIL(
"no field named '" + std::string(fieldName) +
"' in RNTuple '" +
#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
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 r
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t index
Points to an object with RNTuple I/O support and keeps a pointer to the corresponding field.
void Read(NTupleSize_t globalIndex)
static constexpr int kTraitMappable
A field of a fundamental type that can be directly mapped via RField<T>::Map(), i....
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
Base class for all ROOT issued exceptions.
void GetCollectionInfo(NTupleSize_t globalIndex, RClusterIndex *collectionStart, ClusterSize_t *size)
Special help for offset fields.
Classes with dictionaries that can be inspected by TClass.
bool operator==(const iterator &rh) const
RIterator(const RClusterIndex &index)
bool operator!=(const iterator &rh) const
std::forward_iterator_tag iterator_category
Used to loop over entries of collections in a single cluster.
const ClusterSize_t::ValueType fStart
const DescriptorId_t fClusterId
RNTupleClusterRange(DescriptorId_t clusterId, ClusterSize_t::ValueType start, ClusterSize_t::ValueType end)
const ClusterSize_t::ValueType fEnd
std::string GetName() const
DescriptorId_t FindFieldId(std::string_view fieldName, DescriptorId_t parentId) const
bool operator==(const iterator &rh) const
NTupleSize_t difference_type
RIterator(NTupleSize_t index)
bool operator!=(const iterator &rh) const
std::forward_iterator_tag iterator_category
Used to loop over indexes (entries or collections) between start and end.
const NTupleSize_t fStart
RNTupleGlobalRange(NTupleSize_t start, NTupleSize_t end)
An RNTuple that is used to read data from storage.
A view for a collection, that can itself generate new ntuple views for its nested fields.
RNTupleClusterRange GetCollectionRange(const RClusterIndex &clusterIndex)
RNTupleViewCollection GetViewCollection(std::string_view fieldName)
Raises an exception if there is no field with the given name.
~RNTupleViewCollection()=default
RNTupleViewCollection(RNTupleViewCollection &&other)=default
RNTupleViewCollection & operator=(RNTupleViewCollection &&other)=default
RNTupleViewCollection & operator=(const RNTupleViewCollection &other)=delete
RNTupleViewCollection(DescriptorId_t fieldId, Detail::RPageSource *source)
ClusterSize_t operator()(const RClusterIndex &clusterIndex)
ClusterSize_t operator()(NTupleSize_t globalIndex)
RNTupleView< T > GetView(std::string_view fieldName)
Raises an exception if there is no field with the given name.
RNTupleClusterRange GetCollectionRange(NTupleSize_t globalIndex)
Detail::RPageSource * fSource
DescriptorId_t fCollectionFieldId
RNTupleViewCollection(const RNTupleViewCollection &other)=delete
An RNTupleView provides read-only access to a single field of the ntuple.
RNTupleView & operator=(RNTupleView &&other)=default
const C * MapV(NTupleSize_t globalIndex, NTupleSize_t &nItems)
RNTupleView & operator=(const RNTupleView &other)=delete
RNTupleView(RNTupleView &&other)=default
const C * MapV(const RClusterIndex &clusterIndex, NTupleSize_t &nItems)
Detail::RFieldBase::RValue fValue
Used as a Read() destination for fields that are not mappable.
const T & operator()(const RClusterIndex &clusterIndex)
RNTupleView(const RNTupleView &other)=delete
RNTupleView(DescriptorId_t fieldId, Detail::RPageSource *pageSource)
const T & operator()(NTupleSize_t globalIndex)
FieldT fField
fFieldId has fParent always set to null; views access nested fields without looking at the parent
friend class RNTupleViewCollection
RNTupleGlobalRange GetFieldRange() const
constexpr bool isMappable
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 NTupleSize_t kInvalidNTupleIndex
constexpr DescriptorId_t kInvalidDescriptorId
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
Wrap the integer in a struct in order to avoid template specialization clash with std::uint32_t.