Audacity  3.0.3
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>

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...
 

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

1106  ( begin, end )
1107  {}

Member Function Documentation

◆ EndingAfter()

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

Definition at line 1177 of file Track.h.

1178  {
1179  const auto newEnd = this->reversal().find( pTrack ).base();
1180  // More careful construction is needed so that the independent
1181  // increment and decrement of each iterator in the NEW pair
1182  // has the expected behavior at boundaries of the range
1183  return {
1184  { this->first.mBegin, this->first.mIter, newEnd.mIter,
1185  this->first.GetPredicate() },
1186  { this->first.mBegin, newEnd.mIter, newEnd.mIter,
1187  this->second.GetPredicate() }
1188  };
1189  }

Referenced by TrackList::SingletonRange(), and TrackList::SyncLockGroup().

Here is the caller graph for this function:

◆ Excluding()

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

Definition at line 1192 of file Track.h.

1193  {
1194  return this->operator - (
1195  [=](const Track *pTrack){ return pExcluded == pTrack; } );
1196  }

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

1156  {
1157  return {
1158  this-> first.template Filter< TrackType2 >(),
1159  this->second.template Filter< TrackType2 >()
1160  };
1161  }

◆ operator+() [1/2]

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

Definition at line 1112 of file Track.h.

1113  {
1114  const auto &pred1 = this->first.GetPredicate();
1115  using Function = typename TrackIter<TrackType>::FunctionType;
1116  const auto &newPred = pred1
1117  ? Function{ [=] (typename Function::argument_type track) {
1118  return pred1(track) && pred2(track);
1119  } }
1120  : Function{ pred2 };
1121  return {
1122  this->first.Filter( newPred ),
1123  this->second.Filter( newPred )
1124  };
1125  }

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

1131  {
1132  return this->operator + ( std::mem_fn( pmf ) );
1133  }

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

1139  {
1140  using ArgumentType =
1141  typename TrackIterRange::iterator::FunctionType::argument_type;
1142  auto neg = [=] (ArgumentType track) { return !pred2( track ); };
1143  return this->operator + ( neg );
1144  }

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

1150  {
1151  return this->operator + ( std::not1( std::mem_fn( pmf ) ) );
1152  }

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

1164  {
1165  auto newBegin = this->find( pTrack );
1166  // More careful construction is needed so that the independent
1167  // increment and decrement of each iterator in the NEW pair
1168  // has the expected behavior at boundaries of the range
1169  return {
1170  { newBegin.mIter, newBegin.mIter, this->second.mEnd,
1171  this->first.GetPredicate() },
1172  { newBegin.mIter, this->second.mIter, this->second.mEnd,
1173  this->second.GetPredicate() }
1174  };
1175  }

Referenced by TrackList::SingletonRange(), and TrackList::SyncLockGroup().

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

1201  {
1202  for (auto track : *this)
1203  track->TypeSwitch(functions...);
1204  }

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

1210  {
1211  if ( flag ) for (auto track : *this) {
1212  track->TypeSwitch(functions...);
1213  if (!flag)
1214  break;
1215  }
1216  }

References flag.


The documentation for this struct was generated from the following file:
flag
static std::once_flag flag
Definition: WaveformView.cpp:1119
IteratorRange
A convenience for use with range-for.
Definition: MemoryX.h:380
TrackIter::FunctionType
std::function< bool(typename std::add_pointer< typename std::add_const< typename std::remove_pointer< TrackType >::type >::type >::type) > FunctionType
Type of predicate taking pointer to const TrackType.
Definition: Track.h:945
TrackIterRange::operator-
TrackIterRange operator-(const Predicate2 &pred2) const
Definition: Track.h:1138
Track
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:239
TrackIterRange::operator+
TrackIterRange operator+(const Predicate2 &pred2) const
Definition: Track.h:1112