Audacity 3.2.0
Public Member Functions | List of all members
ArrayOf< X > Class Template Reference

This simplifies arrays of arrays, each array separately allocated with NEW[] But it might be better to use std::Array<ArrayOf<X>, N> for some small constant N Or use just one array when sub-arrays have a common size and are not large. More...

#include <MemoryX.h>

Inheritance diagram for ArrayOf< X >:
[legend]
Collaboration diagram for ArrayOf< X >:
[legend]

Public Member Functions

 ArrayOf ()
 
template<typename Integral >
 ArrayOf (Integral count, bool initialize=false)
 
 ArrayOf (const ArrayOf &)=delete
 
 ArrayOf (ArrayOf &&that)
 
ArrayOfoperator= (ArrayOf &&that)
 
ArrayOfoperator= (std::unique_ptr< X[]> &&that)
 
template<typename Integral >
void reinit (Integral count, bool initialize=false)
 

Detailed Description

template<typename X>
class ArrayOf< X >

This simplifies arrays of arrays, each array separately allocated with NEW[] But it might be better to use std::Array<ArrayOf<X>, N> for some small constant N Or use just one array when sub-arrays have a common size and are not large.

ArraysOf<X>

Definition at line 28 of file MemoryX.h.

Constructor & Destructor Documentation

◆ ArrayOf() [1/4]

template<typename X >
ArrayOf< X >::ArrayOf ( )
inline

Definition at line 31 of file MemoryX.h.

31{}

◆ ArrayOf() [2/4]

template<typename X >
template<typename Integral >
ArrayOf< X >::ArrayOf ( Integral  count,
bool  initialize = false 
)
inlineexplicit

Definition at line 34 of file MemoryX.h.

35 {
36 static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
37 reinit(count, initialize);
38 }
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:59

References ArrayOf< X >::reinit().

Here is the call graph for this function:

◆ ArrayOf() [3/4]

template<typename X >
ArrayOf< X >::ArrayOf ( const ArrayOf< X > &  )
delete

◆ ArrayOf() [4/4]

template<typename X >
ArrayOf< X >::ArrayOf ( ArrayOf< X > &&  that)
inline

Definition at line 42 of file MemoryX.h.

43 : std::unique_ptr < X[] >
44 (std::move((std::unique_ptr < X[] >&)(that)))
45 {
46 }

Member Function Documentation

◆ operator=() [1/2]

template<typename X >
ArrayOf & ArrayOf< X >::operator= ( ArrayOf< X > &&  that)
inline

Definition at line 47 of file MemoryX.h.

48 {
49 std::unique_ptr<X[]>::operator=(std::move(that));
50 return *this;
51 }

◆ operator=() [2/2]

template<typename X >
ArrayOf & ArrayOf< X >::operator= ( std::unique_ptr< X[]> &&  that)
inline

Definition at line 52 of file MemoryX.h.

53 {
54 std::unique_ptr<X[]>::operator=(std::move(that));
55 return *this;
56 }

◆ reinit()

template<typename X >
template<typename Integral >
void ArrayOf< X >::reinit ( Integral  count,
bool  initialize = false 
)
inline

Definition at line 59 of file MemoryX.h.

61 {
62 static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
63 if (initialize)
64 // Initialize elements (usually, to zero for a numerical type)
65 std::unique_ptr<X[]>::reset(safenew X[count]{});
66 else
67 // Avoid the slight initialization overhead
68 std::unique_ptr<X[]>::reset(safenew X[count]);
69 }
#define safenew
Definition: MemoryX.h:10

References safenew.

Referenced by MP2ExportProcessor::AddTags(), MP3ExportProcessor::AddTags(), LoudnessBase::AllocBuffers(), ArrayOf< X >::ArrayOf(), TaskProfile::Begin(), VSTEditor::BuildPlain(), SqliteSampleBlock::CalcSummary(), Matrix::CopyFrom(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), EBUR128::EBUR128(), WavPackImportFileHandle::Import(), LadspaEffectBase::InitializePlugin(), LegacyCompressorBase::InitPass1(), LegacyCompressorBase::NewTrackPass1(), VampEffect::PopulateOrExchange(), LadspaEditor::PopulateUI(), SBSMSBase::Process(), EchoBase::Instance::ProcessInitialize(), FindClippingBase::ProcessOne(), SqliteSampleBlock::SetSamples(), and MixerTrackCluster::UpdateMeter().

Here is the caller graph for this function:

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