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

Constructor & Destructor Documentation

◆ ArrayOf() [1/4]

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

Definition at line 29 of file MemoryX.h.

29{}

◆ ArrayOf() [2/4]

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

Definition at line 32 of file MemoryX.h.

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

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

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

Member Function Documentation

◆ operator=() [1/2]

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

Definition at line 45 of file MemoryX.h.

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

◆ operator=() [2/2]

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

Definition at line 50 of file MemoryX.h.

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

◆ reinit()

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

Definition at line 57 of file MemoryX.h.

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

References safenew.

Referenced by ExportMP3::AddTags(), AudioIO::AllocateBuffers(), EffectLoudness::AllocBuffers(), ArrayOf< X >::ArrayOf(), TaskProfile::Begin(), VSTEffect::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(), LadspaEffect::InitializePlugin(), EffectCompressor::InitPass1(), EffectCompressor::NewTrackPass1(), VampEffect::PopulateOrExchange(), EffectSBSMS::Process(), EffectEcho::Instance::ProcessInitialize(), EffectFindClipping::ProcessOne(), and SqliteSampleBlock::SetSamples().

Here is the caller graph for this function:

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