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

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

#include "GeometryCore.h"

Inheritance diagram for geo::details::plane_id_iterator_base< GEOID >:
geo::details::TPC_id_iterator_base< GEOID > geo::details::cryostat_id_iterator_base< GEOID > geo::details::geometry_iterator_base geo::details::geometry_iterator_types geo::details::wire_id_iterator_base< GEOID >

Public Types

using ElementPtr_t = geo::PlaneGeo const *
 
using GeoID_t = typename upper_iterator::GeoID_t
 
using LocalID_t = geo::PlaneID
 type of the ID we change More...
 
using iterator = plane_id_iterator_base< GeoID_t >
 type of this iterator More...
 

Public Member Functions

 plane_id_iterator_base ()
 Default constructor; effect not defined: assign to it before using! More...
 
 plane_id_iterator_base (geo::GeometryCore const *geom)
 Constructor: points to begin. More...
 
 plane_id_iterator_base (geo::GeometryCore const *geom, GeoID_t const &start_from)
 Constructor: points to the specified plane. More...
 
 plane_id_iterator_base (geo::GeometryCore const *geom, BeginPos_t const)
 Constructor: points to begin. More...
 
 plane_id_iterator_base (geo::GeometryCore const *geom, EndPos_t)
 Constructor: points to end. More...
 
