Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
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...
 
Iterator traits
using difference_type = std::ptrdiff_t
 
using value_type = LocalID_t
 
using reference = value_type const &
 
using pointer = value_type const *
 
using iterator_category = std::input_iterator_tag
 

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...
 
reference operator* () const
 Returns the ID the iterator points to. More...
 
pointer 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...
 
- Public Member Functions inherited from geo::details::geometry_iterator_base
 geometry_iterator_base (geo::GeometryCore const *geom)
 Constructor: associates with the specified geometry. More...
 

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...
 
GeoID_t const & ID () const
 Returns the actual type of ID we store. More...
 
GeoID_tID ()
 
- Protected Member Functions inherited from geo::details::geometry_iterator_base
geo::GeometryCore const * geometry () const
 Returns a pointer to the geometry. More...
 
 geometry_iterator_base ()
 Default constructor; do not use a default-constructed iterator as-is! 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 ()
 
ID_t const & local_index () const
 Returns the index (part if the ID) this iterator runs on. More...
 
ID_tlocal_index ()
 

Private Attributes

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

Additional Inherited Members

- Static Public Attributes inherited from geo::details::geometry_iterator_types
static constexpr BeginPos_t begin_pos = {}
 
static constexpr EndPos_t end_pos = {}
 
static constexpr UndefinedPos_t undefined_pos = {}
 

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 148 of file GeometryCore.h.

Member Typedef Documentation

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::difference_type = std::ptrdiff_t

Definition at line 164 of file GeometryCore.h.

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

Definition at line 152 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 153 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 226 of file GeometryCore.h.

this iterator

Definition at line 155 of file GeometryCore.h.

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::iterator_category = std::input_iterator_tag

Definition at line 168 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 157 of file GeometryCore.h.

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::pointer = value_type const*

Definition at line 167 of file GeometryCore.h.

template<typename GEOID>
using geo::details::cryostat_id_iterator_base< GEOID >::reference = value_type const&

Definition at line 166 of file GeometryCore.h.

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

Definition at line 165 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 173 of file GeometryCore.h.

173 {}
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 176 of file GeometryCore.h.

176  :
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:173
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 181 of file GeometryCore.h.

181  :
183  { id = start_from; }
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:109
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:173
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 187 of file GeometryCore.h.

187  :
189  { set_begin(); }
void set_begin()
Sets the iterator to the begin position.
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:109
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:173
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 192 of file GeometryCore.h.

192  :
194  { set_end(); }
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:109
cryostat_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:173
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 229 of file GeometryCore.h.

229  :
230  geometry_iterator_base(geom), id()
231  { set_local_limits(); }
geometry_iterator_base()
Default constructor; do not use a default-constructed iterator as-is!
Definition: GeometryCore.h:126
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:246

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 243 of file GeometryCore.h.

243 { return local_index() == limit; }
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
Definition: GeometryCore.h:267
ID_t limit
maximum number of cryostats
Definition: GeometryCore.h:247
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 5838 of file GeometryCore.h.

5840  { return geometry()->GetElementPtr(localID()); }
CryostatGeo const * GetElementPtr(geo::CryostatID const &cryoid) const
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:123
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
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 235 of file GeometryCore.h.

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

Definition at line 236 of file GeometryCore.h.

236 { return id; }
GeoID_t id
ID of the current cryostat.
Definition: GeometryCore.h:246
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 267 of file GeometryCore.h.

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

Definition at line 268 of file GeometryCore.h.

268 { return localID().Cryostat; }
CryostatID_t Cryostat
Index of cryostat.
Definition: geo_types.h:212
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
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 260 of file GeometryCore.h.

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

Definition at line 262 of file GeometryCore.h.

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

Skips to the next cryostat.

Definition at line 5855 of file GeometryCore.h.

5855  {
5856  if (at_end()) return;
5857  if (++local_index() < limit) return;
5858  localID().isValid = false;
5859 } // 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:267
ID_t limit
maximum number of cryostats
Definition: GeometryCore.h:247
bool isValid
Whether this ID points to a valid element.
Definition: geo_types.h:211
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:243
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 5834 of file GeometryCore.h.

5835  { return geometry() && geometry()->HasElement(localID()); }
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:123
bool HasElement(geo::CryostatID const &cryoid) const
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
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 204 of file GeometryCore.h.

205  { return localID() != as.localID(); }
static constexpr double as
Definition: Units.h:101
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
template<typename GEOID>
reference geo::details::cryostat_id_iterator_base< GEOID >::operator* ( ) const
inline

Returns the ID the iterator points to.

Definition at line 208 of file GeometryCore.h.

208 { return localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
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 214 of file GeometryCore.h.

214 { 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 217 of file GeometryCore.h.

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

Returns a pointer to the ID the iterator points to.

Definition at line 211 of file GeometryCore.h.

211 { return &(localID()); }
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
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 199 of file GeometryCore.h.

200  { return localID() == as.localID(); }
static constexpr double as
Definition: Units.h:101
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260
template<typename GEOID >
void geo::details::cryostat_id_iterator_base< GEOID >::set_begin ( )
inlineprivate

Sets the iterator to the begin position.

Definition at line 5847 of file GeometryCore.h.

5848  { geometry()->GetBeginID(ID()); }
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:123
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:235
template<typename GEOID >
void geo::details::cryostat_id_iterator_base< GEOID >::set_end ( )
inlineprivate

Sets the iterator to the end position.

Definition at line 5851 of file GeometryCore.h.

5852  { 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:123
GeoID_t const & ID() const
Returns the actual type of ID we store.
Definition: GeometryCore.h:235
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 5843 of file GeometryCore.h.

5844  { limit = geometry()->NSiblingElements(localID()); }
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:123
ID_t limit
maximum number of cryostats
Definition: GeometryCore.h:247
unsigned int NSiblingElements(geo::CryostatID const &) const
LocalID_t const & localID() const
Returns the type of ID we act on.
Definition: GeometryCore.h:260

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 246 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 247 of file GeometryCore.h.


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