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

1166 ( begin, end )
1167 {}
A convenience for use with range-for.
Definition: MemoryX.h:252
TrackIter< TrackType > end() const
Definition: MemoryX.h:266
TrackIter< TrackType > begin() const
Definition: MemoryX.h:265

Member Function Documentation

◆ EndingAfter()

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

Definition at line 1237 of file Track.h.

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

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

1253 {
1254 return this->operator - (
1255 [=](const Track *pTrack){ return pExcluded == pTrack; } );
1256 }
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:1198

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

1216 {
1217 return {
1218 this-> first.template Filter< TrackType2 >(),
1219 this->second.template Filter< TrackType2 >()
1220 };
1221 }

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

1173 {
1174 const auto &pred1 = this->first.GetPredicate();
1175 using Function = typename TrackIter<TrackType>::FunctionType;
1176 const auto &newPred = pred1
1177 ? Function{ [=] (typename Function::argument_type track) {
1178 return pred1(track) && pred2(track);
1179 } }
1180 : Function{ pred2 };
1181 return {
1182 this->first.Filter( newPred ),
1183 this->second.Filter( newPred )
1184 };
1185 }
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:1005

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

1191 {
1192 return this->operator + ( std::mem_fn( pmf ) );
1193 }
TrackIterRange operator+(const Predicate2 &pred2) const
Definition: Track.h:1172

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

1199 {
1200 using ArgumentType =
1201 typename TrackIterRange::iterator::FunctionType::argument_type;
1202 auto neg = [=] (ArgumentType track) { return !pred2( track ); };
1203 return this->operator + ( neg );
1204 }

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

1210 {
1211 return this->operator + ( std::not1( std::mem_fn( pmf ) ) );
1212 }

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

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

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

1261 {
1262 for (auto track : *this)
1263 track->TypeSwitch(functions...);
1264 }

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

1270 {
1271 if ( flag ) for (auto track : *this) {
1272 track->TypeSwitch(functions...);
1273 if (!flag)
1274 break;
1275 }
1276 }
static std::once_flag flag

References flag.


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