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

Constructor & Destructor Documentation

◆ ArrayOf() [1/4]

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

Definition at line 30 of file MemoryX.h.

30{}

◆ ArrayOf() [2/4]

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

Definition at line 33 of file MemoryX.h.

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

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

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

Member Function Documentation

◆ operator=() [1/2]

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

Definition at line 46 of file MemoryX.h.

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

◆ operator=() [2/2]

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

Definition at line 51 of file MemoryX.h.

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

◆ reinit()

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

Definition at line 58 of file MemoryX.h.

60 {
61 static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
62 if (initialize)
63 // Initialize elements (usually, to zero for a numerical type)
64 std::unique_ptr<X[]>::reset(safenew X[count]{});
65 else
66 // Avoid the slight initialization overhead
67 std::unique_ptr<X[]>::reset(safenew X[count]);
68 }
#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(), WaveClipWaveformCache::GetWaveDisplay(), WavPackImportFileHandle::Import(), 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: