Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
proxy::details::BoundaryList< Iter > Class Template Reference

Builds and keeps track of internal boundaries in a sequence. More...

#include <AssociatedData.h>

Public Types

using data_iterator_t = Iter
 
using boundaries_t = std::vector< data_iterator_t >
 
using range_iterator_t = BoundaryListRangeIterator< typename boundaries_t::const_iterator >
 Iterator on the ranges contained in the collection. More...
 
using range_ref_t = typename range_iterator_t::value_type
 Structure holding begin and end iterator for a single range. More...
 
using range_t = lar::RangeAsCollection_t< data_iterator_t >
 Range object directly containing the boundary iterators. More...
 

Public Member Functions

 BoundaryList (boundaries_t &&boundaries)
 Constructor: steals the specified boundary list. More...
 
std::size_t nRanges () const
 Returns the number of ranges contained in the list. More...
 
data_iterator_t const & rangeBegin (std::size_t i) const
 Returns the begin iterator of the i-th range (end if overflow). More...
 
data_iterator_t const & rangeEnd (std::size_t i) const
 Returns the end iterator of the i-th range (end if overflow). More...
 
std::size_t size () const
 Returns the number of ranges contained in the list. More...
 
range_iterator_t begin () const
 Returns the begin iterator of the first range. More...
 
range_iterator_t end () const
 Returns the end iterator of the last range. More...
 
range_ref_t rangeRef (std::size_t i) const
 Returns the specified range. More...
 
range_t range (std::size_t i) const
 Returns the specified range in an object holding the iterators. More...
 
auto operator[] (std::size_t i) const -> decltype(auto)
 

Private Types

using boundarylist_t = BoundaryList< Iter >
 

Private Attributes

boundaries_t boundaries
 Begin iterator of each range, plus end iterator of whole sequence. More...
 

Detailed Description

template<typename Iter>
class proxy::details::BoundaryList< Iter >

Builds and keeps track of internal boundaries in a sequence.

Template Parameters
Itertype of iterators to the original sequence

This class manages a sequence of boundary iterators defining the beginning of contiguous subsequences. Each iterator marks the begin of a subsequence, whose end is marked by the beginning of the next one. The last iterator in the boundary list marks the end of the last subsequence, but it does not mark the beginning of a following one. Therefore, for a list of N subsequences there will be N + 1 boundary iterators in the list: N marking the beginning of the respective subsequences, plus another marking the end of the last subsequence.

It is likely that the first iterator in the boundary list is the begin iterator of the underlying sequence (usually a container) being partitioned, while the last one is the end iterator of that sequence.

This is a data class which does not contain any logic to define the subsequences, but rather acquires the result of an algorithm which is expected to have established which the boundaries are.

The underlying representation of the class is a random-access sequence of boundaries. The exposed value, range_t, is a range of data elements (a view with the interface of a random access container), which is internally represented as a single iterator pointing to the begin iterator of the range.

Definition at line 669 of file AssociatedData.h.

Member Typedef Documentation

template<typename Iter>
using proxy::details::BoundaryList< Iter >::boundaries_t = std::vector<data_iterator_t>

Definition at line 673 of file AssociatedData.h.

template<typename Iter>
using proxy::details::BoundaryList< Iter >::boundarylist_t = BoundaryList<Iter>
private

Definition at line 670 of file AssociatedData.h.

template<typename Iter>
using proxy::details::BoundaryList< Iter >::data_iterator_t = Iter

Definition at line 672 of file AssociatedData.h.

Iterator on the ranges contained in the collection.

Definition at line 677 of file AssociatedData.h.

template<typename Iter>
using proxy::details::BoundaryList< Iter >::range_ref_t = typename range_iterator_t::value_type

Structure holding begin and end iterator for a single range.

Definition at line 681 of file AssociatedData.h.

Range object directly containing the boundary iterators.

Definition at line 684 of file AssociatedData.h.

Constructor & Destructor Documentation

template<typename Iter>
proxy::details::BoundaryList< Iter >::BoundaryList ( boundaries_t &&  boundaries)
inlineexplicit

Constructor: steals the specified boundary list.

Definition at line 688 of file AssociatedData.h.

690  { assert(this->boundaries.size() >= 1); }
boundaries_t boundaries
Begin iterator of each range, plus end iterator of whole sequence.
def move(depos, offset)
Definition: depos.py:107

Member Function Documentation

template<typename Iter>
range_iterator_t proxy::details::BoundaryList< Iter >::begin ( ) const
inline

