All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Attributes | Friends | List of all members
geo::details::geometry_element_iterator< GEOIDITER > Class Template Reference

Forward iterator browsing all geometry elements in the detector. More...

#include <GeometryCore.h>

Inheritance diagram for geo::details::geometry_element_iterator< GEOIDITER >:
geo::details::geometry_iterator_types

Public Types

using id_iterator_t = GEOIDITER
 
using iterator = geometry_element_iterator< id_iterator_t >
 this type More...
 
using Element_t = typename std::remove_pointer< ElementPtr_t >::type
 Geometry class pointed by the iterator. More...
 
Types mirrored from the ID iterator
using LocalID_t = typename id_iterator_t::LocalID_t
 
using GeoID_t = typename id_iterator_t::GeoID_t
 
using UndefinedPos_t = typename id_iterator_t::UndefinedPos_t
 
using BeginPos_t = typename id_iterator_t::BeginPos_t
 
using EndPos_t = typename id_iterator_t::EndPos_t
 
using ElementPtr_t = typename id_iterator_t::ElementPtr_t
 
Iterator traits
using difference_type = std::ptrdiff_t
 
using value_type = Element_t
 
using reference = value_type const &
 
using pointer = value_type const *
 
using iterator_category = std::forward_iterator_tag
 

Public Member Functions

 geometry_element_iterator ()=default
 Default constructor; effect not defined: assign to it before using! More...
 
 geometry_element_iterator (geo::GeometryCore const *geom)
 Constructor: points to begin. More...
 
 geometry_element_iterator (id_iterator_t const &iter)
 Constructor: points to the same element as the specified ID iterator. More...
 
 geometry_element_iterator (id_iterator_t &&iter)
 Constructor: points to the same element as the specified ID iterator. More...
 
 geometry_element_iterator (geo::GeometryCore const *geom, GeoID_t const &start_from)
 Constructor: points to the specified geometry element. More...
 
 geometry_element_iterator (geo::GeometryCore const *geom, BeginPos_t const pos)
 Constructor: points to beginning. More...
 
 geometry_element_iterator (geo::GeometryCore const *geom, EndPos_t const pos)
 Constructor: points to end. More...
 
bool operator== (iterator const &as) const
 Returns true if the two iterators point to the same object. More...
 
bool operator!= (iterator const &as) const
 Returns true if the two iterators point to different objects. More...
 
reference operator* () const
 Returns the geometry element the iterator points to. More...
 
pointer operator-> () const
 Returns a pointer to the element the iterator points to (or nullptr) More...
 
iteratoroperator++ ()
 Prefix increment: returns this iterator pointing to the next element. 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 geometry element. More...
 
ElementPtr_t get () const
 Returns a pointer to the geometry element, or nullptr if invalid. More...
 
LocalID_t const & ID () const
 Returns the ID of the pointed geometry element. More...
 

Protected Member Functions

id_iterator_t const & id_iterator () const
 Access to the base ID iterator. More...
 
id_iterator_tid_iterator ()
 

Private Attributes

id_iterator_t id_iter
 iterator performing the job More...
 

Friends

bool geo::details::operator== (iterator const &iter, id_iterator_t const &id_iter)
 
bool geo::details::operator== (id_iterator_t const &id_iter, iterator const &iter)
 
bool geo::details::operator!= (iterator const &iter, id_iterator_t const &id_iter)
 
bool geo::details::operator!= (id_iterator_t const &id_iter, iterator const &iter)
 

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 GEOIDITER>
class geo::details::geometry_element_iterator< GEOIDITER >

Forward iterator browsing all geometry elements in the detector.

Template Parameters
GEOITERtype of geometry ID iterator

This iterator works as the corresponding ID iterator in the template argument. The difference is the dereferenciation operator: this one obtains the geometry element directly, or throws on failure. The boolean conversion operator checks that it can obtain a pointer to the geometry element.

In particular, get() and ID() methods still return the pointer to the geometry element and its ID, respectively.

It can also be initialized and compare with the corresponding ID iterator.

Definition at line 727 of file GeometryCore.h.

Member Typedef Documentation

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::BeginPos_t = typename id_iterator_t::BeginPos_t

Definition at line 793 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::difference_type = std::ptrdiff_t

Definition at line 811 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::Element_t = typename std::remove_pointer<ElementPtr_t>::type

Geometry class pointed by the iterator.

Definition at line 806 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::ElementPtr_t = typename id_iterator_t::ElementPtr_t

Definition at line 795 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::EndPos_t = typename id_iterator_t::EndPos_t

Definition at line 794 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::GeoID_t = typename id_iterator_t::GeoID_t

Definition at line 791 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::id_iterator_t = GEOIDITER

Definition at line 778 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::iterator = geometry_element_iterator<id_iterator_t>

this type

Definition at line 786 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::iterator_category = std::forward_iterator_tag

Definition at line 815 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::LocalID_t = typename id_iterator_t::LocalID_t

Definition at line 790 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::pointer = value_type const*

Definition at line 814 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::reference = value_type const&

Definition at line 813 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::UndefinedPos_t = typename id_iterator_t::UndefinedPos_t

Definition at line 792 of file GeometryCore.h.

template<typename GEOIDITER>
using geo::details::geometry_element_iterator< GEOIDITER >::value_type = Element_t

Definition at line 812 of file GeometryCore.h.

Constructor & Destructor Documentation

template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( )
default

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

template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( geo::GeometryCore const *  geom)
inline

Constructor: points to begin.

Definition at line 823 of file GeometryCore.h.

823  :
824  id_iter(geom) {}
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( id_iterator_t const &  iter)
inline

Constructor: points to the same element as the specified ID iterator.

