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

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

#include "GeometryCore.h"

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

Public Types

using ElementPtr_t = geo::CryostatGeo const *
 
using GeoID_t = GEOID
 type of the actual ID stored in the iterator More...
 
using iterator = cryostat_id_iterator_base< GeoID_t >
 this iterator More...
 
using LocalID_t = geo::CryostatID
 type of the ID we change More...
 

Public Member Functions

 cryostat_id_iterator_base ()
 Default constructor; effect not defined: assign to it before using! More...
 
 cryostat_id_iterator_base (geo::GeometryCore const *geom)
 Constructor: points to begin. More...
 
 cryostat_id_iterator_base (geo::GeometryCore const *geom, GeoID_t const &start_from)
 Constructor: points to the specified cryostat. More...
 
 cryostat_id_iterator_base (geo::GeometryCore const *geom, BeginPos_t const)
 Constructor: points to begin. More...
 
 cryostat_id_iterator_base (geo::GeometryCore const *geom, EndPos_t)
 Constructor: points to end. 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...
 
LocalID_t const & operator* () const
 Returns the ID the iterator points to. More...
 
LocalID_t const * operator-> () const
 Returns a pointer to the ID the iterator points to. More...
 
iteratoroperator++ ()
 Prefix increment: returns this iterator pointing to the next cryostat. 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 cryostat. More...
 
ElementPtr_t get () const
 Returns a pointer to cryostat, or nullptr if invalid. More...
 

Static Public Attributes

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

Protected Types

using ID_t = typename LocalID_t::CryostatID_t
 

Protected Member Functions

 cryostat_id_iterator_base (geo::GeometryCore const *geom, UndefinedPos_t)
 Constructor: does not set the current ID. More...
 
void next ()
 Skips to the next cryostat. 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...
 

Private Member Functions

void set_local_limits ()
 Sets the limit member to the past-the-end cryostat number. More...
 
void set_begin ()
 Sets the iterator to the begin position. More...
 
void set_end ()
 Sets the iterator to the end position. More...
 
LocalID_t const & localID () const
 Returns the type of ID we act on. More...
 
LocalID_tlocalID ()
 Returns the type of ID we act on. More...
 
ID_t const & local_index () const
 Returns the index (part if the ID) this iterator runs on. More...
 
ID_tlocal_index ()
 Returns the index (part if the ID) this iterator runs on. More...
 

Private Attributes

GeoID_t id
 ID of the current cryostat. More...
 
ID_t limit = LocalID_t::InvalidID
 maximum number of cryostats More...
 

Detailed Description

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

Base forward iterator browsing all cryostat IDs in the detector.

Template Parameters
GEOIDID type to be used

This iterator assumes that GEOID is derived from geo::CryostatID. 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 CryostatID data.

Currently, backward iterations are not supported.

Definition at line 160 of file GeometryCore.h.

Member Typedef Documentation

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

Definition at line 164 of file GeometryCore.h.

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::GeoID_t = GEOID

type of the actual ID stored in the iterator

Definition at line 165 of file GeometryCore.h.

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::ID_t = typename LocalID_t::CryostatID_t
protected

Definition at line 228 of file GeometryCore.h.

this iterator

Definition at line 167 of file GeometryCore.h.

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::LocalID_t = geo::CryostatID

type of the ID we change

Definition at line 169 of file GeometryCore.h.

Constructor & Destructor Documentation

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

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

Definition at line 175 of file GeometryCore.h.

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

Constructor: points to begin.

Definition at line 178 of file GeometryCore.h.

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

Constructor: points to the specified cryostat.

Definition at line 183 of file GeometryCore.h.

183  :
185  { id = start_from; }
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:175
template<typename GEOID>
geo::details::cryostat_id_iterator_base< GEOID >::cryostat_id_iterator_base ( geo::GeometryCore const *  geom,
BeginPos_t  const 
)
inline

Constructor: points to begin.

Definition at line 189 of file GeometryCore.h.

189  :
191  { set_begin(); }
void set_begin()
Sets the iterator to the begin position.
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:175
template<typename GEOID>
geo::details::cryostat_id_iterator_base< GEOID >::cryostat_id_iterator_base ( geo::GeometryCore const *  geom,
EndPos_t   
)
inline

Constructor: points to end.

Definition at line 194 of file GeometryCore.h.

194  :
196  { set_end(); }
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:121
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:175
void set_end()
Sets the iterator to the end position.
template<typename GEOID>
geo::details::cryostat_id_iterator_base< GEOID >::cryostat_id_iterator_base ( geo::GeometryCore const *  geom,
UndefinedPos_t   
)
inlineprotected

Constructor: does not set the current ID.

Definition at line 231 of file GeometryCore.h.

