Audacity 3.2.0
Public Member Functions | Public Attributes | Private Attributes | List of all members
LabelTrack::Interval Struct Referencefinal

#include <LabelTrack.h>

Inheritance diagram for LabelTrack::Interval:
[legend]
Collaboration diagram for LabelTrack::Interval:
[legend]

Public Member Functions

 Interval (const LabelTrack &track, size_t index)
 
 ~Interval () override
 
double Start () const override
 
double End () const override
 
size_t NChannels () const override
 Report the number of channels. More...
 
std::shared_ptr< ChannelIntervalDoGetChannel (size_t iChannel) override
 Retrieve a channel. More...
 
- Public Member Functions inherited from WideChannelGroupInterval
 ~WideChannelGroupInterval () override
 
virtual size_t NChannels () const =0
 Report the number of channels. More...
 
template<typename IntervalType = ChannelInterval>
std::shared_ptr< IntervalType > GetChannel (size_t iChannel)
 Retrieve a channel, cast to the given type. More...
 
template<typename IntervalType = const ChannelInterval>
auto GetChannel (size_t iChannel) const -> std::enable_if_t< std::is_const_v< IntervalType >, std::shared_ptr< IntervalType > >
 
template<typename IntervalType = ChannelInterval>
IteratorRange< ChannelIterator< IntervalType > > Channels ()
 Get range of ChannelInterval objects with mutative access. More...
 
template<typename IntervalType = const ChannelInterval>
auto Channels () const -> std::enable_if_t< std::is_const_v< IntervalType >, IteratorRange< ChannelIterator< IntervalType > > >
 Get range of channels with read-only access. More...
 
- Public Member Functions inherited from ChannelGroupInterval
 ChannelGroupInterval ()=default
 
virtual ~ChannelGroupInterval ()
 
virtual double Start () const =0
 
virtual double End () const =0
 

Public Attributes

size_t index
 

Private Attributes

const std::shared_ptr< const LabelTrackmpTrack
 

Additional Inherited Members

virtual std::shared_ptr< ChannelIntervalDoGetChannel (size_t iChannel)=0
 Retrieve a channel. More...
 

Detailed Description

Definition at line 190 of file LabelTrack.h.

Constructor & Destructor Documentation

◆ Interval()

LabelTrack::Interval::Interval ( const LabelTrack track,
size_t  index 
)
inline

Definition at line 191 of file LabelTrack.h.

192 : mpTrack{ track.SharedPointer<const LabelTrack>() }
193 , index{ index }
194 {}
A LabelTrack is a Track that holds labels (LabelStruct).
Definition: LabelTrack.h:95
std::shared_ptr< Subclass > SharedPointer()
Definition: Track.h:146
const std::shared_ptr< const LabelTrack > mpTrack
Definition: LabelTrack.h:205

◆ ~Interval()

LabelTrack::Interval::~Interval ( )
overridedefault

Member Function Documentation

◆ DoGetChannel()

std::shared_ptr< ChannelInterval > LabelTrack::Interval::DoGetChannel ( size_t  iChannel)
overridevirtual

Retrieve a channel.

Postcondition
result: !(iChannel < NChannels()) || result

Implements WideChannelGroupInterval.

Definition at line 70 of file LabelTrack.cpp.

71{
72 if (iChannel == 0)
73 return std::make_shared<ChannelInterval>();
74 return {};
75}

References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.

◆ End()

double LabelTrack::Interval::End ( ) const
overridevirtual
Postcondition
result: Start() < result

Implements ChannelGroupInterval.

Definition at line 59 of file LabelTrack.cpp.

60{
61 return mpTrack->GetLabel(index)->selectedRegion.t1();
62}

◆ NChannels()

size_t LabelTrack::Interval::NChannels ( ) const
overridevirtual

Report the number of channels.

Postcondition
result: result >= 1

Implements WideChannelGroupInterval.

Definition at line 64 of file LabelTrack.cpp.

65{
66 return 1;
67}

◆ Start()

double LabelTrack::Interval::Start ( ) const
overridevirtual
Postcondition
result: result < End()

Implements ChannelGroupInterval.

Definition at line 54 of file LabelTrack.cpp.

55{
56 return mpTrack->GetLabel(index)->selectedRegion.t0();
57}

References index, and mpTrack.

Member Data Documentation

◆ index

size_t LabelTrack::Interval::index

Definition at line 202 of file LabelTrack.h.

Referenced by Start().

◆ mpTrack

const std::shared_ptr<const LabelTrack> LabelTrack::Interval::mpTrack
private
Invariant
not null

Definition at line 205 of file LabelTrack.h.

Referenced by Start().


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