LArSoft  v07_13_02
Liquid Argon Software toolkit - http://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)
 
const_AssnsIter< L, R, D, Dir > & operator= (art::const_AssnsIter< L, R, D, Dir > const &iter)
 
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<class L, class R, class D, Direction Dir = Direction::Forward>
class art::const_AssnsIter< L, R, D, Dir >

Definition at line 36 of file AssnsIter.h.

Member Typedef Documentation

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

Definition at line 42 of file AssnsIter.h.

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

Definition at line 38 of file AssnsIter.h.

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

Definition at line 40 of file AssnsIter.h.

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

Definition at line 41 of file AssnsIter.h.

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

Definition at line 39 of file AssnsIter.h.

Constructor & Destructor Documentation

template<class L, class R, class D, Direction Dir = Direction::Forward>
art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter ( )
default
template<class L, class R, class 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 45 of file AssnsIter.h.

References art::Assns< L, R, D >::size().

46  : coll_{&assns}, index_{assns.size()}
47  {}
size_type size() const
Definition: Assns.h:440
std::size_t index_
Definition: AssnsIter.h:84
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:83
template<class L, class R, class D, Direction Dir = Direction::Forward>
art::const_AssnsIter< L, R, D, Dir >::const_AssnsIter ( art::Assns< L, R, D > const &  assns,
std::size_t const  i 
)
inlineexplicit

Definition at line 48 of file AssnsIter.h.

References art::operator!=(), operator*(), operator+(), lar::dump::operator+=(), operator-(), art::operator==(), art::operator>(), and art::operator>=().

50  : coll_{&assns}, index_{i}
51  {}
std::size_t index_
Definition: AssnsIter.h:84
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:83

Member Function Documentation

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

Definition at line 77 of file AssnsIter.h.

78  {
79  return index_;
80  };
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class 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 191 of file AssnsIter.h.

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

193  {
194  return !(index_ == iter.index_);
195  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir >::reference art::const_AssnsIter< L, R, D, Dir >::operator* ( ) const

Definition at line 121 of file AssnsIter.h.

122  {
123  auto const index = index_for_dereferencing<Dir>(index_);
124  node_.first = (*coll_)[index].first;
125  node_.second = (*coll_)[index].second;
126  node_.data = &(coll_->data(index));
127  return node_;
128  }
std::size_t index_
Definition: AssnsIter.h:84
AssnsNode< L, R, D > node_
Definition: AssnsIter.h:85
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:83
template<class L , class R , class 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 211 of file AssnsIter.h.

References tmp.

212  {
214  tmp.index_ = tmp.index_ + signed_one<Dir>() * i;
215  return tmp;
216  }
Float_t tmp
Definition: plot.C:37
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator++ ( )

Definition at line 145 of file AssnsIter.h.

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

146  {
147  index_ = index_ + signed_one<Dir>();
148  return *this;
149  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > art::const_AssnsIter< L, R, D, Dir >::operator++ ( int  )

Definition at line 153 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::operator--(), and tmp.

155  {
157  index_ = index_ + signed_one<Dir>();
158  return tmp;
159  }
Float_t tmp
Definition: plot.C:37
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class 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 200 of file AssnsIter.h.

201  {
202  // to do add check for index bounds and make sure it works for both positive
203  // and negative values
204  index_ = index_ + signed_one<Dir>() * i;
205  return *this;
206  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class 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 232 of file AssnsIter.h.

References tmp.

233  {
235  tmp.index_ = tmp.index_ - signed_one<Dir>() * i;
236  return tmp;
237  }
Float_t tmp
Definition: plot.C:37
template<class L , class R , class 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 242 of file AssnsIter.h.

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

244  {
245  return (iter1.index_ - index_);
246  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator-- ( )

Definition at line 164 of file AssnsIter.h.

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

165  {
166  index_ = index_ - signed_one<Dir>();
167  return *this;
168  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > art::const_AssnsIter< L, R, D, Dir >::operator-- ( int  )

Definition at line 171 of file AssnsIter.h.

References tmp.

173  {
175  index_ = index_ - signed_one<Dir>();
176  return tmp;
177  }
Float_t tmp
Definition: plot.C:37
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class 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 221 of file AssnsIter.h.

222  {
223  // to do add check for index bounds and make sure it works for both positive
224  // and negative values
225  index_ = index_ - signed_one<Dir>() * i;
226  return *this;
227  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir >::pointer art::const_AssnsIter< L, R, D, Dir >::operator-> ( ) const

Definition at line 133 of file AssnsIter.h.

References art::const_AssnsIter< L, R, D, Dir >::operator++().

134  {
135  auto const index = index_for_dereferencing<Dir>(index_);
136  node_.first = (*coll_)[index].first;
137  node_.second = (*coll_)[index].second;
138  node_.data = &(coll_->data(index));
139  return &node_;
140  }
std::size_t index_
Definition: AssnsIter.h:84
AssnsNode< L, R, D > node_
Definition: AssnsIter.h:85
art::Assns< L, R, D > const * coll_
Definition: AssnsIter.h:83
template<class L , class R , class 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 261 of file AssnsIter.h.

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

263  {
264  auto const& l = left(*this, iter);
265  auto const& r = right(*this, iter);
266  return l.index_ < r.index_;
267  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
template<class L , class R , class 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 272 of file AssnsIter.h.

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

274  {
275  auto const& l = left(*this, iter);
276  auto const& r = right(*this, iter);
277  return l.index_ <= r.index_;
278  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
template<class L , class R , class D , Direction Dir>
art::const_AssnsIter< L, R, D, Dir > & art::const_AssnsIter< L, R, D, Dir >::operator= ( art::const_AssnsIter< L, R, D, Dir > const &  iter)

Definition at line 304 of file AssnsIter.h.

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

306  {
307  node_ = iter.node_;
308  return *this;
309  }
AssnsNode< L, R, D > node_
Definition: AssnsIter.h:85
template<class L , class R , class 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 182 of file AssnsIter.h.

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

184  {
185  return index_ == iter.index_;
186  }
std::size_t index_
Definition: AssnsIter.h:84
template<class L , class R , class 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 283 of file AssnsIter.h.

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

285  {
286  auto const& l = left(*this, iter);
287  auto const& r = right(*this, iter);
288  return l.index_ > r.index_;
289  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
template<class L , class R , class 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 294 of file AssnsIter.h.

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

296  {
297  auto const& l = left(*this, iter);
298  auto const& r = right(*this, iter);
299  return l.index_ >= r.index_;
300  }
constexpr auto const & right(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:112
constexpr auto const & left(const_AssnsIter< L, R, D, Dir > const &a, const_AssnsIter< L, R, D, Dir > const &b)
Definition: AssnsIter.h:104
template<class L , class R , class 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 251 of file AssnsIter.h.

References tmp.

252  {
254  tmp.index_ = tmp.index_ + signed_one<Dir>() * i;
255  return tmp.node_;
256  }
Float_t tmp
Definition: plot.C:37

Member Data Documentation

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

Definition at line 83 of file AssnsIter.h.

template<class L, class R, class D, Direction Dir = Direction::Forward>
std::size_t art::const_AssnsIter< L, R, D, Dir >::index_ {-1ull}
private
template<class L, class R, class D, Direction Dir = Direction::Forward>
AssnsNode<L, R, D> art::const_AssnsIter< L, R, D, Dir >::node_ {}
mutableprivate

Definition at line 85 of file AssnsIter.h.

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


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