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

1173 ( begin, end )
1174 {}
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 1244 of file Track.h.

1245 {
1246 const auto newEnd = this->reversal().find( pTrack ).base();
1247 // More careful construction is needed so that the independent
1248 // increment and decrement of each iterator in the NEW pair
1249 // has the expected behavior at boundaries of the range
1250 return {
1251 { this->first.mBegin, this->first.mIter, newEnd.mIter,
1252 this->first.GetPredicate() },
1253 { this->first.mBegin, newEnd.mIter, newEnd.mIter,
1254 this->second.GetPredicate() }
1255 };
1256 }
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 1259 of file Track.h.

1260 {
1261 return this->operator - (
1262 [=](const Track *pTrack){ return pExcluded == pTrack; } );
1263 }
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:226
TrackIterRange operator-(const Predicate2 &pred2) const
Definition: Track.h:1205

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

1223 {
1224 return {
1225 this-> first.template Filter< TrackType2 >(),
1226 this->second.template Filter< TrackType2 >()
1227 };
1228 }

Referenced by SyncLock::Group().

Here is the caller 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 1179 of file Track.h.

1180 {
1181 const auto &pred1 = this->first.GetPredicate();
1182 using Function = typename TrackIter<TrackType>::FunctionType;
1183 const auto &newPred = pred1
1184 ? Function{ [=] (typename Function::argument_type track) {
1185 return pred1(track) && pred2(track);
1186 } }
1187 : Function{ pred2 };
1188 return {
1189 this->first.Filter( newPred ),
1190 this->second.Filter( newPred )
1191 };
1192 }
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:1012

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

1198 {
1199 return this->operator + ( std::mem_fn( pmf ) );
1200 }
TrackIterRange operator+(const Predicate2 &pred2) const
Definition: Track.h:1179

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

1206 {
1207 using ArgumentType =
1208 typename TrackIterRange::iterator::FunctionType::argument_type;
1209 auto neg = [=] (ArgumentType track) { return !pred2( track ); };
1210 return this->operator + ( neg );
1211 }

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

1217 {
1218 return this->operator + ( std::not1( std::mem_fn( pmf ) ) );
1219 }

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

1231 {
1232 auto newBegin = this->find( pTrack );
1233 // More careful construction is needed so that the independent
1234 // increment and decrement of each iterator in the NEW pair
1235 // has the expected behavior at boundaries of the range
1236 return {
1237 { newBegin.mIter, newBegin.mIter, this->second.mEnd,
1238 this->first.GetPredicate() },
1239 { newBegin.mIter, this->second.mIter, this->second.mEnd,
1240 this->second.GetPredicate() }
1241 };
1242 }
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 1267 of file Track.h.

1268 {
1269 for (auto track : *this)
1270 track->TypeSwitch(functions...);
1271 }

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

1277 {
1278 if ( flag ) for (auto track : *this) {
1279 track->TypeSwitch(functions...);
1280 if (!flag)
1281 break;
1282 }
1283 }
static std::once_flag flag

References flag.


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