template<typename OTHERID >
bool operator== (plane_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to the same plane. More...
 
template<typename OTHERID >
bool operator!= (plane_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to different 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...
 
ElementPtr_t get () const
 Returns a pointer to plane, or nullptr if invalid. More...
 

Protected Types

using ID_t = typename LocalID_t::PlaneID_t
 specific type for plane ID More...
 

Protected Member Functions

 plane_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 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== (TPC_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to the same TPC. 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!= (TPC_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to different TPCs. 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 = TPC_id_iterator_base< GEOID >
 

Private Member Functions

void set_local_limits ()
 Sets limit to the past-the-end plane number of current TPC. More...
 
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 planes in the current TPC More...
 

Detailed Description

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

Base forward iterator browsing all plane IDs in the detector.

Template Parameters
GEOIDID type to be used

This iterator requires that GEOID is derived from geo::PlaneID. 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 PlaneID 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 430 of file GeometryCore.h.

Member Typedef Documentation

template<typename GEOID>
using geo::details::plane_id_iterator_base< GEOID >::ElementPtr_t = geo::PlaneGeo const*

Definition at line 437 of file GeometryCore.h.

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

Definition at line 438 of file GeometryCore.h.

template<typename GEOID>
using geo::details::plane_id_iterator_base< GEOID >::ID_t = typename LocalID_t::PlaneID_t
protected

specific type for plane ID

Definition at line 511 of file GeometryCore.h.

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

type of this iterator

Definition at line 445 of file GeometryCore.h.

template<typename GEOID>
using geo::details::plane_id_iterator_base< GEOID >::LocalID_t = geo::PlaneID

type of the ID we change

Definition at line 440 of file GeometryCore.h.

template<typename GEOID>
using geo::details::plane_id_iterator_base< GEOID >::upper_iterator = TPC_id_iterator_base<GEOID>
private

Definition at line 434 of file GeometryCore.h.

Constructor & Destructor Documentation

template<typename GEOID>
geo::details::plane_id_iterator_base< GEOID >::plane_id_iterator_base ( )
inline

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

Definition at line 458 of file GeometryCore.h.

458 {}
template<typename GEOID>
geo::details::plane_id_iterator_base< GEOID >::plane_id_iterator_base ( geo::GeometryCore const *  geom)
inline

Constructor: points to begin.

Definition at line 461 of file GeometryCore.h.

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

Constructor: points to the specified plane.

Definition at line 466 of file GeometryCore.h.

466  :
467  upper_iterator(geom, start_from)
468  { set_local_limits(); }
TPC_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:434
void set_local_limits()
Sets limit to the past-the-end plane number of current TPC.
template<typename GEOID>
geo::details::plane_id_iterator_base< GEOID >::plane_id_iterator_base ( geo::GeometryCore const *  geom,
BeginPos_t  const 
)
inline

Constructor: points to begin.

Definition at line 471 of file GeometryCore.h.

471  :
473  { set_local_limits(); }
TPC_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:434
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:119
void set_local_limits()
Sets limit to the past-the-end plane number of current TPC.
template<typename GEOID>
geo::details::plane_id_iterator_base< GEOID >::plane_id_iterator_base ( geo::GeometryCore const *  geom,
EndPos_t   
)
inline

Constructor: points to end.

Definition at line 476 of file GeometryCore.h.

476  :
477  upper_iterator(geom, end_pos)
478  {} // the local limit is ill-defined and left invalid
TPC_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:434
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:120
template<typename GEOID>
geo::details::plane_id_iterator_base< GEOID >::plane_id_iterator_base ( geo::GeometryCore const *  geom,
UndefinedPos_t   
)
inlineprotected

Constructor: position undefined (meaning undefined local limits too)

Definition at line 514 of file GeometryCore.h.

514  :
516  {}
TPC_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:434
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121

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 >
auto geo::details::plane_id_iterator_base< GEOID >::get ( ) const
inline

Returns a pointer to plane, or nullptr if invalid.

Definition at line 5751 of file GeometryCore.h.

CryostatGeo const * GetElementPtr(geo::CryostatID const &cryoid) const
Returns the specified cryostat.
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
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::plane_id_iterator_base< GEOID >::local_index ( ) const
inlineprotected

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

Definition at line 530 of file GeometryCore.h.

530 { return localID().Plane; }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
template<typename GEOID>
ID_t& geo::details::plane_id_iterator_base< GEOID >::local_index ( )
inlineprivate

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

Definition at line 544 of file GeometryCore.h.

544 { return localID().Plane; }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
PlaneID_t Plane
Index of the plane within its TPC.
Definition: geo_types.h:258
template<typename GEOID>
LocalID_t const& geo::details::plane_id_iterator_base< GEOID >::localID ( ) const
inlineprotected

Returns the type of ID we act on.

Definition at line 521 of file GeometryCore.h.

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

522  { 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
geo::PlaneID LocalID_t
type of the ID we change
Definition: GeometryCore.h:440
template<typename GEOID>
LocalID_t& geo::details::plane_id_iterator_base< GEOID >::localID ( )
inlineprivate

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

Definition at line 541 of file GeometryCore.h.

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

Skips to the next plane.

Definition at line 5762 of file GeometryCore.h.

5762  {
5763  // if at end (checked in the inherited context), do nothing
5764  if (upper_iterator::at_end()) return;
5765 
5766  // if after incrementing we haven't reached the limit, we are done
5767  if (++local_index() < limit) return;
5768 
5769  // we reached the end of the current elements list, we need to escalate:
5770  // - go to the next parent; if that becomes invalid, too bad, but we go on
5772  // - set the index to the first element of the new parent
5773  local_index() = 0;
5774  // - update how many elements there are
5775  // (expect 0 if it is now at_end() -- and it does not even matter)
5776  set_local_limits();
5777 } // geo::details::plane_id_iterator_base<GEOID>::next()
void next()
Skips to the next TPC.
ID_t limit
maximum number of planes in the current TPC
Definition: GeometryCore.h:535
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:530
void set_local_limits()
Sets limit to the past-the-end plane number of current TPC.
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:245
template<typename GEOID >
geo::details::plane_id_iterator_base< GEOID >::operator bool ( ) const
inline

Returns whether the iterator is pointing to a valid plane.

Definition at line 5744 of file GeometryCore.h.

5744  {
5745  return upper_iterator::geometry()
5747 } // geo::details::plane_id_iterator_base<>::operator bool()
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
bool HasElement(geo::CryostatID const &cryoid) const
Returns whether we have the specified cryostat.
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::TPC_id_iterator_base< GEOID >::operator!= ( TPC_id_iterator_base< OTHERID > const &  as) const
inlineinherited

Returns true if the two iterators point to different TPCs.

Definition at line 351 of file GeometryCore.h.

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

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

Returns true if the two iterators point to different planes.

Definition at line 488 of file GeometryCore.h.

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

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

Returns the PlaneID the iterator points to.

Definition at line 492 of file GeometryCore.h.

492 { return localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
template<typename GEOID>
iterator& geo::details::plane_id_iterator_base< GEOID >::operator++ ( )
inline

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

Definition at line 498 of file GeometryCore.h.

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

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

Definition at line 501 of file GeometryCore.h.

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

Returns the PlaneID the iterator points to.

Definition at line 495 of file GeometryCore.h.

495 { return &(localID()); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:521
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::TPC_id_iterator_base< GEOID >::operator== ( TPC_id_iterator_base< OTHERID > const &  as) const
inlineinherited

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

Definition at line 346 of file GeometryCore.h.

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

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

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

Definition at line 483 of file GeometryCore.h.

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

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

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

Definition at line 5756 of file GeometryCore.h.

5756  {
5757  // limit is how many sibling planes there are
5759 } // geo::details::plane_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.
Definition: GeometryCore.h:521
ID_t limit
maximum number of planes in the current TPC
Definition: GeometryCore.h:535

Member Data Documentation

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

maximum number of planes in the current TPC

Definition at line 535 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: