ModelTransformer Class Reference

#include <ModelTransformer.h>

Inherits Thread.

Inherited by FeatureExtractionModelTransformer, and RealTimeEffectModelTransformer.

Inheritance diagram for ModelTransformer:

Inheritance graph
[legend]
Collaboration diagram for ModelTransformer:

Collaboration graph
[legend]
List of all members.

Detailed Description

A ModelTransformer turns one data model into another.

Typically in this application, a ModelTransformer might have a DenseTimeValueModel as its input (e.g. an audio waveform) and a SparseOneDimensionalModel (e.g. detected beats) as its output.

The ModelTransformer typically runs in the background, as a separate thread populating the output model. The model is available to the user of the ModelTransformer immediately, but may be initially empty until the background thread has populated it.

Definition at line 38 of file ModelTransformer.h.

Public Types

enum  Type { RTThread, NonRTThread }

Public Slots

void start ()

Public Member Functions

virtual ~ModelTransformer ()
void abandon ()
 Hint to the processing thread that it should give up, for example because the process is going to exit or we want to get rid of the input model.
ModelgetInputModel ()
 Return the input model for the transform.
int getInputChannel ()
 Return the input channel spec for the transform.
ModelgetOutputModel ()
 Return the output model created by the transform.
ModeldetachOutputModel ()
 Return the output model, also detaching it from the transformer so that it will not be deleted when the transformer is.
QString getMessage () const
 Return a warning or error message.

Protected Member Functions

 ModelTransformer (Input input, const Transform &transform)

Protected Attributes

Transform m_transform
Input m_input
Modelm_output
bool m_detached
bool m_abandoned
QString m_message

Classes

class  Input


Member Enumeration Documentation

enum Thread::Type [inherited]

Enumerator:
RTThread 
NonRTThread 

Definition at line 27 of file Thread.h.


Constructor & Destructor Documentation

ModelTransformer::~ModelTransformer (  )  [virtual]

Definition at line 27 of file ModelTransformer.cpp.

References m_abandoned, m_detached, and m_output.

ModelTransformer::ModelTransformer ( Input  input,
const Transform transform 
) [protected]

Definition at line 18 of file ModelTransformer.cpp.


Member Function Documentation

void ModelTransformer::abandon (  )  [inline]

Hint to the processing thread that it should give up, for example because the process is going to exit or we want to get rid of the input model.

Caller should still wait() and/or delete the transform before assuming its input and output models are no longer required.

Definition at line 66 of file ModelTransformer.h.

References m_abandoned.

Model* ModelTransformer::getInputModel (  )  [inline]

Return the input model for the transform.

Definition at line 71 of file ModelTransformer.h.

References ModelTransformer::Input::getModel(), and m_input.

Referenced by RealTimeEffectModelTransformer::getConformingInput(), and FeatureExtractionModelTransformer::getConformingInput().

int ModelTransformer::getInputChannel (  )  [inline]

Return the input channel spec for the transform.

Definition at line 76 of file ModelTransformer.h.

References ModelTransformer::Input::getChannel(), and m_input.

Model* ModelTransformer::getOutputModel (  )  [inline]

Return the output model created by the transform.

Returns a null model if the transform could not be initialised; an error message may be available via getMessage() in this situation.

Definition at line 83 of file ModelTransformer.h.

References m_output.

Model* ModelTransformer::detachOutputModel (  )  [inline]

Return the output model, also detaching it from the transformer so that it will not be deleted when the transformer is.

The caller takes ownership of the model.

Definition at line 90 of file ModelTransformer.h.

References m_detached, and m_output.

Referenced by ModelTransformerFactory::transform().

QString ModelTransformer::getMessage (  )  const [inline]

Return a warning or error message.

If getOutputModel returned a null pointer, this should contain a fatal error message for the transformer; otherwise it may contain a warning to show to the user about e.g. suboptimal block size or whatever.

Definition at line 98 of file ModelTransformer.h.

References m_message.

Referenced by ModelTransformerFactory::transform().

void Thread::start (  )  [slot, inherited]

Definition at line 34 of file Thread.cpp.

References Thread::m_type, and Thread::RTThread.

Referenced by AudioCallbackPlaySource::addModel(), WaveFileModel::fillCache(), FFTDataServer::getCacheAux(), FFTDataServer::isColumnReady(), MatrixFile::MatrixFile(), MP3FileReader::MP3FileReader(), OggVorbisFileReader::OggVorbisFileReader(), DSSIPluginInstance::requestNonRTThread(), ResamplingWavFileReader::ResamplingWavFileReader(), FFTDataServer::FillThread::run(), and ModelTransformerFactory::transform().


Member Data Documentation

Transform ModelTransformer::m_transform [protected]

Definition at line 103 of file ModelTransformer.h.

Referenced by FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(), RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(), RealTimeEffectModelTransformer::run(), and FeatureExtractionModelTransformer::run().

Input ModelTransformer::m_input [protected]

Definition at line 104 of file ModelTransformer.h.

Referenced by FeatureExtractionModelTransformer::addFeature(), FeatureExtractionModelTransformer::getFrames(), getInputChannel(), getInputModel(), RealTimeEffectModelTransformer::run(), and FeatureExtractionModelTransformer::run().

Model* ModelTransformer::m_output [protected]

Definition at line 105 of file ModelTransformer.h.

Referenced by FeatureExtractionModelTransformer::addFeature(), detachOutputModel(), FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(), FeatureExtractionModelTransformer::getConformingOutput(), getOutputModel(), RealTimeEffectModelTransformer::RealTimeEffectModelTransformer(), RealTimeEffectModelTransformer::run(), FeatureExtractionModelTransformer::run(), and ~ModelTransformer().

bool ModelTransformer::m_detached [protected]

Definition at line 106 of file ModelTransformer.h.

Referenced by detachOutputModel(), and ~ModelTransformer().

bool ModelTransformer::m_abandoned [protected]

Definition at line 107 of file ModelTransformer.h.

Referenced by abandon(), RealTimeEffectModelTransformer::run(), FeatureExtractionModelTransformer::run(), and ~ModelTransformer().

QString ModelTransformer::m_message [protected]

Definition at line 108 of file ModelTransformer.h.

Referenced by FeatureExtractionModelTransformer::FeatureExtractionModelTransformer(), and getMessage().


The documentation for this class was generated from the following files:
Generated on Wed Feb 20 15:45:34 2008 for SonicVisualiser by  doxygen 1.5.1