LArSoft  v10_04_05
Liquid Argon Software toolkit - https://larsoft.org/
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
geo::Iterable< IterationPolicy, Transform > Class Template Reference

#include "Iterable.h"

Public Types

template<typename T >
using range_type = details::RangeType< iterator_type< T >, id_sentinel_for< T >>
 

Public Member Functions

 Iterable (IterationPolicy const &policy)
 
 Iterable (IterationPolicy const &policy, Transform const &transform)
 
template<typename T >
iterator_type< T > begin () const
 
template<typename T , typename BaseID >
iterator_type< T > begin (BaseID const &id) const
 
template<typename T >
id_sentinel_for< T > end () const
 
template<typename T , typename BaseID >
id_sentinel_for< T > end (BaseID const &id) const
 
template<typename T >
range_type< T > Iterate () const
 
template<typename T , typename ID >
range_type< T > Iterate (ID const &id) const
 

Private Types

template<typename T >
using id_sentinel_for = details::id_sentinel< typename details::IDIteratorValueType< T >::type >
 
template<typename T >
using iterator_type = typename details::IteratorFor< T, IterationPolicy, Transform >::type
 

Private Attributes

IterationPolicy fPolicy
 
std::conditional_t< std::is_same_v< Transform, void >, void_tag, Transform > fTransform
 

Detailed Description

template<typename IterationPolicy, typename Transform = void_tag>
class geo::Iterable< IterationPolicy, Transform >

Definition at line 56 of file Iterable.h.

Member Typedef Documentation

template<typename IterationPolicy, typename Transform = void_tag>
template<typename T >
using geo::Iterable< IterationPolicy, Transform >::id_sentinel_for = details::id_sentinel<typename details::IDIteratorValueType<T>::type>
private

Definition at line 58 of file Iterable.h.

template<typename IterationPolicy, typename Transform = void_tag>
template<typename T >
using geo::Iterable< IterationPolicy, Transform >::iterator_type = typename details::IteratorFor<T, IterationPolicy, Transform>::type
private

Definition at line 61 of file Iterable.h.

template<typename IterationPolicy, typename Transform = void_tag>
template<typename T >
using geo::Iterable< IterationPolicy, Transform >::range_type = details::RangeType<iterator_type<T>, id_sentinel_for<T>>

Definition at line 118 of file Iterable.h.

Constructor & Destructor Documentation

template<typename IterationPolicy, typename Transform = void_tag>
geo::Iterable< IterationPolicy, Transform >::Iterable ( IterationPolicy const &  policy)
inlineexplicit

Definition at line 64 of file Iterable.h.

64 : fPolicy{policy} {}
IterationPolicy fPolicy
Definition: Iterable.h:133
template<typename IterationPolicy, typename Transform = void_tag>
geo::Iterable< IterationPolicy, Transform >::Iterable ( IterationPolicy const &  policy,
Transform const &  transform 
)
inline

Definition at line 66 of file Iterable.h.

67  : fPolicy{policy}, fTransform{transform}
68  {}
IterationPolicy fPolicy
Definition: Iterable.h:133
std::conditional_t< std::is_same_v< Transform, void >, void_tag, Transform > fTransform
Definition: Iterable.h:134

Member Function Documentation

template<typename IterationPolicy, typename Transform = void_tag>
template<typename T >
iterator_type<T> geo::Iterable< IterationPolicy, Transform >::begin ( ) const
inline

Definition at line 72 of file Iterable.h.

73  {
74  using namespace details;
75  using ID = typename IDIteratorValueType<T>::type;
76  auto const iterator = iterator_for(ID::first(), fPolicy);
77  if constexpr (std::is_base_of<CryostatID, T>{}) { return iterator; }
78  else {
79  static_assert(!std::is_same_v<Transform, void_tag>);
80  return fTransform.template transform<T>(iterator);
81  }
82  }
intermediate_table::iterator iterator
IterationPolicy fPolicy
Definition: Iterable.h:133
auto iterator_for(LocalID const &id, SiblingPolicy const &siblingPolicy)
Definition: id_iterators.h:236
std::conditional_t< std::is_same_v< Transform, void >, void_tag, Transform > fTransform
Definition: Iterable.h:134
template<typename IterationPolicy, typename Transform = void_tag>
template<typename T , typename BaseID >
iterator_type<T> geo::Iterable< IterationPolicy, Transform >::begin ( BaseID const &  id) const
inline

Definition at line 85 of file Iterable.h.

86  {
87  using namespace details;
88  using ID = typename IDIteratorValueType<T>::type;
89  static_assert(is_base_of_strict<BaseID, ID>);
90  auto const iterator = iterator_for(ID::first(id), fPolicy);
91  if constexpr (std::is_base_of<CryostatID, T>{}) { return iterator; }
92  else {
93  static_assert(!std::is_same_v<Transform, void_tag>);
94  return fTransform.template transform<T>(iterator);
95  }
96  }
intermediate_table::iterator iterator
IterationPolicy fPolicy
Definition: Iterable.h:133
auto iterator_for(LocalID const &id, SiblingPolicy const &siblingPolicy)
Definition: id_iterators.h:236
std::conditional_t< std::is_same_v< Transform, void >, void_tag, Transform > fTransform
Definition: Iterable.h:134
template<typename IterationPolicy, typename Transform = void_tag>
template<typename T >
id_sentinel_for<T> geo::Iterable< IterationPolicy, Transform >::end ( ) const
inline

Definition at line 99 of file Iterable.h.

100  {
101  using namespace details;
102  using ID = typename IDIteratorValueType<T>::type;
103  static_assert(std::is_base_of<CryostatID, ID>{});
104  return {fPolicy.template GetEndID<ID>()};
105  }
IterationPolicy fPolicy
Definition: Iterable.h:133
template<typename IterationPolicy, typename Transform = void_tag>
template<typename T , typename BaseID >
id_sentinel_for<T> geo::Iterable< IterationPolicy, Transform >::end ( BaseID const &  id) const
inline

Definition at line 108 of file Iterable.h.

109  {
110  using namespace details;
111  using ID = typename IDIteratorValueType<T>::type;
112  static_assert(std::is_base_of<CryostatID, ID>{});
113  static_assert(is_base_of_strict<BaseID, ID>);
114  return {fPolicy.template GetEndID<ID>(id)};
115  }
IterationPolicy fPolicy
Definition: Iterable.h:133
template<typename IterationPolicy, typename Transform = void_tag>
template<typename T , typename ID >
range_type<T> geo::Iterable< IterationPolicy, Transform >::Iterate ( ID const &  id) const
inline

Definition at line 127 of file Iterable.h.

128  {
129  return ranges::make_subrange(begin<T>(id), end<T>(id));
130  }

Member Data Documentation

template<typename IterationPolicy, typename Transform = void_tag>
IterationPolicy geo::Iterable< IterationPolicy, Transform >::fPolicy
private

Definition at line 133 of file Iterable.h.

template<typename IterationPolicy, typename Transform = void_tag>
std::conditional_t<std::is_same_v<Transform, void>, void_tag, Transform> geo::Iterable< IterationPolicy, Transform >::fTransform
private

Definition at line 134 of file Iterable.h.


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