ATLAS Offline Software
Public Types | Public Member Functions | Protected Types | Private Attributes | List of all members
DerivationFramework::TriggerMatchingUtils::RangedItr< T > Class Template Reference

utility class that acts wraps a bidirectional iterator. More...

#include <RangedItr.h>

Collaboration diagram for DerivationFramework::TriggerMatchingUtils::RangedItr< T >:

Public Types

using iterator_category = std::bidirectional_iterator_tag
 
using value_type = typename tr::value_type
 
using reference = typename tr::reference
 
using pointer = typename tr::pointer
 
using difference_type = typename tr::difference_type
 

Public Member Functions

 RangedItr ()=default
 Default Constructor. More...
 
 RangedItr (const T &begin, const T &end)
 Construct from a beginning and an end. More...
 
 RangedItr (const T &begin, const T &end, const T &position)
 Construct from a beginning, an end and a starting position. More...
 
reference operator* ()
 Iterator interface. More...
 
pointer operator-> ()
 
RangedItroperator++ ()
 
RangedItr operator++ (int)
 
RangedItroperator-- ()
 
RangedItr operator-- (int)
 
bool operator== (const RangedItr &other)
 
bool operator!= (const RangedItr &other)
 
bool exhausted () const
 Is this iterator exhausted? More...
 
void restart ()
 Reset this iterator to its start. More...
 
RangedItr begin () const
 Make this act as a range. More...
 
RangedItr end () const
 
difference_type size () const
 
 operator T () const
 Allow conversion back to the original iterator type. More...
 

Protected Types

using tr = std::iterator_traits< T >
 

Private Attributes

m_begin
 
m_end
 
m_position
 

Detailed Description

template<typename T>
class DerivationFramework::TriggerMatchingUtils::RangedItr< T >

utility class that acts wraps a bidirectional iterator.

This class acts as both and range and an iterator.

Definition at line 18 of file RangedItr.h.

Member Typedef Documentation

◆ difference_type

template<typename T >
using DerivationFramework::TriggerMatchingUtils::RangedItr< T >::difference_type = typename tr::difference_type

Definition at line 30 of file RangedItr.h.

◆ iterator_category

template<typename T >
using DerivationFramework::TriggerMatchingUtils::RangedItr< T >::iterator_category = std::bidirectional_iterator_tag

Definition at line 26 of file RangedItr.h.

◆ pointer

template<typename T >
using DerivationFramework::TriggerMatchingUtils::RangedItr< T >::pointer = typename tr::pointer

Definition at line 29 of file RangedItr.h.

◆ reference

template<typename T >
using DerivationFramework::TriggerMatchingUtils::RangedItr< T >::reference = typename tr::reference

Definition at line 28 of file RangedItr.h.

◆ tr

template<typename T >
using DerivationFramework::TriggerMatchingUtils::RangedItr< T >::tr = std::iterator_traits<T>
protected

Definition at line 20 of file RangedItr.h.

◆ value_type

template<typename T >
using DerivationFramework::TriggerMatchingUtils::RangedItr< T >::value_type = typename tr::value_type

Definition at line 27 of file RangedItr.h.

Constructor & Destructor Documentation

◆ RangedItr() [1/3]

template<typename T >
DerivationFramework::TriggerMatchingUtils::RangedItr< T >::RangedItr ( )
default

Default Constructor.

◆ RangedItr() [2/3]

template<typename T >
DerivationFramework::TriggerMatchingUtils::RangedItr< T >::RangedItr ( const T &  begin,
const T &  end 
)
inline

Construct from a beginning and an end.

Definition at line 36 of file RangedItr.h.

36  :
37  RangedItr(begin, end, begin) {}

◆ RangedItr() [3/3]

template<typename T >
DerivationFramework::TriggerMatchingUtils::RangedItr< T >::RangedItr ( const T &  begin,
const T &  end,
const T &  position 
)
inline

Construct from a beginning, an end and a starting position.

Definition at line 40 of file RangedItr.h.

40  :
41  m_begin(begin), m_end(end), m_position(position) {}

Member Function Documentation

◆ begin()

template<typename T >
RangedItr DerivationFramework::TriggerMatchingUtils::RangedItr< T >::begin ( ) const
inline

Make this act as a range.

Definition at line 84 of file RangedItr.h.

84 { return RangedItr(m_begin, m_end, m_begin); }

