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

Base forward iterator browsing all TPC set IDs in the detector. More...

#include "GeometryCore.h"

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

Public Types

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

Public Member Functions

 TPCset_id_iterator_base ()
 Default constructor; effect not defined: assign to it before using! More...
 
 TPCset_id_iterator_base (geo::GeometryCore const *geom)
 Constructor: points to begin. More...
 
 TPCset_id_iterator_base (geo::GeometryCore const *geom, GeoID_t const &start_from)
 Constructor: points to the specified TPC set. More...
 
 TPCset_id_iterator_base (geo::GeometryCore const *geom, BeginPos_t const)
 Constructor: points to begin. More...
 
 TPCset_id_iterator_base (geo::GeometryCore const *geom, EndPos_t)
 Constructor: points to end. 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!= (TPCset_id_iterator_base< OTHERID > const &as) const
 Returns true if the two iterators point to different TPC sets. More...
 
LocalID_t const & operator* () const
 Returns the TPCsetID the iterator points to. More...
 
LocalID_t const * operator-> () const
 Returns the TPCsetID the iterator points to. More...
 
iteratoroperator++ ()
 Prefix increment: returns this iterator pointing to the next TPC set. 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 TPC set. More...
 

Protected Types

using ID_t = typename LocalID_t::TPCsetID_t
 Specific type for TPC set ID. More...
 
using ElementPtr_t = geo::CryostatGeo const *
 

Protected Member Functions

 TPCset_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 TPC set. More...
 
ID_t const & local_index () const
 Returns the index (part if the ID) this iterator runs on. 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!= (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 = cryostat_id_iterator_base< GEOID >
 

Private Member Functions

void set_local_limits ()
 Sets limit to the past-the-end TPC set number of current croystat. 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...
 
upper_iterator::ElementPtr_t get () const =delete
 

Private Attributes

ID_t limit = LocalID_t::InvalidID
 maximum number of TPC sets in the current cryostat. More...
 

Detailed Description

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

Base forward iterator browsing all TPC set IDs in the detector.

Template Parameters
GEOIDID type to be used

This iterator requires that GEOID is derived from geo::TPCSetID. 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 TPCsetID 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 883 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::TPCset_id_iterator_base< GEOID >::GeoID_t = typename upper_iterator::GeoID_t

Definition at line 890 of file GeometryCore.h.

template<typename GEOID>
using geo::details::TPCset_id_iterator_base< GEOID >::ID_t = typename LocalID_t::TPCsetID_t
protected

Specific type for TPC set ID.

Definition at line 962 of file GeometryCore.h.

Type of this iterator.

Definition at line 897 of file GeometryCore.h.

template<typename GEOID>
using geo::details::TPCset_id_iterator_base< GEOID >::LocalID_t = readout::TPCsetID

Type of the ID we change.

Definition at line 892 of file GeometryCore.h.

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

Definition at line 887 of file GeometryCore.h.

Constructor & Destructor Documentation

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

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

Definition at line 910 of file GeometryCore.h.

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

Constructor: points to begin.

Definition at line 913 of file GeometryCore.h.

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

Constructor: points to the specified TPC set.

Definition at line 919 of file GeometryCore.h.

920  : upper_iterator(geom, start_from)
921  { set_local_limits(); }
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:887
void set_local_limits()
Sets limit to the past-the-end TPC set number of current croystat.
template<typename GEOID>
geo::details::TPCset_id_iterator_base< GEOID >::TPCset_id_iterator_base ( geo::GeometryCore const *  geom,
BeginPos_t  const 
)
inline

Constructor: points to begin.

Definition at line 924 of file GeometryCore.h.

925  : upper_iterator(geom, begin_pos)
926  { set_local_limits(); }
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:119
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:887
void set_local_limits()
Sets limit to the past-the-end TPC set number of current croystat.
template<typename GEOID>
geo::details::TPCset_id_iterator_base< GEOID >::TPCset_id_iterator_base ( geo::GeometryCore const *  geom,
EndPos_t   
)
inline

Constructor: points to end.

Definition at line 929 of file GeometryCore.h.

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

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

Definition at line 965 of file GeometryCore.h.

967  {}
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:887

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>
upper_iterator::ElementPtr_t geo::details::TPCset_id_iterator_base< GEOID >::get ( ) const
privatedelete
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::TPCset_id_iterator_base< GEOID >::local_index ( ) const
inlineprotected

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

Definition at line 981 of file GeometryCore.h.

981 { return localID().TPCset; }
TPCsetID_t TPCset
index of the TPC set within its cryostat
Definition: readout_types.h:51
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:972
template<typename GEOID>
ID_t& geo::details::TPCset_id_iterator_base< GEOID >::local_index ( )
inlineprivate

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

Definition at line 995 of file GeometryCore.h.

995 { return localID().TPCset; }
TPCsetID_t TPCset
index of the TPC set within its cryostat
Definition: readout_types.h:51
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:972
template<typename GEOID>
LocalID_t const& geo::details::TPCset_id_iterator_base< GEOID >::localID ( ) const
inlineprotected

Returns the type of ID we act on.

Definition at line 972 of file GeometryCore.h.

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

973  { 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::TPCsetID LocalID_t
Type of the ID we change.
Definition: GeometryCore.h:892
template<typename GEOID>
LocalID_t& geo::details::TPCset_id_iterator_base< GEOID >::localID ( )
inlineprivate

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

Definition at line 992 of file GeometryCore.h.

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

Skips to the next TPC set.

Definition at line 5825 of file GeometryCore.h.

5825  {
5826  // if at end (checked in the inherited context), do nothing
5827  if (upper_iterator::at_end()) return;
5828 
5829  // if after incrementing we haven't reached the limit, we are done
5830  if (++local_index() < limit) return;
5831 
5832  // we reached the end of the current elements list, we need to escalate:
5833  // - go to the next parent; if that becomes invalid, too bad, but we go on
5835  // - set the index to the first element of the new parent
5836  local_index() = 0;
5837  // - update how many elements there are
5838  // (expect 0 if it is now at_end() -- and it does not even matter)
5839  set_local_limits();
5840 } // geo::details::TPCset_id_iterator_base<GEOID>::next()
void set_local_limits()
Sets limit to the past-the-end TPC set number of current croystat.
ID_t limit
maximum number of TPC sets in the current cryostat.
Definition: GeometryCore.h:986
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:981
void next()
Skips to the next cryostat.
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:245
template<typename GEOID >
geo::details::TPCset_id_iterator_base< GEOID >::operator bool ( ) const
inline

Returns whether the iterator is pointing to a valid TPC set.

Definition at line 5812 of file GeometryCore.h.

5812  {
5813  return upper_iterator::geometry()
5815 } // geo::details::TPCset_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.
Definition: GeometryCore.h:972
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
inline

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>
LocalID_t const& geo::details::TPCset_id_iterator_base< GEOID >::operator* ( ) const
inline

Returns the TPCsetID the iterator points to.

Definition at line 945 of file GeometryCore.h.

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

Prefix increment: returns this iterator pointing to the next TPC set.

Definition at line 951 of file GeometryCore.h.

951 { next(); return *this; }
void next()
Skips to the next TPC set.
template<typename GEOID>
iterator geo::details::TPCset_id_iterator_base< GEOID >::operator++ ( int  )
inline

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

Definition at line 954 of file GeometryCore.h.

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

Returns the TPCsetID the iterator points to.

Definition at line 948 of file GeometryCore.h.

948 { return &(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::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
inline

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 >
void geo::details::TPCset_id_iterator_base< GEOID >::set_local_limits ( )
inlineprivate

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

Definition at line 5819 of file GeometryCore.h.

5819  {
5820  // limit is how many sibling TPCs there are
5822 } // geo::details::TPCset_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.
ID_t limit
maximum number of TPC sets in the current cryostat.
Definition: GeometryCore.h:986
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:972

Member Data Documentation

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

maximum number of TPC sets in the current cryostat.

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