231  :
232  geometry_iterator_base(geom), id()
233  { set_local_limits(); }
geometry_iterator_base()
Default constructor; do not use a default-constructed iterator as-is!
Definition: GeometryCore.h:138
void set_local_limits()
Sets the limit member to the past-the-end cryostat number.
GeoID_t id
ID of the current cryostat.
Definition: GeometryCore.h:248

Member Function Documentation

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

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::cryostat_id_iterator_base< GEOID >::get ( ) const
inline

Returns a pointer to cryostat, or nullptr if invalid.

Definition at line 5676 of file GeometryCore.h.

5678  { return geometry()->GetElementPtr(localID()); }
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:262
template<typename GEOID>
GeoID_t const& geo::details::cryostat_id_iterator_base< GEOID >::ID ( ) const
inlineprotected

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 ( )
inlineprotected

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::cryostat_id_iterator_base< GEOID >::local_index ( ) const
inlineprivate

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

Definition at line 269 of file GeometryCore.h.

269 { return localID().Cryostat; }
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:262
template<typename GEOID>
ID_t& geo::details::cryostat_id_iterator_base< GEOID >::local_index ( )
inlineprivate

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

Definition at line 270 of file GeometryCore.h.

270 { return localID().Cryostat; }
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:130
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:262
template<typename GEOID>
LocalID_t const& geo::details::cryostat_id_iterator_base< GEOID >::localID ( ) const
inlineprivate

Returns the type of ID we act on.

Definition at line 262 of file GeometryCore.h.

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

263  { return static_cast<LocalID_t const&>(ID()); }
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:237
geo::CryostatID LocalID_t
type of the ID we change
Definition: GeometryCore.h:169
template<typename GEOID>
LocalID_t& geo::details::cryostat_id_iterator_base< GEOID >::localID ( )
inlineprivate

Returns the type of ID we act on.

Definition at line 264 of file GeometryCore.h.

References geo::CryostatID::Cryostat.

264 { return static_cast<LocalID_t&>(ID()); }
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:237
geo::CryostatID LocalID_t
type of the ID we change
Definition: GeometryCore.h:169
template<typename GEOID >
void geo::details::cryostat_id_iterator_base< GEOID >::next ( )
protected

Skips to the next cryostat.

Definition at line 5693 of file GeometryCore.h.

5693  {
5694  if (at_end()) return;
5695  if (++local_index() < limit) return;
5696  localID().isValid = false;
5697 } // geo::cryostat_id_iterator_base<GEOID>::next()
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
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:129
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:262
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:245
template<typename GEOID >
geo::details::cryostat_id_iterator_base< GEOID >::operator bool ( ) const
inline

Returns whether the iterator is pointing to a valid cryostat.

Definition at line 5672 of file GeometryCore.h.

5673  { return geometry() && geometry()->HasElement(localID()); }
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:262
template<typename GEOID>
template<typename OTHERID >
bool geo::details::cryostat_id_iterator_base< GEOID >::operator!= ( cryostat_id_iterator_base< OTHERID > const &  as) const
inline

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

Returns the ID the iterator points to.

Definition at line 210 of file GeometryCore.h.

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

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

Definition at line 216 of file GeometryCore.h.

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

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

Definition at line 219 of file GeometryCore.h.

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

Returns a pointer to the ID the iterator points to.

Definition at line 213 of file GeometryCore.h.

213 { return &(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::cryostat_id_iterator_base< GEOID >::operator== ( cryostat_id_iterator_base< OTHERID > const &  as) const
inline

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

Sets the iterator to the begin position.

Definition at line 5685 of file GeometryCore.h.

5686  { geometry()->GetBeginID(ID()); }
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
GeoID GetBeginID() const
Returns the ID of the first element of the detector.
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:237
template<typename GEOID >
void geo::details::cryostat_id_iterator_base< GEOID >::set_end ( )
inlineprivate

Sets the iterator to the end position.

Definition at line 5689 of file GeometryCore.h.

5690  { geometry()->GetEndID(ID()); }
GeoID GetEndID() const
Returns the (possibly invalid) ID after the last subelement of the detector.
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:237
template<typename GEOID >
void geo::details::cryostat_id_iterator_base< GEOID >::set_local_limits ( )
inlineprivate

Sets the limit member to the past-the-end cryostat number.

Definition at line 5681 of file GeometryCore.h.

5682  { limit = geometry()->NSiblingElements(localID()); }
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:135
ID_t limit
maximum number of cryostats
Definition: GeometryCore.h:249
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:262

Member Data Documentation

template<typename GEOID>
GeoID_t geo::details::cryostat_id_iterator_base< GEOID >::id
private

ID of the current cryostat.

Definition at line 248 of file GeometryCore.h.

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

maximum number of cryostats

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