◆ end()

template<typename T >
RangedItr DerivationFramework::TriggerMatchingUtils::RangedItr< T >::end ( ) const
inline

Definition at line 85 of file RangedItr.h.

85 { return RangedItr(m_begin, m_end, m_end); }

◆ exhausted()

template<typename T >
bool DerivationFramework::TriggerMatchingUtils::RangedItr< T >::exhausted ( ) const
inline

Is this iterator exhausted?

Definition at line 78 of file RangedItr.h.

78 { return m_position == m_end; }

◆ operator T()

template<typename T >
DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator T ( ) const
inline

Allow conversion back to the original iterator type.

Definition at line 89 of file RangedItr.h.

89 { return m_position; }

◆ operator!=()

template<typename T >
bool DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator!= ( const RangedItr< T > &  other)
inline

Definition at line 73 of file RangedItr.h.

73  {
74  return !(*this == other);
75  }

◆ operator*()

template<typename T >
reference DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator* ( )
inline

Iterator interface.

Definition at line 44 of file RangedItr.h.

44 { return m_position.operator*(); }

◆ operator++() [1/2]

template<typename T >
RangedItr& DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator++ ( )
inline

Definition at line 47 of file RangedItr.h.

47  {
48  ++m_position;
49  return *this;
50  }

◆ operator++() [2/2]

template<typename T >
RangedItr DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator++ ( int  )
inline

Definition at line 51 of file RangedItr.h.

51  {
52  RangedItr ret = *this;
53  ++m_position;
54  return ret;
55  }

◆ operator--() [1/2]

template<typename T >
RangedItr& DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator-- ( )
inline

Definition at line 57 of file RangedItr.h.

57  {
58  --m_position;
59  return *this;
60  }

◆ operator--() [2/2]

template<typename T >
RangedItr DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator-- ( int  )
inline

Definition at line 61 of file RangedItr.h.

61  {
62  RangedItr ret = *this;
63  --m_position;
64  return ret;
65  }

◆ operator->()

template<typename T >
pointer DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator-> ( )
inline

Definition at line 45 of file RangedItr.h.

45 { return m_position.operator->(); }

◆ operator==()

template<typename T >
bool DerivationFramework::TriggerMatchingUtils::RangedItr< T >::operator== ( const RangedItr< T > &  other)
inline

Definition at line 67 of file RangedItr.h.

67  {
68  return m_begin == other.m_begin &&
69  m_end == other.m_end &&
70  m_position == other.m_position;
71  }

◆ restart()

template<typename T >
void DerivationFramework::TriggerMatchingUtils::RangedItr< T >::restart ( )
inline

Reset this iterator to its start.

Definition at line 81 of file RangedItr.h.

81 { m_position = m_begin; }

◆ size()

template<typename T >
difference_type DerivationFramework::TriggerMatchingUtils::RangedItr< T >::size ( ) const
inline

Definition at line 86 of file RangedItr.h.

86 { return std::distance(m_begin, m_end); }

Member Data Documentation

◆ m_begin

template<typename T >
T DerivationFramework::TriggerMatchingUtils::RangedItr< T >::m_begin
private

Definition at line 91 of file RangedItr.h.

◆ m_end

template<typename T >
T DerivationFramework::TriggerMatchingUtils::RangedItr< T >::m_end
private

Definition at line 92 of file RangedItr.h.

◆ m_position

template<typename T >
T DerivationFramework::TriggerMatchingUtils::RangedItr< T >::m_position
private

Definition at line 93 of file RangedItr.h.


The documentation for this class was generated from the following file:
DerivationFramework::TriggerMatchingUtils::RangedItr::m_end
T m_end
Definition: RangedItr.h:92
DerivationFramework::TriggerMatchingUtils::RangedItr::begin
RangedItr begin() const
Make this act as a range.
Definition: RangedItr.h:84
DerivationFramework::TriggerMatchingUtils::RangedItr::m_begin
T m_begin
Definition: RangedItr.h:91
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
DerivationFramework::TriggerMatchingUtils::RangedItr::end
RangedItr end() const
Definition: RangedItr.h:85
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
DerivationFramework::TriggerMatchingUtils::RangedItr::m_position
T m_position
Definition: RangedItr.h:93
DerivationFramework::TriggerMatchingUtils::RangedItr::RangedItr
RangedItr()=default
Default Constructor.