16#ifndef ROOT7_RNTupleView
17#define ROOT7_RNTupleView
27#include <unordered_map>
30namespace Experimental {
45 class RIterator :
public std::iterator<std::forward_iterator_tag, NTupleSize_t> {
81 class RIterator :
public std::iterator<std::forward_iterator_tag, RClusterIndex> {
107template <
class FieldT>
113 template<
class C,
typename ... ArgsT>
114 using MapOverloadT =
decltype(std::declval<C>().Map(std::declval<ArgsT>() ...)) (
C::*)(ArgsT ...);
153 :
fField(pageSource->GetDescriptor().GetFieldDescriptor(fieldId).GetFieldName()),
fValue(
fField.GenerateValue())
156 std::unordered_map<const Detail::RFieldBase *, DescriptorId_t> field2Id;
157 field2Id[&
fField] = fieldId;
161 field2Id[&
f] = subFieldId;
174 template <
typename C = T>
175 typename std::enable_if_t<Internal::IsMappable<FieldT>::value,
const C&>
178 template <
typename C = T>
179 typename std::enable_if_t<!Internal::IsMappable<FieldT>::value,
const C&>
185 template <
typename C = T>
186 typename std::enable_if_t<Internal::IsMappable<FieldT>::value,
const C&>
189 template <
typename C = T>
190 typename std::enable_if_t<!Internal::IsMappable<FieldT>::value,
const C&>
240 template <
typename T>
static void Connect(DescriptorId_t fieldId, RPageStorage &pageStorage, RFieldBase &field)
Abstract interface to read data from an ntuple.
const RNTupleDescriptor & GetDescriptor() const
decltype(std::declval< C >().Map(std::declval< ArgsT >() ...))(C::*)(ArgsT ...) MapOverloadT
static RFailure Test(...)
static constexpr bool value
static RSuccess Test(MapOverloadT< C, NTupleSize_t >)
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
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
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
DescriptorId_t FindFieldId(std::string_view fieldName, DescriptorId_t parentId) const
bool operator==(const iterator &rh) const
RIterator(NTupleSize_t index)
bool operator!=(const iterator &rh) const
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)
~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)
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.
Detail::RFieldValue fValue
Used as a Read() destination for fields that are not mappable.
RNTupleView & operator=(RNTupleView &&other)=default
std::enable_if_t< Internal::IsMappable< FieldT >::value, const C & > operator()(NTupleSize_t globalIndex)
std::enable_if_t<!Internal::IsMappable< FieldT >::value, const C & > operator()(const RClusterIndex &clusterIndex)
RNTupleView & operator=(const RNTupleView &other)=delete
RNTupleView(RNTupleView &&other)=default
RNTupleView(const RNTupleView &other)=delete
RNTupleView(DescriptorId_t fieldId, Detail::RPageSource *pageSource)
std::enable_if_t< Internal::IsMappable< FieldT >::value, const C & > operator()(const RClusterIndex &clusterIndex)
std::enable_if_t<!Internal::IsMappable< FieldT >::value, const C & > 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
basic_string_view< char > string_view
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
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Wrap the 32bit integer in a struct in order to avoid template specialization clash with std::uint32_t...