Returns the begin iterator of the first range.

Definition at line 705 of file AssociatedData.h.

706  { return { boundaries.begin() }; }
boundaries_t boundaries
Begin iterator of each range, plus end iterator of whole sequence.
template<typename Iter>
range_iterator_t proxy::details::BoundaryList< Iter >::end ( ) const
inline

Returns the end iterator of the last range.

Definition at line 708 of file AssociatedData.h.

709  { return { std::prev(boundaries.end()) }; }
boundaries_t boundaries
Begin iterator of each range, plus end iterator of whole sequence.
template<typename Iter>
std::size_t proxy::details::BoundaryList< Iter >::nRanges ( ) const
inline

Returns the number of ranges contained in the list.

Definition at line 693 of file AssociatedData.h.

694  { return boundaries.size() - 1; }
boundaries_t boundaries
Begin iterator of each range, plus end iterator of whole sequence.
template<typename Iter>
auto proxy::details::BoundaryList< Iter >::operator[] ( std::size_t  i) const -> decltype(auto)
inline

Returns the begin iterator of the i-th range (unchecked).

See also
range()

Definition at line 744 of file AssociatedData.h.

745  { return range(i); }
range_t range(std::size_t i) const
Returns the specified range in an object holding the iterators.
template<typename Iter>
range_t proxy::details::BoundaryList< Iter >::range ( std::size_t  i) const
inline

Returns the specified range in an object holding the iterators.

Parameters
iindex of the range to be returned
Returns
a new object with container interface
See also
rangeRef()

The returned object contains copies of the begin and end iterators of the range. This object is self-contained and valid even after this BoundaryList object is destroyed.

Note the content of the range itself is not copied: just the boundary iterators of the range are.

Definition at line 739 of file AssociatedData.h.

740  { return lar::makeCollectionView(rangeBegin(i), rangeEnd(i)); }
data_iterator_t const & rangeBegin(std::size_t i) const
Returns the begin iterator of the i-th range (end if overflow).
auto makeCollectionView(BeginIter const &b, EndIter const &e)
Creates a CollectionView from the specified iterators.
data_iterator_t const & rangeEnd(std::size_t i) const
Returns the end iterator of the i-th range (end if overflow).
template<typename Iter>
data_iterator_t const& proxy::details::BoundaryList< Iter >::rangeBegin ( std::size_t  i) const
inline

Returns the begin iterator of the i-th range (end if overflow).

Definition at line 696 of file AssociatedData.h.

697  { return boundaries[std::min(i, nRanges())]; }
boundaries_t boundaries
Begin iterator of each range, plus end iterator of whole sequence.
std::size_t nRanges() const
Returns the number of ranges contained in the list.
T min(sqlite3 *const db, std::string const &table_name, std::string const &column_name)
Definition: statistics.h:55
template<typename Iter>
data_iterator_t const& proxy::details::BoundaryList< Iter >::rangeEnd ( std::size_t  i) const
inline

Returns the end iterator of the i-th range (end if overflow).

Definition at line 699 of file AssociatedData.h.

700  { return rangeBegin(i + 1); }
data_iterator_t const & rangeBegin(std::size_t i) const
Returns the begin iterator of the i-th range (end if overflow).
template<typename Iter>
range_ref_t proxy::details::BoundaryList< Iter >::rangeRef ( std::size_t  i) const
inline

Returns the specified range.

Parameters
iindex of the range to be returned
Returns
a proxy object with container interface
See also
range()

The returned object exposes the range as a random access container interface.

Internally, it refers to the relevant information from this BoundaryList object, and therefore it becomes invalid when this BoundaryList object is destroyed. If this is not acceptable, use range() instead.

Definition at line 724 of file AssociatedData.h.

725  { return { std::next(boundaries.begin(), i) }; }
boundaries_t boundaries
Begin iterator of each range, plus end iterator of whole sequence.
template<typename Iter>
std::size_t proxy::details::BoundaryList< Iter >::size ( void  ) const
inline

Returns the number of ranges contained in the list.

Definition at line 703 of file AssociatedData.h.

703 { return nRanges(); }
std::size_t nRanges() const
Returns the number of ranges contained in the list.

Member Data Documentation

template<typename Iter>
boundaries_t proxy::details::BoundaryList< Iter >::boundaries
private

Begin iterator of each range, plus end iterator of whole sequence.

Definition at line 749 of file AssociatedData.h.


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