Audacity 3.2.0
Public Member Functions | List of all members
TrackIterRange< TrackType > Struct Template Reference

Range between two TrackIters, usable in range-for statements, and with Visit member functions. More...

#include <Track.h>

Inheritance diagram for TrackIterRange< TrackType >:
[legend]
Collaboration diagram for TrackIterRange< TrackType >:
[legend]

Public Member Functions

 TrackIterRange (const TrackIter< TrackType > &begin, const TrackIter< TrackType > &end)
 
template<typename Predicate2 >
TrackIterRange operator+ (const Predicate2 &pred2) const
 
template<typename R , typename C >
TrackIterRange operator+ (R(C ::*pmf)() const) const
 
template<typename Predicate2 >
TrackIterRange operator- (const Predicate2 &pred2) const
 
template<typename R , typename C >
TrackIterRange operator- (R(C ::*pmf)() const) const
 
template<typename TrackType2 >
TrackIterRange< TrackType2 > Filter () const
 
TrackIterRange StartingWith (const Track *pTrack) const
 
TrackIterRange EndingAfter (const Track *pTrack) const
 
TrackIterRange Excluding (const TrackType *pExcluded) const
 
template<typename ... Functions>
void Visit (const Functions &...functions)
 See Track::TypeSwitch. More...
 
template<typename Flag , typename ... Functions>
void VisitWhile (Flag &flag, const Functions &...functions)
 See Track::TypeSwitch. More...
 
- Public Member Functions inherited from IteratorRange< TrackIter< TrackType > >
 IteratorRange (const TrackIter< TrackType > &a, const TrackIter< TrackType > &b)
 
 IteratorRange (TrackIter< TrackType > &&a, TrackIter< TrackType > &&b)
 
IteratorRange< reverse_iteratorreversal () const
 
TrackIter< TrackType > begin () const
 
TrackIter< TrackType > end () const
 
reverse_iterator rbegin () const
 
reverse_iterator rend () const
 
bool empty () const
 
 operator bool () const
 
size_t size () const
 
iterator find (const T &t) const
 
long index (const T &t) const
 
bool contains (const T &t) const
 
iterator find_if (const F &f) const
 
long index_if (const F &f) const
 
bool all_of (const F &f) const
 
bool any_of (const F &f) const
 
bool none_of (const F &f) const
 
accumulate (R init, Binary binary_op={}, Unary unary_op={}) const
 
accumulate (R init, Binary binary_op, R2(C ::*pmf)() const) const
 
min (Unary unary_op={}) const
 
min (R2(C ::*pmf)() const) const
 
max (Unary unary_op={}) const
 
max (R2(C ::*pmf)() const) const
 
sum (Unary unary_op={}) const
 
sum (R2(C ::*pmf)() const) const
 

Additional Inherited Members

- Public Types inherited from IteratorRange< TrackIter< TrackType > >
using iterator = TrackIter< TrackType >
 
using reverse_iterator = std::reverse_iterator< TrackIter< TrackType > >
 

Detailed Description

template<typename TrackType>
struct TrackIterRange< TrackType >

Range between two TrackIters, usable in range-for statements, and with Visit member functions.

Definition at line 680 of file Track.h.

Constructor & Destructor Documentation

◆ TrackIterRange()

template<typename TrackType >
TrackIterRange< TrackType >::TrackIterRange ( const TrackIter< TrackType > &  begin,
const TrackIter< TrackType > &  end 
)
inline

Definition at line 683 of file Track.h.

687 ( begin, end )
688 {}
A convenience for use with range-for.
Definition: IteratorX.h:39
TrackIter< TrackType > end() const
Definition: IteratorX.h:53
TrackIter< TrackType > begin() const
Definition: IteratorX.h:52

Member Function Documentation

◆ EndingAfter()

template<typename TrackType >
TrackIterRange TrackIterRange< TrackType >::EndingAfter ( const Track pTrack) const
inline

Definition at line 758 of file Track.h.

759 {
760 const auto newEnd = this->reversal().find( pTrack ).base();
761 // More careful construction is needed so that the independent
762 // increment and decrement of each iterator in the NEW pair
763 // has the expected behavior at boundaries of the range
764 return {
765 { this->first.mBegin, this->first.mIter, newEnd.mIter,
766 this->first.GetPredicate() },
767 { this->first.mBegin, newEnd.mIter, newEnd.mIter,
768 this->second.GetPredicate() }
769 };
770 }
IteratorRange< reverse_iterator > reversal() const
Definition: IteratorX.h:49

References IteratorRange< TrackIter< TrackType > >::reversal().

Referenced by TrackList::SingletonRange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Excluding()

template<typename TrackType >
TrackIterRange TrackIterRange< TrackType >::Excluding ( const TrackType *  pExcluded) const
inline

Definition at line 773 of file Track.h.

