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 814 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 817 of file Track.h.

821 ( begin, end )
822 {}
A convenience for use with range-for.
Definition: MemoryX.h:277
TrackIter< TrackType > end() const
Definition: MemoryX.h:291
TrackIter< TrackType > begin() const
Definition: MemoryX.h:290

Member Function Documentation

◆ EndingAfter()

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

Definition at line 892 of file Track.h.

893 {
894 const auto newEnd = this->reversal().find( pTrack ).base();
895 // More careful construction is needed so that the independent
896 // increment and decrement of each iterator in the NEW pair
897 // has the expected behavior at boundaries of the range
898 return {
899 { this->first.mBegin, this->first.mIter, newEnd.mIter,
900 this->first.GetPredicate() },
901 { this->first.mBegin, newEnd.mIter, newEnd.mIter,
902 this->second.GetPredicate() }
903 };
904 }
IteratorRange< reverse_iterator > reversal() const
Definition: MemoryX.h:287

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 907 of file Track.h.

908 {
909 return this->operator - (
910 [=](const Track *pTrack){ return pExcluded == pTrack; } );
911 }
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:123
TrackIterRange operator-(const Predicate2 &pred2) const
Definition: Track.h:853

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 870 of file Track.h.

871 {
872 return {
873 this-> first.template Filter< TrackType2 >(),
874 this->second.template Filter< TrackType2 >()
875 };
876 }
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 827 of file Track.h.

828 {
829 const auto &pred1 = this->first.GetPredicate();
830 using Function = typename TrackIter<TrackType>::FunctionType;
831 const auto &newPred = pred1
832 ? Function{ [=] (typename Function::argument_type track) {
833 return pred1(track) && pred2(track);
834 } }
835 : Function{ pred2 };
836 return {
837 this->first.Filter( newPred ),
838 this->second.Filter( newPred )
839 };
840 }
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:660

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 845 of file Track.h.

846 {
847 return this->operator + ( std::mem_fn( pmf ) );
848 }
TrackIterRange operator+(const Predicate2 &pred2) const
Definition: Track.h:827

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 853 of file Track.h.

854 {
855 using ArgumentType =
856 typename TrackIterRange::iterator::FunctionType::argument_type;
857 auto neg = [=] (ArgumentType track) { return !pred2( track ); };
858 return this->operator + ( neg );
859 }

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 864 of file Track.h.

865 {
866 return this->operator + ( std::not1( std::mem_fn( pmf ) ) );
867 }

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 878 of file Track.h.

879 {
880 auto newBegin = this->find( pTrack );
881 // More careful construction is needed so that the independent
882 // increment and decrement of each iterator in the NEW pair
883 // has the expected behavior at boundaries of the range
884 return {
885 { newBegin.mIter, newBegin.mIter, this->second.mEnd,
886 this->first.GetPredicate() },
887 { newBegin.mIter, this->second.mIter, this->second.mEnd,
888 this->second.GetPredicate() }
889 };
890 }
iterator find(const T &t) const
Definition: MemoryX.h:300

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 915 of file Track.h.

916 {
917 for (auto track : *this)
918 track->TypeSwitch(functions...);
919 }

◆ 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 924 of file Track.h.

925 {
926 if ( flag ) for (auto track : *this) {
927 track->TypeSwitch(functions...);
928 if (!flag)
929 break;
930 }
931 }
static std::once_flag flag

References flag.


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