LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
art::const_AssnsIter< L, R, D, Dir > Class Template Reference

#include "AssnsIter.h"

Public Types

using iterator_category = std::random_access_iterator_tag
 
using value_type = art::AssnsNode< L, R, D >
 
using pointer = value_type const *
 
using reference = value_type const &
 
using difference_type = std::ptrdiff_t
 

Public Member Functions

 const_AssnsIter ()=default
 
 const_AssnsIter (art::Assns< L, R, D > const &assns)
 
 const_AssnsIter (art::Assns< L, R, D > const &assns, std::size_t const i)
 
reference operator* () const
 
pointer operator-> () const
 
const_AssnsIter< L, R, D, Dir > & operator++ ()
 
const_AssnsIter< L, R, D, Dir > operator++ (int)
 
const_AssnsIter< L, R, D, Dir > & operator-- ()
 
const_AssnsIter< L, R, D, Dir > operator-- (int)
 
bool operator== (art::const_AssnsIter< L, R, D, Dir > const &iter) const
 
bool operator!= (art::const_AssnsIter< L, R, D, Dir > const &iter) const
 
const_AssnsIter< L, R, D, Dir > & operator+= (std::size_t i)
 
const_AssnsIter< L, R, D, Dir > operator+ (std::size_t i) const
 
const_AssnsIter< L, R, D, Dir > & operator-= (std::size_t i)
 
const_AssnsIter< L, R, D, Dir > operator- (std::size_t i) const
 
std::size_t operator- (art::const_AssnsIter< L, R, D, Dir > const &iter1) const
 
value_type operator[] (std::size_t i) const
 
bool operator< (art::const_AssnsIter< L, R, D, Dir > const &iter) const
 
bool operator<= (art::const_AssnsIter< L, R, D, Dir > const &iter) const
 
bool operator> (art::const_AssnsIter< L, R, D, Dir > const &iter) const
 
bool operator>= (art::const_AssnsIter< L, R, D, Dir > const &iter) const
 
std::size_t getIndex () const
 

Private Attributes

art::Assns< L, R, D > const * coll_ {nullptr}
 
std::size_t index_ {-1ull}
 
AssnsNode< L, R, D > node_ {}
 

Detailed Description

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
class art::const_AssnsIter< L, R, D, Dir >

Definition at line 28 of file AssnsIter.h.

Member Typedef Documentation

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
using art::const_AssnsIter< L, R, D, Dir >::difference_type = std::ptrdiff_t

Definition at line 34 of file AssnsIter.h.

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
using art::const_AssnsIter< L, R, D, Dir >::iterator_category = std::random_access_iterator_tag

Definition at line 30 of file AssnsIter.h.

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
using art::const_AssnsIter< L, R, D, Dir >::pointer = value_type const*

Definition at line 32 of file AssnsIter.h.

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
using art::const_AssnsIter< L, R, D, Dir >::reference = value_type const&

Definition at line 33 of file AssnsIter.h.

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
using art::const_AssnsIter< L, R, D, Dir >::value_type = art::AssnsNode<L, R, D>

Definition at line 31 of file AssnsIter.h.

Constructor & Destructor Documentation

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter ( )
default
template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter ( art::Assns< L, R, D > const &  assns)
inlineexplicit

Definition at line 37 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

38  : coll_{&assns}, index_{assns.size()}
39  {}
size_type size() const
Definition: Assns.h:500
std::size_t index_
Definition: AssnsIter.h:74
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:73

Member Function Documentation

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
std::size_t art::const_AssnsIter< L, R, D, Dir >::getIndex ( ) const
inline

Definition at line 67 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

68  {
69  return index_;
70  };
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
bool art::const_AssnsIter< L, R, D, Dir >::operator!= ( art::const_AssnsIter< L, R, D, Dir > const &  iter) const

Definition at line 181 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

