Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
RNTupleRange.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleRange.hxx
2/// \author Jakob Blomer <jblomer@cern.ch>
3/// \date 2018-10-05
4
5/*************************************************************************
6 * Copyright (C) 1995-2019, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_RNTupleRange
14#define ROOT_RNTupleRange
15
16#include <ROOT/RNTupleTypes.hxx>
17
18namespace ROOT {
19
20// clang-format off
21/**
22\class ROOT::RNTupleGlobalRange
23\ingroup NTuple
24\brief Used to loop over indexes (entries or collections) between start and end
25*/
26// clang-format on
28private:
31
32public:
33 class RIterator {
34 private:
36
37 public:
39 using iterator_category = std::input_iterator_tag;
41 using difference_type = std::ptrdiff_t;
42 using pointer = const ROOT::NTupleSize_t *;
44
45 RIterator() = default;
46 explicit RIterator(ROOT::NTupleSize_t index) : fIndex(index) {}
47 ~RIterator() = default;
48
49 iterator operator++(int) /* postfix */
50 {
51 auto r = *this;
52 fIndex++;
53 return r;
54 }
55 iterator &operator++() /* prefix */
56 {
57 ++fIndex;
58 return *this;
59 }
60 reference operator*() const { return fIndex; }
61 pointer operator->() const { return &fIndex; }
62 bool operator==(const iterator &rh) const { return fIndex == rh.fIndex; }
63 bool operator!=(const iterator &rh) const { return fIndex != rh.fIndex; }
64 };
65
67 RIterator begin() const { return RIterator(fStart); }
68 RIterator end() const { return RIterator(fEnd); }
69 ROOT::NTupleSize_t size() const { return fEnd - fStart; }
71};
72
73// clang-format off
74/**
75\class ROOT::RNTupleLocalRange
76\ingroup NTuple
77\brief Used to loop over entries of collections in a single cluster
78*/
79// clang-format on
81private:
85
86public:
87 class RIterator {
88 private:
90
91 public:
93 using iterator_category = std::input_iterator_tag;
95 using difference_type = std::ptrdiff_t;
96 using pointer = const RNTupleLocalIndex *;
98
99 RIterator() = default;
100 explicit RIterator(RNTupleLocalIndex localIndex) : fLocalIndex(localIndex) {}
101 ~RIterator() = default;
102
103 iterator operator++(int) /* postfix */
104 {
105 auto r = *this;
106 fLocalIndex++;
107 return r;
108 }
109 iterator &operator++() /* prefix */
110 {
111 fLocalIndex++;
112 return *this;
113 }
114 reference operator*() const { return fLocalIndex; }
115 pointer operator->() const { return &fLocalIndex; }
116 bool operator==(const iterator &rh) const { return fLocalIndex == rh.fLocalIndex; }
117 bool operator!=(const iterator &rh) const { return fLocalIndex != rh.fLocalIndex; }
118 };
119
126 ROOT::NTupleSize_t size() const { return fEnd - fStart; }
127};
128
129} // namespace ROOT
130
131#endif
ROOT::R::TRInterface & r
Definition Object.C:4
start
Definition Rotated.cxx:223
const ROOT::NTupleSize_t & reference
bool operator==(const iterator &rh) const
std::input_iterator_tag iterator_category
const ROOT::NTupleSize_t * pointer
RIterator(ROOT::NTupleSize_t index)
bool operator!=(const iterator &rh) const
ROOT::NTupleSize_t size() const
ROOT::NTupleSize_t fStart
ROOT::NTupleSize_t fEnd
RNTupleGlobalRange(ROOT::NTupleSize_t start, ROOT::NTupleSize_t end)
RIterator begin() const
RIterator end() const
Addresses a column element or field item relative to a particular cluster, instead of a global NTuple...
std::input_iterator_tag iterator_category
const RNTupleLocalIndex * pointer
RIterator(RNTupleLocalIndex localIndex)
const RNTupleLocalIndex & reference
bool operator==(const iterator &rh) const
bool operator!=(const iterator &rh) const
ROOT::NTupleSize_t fStart
ROOT::NTupleSize_t size() const
ROOT::DescriptorId_t fClusterId
ROOT::NTupleSize_t fEnd
RNTupleLocalRange(ROOT::DescriptorId_t clusterId, ROOT::NTupleSize_t start, ROOT::NTupleSize_t end)
RIterator end() const
RIterator begin() const
std::uint64_t DescriptorId_t
Distriniguishes elements of the same type within a descriptor, e.g. different fields.
constexpr NTupleSize_t kInvalidNTupleIndex
std::uint64_t NTupleSize_t
Integer type long enough to hold the maximum number of entries in a column.