774 {
775 return this->operator - (
776 [=](const Track *pTrack){ return pExcluded == pTrack; } );
777 }
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:110
TrackIterRange operator-(const Predicate2 &pred2) const
Definition: Track.h:719

References TrackIterRange< TrackType >::operator-().

Here is the call graph for this function:

◆ Filter()

template<typename TrackType >
template<typename TrackType2 >
TrackIterRange< TrackType2 > TrackIterRange< TrackType >::Filter ( ) const
inline

Definition at line 736 of file Track.h.

737 {
738 return {
739 this-> first.template Filter< TrackType2 >(),
740 this->second.template Filter< TrackType2 >()
741 };
742 }
Select only the subsequence of the type list satisfying the predicate.
Definition: TypeList.h:500

◆ operator+() [1/2]

template<typename TrackType >
template<typename Predicate2 >
TrackIterRange TrackIterRange< TrackType >::operator+ ( const Predicate2 &  pred2) const
inline

Definition at line 693 of file Track.h.

694 {
695 const auto &pred1 = this->first.GetPredicate();
696 using Function = typename TrackIter<TrackType>::FunctionType;
697 const auto &newPred = pred1
698 ? Function{ [=] (typename Function::argument_type track) {
699 return pred1(track) && pred2(track);
700 } }
701 : Function{ pred2 };
702 return {
703 this->first.Filter( newPred ),
704 this->second.Filter( newPred )
705 };
706 }
std::function< bool(std::add_pointer_t< std::add_const_t< std::remove_pointer_t< TrackType > > >) > FunctionType
Type of predicate taking pointer to const TrackType.
Definition: Track.h:526

Referenced by TrackIterRange< TrackType >::operator+(), and TrackIterRange< TrackType >::operator-().

Here is the caller graph for this function:

◆ operator+() [2/2]

template<typename TrackType >
template<typename R , typename C >
TrackIterRange TrackIterRange< TrackType >::operator+ ( R(C ::*)() const  pmf) const
inline

Definition at line 711 of file Track.h.

712 {
713 return this->operator + ( std::mem_fn( pmf ) );
714 }
TrackIterRange operator+(const Predicate2 &pred2) const
Definition: Track.h:693

References TrackIterRange< TrackType >::operator+().

Here is the call graph for this function:

◆ operator-() [1/2]

template<typename TrackType >
template<typename Predicate2 >
TrackIterRange TrackIterRange< TrackType >::operator- ( const Predicate2 &  pred2) const
inline

Definition at line 719 of file Track.h.

720 {
721 using ArgumentType =
722 typename TrackIterRange::iterator::FunctionType::argument_type;
723 auto neg = [=] (ArgumentType track) { return !pred2( track ); };
724 return this->operator + ( neg );
725 }

References TrackIterRange< TrackType >::operator+().

Referenced by TrackIterRange< TrackType >::Excluding().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator-() [2/2]

template<typename TrackType >
template<typename R , typename C >
TrackIterRange TrackIterRange< TrackType >::operator- ( R(C ::*)() const  pmf) const
inline

Definition at line 730 of file Track.h.

731 {
732 return this->operator + ( std::not1( std::mem_fn( pmf ) ) );
733 }

References TrackIterRange< TrackType >::operator+().

Here is the call graph for this function:

◆ StartingWith()

template<typename TrackType >
TrackIterRange TrackIterRange< TrackType >::StartingWith ( const Track pTrack) const
inline

Definition at line 744 of file Track.h.

745 {
746 auto newBegin = this->find( pTrack );
747 // More careful construction is needed so that the independent
748 // increment and decrement of each iterator in the NEW pair
749 // has the expected behavior at boundaries of the range
750 return {
751 { newBegin.mIter, newBegin.mIter, this->second.mEnd,
752 this->first.GetPredicate() },
753 { newBegin.mIter, this->second.mIter, this->second.mEnd,
754 this->second.GetPredicate() }
755 };
756 }
iterator find(const T &t) const
Definition: IteratorX.h:62

References IteratorRange< TrackIter< TrackType > >::find().

Referenced by TrackList::SingletonRange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Visit()

template<typename TrackType >
template<typename ... Functions>
void TrackIterRange< TrackType >::Visit ( const Functions &...  functions)
inline

See Track::TypeSwitch.

Definition at line 781 of file Track.h.

782 {
783 for (auto track : *this)
784 track->TypeSwitch(functions...);
785 }

◆ VisitWhile()

template<typename TrackType >
template<typename Flag , typename ... Functions>
void TrackIterRange< TrackType >::VisitWhile ( Flag &  flag,
const Functions &...  functions 
)
inline

See Track::TypeSwitch.

Visit until flag is false, or no more tracks

Definition at line 790 of file Track.h.

791 {
792 if ( flag ) for (auto track : *this) {
793 track->TypeSwitch(functions...);
794 if (!flag)
795 break;
796 }
797 }
static std::once_flag flag

References flag.


The documentation for this struct was generated from the following files: