Audacity  3.0.3
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.

Memory.h template class for making an array of float, bool, etc.

ArraysOf<X>

Definition at line 81 of file MemoryX.h.

Constructor & Destructor Documentation

◆ ArrayOf() [1/4]

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

Definition at line 84 of file MemoryX.h.

84 {}

◆ ArrayOf() [2/4]

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

Definition at line 87 of file MemoryX.h.

88  {
89  static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
90  reinit(count, initialize);
91  }

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

96  : std::unique_ptr < X[] >
97  (std::move((std::unique_ptr < X[] >&)(that)))
98  {
99  }

Member Function Documentation

◆ operator=() [1/2]

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

Definition at line 100 of file MemoryX.h.

101  {
102  std::unique_ptr<X[]>::operator=(std::move(that));
103  return *this;
104  }

◆ operator=() [2/2]

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

Definition at line 105 of file MemoryX.h.

106  {
107  std::unique_ptr<X[]>::operator=(std::move(that));
108  return *this;
109  }

◆ reinit()

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

Definition at line 112 of file MemoryX.h.

114  {
115  static_assert(std::is_unsigned<Integral>::value, "Unsigned arguments only");
116  if (initialize)
117  // Initialize elements (usually, to zero for a numerical type)
118  std::unique_ptr<X[]>::reset(safenew X[count]{});
119  else
120  // Avoid the slight initialization overhead
121  std::unique_ptr<X[]>::reset(safenew X[count]);
122  }

Referenced by ExportMP3::AddTags(), AudioIO::AllocateBuffers(), EffectLoudness::AllocBuffers(), ArrayOf< MeterUpdateMsg >::ArrayOf(), TaskProfile::Begin(), VSTEffect::BuildPlain(), ODDecodeBlockFile::CalcSummary(), ODPCMAliasBlockFile::CalcSummary(), SqliteSampleBlock::CalcSummary(), Matrix::CopyFrom(), anonymous_namespace{WaveformView.cpp}::DrawIndividualSamples(), anonymous_namespace{WaveformView.cpp}::DrawMinMaxRMS(), EBUR128::EBUR128(), EffectNoiseRemoval::EffectNoiseRemoval(), WaveClip::GetWaveDisplay(), EffectNoiseRemoval::Initialize(), EffectCompressor::InitPass1(), EffectCompressor::NewTrackPass1(), VampEffect::PopulateOrExchange(), EffectSBSMS::Process(), AudioUnitEffect::ProcessInitialize(), EffectEcho::ProcessInitialize(), EffectFindClipping::ProcessOne(), Effect::ProcessPass(), LegacyBlockFile::ReadSummary(), ODDecodeBlockFile::ReadSummary(), ODPCMAliasBlockFile::ReadSummary(), SilentBlockFile::ReadSummary(), SimpleBlockFile::ReadSummary(), SqliteSampleBlock::SetSamples(), and ODPCMAliasBlockFile::WriteSummary().

Here is the caller graph for this function:

The documentation for this class was generated from the following file:
ArrayOf::reinit
void reinit(Integral count, bool initialize=false)
Definition: MemoryX.h:112
safenew
#define safenew
Definition: MemoryX.h:8