All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
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...
 
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

 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...
 
reference operator* () const
 Returns the TPCsetID the iterator points to. More...
 
pointer 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...
 
- Protected Types inherited from geo::details::cryostat_id_iterator_base< GEOID >
using ID_t = typename LocalID_t::CryostatID_t
 
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...
 
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
 

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...
 
- Protected Member Functions inherited from geo::details::cryostat_id_iterator_base< GEOID >
 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 ()
 
 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...
 
- 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...
 
 geometry_iterator_base (geo::GeometryCore const *geom)
 Constructor: associates with the specified geometry. More...
 

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

Member Typedef Documentation

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

Definition at line 962 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 940 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 1023 of file GeometryCore.h.

Type of this iterator.

Definition at line 947 of file GeometryCore.h.

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

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

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

Definition at line 965 of file GeometryCore.h.

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

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

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

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

971 {}
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 974 of file GeometryCore.h.

976  {}
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
TPCset_id_iterator_base()
Default constructor; effect not defined: assign to it before using!
Definition: GeometryCore.h:971
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 980 of file GeometryCore.h.

981  : upper_iterator(geom, start_from)
982  { set_local_limits(); }
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:937
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 985 of file GeometryCore.h.

986  : upper_iterator(geom, begin_pos)
987  { set_local_limits(); }
static constexpr BeginPos_t begin_pos
Definition: GeometryCore.h:107
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:937
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 990 of file GeometryCore.h.

991  : upper_iterator(geom, end_pos)
992  {} // the local limit is ill-defined and left invalid
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:937
static constexpr EndPos_t end_pos
Definition: GeometryCore.h:108
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 1026 of file GeometryCore.h.

1027  : upper_iterator(geom, undefined_pos)
1028  {}
static constexpr UndefinedPos_t undefined_pos
Definition: GeometryCore.h:109
cryostat_id_iterator_base< GEOID > upper_iterator
Definition: GeometryCore.h:937

Member Function Documentation

template<typename GEOID>
upper_iterator::ElementPtr_t geo::details::TPCset_id_iterator_base< GEOID >::get ( ) const
privatedelete
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 1042 of file GeometryCore.h.

1042 { return localID().TPCset; }
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
LocalID_t const & localID() const
Returns the type of ID we act on.
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 1056 of file GeometryCore.h.

1056 { return localID().TPCset; }
TPCsetID_t TPCset
Index of the TPC set within its cryostat.
Definition: readout_types.h:90
LocalID_t const & localID() const
Returns the type of ID we act on.
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 1033 of file GeometryCore.h.

1034  { 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:235
readout::TPCsetID LocalID_t
Type of the ID we change.
Definition: GeometryCore.h:942
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 1053 of file GeometryCore.h.

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

Skips to the next TPC set.

Definition at line 6015 of file GeometryCore.h.

6015  {
6016  // if at end (checked in the inherited context), do nothing
6017  if (upper_iterator::at_end()) return;
6018 
6019  // if after incrementing we haven't reached the limit, we are done
6020  if (++local_index() < limit) return;
6021 
6022  // we reached the end of the current elements list, we need to escalate:
6023  // - go to the next parent; if that becomes invalid, too bad, but we go on
6025  // - set the index to the first element of the new parent
6026  local_index() = 0;
6027  // - update how many elements there are
6028  // (expect 0 if it is now at_end() -- and it does not even matter)
6029  set_local_limits();
6030 } // 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.
ID_t const & local_index() const
Returns the index (part if the ID) this iterator runs on.
void next()
Skips to the next cryostat.
bool at_end() const
Returns whether this iterator has reached the end.
Definition: GeometryCore.h:243
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 6002 of file GeometryCore.h.

6002  {
6003  return upper_iterator::geometry()
6005 } // geo::details::TPCset_id_iterator_base<>::operator bool()
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.
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 1002 of file GeometryCore.h.

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

Returns the TPCsetID the iterator points to.

Definition at line 1006 of file GeometryCore.h.

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

1012 { 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 1015 of file GeometryCore.h.

1015 { iterator old(*this); next(); return old; }
TPCset_id_iterator_base< GeoID_t > iterator
Type of this iterator.
Definition: GeometryCore.h:947
void next()
Skips to the next TPC set.
template<typename GEOID>
pointer geo::details::TPCset_id_iterator_base< GEOID >::operator-> ( ) const
inline

Returns the TPCsetID the iterator points to.

Definition at line 1009 of file GeometryCore.h.

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

998  { return localID() == as.localID(); }
LocalID_t const & localID() const
Returns the type of ID we act on.
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 6009 of file GeometryCore.h.

6009  {
6010  // limit is how many sibling TPCs there are
6012 } // geo::details::TPCset_id_iterator_base<GEOID>::set_local_limits()
geo::GeometryCore const * geometry() const
Returns a pointer to the geometry.
Definition: GeometryCore.h:123
unsigned int NSiblingElements(geo::CryostatID const &) const
ID_t limit
maximum number of TPC sets in the current cryostat.
LocalID_t const & localID() const
Returns the type of ID we act on.

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


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