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

1172 ( begin, end )
1173 {}
A convenience for use with range-for.
Definition: MemoryX.h:260
TrackIter< TrackType > end() const
Definition: MemoryX.h:274
TrackIter< TrackType > begin() const
Definition: MemoryX.h:273

Member Function Documentation

◆ EndingAfter()

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

Definition at line 1243 of file Track.h.

1244 {
1245 const auto newEnd = this->reversal().find( pTrack ).base();
1246 // More careful construction is needed so that the independent
1247 // increment and decrement of each iterator in the NEW pair
1248 // has the expected behavior at boundaries of the range
1249 return {
1250 { this->first.mBegin, this->first.mIter, newEnd.mIter,
1251 this->first.GetPredicate() },
1252 { this->first.mBegin, newEnd.mIter, newEnd.mIter,
1253 this->second.GetPredicate() }
1254 };
1255 }
IteratorRange< reverse_iterator > reversal() const
Definition: MemoryX.h:270

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

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

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

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

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

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

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

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

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

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

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

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

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

1230 {
1231 auto newBegin = this->find( pTrack );
1232 // More careful construction is needed so that the independent
1233 // increment and decrement of each iterator in the NEW pair
1234 // has the expected behavior at boundaries of the range
1235 return {
1236 { newBegin.mIter, newBegin.mIter, this->second.mEnd,
1237 this->first.GetPredicate() },
1238 { newBegin.mIter, this->second.mIter, this->second.mEnd,
1239 this->second.GetPredicate() }
1240 };
1241 }
iterator find(const T &t) const
Definition: MemoryX.h:283

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

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

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

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

References flag.


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