Audacity 3.2.0
Public Member Functions | Private Types | Private Attributes | Friends | List of all members
ChannelGroup::ChannelIterator< ChannelType > Class Template Reference

#include <Channel.h>

Inheritance diagram for ChannelGroup::ChannelIterator< ChannelType >:
[legend]
Collaboration diagram for ChannelGroup::ChannelIterator< ChannelType >:
[legend]

Public Member Functions

 ChannelIterator ()=default
 
 ChannelIterator (GroupType *pGroup, size_t index)
 
std::shared_ptr< ChannelType > operator* () const
 
ChannelIteratoroperator++ ()
 
ChannelIterator operator++ (int)
 
ChannelIteratoroperator-- ()
 
ChannelIterator operator-- (int)
 

Private Types

using GroupType = std::conditional_t< std::is_const_v< ChannelType >, const ChannelGroup, ChannelGroup >
 

Private Attributes

GroupTypempGroup {}
 
size_t mIndex {}
 

Friends

bool operator== (ChannelIterator a, ChannelIterator b)
 
bool operator!= (ChannelIterator a, ChannelIterator b)
 

Additional Inherited Members

- Public Types inherited from ValueIterator< std::shared_ptr< ChannelType >, std::bidirectional_iterator_tag >
using iterator_category = std::bidirectional_iterator_tag
 
using value_type = std::shared_ptr< ChannelType >
 
using difference_type = ptrdiff_t
 
using pointer = void
 
using reference = const std::shared_ptr< ChannelType >
 

Detailed Description

template<typename ChannelType>
class ChannelGroup::ChannelIterator< ChannelType >

Iterator for channels; destroying the related ChannelGroup invalidates it

Definition at line 344 of file Channel.h.

Member Typedef Documentation

◆ GroupType

template<typename ChannelType >
using ChannelGroup::ChannelIterator< ChannelType >::GroupType = std::conditional_t<std::is_const_v<ChannelType>, const ChannelGroup, ChannelGroup>
private

Definition at line 349 of file Channel.h.

Constructor & Destructor Documentation

◆ ChannelIterator() [1/2]

template<typename ChannelType >
ChannelGroup::ChannelIterator< ChannelType >::ChannelIterator ( )
default

◆ ChannelIterator() [2/2]

template<typename ChannelType >
ChannelGroup::ChannelIterator< ChannelType >::ChannelIterator ( GroupType pGroup,
size_t  index 
)
inline

Definition at line 353 of file Channel.h.

354 : mpGroup{ pGroup }, mIndex{ index }
355 {}

Member Function Documentation

◆ operator*()

template<typename ChannelType >
std::shared_ptr< ChannelType > ChannelGroup::ChannelIterator< ChannelType >::operator* ( ) const
inline

Definition at line 357 of file Channel.h.

358 {
359 if (!mpGroup || mIndex >= mpGroup->NChannels())
360 return {};
361 return mpGroup->template GetChannel<ChannelType>(mIndex);
362 }

◆ operator++() [1/2]

template<typename ChannelType >
ChannelIterator & ChannelGroup::ChannelIterator< ChannelType >::operator++ ( )
inline

Definition at line 364 of file Channel.h.

364{ ++mIndex; return *this; }

◆ operator++() [2/2]

template<typename ChannelType >
ChannelIterator ChannelGroup::ChannelIterator< ChannelType >::operator++ ( int  )
inline

Definition at line 365 of file Channel.h.

366 { auto copy{ *this }; operator ++(); return copy; }
ChannelIterator & operator++()
Definition: Channel.h:364
void copy(const T *src, T *dst, int32_t n)
Definition: VectorOps.h:40

References staffpad::vo::copy().

Here is the call graph for this function:

◆ operator--() [1/2]

template<typename ChannelType >
ChannelIterator & ChannelGroup::ChannelIterator< ChannelType >::operator-- ( )
inline

Definition at line 368 of file Channel.h.

368{ --mIndex; return *this; }

◆ operator--() [2/2]

template<typename ChannelType >
ChannelIterator ChannelGroup::ChannelIterator< ChannelType >::operator-- ( int  )
inline

Definition at line 369 of file Channel.h.

370 { auto copy{ *this }; operator --(); return copy; }
ChannelIterator & operator--()
Definition: Channel.h:368

References staffpad::vo::copy().

Here is the call graph for this function:

Friends And Related Function Documentation

◆ operator!=

template<typename ChannelType >
bool operator!= ( ChannelIterator< ChannelType >  a,
ChannelIterator< ChannelType >  b 
)
friend

Definition at line 374 of file Channel.h.

375 { return !(a == b); }

◆ operator==

template<typename ChannelType >
bool operator== ( ChannelIterator< ChannelType >  a,
ChannelIterator< ChannelType >  b 
)
friend

Definition at line 372 of file Channel.h.

373 { return a.mpGroup == b.mpGroup && a.mIndex == b.mIndex; }

Member Data Documentation

◆ mIndex

template<typename ChannelType >
size_t ChannelGroup::ChannelIterator< ChannelType >::mIndex {}
private

Definition at line 379 of file Channel.h.

◆ mpGroup

template<typename ChannelType >
GroupType* ChannelGroup::ChannelIterator< ChannelType >::mpGroup {}
private

Definition at line 378 of file Channel.h.


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