LArSoft
v06_85_00
Liquid Argon Software toolkit - http://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 59 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::InnerContainer_t = typename InnerContainerExtractor_t::result_type |
Definition at line 157 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::InnerContainerExtractor_t = INNERCONTEXTRACT |
Definition at line 156 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::InnerIterator_t = typename InnerContainer_t::const_iterator |
Definition at line 160 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 164 of file NestedIterator.h.
using lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::OuterIterator_t = ITER |
Definition at line 155 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 167 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 323 of file NestedIterator.h.
|
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 212 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 233 of file NestedIterator.h.
|
inlineprotected |
Internal constructor: past-the-end iterator pointing to specified place.
Definition at line 298 of file NestedIterator.h.
|
inlineprivate |
Extracts the value out of the inner iterator.
Definition at line 310 of file NestedIterator.h.
|
private |
Definition at line 353 of file NestedIterator.h.
References evd::details::begin(), and evd::details::end().
|
inlineprivate |
Definition at line 306 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator!=(), and lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::operator==().
|
inline |
Bonus: convert to bool to find out if we are at the end.
Definition at line 283 of file NestedIterator.h.
|
inline |
Bonus: convert to bool to find out if we are at the end.
Definition at line 284 of file NestedIterator.h.
|
inline |
Returns true if the two iterators are not equivalent.
Definition at line 270 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 257 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 334 of file NestedIterator.h.
|
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 252 of file NestedIterator.h.
|
inline |
Definition at line 258 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.
|
private |
Definition at line 360 of file NestedIterator.h.
|
private |
points to the next item
Definition at line 364 of file NestedIterator.h.
void lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap | ( | iterator_type & | with | ) |
Swaps this with the specified iterator.
Definition at line 343 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 173 of file NestedIterator.h.
|
static |
Definition at line 174 of file NestedIterator.h.
|
protected |
stores the end of current inner container
Definition at line 295 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap().
|
protected |
points to the current element
Definition at line 294 of file NestedIterator.h.
Referenced by 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 >::swap().
|
protected |
points to past-the-end inner container
Definition at line 292 of file NestedIterator.h.
Referenced by lar::deep_const_fwd_iterator_nested< ITER, INNERCONTEXTRACT >::swap().
|
protected |
points to current inner container
Definition at line 291 of file NestedIterator.h.
Referenced by 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 >::swap().