LArSoft
v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
|
Internal helper class: actual implementation of nested iterator. More...
#include "NestedIterator.h"
Classes | |
struct | BeginPositionTag |
struct | EndPositionTag |
Public Types | |
using | OuterIterator_t = ITER |
using | InnerContainerExtractor_t = INNERCONTEXTRACT |
using | InnerContainer_t = typename InnerContainerExtractor_t::result_type |
using | InnerIterator_t = typename InnerContainer_t::const_iterator |
using | iterator_type = deep_const_fwd_iterator_nested< OuterIterator_t, InnerContainerExtractor_t > |
using | value_type = typename InnerIterator_t::value_type |
Type of the value pointed by the iterator. More... | |
Public Member Functions | |
deep_const_fwd_iterator_nested ()=default | |
Default constructor: invalid iterator. More... | |
deep_const_fwd_iterator_nested (OuterIterator_t src, OuterIterator_t end) | |
Constructor: starts from the container at the specified iterator. More... | |
template<class CONT > | |
deep_const_fwd_iterator_nested (const CONT &cont, BeginPositionTag) | |
Constructor: starts from the beginning of the specified container. More... | |
template<class CONT > | |
deep_const_fwd_iterator_nested (const CONT &cont, EndPositionTag) | |
Constructor: starts from the end of the specified container. More... | |
iterator_type & | operator++ () |
Prefix increment operator: points to the next element. More... | |
iterator_type | operator++ (int) |
Postfix increment operator: points to the next element. More... | |
void | swap (iterator_type &with) |
Swaps this with the specified iterator. More... | |
Dereference operators | |
const value_type & | operator* () const |
const value_type & | operator-> () const |
Comparison operators | |
Returns true if the two iterators are equivalent | |
bool | operator== (const iterator_type &as) const |
Returns true if the two iterators are not equivalent. More... | |
bool | operator!= (const iterator_type &as) const |
Returns true if the two iterators are not equivalent. More... | |
operator bool () const | |
Bonus: convert to bool to find out if we are at the end. More... | |
bool | operator! () const |
Bonus: convert to bool to find out if we are at the end. More... | |
Static Public Attributes | |
static constexpr BeginPositionTag | begin = {} |
static constexpr EndPositionTag | end = {} |
Protected Member Functions | |
deep_const_fwd_iterator_nested (OuterIterator_t end) | |
Internal constructor: past-the-end iterator pointing to specified place. More... | |
Protected Attributes | |
OuterIterator_t | outer_iter |
points to current inner container More... | |
OuterIterator_t | outer_end |
points to past-the-end inner container More... | |
InnerIterator_t | inner_iter |
points to the current element More... | |
InnerIterator_t | inner_end |
stores the end of current inner container More... | |
Private Member Functions | |
void | init_inner () |
void | reset_inner () |
void | skip_empty () |
points to the next item More... | |
bool | is_end () const |
const InnerContainerExtractor_t::result_type & | extract_container (const typename OuterIterator_t::value_type &v) |
Extracts the value out of the inner iterator. More... | |
Internal helper class: actual implementation of nested iterator.
Definition at line 53 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::InnerContainer_t = typename InnerContainerExtractor_t::result_type |
Definition at line 145 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::InnerContainerExtractor_t = INNERCONTEXTRACT |
Definition at line 144 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::InnerIterator_t = typename InnerContainer_t::const_iterator |
Definition at line 148 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::iterator_type = deep_const_fwd_iterator_nested<OuterIterator_t, InnerContainerExtractor_t> |
Definition at line 152 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::OuterIterator_t = ITER |
Definition at line 143 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::value_type = typename InnerIterator_t::value_type |
Type of the value pointed by the iterator.
Definition at line 155 of file NestedIterator.h.
|
default |
Default constructor: invalid iterator.
This constructor sets the iterator in an invalid, end-of-container state.
lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::deep_const_fwd_iterator_nested | ( | OuterIterator_t | src, |
OuterIterator_t | end | ||
) |
Constructor: starts from the container at the specified iterator.
src | the starting point of the iterator |
end | the end point of the iterator |
This constructor does not set and end. Due to how the class works, if the outer container has an "end", reaching it with this iterator has a undefined behaviour. You most likely want to use the constructor where you can also specify the end of the container.
Definition at line 315 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::init_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::is_end(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty().
|
inline |
Constructor: starts from the beginning of the specified container.
cont | the container |
[anonymous] | tag to select the begin-of-container behaviour |
The second parameter is used just to choose which constructor to use. Two constants are provided, begin and end, defined in the iterator itself (no explicit namespace is required). Example:
Definition at line 199 of file NestedIterator.h.
|
inline |
Constructor: starts from the end of the specified container.
cont | the container |
[anonymous] | tag to select the end-of-container behaviour |
The second parameter is used just to choose which constructor to use. Two constants are provided, begin and end, defined in the iterator itself (no explicit namespace is required). Example:
Definition at line 222 of file NestedIterator.h.
|
inlineprotected |
Internal constructor: past-the-end iterator pointing to specified place.
Definition at line 291 of file NestedIterator.h.
|
inlineprivate |
Extracts the value out of the inner iterator.
Definition at line 302 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::init_inner().
|
private |
Definition at line 344 of file NestedIterator.h.
References util::begin(), util::end(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::extract_container(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_end, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter, and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::outer_iter.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::deep_const_fwd_iterator_nested(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty().
|
inlineprivate |
Definition at line 299 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::deep_const_fwd_iterator_nested(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator!=(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator==(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty().
|
inline |
Bonus: convert to bool to find out if we are at the end.
Definition at line 276 of file NestedIterator.h.
|
inline |
Bonus: convert to bool to find out if we are at the end.
Definition at line 277 of file NestedIterator.h.
|
inline |
Returns true if the two iterators are not equivalent.
Definition at line 264 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::is_end(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::outer_iter.
|
inline |
Definition at line 251 of file NestedIterator.h.
deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT > & lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator++ | ( | ) |
Prefix increment operator: points to the next element.
The behaviour of this method on a past-the-end iterator is undefined (currently, chances are it will access invalid memory).
Definition at line 327 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter, and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty().
|
inline |
Postfix increment operator: points to the next element.
The behaviour of this method on a past-the-end iterator is undefined (currently, chances are it will access invalid memory).
Definition at line 242 of file NestedIterator.h.
|
inline |
Definition at line 252 of file NestedIterator.h.
|
inline |
Returns true if the two iterators are not equivalent.
Definition at line 258 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::is_end(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::outer_iter.
|
private |
Definition at line 351 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_end, and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty().
|
private |
points to the next item
Definition at line 357 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::init_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_end, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::is_end(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::outer_iter, and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::reset_inner().
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::deep_const_fwd_iterator_nested(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator++().
void lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap | ( | iterator_type & | with | ) |
Swaps this with the specified iterator.
Definition at line 335 of file NestedIterator.h.
References lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_end, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::inner_iter, lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::outer_end, and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::outer_iter.
Referenced by std::swap().
|
static |
Definition at line 160 of file NestedIterator.h.
|
static |
Definition at line 161 of file NestedIterator.h.
|
protected |
stores the end of current inner container
Definition at line 288 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::init_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::reset_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap().
|
protected |
points to the current element
Definition at line 287 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::init_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator!=(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator++(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator==(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::reset_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap().
|
protected |
points to past-the-end inner container
Definition at line 285 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap().
|
protected |
points to current inner container
Definition at line 284 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::init_inner(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator!=(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator==(), lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::skip_empty(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap().