Audacity  3.0.3
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
SampleBlockFactory Class Referenceabstract

abstract base class with methods to produce SampleBlock objects More...

#include <SampleBlock.h>

Inheritance diagram for SampleBlockFactory:
[legend]

Public Types

using SampleBlockIDs = std::unordered_set< SampleBlockID >
 
using BlockDeletionCallback = std::function< void(const SampleBlock &) >
 Type of function that is informed when a block is about to be deleted. More...
 

Public Member Functions

virtual ~SampleBlockFactory ()
 
SampleBlockPtr Create (constSamplePtr src, size_t numsamples, sampleFormat srcformat)
 
SampleBlockPtr CreateSilent (size_t numsamples, sampleFormat srcformat)
 
SampleBlockPtr CreateFromXML (sampleFormat srcformat, const wxChar **attrs)
 
virtual SampleBlockIDs GetActiveBlockIDs ()=0
 
virtual BlockDeletionCallback SetBlockDeletionCallback (BlockDeletionCallback callback)=0
 Install a callback, returning the previously installed callback. More...
 

Static Public Member Functions

static SampleBlockFactoryFactory RegisterFactoryFactory (SampleBlockFactoryFactory newFactory)
 
static SampleBlockFactoryPtr New (AudacityProject &project)
 

Protected Member Functions

virtual SampleBlockPtr DoCreate (constSamplePtr src, size_t numsamples, sampleFormat srcformat)=0
 
virtual SampleBlockPtr DoCreateSilent (size_t numsamples, sampleFormat srcformat)=0
 
virtual SampleBlockPtr DoCreateFromXML (sampleFormat srcformat, const wxChar **attrs)=0
 

Detailed Description

abstract base class with methods to produce SampleBlock objects

Definition at line 105 of file SampleBlock.h.

Member Typedef Documentation

◆ BlockDeletionCallback

using SampleBlockFactory::BlockDeletionCallback = std::function< void(const SampleBlock&) >

Type of function that is informed when a block is about to be deleted.

Definition at line 139 of file SampleBlock.h.

◆ SampleBlockIDs

Definition at line 134 of file SampleBlock.h.

Constructor & Destructor Documentation

◆ ~SampleBlockFactory()

SampleBlockFactory::~SampleBlockFactory ( )
virtualdefault

Member Function Documentation

◆ Create()

SampleBlockPtr SampleBlockFactory::Create ( constSamplePtr  src,
size_t  numsamples,
sampleFormat  srcformat 
)

Definition at line 41 of file SampleBlock.cpp.

44 {
45  auto result = DoCreate(src, numsamples, srcformat);
46  if (!result)
48  return result;
49 }

References DoCreate(), and THROW_INCONSISTENCY_EXCEPTION.

Referenced by anonymous_namespace{Sequence.cpp}::ShareOrCopySampleBlock().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CreateFromXML()

SampleBlockPtr SampleBlockFactory::CreateFromXML ( sampleFormat  srcformat,
const wxChar **  attrs 
)

Definition at line 61 of file SampleBlock.cpp.

64 {
65  auto result = DoCreateFromXML(srcformat, attrs);
66  if (!result)
68  return result;
69 }

References DoCreateFromXML(), and THROW_INCONSISTENCY_EXCEPTION.

Here is the call graph for this function:

◆ CreateSilent()

SampleBlockPtr SampleBlockFactory::CreateSilent ( size_t  numsamples,
sampleFormat  srcformat 
)

Definition at line 51 of file SampleBlock.cpp.

54 {
55  auto result = DoCreateSilent(numsamples, srcformat);
56  if (!result)
58  return result;
59 }

References DoCreateSilent(), and THROW_INCONSISTENCY_EXCEPTION.

Here is the call graph for this function:

◆ DoCreate()

virtual SampleBlockPtr SampleBlockFactory::DoCreate ( constSamplePtr  src,
size_t  numsamples,
sampleFormat  srcformat 
)
protectedpure virtual

Implemented in SqliteSampleBlockFactory.

Referenced by Create().

Here is the caller graph for this function:

◆ DoCreateFromXML()

virtual SampleBlockPtr SampleBlockFactory::DoCreateFromXML ( sampleFormat  srcformat,
const wxChar **  attrs 
)
protectedpure virtual

Implemented in SqliteSampleBlockFactory.

Referenced by CreateFromXML().

Here is the caller graph for this function:

◆ DoCreateSilent()

virtual SampleBlockPtr SampleBlockFactory::DoCreateSilent ( size_t  numsamples,
sampleFormat  srcformat 
)
protectedpure virtual

Implemented in SqliteSampleBlockFactory.

Referenced by CreateSilent().

Here is the caller graph for this function:

◆ GetActiveBlockIDs()

virtual SampleBlockIDs SampleBlockFactory::GetActiveBlockIDs ( )
pure virtual
Returns
ids of all sample blocks created by this factory and still extant

Implemented in SqliteSampleBlockFactory.

◆ New()

SampleBlockFactoryPtr SampleBlockFactory::New ( AudacityProject project)
static

Definition at line 31 of file SampleBlock.cpp.

32 {
33  auto &factory = installedFactory();
34  if ( ! factory )
36  return factory( project );
37 }

References factory, installedFactory(), and THROW_INCONSISTENCY_EXCEPTION.

Referenced by BenchmarkDialog::OnRun().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RegisterFactoryFactory()

SampleBlockFactoryFactory SampleBlockFactory::RegisterFactoryFactory ( SampleBlockFactoryFactory  newFactory)
static

Definition at line 22 of file SampleBlock.cpp.

24 {
25  auto &theFactory = installedFactory();
26  auto result = std::move( theFactory );
27  theFactory = std::move( newFactory );
28  return result;
29 }

References installedFactory().

Referenced by Injector::Injector().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetBlockDeletionCallback()

virtual BlockDeletionCallback SampleBlockFactory::SetBlockDeletionCallback ( BlockDeletionCallback  callback)
pure virtual

Install a callback, returning the previously installed callback.

Implemented in SqliteSampleBlockFactory.


The documentation for this class was generated from the following files:
SampleBlockFactory::DoCreate
virtual SampleBlockPtr DoCreate(constSamplePtr src, size_t numsamples, sampleFormat srcformat)=0
SampleBlockFactory::DoCreateFromXML
virtual SampleBlockPtr DoCreateFromXML(sampleFormat srcformat, const wxChar **attrs)=0
SampleBlockFactory::DoCreateSilent
virtual SampleBlockPtr DoCreateSilent(size_t numsamples, sampleFormat srcformat)=0
installedFactory
static SampleBlockFactoryFactory & installedFactory()
Definition: SampleBlock.cpp:16
factory
static RegisteredToolbarFactory factory
Definition: ControlToolBar.cpp:817
THROW_INCONSISTENCY_EXCEPTION
#define THROW_INCONSISTENCY_EXCEPTION
Throw InconsistencyException, using C++ preprocessor to identify the source code location.
Definition: InconsistencyException.h:79