LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
geo::details::ROP_id_iterator_base< GEOID > Class Template Reference

Base forward iterator browsing all readout plane IDs in the detector. More...

#include "GeometryCore.h"

Inheritance diagram for geo::details::ROP_id_iterator_base< GEOID >:
geo::details::TPCset_id_iterator_base< GEOID > geo::details::cryostat_id_iterator_base< GEOID > geo::details::geometry_iterator_base geo::details::geometry_iterator_types

Public Types

using GeoID_t = typename upper_iterator::GeoID_t
 
using LocalID_t = readout::ROPID
 type of the ID we change More...
 
using iterator = ROP_id_iterator_base< GeoID_t >
 Type of this iterator. More...
 

Public Member Functions

 ROP_id_iterator_base ()=default
 Default constructor; effect not defined: assign to it before using! More...
 
 ROP_id_iterator_base (geo::GeometryCore const *geom)
 Constructor: points to begin. More...
 
 ROP_id_iterator_base (geo::GeometryCore const *geom, GeoID_t const &start_from)
 Constructor: points to the specified readout plane. More...
 
 ROP_id_iterator_base (geo::GeometryCore const *geom, BeginPos_t const)
 Constructor: points to begin. More...
 
 ROP_id_iterator_base (geo::GeometryCore const *geom, EndPos_t)
 Constructor: points to end. More...
 
template<typename OTHERID >
bool operator== (ROP_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to the same readout plane. More...
 
template<typename OTHERID >
bool operator!= (ROP_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to different readout planes. More...
 
LocalID_t const & operator* () const
 Returns the PlaneID the iterator points to. More...
 
LocalID_t const * operator-> () const
 Returns the PlaneID the iterator points to. More...
 
iteratoroperator++ ()
 Prefix increment: returns this iterator pointing to the next plane. More...
 
iterator operator++ (int)
 Postfix increment: returns the current iterator, then increments it. More...
 
 operator bool () const
 Returns whether the iterator is pointing to a valid plane. More...
 

Protected Types

using ID_t = typename LocalID_t::ROPID_t
 Specific type for plane ID. More...
 
using ElementPtr_t = geo::CryostatGeo const *
 

Protected Member Functions

 ROP_id_iterator_base (geo::GeometryCore const *geom, UndefinedPos_t)
 Constructor: position undefined (meaning undefined local limits too). More...
 
LocalID_t const & localID () const
 Returns the type of ID we act on. More...
 
void next ()
 Skips to the next readout plane. More...
 
ID_t const & local_index () const
 Returns the index (part if the ID) this iterator runs on. More...
 
template<typename OTHERID >
bool operator== (TPCset_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to the same TPC set. More...
 
template<typename OTHERID >
bool operator== (cryostat_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to the same cryostat. More...
 
template<typename OTHERID >
bool operator!= (TPCset_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to different TPC sets. More...
 
template<typename OTHERID >
bool operator!= (cryostat_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to different cryostats. More...
 
bool at_end () const
 Returns whether this iterator has reached the end. More...
 
geo::GeometryCore const * geometry () const
 Returns a pointer to the geometry. More...
 
GeoID_t const & ID () const
 Returns the actual type of ID we store. More...
 
GeoID_tID ()
 Returns the actual type of ID we store. More...
 

Static Protected Attributes

static constexpr BeginPos_t begin_pos = {}
 
static constexpr EndPos_t end_pos = {}
 
static constexpr UndefinedPos_t undefined_pos = {}
 

Private Types

using upper_iterator = TPCset_id_iterator_base< GEOID >
 

Private Member Functions

void set_local_limits ()
 
LocalID_tlocalID ()
 Returns the type of ID we act on (non-const version). More...
 
ID_tlocal_index ()
 Returns the index (part if the ID) this iterator runs on (non-const). More...
 

Private Attributes

ID_t limit = LocalID_t::InvalidID
 Maximum number of readout planes in the current TPC set. More...
 

Detailed Description

template<typename GEOID>
class geo::details::ROP_id_iterator_base< GEOID >

Base forward iterator browsing all readout plane IDs in the detector.

Template Parameters
GEOIDID type to be used

This iterator requires that GEOID is derived from geo::ROPID. Note that no polymorphic behaviour is required, or expected, from GEOID.

This iterator is designed to carry on, untouched, anything else that the GEOID type defines beyond the required ROPID data.

Note
A number of "local" methods are overloaded: since there is no polymorphism here and they are not virtual functions, these are designed not to replace the inherited methods except within the non-inherited and explicitly redefined methods.

Currently, backward iterations are not supported.

Definition at line 1023 of file GeometryCore.h.

Member Typedef Documentation

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::ElementPtr_t = geo::CryostatGeo const*
inherited

Definition at line 164 of file GeometryCore.h.

template<typename GEOID>
using geo::details::ROP_id_iterator_base< GEOID >::GeoID_t = typename upper_iterator::GeoID_t

Definition at line 1030 of file GeometryCore.h.

template<typename GEOID>
using geo::details::ROP_id_iterator_base< GEOID >::ID_t = typename LocalID_t::ROPID_t
protected

Specific type for plane ID.

Definition at line 1100 of file GeometryCore.h.

template<typename GEOID>
using geo::details::ROP_id_iterator_base< GEOID >::iterator = ROP_id_iterator_base<GeoID_t>

Type of this iterator.

Definition at line 1037 of file GeometryCore.h.

template<typename GEOID>
using geo::details::ROP_id_iterator_base< GEOID >::LocalID_t = readout::ROPID

type of the ID we change

Definition at line 1032 of file GeometryCore.h.

template<typename GEOID>
using geo::details::ROP_id_iterator_base< GEOID >::upper_iterator = TPCset_id_iterator_base<GEOID>
private

Definition at line 1027 of file GeometryCore.h.

Constructor & Destructor Documentation

template<typename GEOID>
geo::details::ROP_id_iterator_base< GEOID >::ROP_id_iterator_base ( )
default

Default constructor; effect not defined: assign to it before using!

template<typename GEOID>
geo::details::ROP_id_iterator_base< GEOID >::ROP_id_iterator_base ( geo::GeometryCore const *  geom)
inline

Constructor: points to begin.

Definition at line 1053 of file GeometryCore.h.

1054  : ROP_id_iterator_base(geom, begin_pos) {}
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:119
ROP_id_iterator_base()=default
Default constructor; effect not defined: assign to it before using!
template<typename GEOID>
geo::details::ROP_id_iterator_base< GEOID >::ROP_id_iterator_base ( geo::GeometryCore const *  geom,
GeoID_t const &  start_from 
)
inline

Constructor: points to the specified readout plane.

Definition at line 1058 of file GeometryCore.h.

1059  : upper_iterator(geom, start_from)
1060  { set_local_limits(); }
TPCset_id_iterator_base< GEOID > upper_iterator
template<typename GEOID>
geo::details::ROP_id_iterator_base< GEOID >::ROP_id_iterator_base ( geo::GeometryCore const *  geom,
BeginPos_t  const 
)
inline

Constructor: points to begin.

Definition at line 1063 of file GeometryCore.h.

1064  : upper_iterator(geom, begin_pos)
1065  { set_local_limits(); }
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:119
TPCset_id_iterator_base< GEOID > upper_iterator
template<typename GEOID>
geo::details::ROP_id_iterator_base< GEOID >::ROP_id_iterator_base ( geo::GeometryCore const *  geom,
EndPos_t   
)
inline

Constructor: points to end.

Definition at line 1068 of file GeometryCore.h.

1069  : upper_iterator(geom, end_pos)
1070  {} // the local limit is ill-defined and left invalid
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:120
TPCset_id_iterator_base< GEOID > upper_iterator
template<typename GEOID>
geo::details::ROP_id_iterator_base< GEOID >::ROP_id_iterator_base ( geo::GeometryCore const *  geom,
UndefinedPos_t   
)
inlineprotected

Constructor: position undefined (meaning undefined local limits too).

Definition at line 1103 of file GeometryCore.h.

1104  : upper_iterator(geom, undefined_pos)
1105  {}
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121
TPCset_id_iterator_base< GEOID > upper_iterator

Member Function Documentation

template<typename GEOID>
bool geo::details::cryostat_id_iterator_base< GEOID >::at_end ( ) const
inlineprotectedinherited

Returns whether this iterator has reached the end.

Definition at line 245 of file GeometryCore.h.

245 { return local_index() == limit; }
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:269
ID_t limit
maximum number of cryostats
Definition: GeometryCore.h:249
geo::GeometryCore const* geo::details::geometry_iterator_base::geometry ( ) const
inlineprotectedinherited

Returns a pointer to the geometry.

Definition at line 135 of file GeometryCore.h.

135 { return pGeo; }
GeometryCore const * pGeo
pointer to the geometry
Definition: GeometryCore.h:141
template<typename GEOID>
GeoID_t const& geo::details::cryostat_id_iterator_base< GEOID >::ID ( ) const
inlineprotectedinherited

Returns the actual type of ID we store.

Definition at line 237 of file GeometryCore.h.

237 { return id; }
GeoID_t id
ID of the current cryostat.
Definition: GeometryCore.h:248
template<typename GEOID>
GeoID_t& geo::details::cryostat_id_iterator_base< GEOID >::ID ( )
inlineprotectedinherited

Returns the actual type of ID we store.

Definition at line 238 of file GeometryCore.h.

238 { return id; }
GeoID_t id
ID of the current cryostat.
Definition: GeometryCore.h:248
template<typename GEOID>
ID_t const& geo::details::ROP_id_iterator_base< GEOID >::local_index ( ) const
inlineprotected

Returns the index (part if the ID) this iterator runs on.

Definition at line 1119 of file GeometryCore.h.

1119 { return localID().ROP; }
ROPID_t ROP
index of the plane within its TPC
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID>
ID_t& geo::details::ROP_id_iterator_base< GEOID >::local_index ( )
inlineprivate

Returns the index (part if the ID) this iterator runs on (non-const).

Definition at line 1134 of file GeometryCore.h.

1134 { return localID().ROP; }
ROPID_t ROP
index of the plane within its TPC
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID>
LocalID_t const& geo::details::ROP_id_iterator_base< GEOID >::localID ( ) const
inlineprotected

Returns the type of ID we act on.

Definition at line 1110 of file GeometryCore.h.

Referenced by geo::details::ROP_id_iterator_base< GEOID >::operator!=(), and geo::details::ROP_id_iterator_base< GEOID >::operator==().

1111  { return static_cast<LocalID_t const&>(upper_iterator::ID()); }
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:237
readout::ROPID LocalID_t
type of the ID we change
template<typename GEOID>
LocalID_t& geo::details::ROP_id_iterator_base< GEOID >::localID ( )
inlineprivate

Returns the type of ID we act on (non-const version).

Definition at line 1131 of file GeometryCore.h.

1131 { return static_cast<LocalID_t&>(ID()); }
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:237
readout::ROPID LocalID_t
type of the ID we change
template<typename GEOID >
void geo::details::ROP_id_iterator_base< GEOID >::next ( )
inlineprotected

Skips to the next readout plane.

Definition at line 5889 of file GeometryCore.h.

5889  {
5890  // if at end (checked in the inherited context), do nothing
5891  if (upper_iterator::at_end()) return;
5892 
5893  // if after incrementing we haven't reached the limit, we are done
5894  if (++local_index() < limit) return;
5895 
5896  // we reached the end of the current elements list, we need to escalate:
5897  // - go to the next parent; if that becomes invalid, too bad, but we go on
5899  // - set the index to the first element of the new parent
5900  local_index() = 0;
5901  // - update how many elements there are
5902  // (expect 0 if it is now at_end() -- and it does not even matter)
5903  set_local_limits();
5904 } // geo::details::ROP_id_iterator_base<GEOID>::next()
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
void next()
Skips to the next TPC set.
ID_t limit
Maximum number of readout planes in the current TPC set.
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:245
template<typename GEOID >
geo::details::ROP_id_iterator_base< GEOID >::operator bool ( ) const
inline

Returns whether the iterator is pointing to a valid plane.

Definition at line 5876 of file GeometryCore.h.

5876  {
5877  return upper_iterator::geometry()
5879 } // geo::details::ROP_id_iterator_base<>::operator bool()
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
bool HasElement(geo::CryostatID const &cryoid) const
Returns whether we have the specified cryostat.
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID>
template<typename OTHERID >
bool geo::details::cryostat_id_iterator_base< GEOID >::operator!= ( cryostat_id_iterator_base< OTHERID > const &  as) const
inlineinherited

Returns true if the two iterators point to different cryostats.

Definition at line 206 of file GeometryCore.h.

References geo::details::cryostat_id_iterator_base< GEOID >::localID().

207  { return localID() != as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:262
template<typename GEOID>
template<typename OTHERID >
bool geo::details::TPCset_id_iterator_base< GEOID >::operator!= ( TPCset_id_iterator_base< OTHERID > const &  as) const
inlineinherited

Returns true if the two iterators point to different TPC sets.

Definition at line 941 of file GeometryCore.h.

References geo::details::TPCset_id_iterator_base< GEOID >::localID().

942  { return localID() != as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:972
template<typename GEOID>
template<typename OTHERID >
bool geo::details::ROP_id_iterator_base< GEOID >::operator!= ( ROP_id_iterator_base< OTHERID > const &  as) const
inline

Returns true if the two iterators point to different readout planes.

Definition at line 1080 of file GeometryCore.h.

References geo::details::ROP_id_iterator_base< GEOID >::localID().

1081  { return localID() != as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID>
LocalID_t const& geo::details::ROP_id_iterator_base< GEOID >::operator* ( ) const
inline

Returns the PlaneID the iterator points to.

Definition at line 1084 of file GeometryCore.h.

1084 { return localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID>
iterator& geo::details::ROP_id_iterator_base< GEOID >::operator++ ( )
inline

Prefix increment: returns this iterator pointing to the next plane.

Definition at line 1090 of file GeometryCore.h.

1090 { next(); return *this; }
void next()
Skips to the next readout plane.
template<typename GEOID>
iterator geo::details::ROP_id_iterator_base< GEOID >::operator++ ( int  )
inline

Postfix increment: returns the current iterator, then increments it.

Definition at line 1093 of file GeometryCore.h.

1093 { iterator old(*this); next(); return old; }
void next()
Skips to the next readout plane.
template<typename GEOID>
LocalID_t const* geo::details::ROP_id_iterator_base< GEOID >::operator-> ( ) const
inline

Returns the PlaneID the iterator points to.

Definition at line 1087 of file GeometryCore.h.

1087 { return &(localID()); }
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID>
template<typename OTHERID >
bool geo::details::cryostat_id_iterator_base< GEOID >::operator== ( cryostat_id_iterator_base< OTHERID > const &  as) const
inlineinherited

Returns true if the two iterators point to the same cryostat.

Definition at line 201 of file GeometryCore.h.

References geo::details::cryostat_id_iterator_base< GEOID >::localID().

202  { return localID() == as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:262
template<typename GEOID>
template<typename OTHERID >
bool geo::details::TPCset_id_iterator_base< GEOID >::operator== ( TPCset_id_iterator_base< OTHERID > const &  as) const
inlineinherited

Returns true if the two iterators point to the same TPC set.

Definition at line 936 of file GeometryCore.h.

References geo::details::TPCset_id_iterator_base< GEOID >::localID().

937  { return localID() == as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:972
template<typename GEOID>
template<typename OTHERID >
bool geo::details::ROP_id_iterator_base< GEOID >::operator== ( ROP_id_iterator_base< OTHERID > const &  as) const
inline

Returns true if the two iterators point to the same readout plane.

Definition at line 1075 of file GeometryCore.h.

References geo::details::ROP_id_iterator_base< GEOID >::localID().

1076  { return localID() == as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
template<typename GEOID >
void geo::details::ROP_id_iterator_base< GEOID >::set_local_limits ( )
inlineprivate

Sets limit to the past-the-end readout plane number of current TPC set.

Definition at line 5883 of file GeometryCore.h.

5883  {
5884  // limit is how many sibling planes there are
5886 } // geo::details::ROP_id_iterator_base<GEOID>::set_local_limits()
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
unsigned int NSiblingElements(geo::CryostatID const &) const
Returns the number of cryostats in the detector.
LocalID_t const & localID() const
Returns the type of ID we act on.
ID_t limit
Maximum number of readout planes in the current TPC set.

Member Data Documentation

template<typename GEOID>
ID_t geo::details::ROP_id_iterator_base< GEOID >::limit = LocalID_t::InvalidID
private

Maximum number of readout planes in the current TPC set.

Definition at line 1124 of file GeometryCore.h.

constexpr details::geometry_iterator_types::UndefinedPos_t geo::details::geometry_iterator_types::undefined_pos = {}
staticinherited

Definition at line 121 of file GeometryCore.h.

Referenced by geo::GeometryCore::PointWithinSegments().


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