Definition at line 827 of file GeometryCore.h.

827 : id_iter(iter) {}
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( id_iterator_t &&  iter)
inline

Constructor: points to the same element as the specified ID iterator.

Definition at line 830 of file GeometryCore.h.

830 : id_iter(iter) {}
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( geo::GeometryCore const *  geom,
GeoID_t const &  start_from 
)
inline

Constructor: points to the specified geometry element.

Definition at line 834 of file GeometryCore.h.

834  :
835  id_iter(geom, start_from)
836  {}
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( geo::GeometryCore const *  geom,
BeginPos_t const  pos 
)
inline

Constructor: points to beginning.

Definition at line 840 of file GeometryCore.h.

840  :
841  id_iter(geom, pos)
842  {}
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::geometry_element_iterator ( geo::GeometryCore const *  geom,
EndPos_t const  pos 
)
inline

Constructor: points to end.

Definition at line 846 of file GeometryCore.h.

846  :
847  id_iter(geom, pos)
848  {}
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910

Member Function Documentation

template<typename GEOIDITER>
ElementPtr_t geo::details::geometry_element_iterator< GEOIDITER >::get ( ) const
inline

Returns a pointer to the geometry element, or nullptr if invalid.

Definition at line 888 of file GeometryCore.h.

888 { return id_iterator().get(); }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905
template<typename GEOIDITER>
LocalID_t const& geo::details::geometry_element_iterator< GEOIDITER >::ID ( ) const
inline

Returns the ID of the pointed geometry element.

Definition at line 891 of file GeometryCore.h.

891 { return *(id_iterator()); }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905
template<typename GEOIDITER>
id_iterator_t const& geo::details::geometry_element_iterator< GEOIDITER >::id_iterator ( ) const
inlineprotected

Access to the base ID iterator.

Definition at line 905 of file GeometryCore.h.

905 { return id_iter; }
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
id_iterator_t& geo::details::geometry_element_iterator< GEOIDITER >::id_iterator ( )
inlineprotected

Definition at line 906 of file GeometryCore.h.

906 { return id_iter; }
id_iterator_t id_iter
iterator performing the job
Definition: GeometryCore.h:910
template<typename GEOIDITER>
geo::details::geometry_element_iterator< GEOIDITER >::operator bool ( ) const
inline

Returns whether the iterator is pointing to a valid geometry element.

Definition at line 884 of file GeometryCore.h.

885  { return bool(id_iterator()) && (id_iterator().get() != nullptr); }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905
static constexpr bool
template<typename GEOIDITER>
bool geo::details::geometry_element_iterator< GEOIDITER >::operator!= ( iterator const &  as) const
inline

Returns true if the two iterators point to different objects.

Definition at line 855 of file GeometryCore.h.

856  { return id_iterator() != as.id_iterator(); }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905
template<typename GEOIDITER>
reference geo::details::geometry_element_iterator< GEOIDITER >::operator* ( ) const
inline

Returns the geometry element the iterator points to.

Returns
a constant reference to the element the iterator points to
Exceptions
cet::exception(category "geometry_iterator") if no valid geometry element is currently pointed by the iterator

Definition at line 864 of file GeometryCore.h.

865  {
866  ElementPtr_t ptr = get();
867  if (ptr) return *ptr;
868  throw cet::exception("geometry_iterator")
869  << "iterator attempted to obtain geometry element "
870  << std::string(ID());
871  } // operator*()
LocalID_t const & ID() const
Returns the ID of the pointed geometry element.
Definition: GeometryCore.h:891
typename id_iterator_t::ElementPtr_t ElementPtr_t
Definition: GeometryCore.h:795
template<typename GEOIDITER>
iterator& geo::details::geometry_element_iterator< GEOIDITER >::operator++ ( )
inline

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

Definition at line 877 of file GeometryCore.h.

877 { ++id_iterator(); return *this; }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905
template<typename GEOIDITER>
iterator geo::details::geometry_element_iterator< GEOIDITER >::operator++ ( int  )
inline

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

Definition at line 880 of file GeometryCore.h.

881  { iterator old(*this); ++id_iterator(); return old; }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905
geometry_element_iterator< id_iterator_t > iterator
this type
Definition: GeometryCore.h:786
template<typename GEOIDITER>
pointer geo::details::geometry_element_iterator< GEOIDITER >::operator-> ( ) const
inline

Returns a pointer to the element the iterator points to (or nullptr)

Definition at line 874 of file GeometryCore.h.

874 { return get(); }
template<typename GEOIDITER>
bool geo::details::geometry_element_iterator< GEOIDITER >::operator== ( iterator const &  as) const
inline

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

Definition at line 851 of file GeometryCore.h.

852  { return id_iterator() == as.id_iterator(); }
id_iterator_t const & id_iterator() const
Access to the base ID iterator.
Definition: GeometryCore.h:905

Friends And Related Function Documentation

template<typename GEOIDITER>
bool geo::details::operator!= ( iterator const &  iter,
id_iterator_t const &  id_iter 
)
friend
template<typename GEOIDITER>
bool geo::details::operator!= ( id_iterator_t const &  id_iter,
iterator const &  iter 
)
friend
template<typename GEOIDITER>
bool geo::details::operator== ( iterator const &  iter,
id_iterator_t const &  id_iter 
)
friend
template<typename GEOIDITER>
bool geo::details::operator== ( id_iterator_t const &  id_iter,
iterator const &  iter 
)
friend

Member Data Documentation

template<typename GEOIDITER>
id_iterator_t geo::details::geometry_element_iterator< GEOIDITER >::id_iter
private

iterator performing the job

Definition at line 910 of file GeometryCore.h.


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