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 365 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 370 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 374 of file Channel.h.

375 : mpGroup{ pGroup }, mIndex{ index }
376 {}

Member Function Documentation

◆ operator*()

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

Definition at line 378 of file Channel.h.

379 {
380 if (!mpGroup || mIndex >= mpGroup->NChannels())
381 return {};
382 return mpGroup->template GetChannel<ChannelType>(mIndex);
383 }

◆ operator++() [1/2]

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

Definition at line 385 of file Channel.h.

385{ ++mIndex; return *this; }

◆ operator++() [2/2]

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

Definition at line 386 of file Channel.h.

387 { auto copy{ *this }; operator ++(); return copy; }
ChannelIterator & operator++()
Definition: Channel.h:385
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 389 of file Channel.h.

389{ --mIndex; return *this; }

◆ operator--() [2/2]

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

Definition at line 390 of file Channel.h.

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

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 395 of file Channel.h.

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

◆ operator==

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

Definition at line 393 of file Channel.h.

394 { 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 400 of file Channel.h.

◆ mpGroup

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

Definition at line 399 of file Channel.h.


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