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 341 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 346 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 350 of file Channel.h.

351 : mpGroup{ pGroup }, mIndex{ index }
352 {}

Member Function Documentation

◆ operator*()

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

Definition at line 354 of file Channel.h.

355 {
356 if (!mpGroup || mIndex >= mpGroup->NChannels())
357 return {};
358 return mpGroup->template GetChannel<ChannelType>(mIndex);
359 }

◆ operator++() [1/2]

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

Definition at line 361 of file Channel.h.

361{ ++mIndex; return *this; }

◆ operator++() [2/2]

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

Definition at line 362 of file Channel.h.

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

365{ --mIndex; return *this; }

◆ operator--() [2/2]

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

Definition at line 366 of file Channel.h.

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

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

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

◆ operator==

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

Definition at line 369 of file Channel.h.

370 { 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 376 of file Channel.h.

◆ mpGroup

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

Definition at line 375 of file Channel.h.


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