183  {
184  return !(index_ == iter.index_);
185  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir >::reference art::const_AssnsIter< L, R, D, Dir >::operator* ( ) const

Definition at line 111 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::coll_, art::const_AssnsIter< L, R, D, Dir >::index_, and art::const_AssnsIter< L, R, D, Dir >::node_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

112  {
113  auto const index = index_for_dereferencing<Dir>(index_);
114  node_.first = (*coll_)[index].first;
115  node_.second = (*coll_)[index].second;
116  node_.data = &(coll_->data(index));
117  return node_;
118  }
std::size_t index_
Definition: AssnsIter.h:74
AssnsNode< L, R, D > node_
Definition: AssnsIter.h:75
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:73
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > art::const_AssnsIter< L, R, D, Dir >::operator+ ( std::size_t  i) const

Definition at line 201 of file AssnsIter.h.

References tmp.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

202  {
204  tmp.index_ = tmp.index_ + signed_one<Dir>() * i;
205  return tmp;
206  }
Float_t tmp
Definition: plot.C:35
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator++ ( )

Definition at line 135 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

136  {
137  index_ = index_ + signed_one<Dir>();
138  return *this;
139  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > art::const_AssnsIter< L, R, D, Dir >::operator++ ( int  )

Definition at line 144 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_, and tmp.

145  {
147  index_ = index_ + signed_one<Dir>();
148  return tmp;
149  }
Float_t tmp
Definition: plot.C:35
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator+= ( std::size_t  i)

Definition at line 190 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

191  {
192  // to do add check for index bounds and make sure it works for both positive
193  // and negative values
194  index_ = index_ + signed_one<Dir>() * i;
195  return *this;
196  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > art::const_AssnsIter< L, R, D, Dir >::operator- ( std::size_t  i) const

Definition at line 222 of file AssnsIter.h.

References tmp.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

223  {
225  tmp.index_ = tmp.index_ - signed_one<Dir>() * i;
226  return tmp;
227  }
Float_t tmp
Definition: plot.C:35
template<typename L , typename R , typename D , Direction Dir>
std::size_t art::const_AssnsIter< L, R, D, Dir >::operator- ( art::const_AssnsIter< L, R, D, Dir > const &  iter1) const

Definition at line 232 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

234  {
235  return (iter1.index_ - index_);
236  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator-- ( )

Definition at line 154 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

155  {
156  index_ = index_ - signed_one<Dir>();
157  return *this;
158  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > art::const_AssnsIter< L, R, D, Dir >::operator-- ( int  )

Definition at line 162 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_, and tmp.

163  {
165  index_ = index_ - signed_one<Dir>();
166  return tmp;
167  }
Float_t tmp
Definition: plot.C:35
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator-= ( std::size_t  i)

Definition at line 211 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

212  {
213  // to do add check for index bounds and make sure it works for both positive
214  // and negative values
215  index_ = index_ - signed_one<Dir>() * i;
216  return *this;
217  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir >::pointer art::const_AssnsIter< L, R, D, Dir >::operator-> ( ) const

Definition at line 123 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::coll_, art::const_AssnsIter< L, R, D, Dir >::index_, and art::const_AssnsIter< L, R, D, Dir >::node_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

124  {
125  auto const index = index_for_dereferencing<Dir>(index_);
126  node_.first = (*coll_)[index].first;
127  node_.second = (*coll_)[index].second;
128  node_.data = &(coll_->data(index));
129  return &node_;
130  }
std::size_t index_
Definition: AssnsIter.h:74
AssnsNode< L, R, D > node_
Definition: AssnsIter.h:75
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:73
template<typename L , typename R , typename D , Direction Dir>
bool art::const_AssnsIter< L, R, D, Dir >::operator< ( art::const_AssnsIter< L, R, D, Dir > const &  iter) const

Definition at line 251 of file AssnsIter.h.

References art::left(), r, and art::right().

253  {
254  auto const& l = left(*this, iter);
255  auto const& r = right(*this, iter);
256  return l.index_ < r.index_;
257  }
TRandom r
Definition: spectrum.C:23
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
template<typename L , typename R , typename D , Direction Dir>
bool art::const_AssnsIter< L, R, D, Dir >::operator<= ( art::const_AssnsIter< L, R, D, Dir > const &  iter) const

Definition at line 262 of file AssnsIter.h.

References art::left(), r, and art::right().

264  {
265  auto const& l = left(*this, iter);
266  auto const& r = right(*this, iter);
267  return l.index_ <= r.index_;
268  }
TRandom r
Definition: spectrum.C:23
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
template<typename L , typename R , typename D , Direction Dir>
bool art::const_AssnsIter< L, R, D, Dir >::operator== ( art::const_AssnsIter< L, R, D, Dir > const &  iter) const

Definition at line 172 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::index_.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

174  {
175  return index_ == iter.index_;
176  }
std::size_t index_
Definition: AssnsIter.h:74
template<typename L , typename R , typename D , Direction Dir>
bool art::const_AssnsIter< L, R, D, Dir >::operator> ( art::const_AssnsIter< L, R, D, Dir > const &  iter) const

Definition at line 273 of file AssnsIter.h.

References art::left(), r, and art::right().

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

275  {
276  auto const& l = left(*this, iter);
277  auto const& r = right(*this, iter);
278  return l.index_ > r.index_;
279  }
TRandom r
Definition: spectrum.C:23
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
template<typename L , typename R , typename D , Direction Dir>
bool art::const_AssnsIter< L, R, D, Dir >::operator>= ( art::const_AssnsIter< L, R, D, Dir > const &  iter) const

Definition at line 284 of file AssnsIter.h.

References art::left(), r, and art::right().

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

286  {
287  auto const& l = left(*this, iter);
288  auto const& r = right(*this, iter);
289  return l.index_ >= r.index_;
290  }
TRandom r
Definition: spectrum.C:23
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:102
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:94
template<typename L , typename R , typename D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir >::value_type art::const_AssnsIter< L, R, D, Dir >::operator[] ( std::size_t  i) const

Definition at line 241 of file AssnsIter.h.

References tmp.

Referenced by art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter().

242  {
244  tmp.index_ = tmp.index_ + signed_one<Dir>() * i;
245  return tmp.node_;
246  }
Float_t tmp
Definition: plot.C:35

Member Data Documentation

template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
art::Assns<L, R, D> const* art::const_AssnsIter< L, R, D, Dir >::coll_ {nullptr}
private
template<typename L, typename R, typename D, Direction Dir = Direction::Forward>
AssnsNode<L, R, D> art::const_AssnsIter< L, R, D, Dir >::node_ {}
mutableprivate

The documentation for this class was generated from the following file: