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 25 of file MemoryX.h.

Constructor & Destructor Documentation

◆ ArrayOf() [1/4]

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

Definition at line 28 of file MemoryX.h.

28{}

◆ ArrayOf() [2/4]

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

Definition at line 31 of file MemoryX.h.

32 {
33 static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
34 reinit(count, initialize);
35 }
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:56

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 39 of file MemoryX.h.

40 : std::unique_ptr < X[] >
41 (std::move((std::unique_ptr < X[] >&)(that)))
42 {
43 }

Member Function Documentation

◆ operator=() [1/2]

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

Definition at line 44 of file MemoryX.h.

45 {
46 std::unique_ptr<X[]>::operator=(std::move(that));
47 return *this;
48 }

◆ operator=() [2/2]

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

Definition at line 49 of file MemoryX.h.

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

◆ reinit()

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

Definition at line 56 of file MemoryX.h.

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

References safenew.

Referenced by MP2ExportProcessor::AddTags(), MP3ExportProcessor::AddTags(), EffectLoudness::AllocBuffers(), ArrayOf< X >::ArrayOf(), TaskProfile::Begin(), VSTEditor::BuildPlain(), SqliteSampleBlock::CalcSummary(), Matrix::CopyFrom(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveformView.cpp}::DrawMinMaxRMS(), EBUR128::EBUR128(), EffectNoiseRemoval::EffectNoiseRemoval(), WaveClipWaveformCache::GetWaveDisplay(), WavPackImportFileHandle::Import(), EffectNoiseRemoval::Initialize(), LadspaEffectBase::InitializePlugin(), EffectCompressor::InitPass1(), EffectCompressor::NewTrackPass1(), VampEffect::PopulateOrExchange(), LadspaEditor::PopulateUI(), EffectSBSMS::Process(), EffectEcho::Instance::ProcessInitialize(), EffectFindClipping::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: