12#ifndef ROOT_TTreeReaderArray
13#define ROOT_TTreeReaderArray
44 bool suppressErrorsForMissingBranch =
false);
50 std::unique_ptr<TVirtualCollectionReader>
fImpl;
81 template <
typename ReaderArrayType>
88 using pointer = std::conditional_t<std::is_const<ReaderArrayType>::value,
const T *, T *>;
89 using reference = std::conditional_t<std::is_const<ReaderArrayType>::value,
const T &, T &>;
101 : fArray(array), fIndex(
index),
fSize(fArray ? fArray->GetSize() : 0u)
118 R__ASSERT(fArray &&
"invalid iterator!");
119 return fArray->
At(fIndex);
127 if (!IsValid() && !other.
IsValid())
129 return fArray == other.
fArray && fIndex == other.
fIndex;
175 const auto index = std::ptrdiff_t(fIndex);
176 const auto newIndex =
index >=
n ?
index -
n : std::numeric_limits<
decltype(fIndex)>::max();
195 bool IsValid()
const {
return fArray !=
nullptr; }
203 : TTreeReaderArrayBase(&tr, branchname,
TDictionary::GetDictionary(typeid(T))) {}
205 T &
At(std::size_t idx) {
return *
static_cast<T *
>(
UntypedAt(idx)); }
206 const T &
At(std::size_t idx)
const {
return *
static_cast<T *
>(
UntypedAt(idx)); }
208 const T &
operator[](std::size_t idx)
const {
return At(idx); }
218#define R__TTreeReaderArray_TypeString(T) #T
220#undef R__TTreeReaderArray_TypeString
#define R__ASSERT(e)
Checks condition e and reports a fatal error if it's false.
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
#define R__TTreeReaderArray_TypeString(T)
Base class of TTreeReaderArray.
void CreateProxy() override
Create the proxy object for our branch.
std::unique_ptr< TVirtualCollectionReader > fImpl
bool GetBranchAndLeaf(TBranch *&branch, TLeaf *&myLeaf, TDictionary *&branchActualType, bool suppressErrorsForMissingBranch=false)
Determine the branch / leaf and its type; reset fProxy / fSetupStatus on error.
std::size_t GetSize() const
TTreeReaderArrayBase(TTreeReader *reader, const char *branchname, TDictionary *dict)
void * UntypedAt(std::size_t idx) const
EReadStatus GetReadStatus() const override
void SetImpl(TBranch *branch, TLeaf *myLeaf)
Create the TVirtualCollectionReader object for our branch.
const char * GetBranchContentDataType(TBranch *branch, TString &contentTypeName, TDictionary *&dict)
Access a branch's collection content (not the collection itself) through a proxy.
Base class of TTreeReaderValue.
Detail::TBranchProxy * GetProxy() const
@ kReadError
Problem reading data.
A TTree is a list of TBranches.
This class defines an abstract interface that must be implemented by all classes that contain diction...
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
Random access iterator to the elements of a TTreeReaderArray.
Iterator_t()
Default ctor: constructs a past-the-end iterator.
std::size_t fIndex
Current index in the array.
bool operator>(const Iterator_t &other) const
reference operator[](std::size_t index) const
Iterator_t & operator--()
Pre-decrement operator.
bool operator!=(const Iterator_t &other) const
std::ptrdiff_t difference_type
Iterator_t operator++(int)
Post-increment operator.
bool operator>=(const Iterator_t &other) const
reference operator*() const
Iterator_t(const Iterator_t &)=default
Iterator_t & operator++()
Pre-increment operator.
Iterator_t operator--(int)
Post-decrement operator.
std::size_t fSize
Size of the TTreeReaderArray.
Iterator_t & operator-=(std::ptrdiff_t n)
Iterator_t & operator=(Iterator_t &&)=default
std::conditional_t< std::is_const< ReaderArrayType >::value, const T *, T * > pointer
bool operator<(const Iterator_t &other) const
std::ptrdiff_t operator-(const Iterator_t &other) const
TTreeReaderArray * fArray
The array iterated over; nullptr if invalid/past-the-end.
Iterator_t & operator=(const Iterator_t &)=default
std::conditional_t< std::is_const< ReaderArrayType >::value, const T &, T & > reference
Iterator_t & operator+=(std::ptrdiff_t n)
Iterator_t(Iterator_t &&)=default
bool operator<=(const Iterator_t &other) const
Iterator_t operator-(std::ptrdiff_t n) const
bool operator==(const Iterator_t &other) const
friend auto operator+(std::ptrdiff_t n, const Iterator_t &it) -> decltype(it+n)
Iterator_t operator+(std::ptrdiff_t n) const
std::random_access_iterator_tag iterator_category
pointer operator->() const
Iterator_t(std::size_t index, TTreeReaderArray *array)
Construct iterator.
Iterator_t(std::size_t index, const TTreeReaderArray *array)
Construct iterator from a const TTreeReaderArray.
An interface for reading collections stored in ROOT columnar datasets.
const char * GetDerivedTypeName() const override
TTreeReaderArray(TTreeReader &tr, const char *branchname)
Create an array reader of branch "branchname" for TTreeReader "tr".
const_iterator cend() const
const_iterator cbegin() const
const T & At(std::size_t idx) const
const_iterator begin() const
const T & operator[](std::size_t idx) const
T & operator[](std::size_t idx)
const_iterator end() const
A simple, robust and fast interface to read values from ROOT columnar datasets such as TTree,...
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...