svcore  1.9
Model Class Reference

Model is the base class for all data models that represent any sort of data on a time scale based on an audio frame rate. More...

#include <Model.h>

Inheritance diagram for Model:
Collaboration diagram for Model:

List of all members.

Public Slots

void aboutToDelete ()
void sourceModelAboutToBeDeleted ()

Signals

void modelChanged ()
 Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly)
void modelChangedWithin (int startFrame, int endFrame)
 Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly)
void completionChanged ()
 Emitted when some internal processing has advanced a stage, but the model has not changed externally.
void ready ()
 Emitted when internal processing is complete (i.e.
void alignmentCompletionChanged ()
 Emitted when the completion percentage changes for the calculation of this model's alignment model.
void aboutToBeDeleted ()
 Emitted when something notifies this model (through calling aboutToDelete() that it is about to delete it.

Public Member Functions

virtual ~Model ()
virtual bool isOK () const =0
 Return true if the model was constructed successfully.
virtual int getStartFrame () const =0
 Return the first audio frame spanned by the model.
virtual int getEndFrame () const =0
 Return the last audio frame spanned by the model.
virtual int getSampleRate () const =0
 Return the frame rate in frames per second.
virtual int getNativeRate () const
 Return the frame rate of the underlying material, if the model itself has already been resampled.
virtual QString getTitle () const
 Return the "work title" of the model, if known.
virtual QString getMaker () const
 Return the "artist" or "maker" of the model, if known.
virtual QString getLocation () const
 Return the location of the data in this model (e.g.
virtual QString getTypeName () const =0
 Return the type of the model.
virtual Modelclone () const =0
 Return a copy of this model.
virtual void abandon ()
 Mark the model as abandoning.
virtual bool isAbandoning () const
 Query whether the model has been marked as abandoning.
virtual bool isReady (int *completion=0) const
 Return true if the model has finished loading or calculating all its data, for a model that is capable of calculating in a background thread.
virtual const ZoomConstraintgetZoomConstraint () const
 If this model imposes a zoom constraint, i.e.
virtual ModelgetSourceModel () const
 If this model was derived from another, return the model it was derived from.
virtual void setSourceModel (Model *model)
 Set the source model for this model.
virtual void setAlignment (AlignmentModel *alignment)
 Specify an aligment between this model's timeline and that of a reference model.
virtual const AlignmentModelgetAlignment () const
 Retrieve the alignment model for this model.
virtual const ModelgetAlignmentReference () const
 Return the reference model for the current alignment timeline, if any.
virtual int alignToReference (int frame) const
 Return the frame number of the reference model that corresponds to the given frame number in this model.
virtual int alignFromReference (int referenceFrame) const
 Return the frame number in this model that corresponds to the given frame number of the reference model.
virtual int getAlignmentCompletion () const
 Return the completion percentage for the alignment model: 100 if there is no alignment model or it has been entirely calculated, or less than 100 if it is still being calculated.
void setRDFTypeURI (QString uri)
 Set the event, feature, or signal type URI for the features contained in this model, according to the Audio Features RDF ontology.
QString getRDFTypeURI () const
 Retrieve the event, feature, or signal type URI for the features contained in this model, if previously set with setRDFTypeURI.
virtual void toXml (QTextStream &stream, QString indent="", QString extraAttributes="") const
 Stream this exportable object out to XML on a text stream.
virtual QString toDelimitedDataString (QString delimiter) const
virtual QString toDelimitedDataStringSubset (QString, int, int) const
virtual QString toXmlString (QString indent="", QString extraAttributes="") const
 Convert this exportable object to XML in a string.
virtual bool canPlay () const
virtual QString getDefaultPlayClipId () const
virtual bool getDefaultPlayAudible () const

Static Public Member Functions

static QString encodeEntities (QString)
static QString encodeColour (int r, int g, int b)
static int getObjectExportId (const void *)

Static Public Attributes

static const int COMPLETION_UNKNOWN = -1

Protected Member Functions

 Model ()
 Model (const Model &)
Modeloperator= (const Model &)

Protected Attributes

Modelm_sourceModel
AlignmentModelm_alignment
QString m_typeUri
bool m_abandoning
bool m_aboutToDelete

Detailed Description

Model is the base class for all data models that represent any sort of data on a time scale based on an audio frame rate.

Definition at line 35 of file Model.h.


Constructor & Destructor Documentation

Model::~Model ( ) [virtual]

Definition at line 25 of file Model.cpp.

References aboutToDelete(), m_aboutToDelete, m_alignment, and SVDEBUG.

Model::Model ( ) [inline, protected]

Definition at line 291 of file Model.h.

Model::Model ( const Model ) [protected]

Member Function Documentation

virtual int Model::getNativeRate ( ) const [inline, virtual]

Return the frame rate of the underlying material, if the model itself has already been resampled.

Reimplemented in WaveFileModel.

Definition at line 69 of file Model.h.

References getSampleRate().

QString Model::getTitle ( ) const [virtual]

Return the "work title" of the model, if known.

Reimplemented in WaveFileModel.

Definition at line 153 of file Model.cpp.

References getTitle(), and m_sourceModel.

Referenced by getTitle().

QString Model::getMaker ( ) const [virtual]

Return the "artist" or "maker" of the model, if known.

Reimplemented in WaveFileModel.

Definition at line 160 of file Model.cpp.

References getMaker(), and m_sourceModel.

Referenced by getMaker().

QString Model::getLocation ( ) const [virtual]

Return the location of the data in this model (e.g.

source URL). This should not normally be returned for editable models that have been edited.

Reimplemented in WaveFileModel.

Definition at line 167 of file Model.cpp.

References getLocation(), and m_sourceModel.

Referenced by getLocation().

virtual Model* Model::clone ( ) const [pure virtual]

Return a copy of this model.

If the model is not editable, this may be effectively a shallow copy. If the model is editable, however, this operation must properly copy all of the model's editable data.

In general this operation is not useful for non-editable dense models such as waveforms, because there may be no efficient copy operation implemented -- for such models it is better not to copy at all.

Caller owns the returned value.

Implemented in FFTModel, EditableDenseThreeDimensionalModel, AggregateWaveModel, SparseModel< PointType >, WaveFileModel, WritableWaveFileModel, SparseModel< FlexiNote >, SparseModel< Note >, SparseModel< PathPoint >, SparseModel< TextPoint >, SparseModel< ImagePoint >, SparseModel< TimeValuePoint >, SparseModel< OneDimensionalPoint >, SparseModel< RegionRec >, Dense3DModelPeakCache, and AlignmentModel.

Referenced by AlignmentModel::clone().

virtual void Model::abandon ( ) [inline, virtual]

Mark the model as abandoning.

This means that the application no longer needs it, so it can stop doing any background calculations it may be involved in. Note that as far as the model API is concerned, this does nothing more than tell the model to return true from isAbandoning(). The actual response to this will depend on the model's context -- it's possible nothing at all will change.

Definition at line 118 of file Model.h.

References m_abandoning.

virtual bool Model::isAbandoning ( ) const [inline, virtual]

Query whether the model has been marked as abandoning.

Definition at line 125 of file Model.h.

References m_abandoning.

Referenced by FeatureExtractionModelTransformer::setCompletion().

virtual bool Model::isReady ( int *  completion = 0) const [inline, virtual]

Return true if the model has finished loading or calculating all its data, for a model that is capable of calculating in a background thread.

The default implementation is appropriate for a thread that does not background any work but carries out all its calculation from the constructor or accessors.

If "completion" is non-NULL, this function should return through it an estimated percentage value showing how far through the background operation it thinks it is (for progress reporting). If it has no way to calculate progress, it may return the special value COMPLETION_UNKNOWN.

Reimplemented in SparseModel< PointType >, SparseModel< FlexiNote >, SparseModel< Note >, SparseModel< PathPoint >, SparseModel< TextPoint >, SparseModel< ImagePoint >, SparseModel< TimeValuePoint >, SparseModel< OneDimensionalPoint >, SparseModel< RegionRec >, AlignmentModel, AggregateWaveModel, WaveFileModel, and WritableWaveFileModel.

Definition at line 142 of file Model.h.

References isOK().

Referenced by FFTDataServer::fillColumn(), RealTimeEffectModelTransformer::run(), FeatureExtractionModelTransformer::run(), and FFTDataServer::FillThread::run().

virtual const ZoomConstraint* Model::getZoomConstraint ( ) const [inline, virtual]

If this model imposes a zoom constraint, i.e.

some limit to the set of resolutions at which its data can meaningfully be displayed, then return it.

Reimplemented in AggregateWaveModel, WritableWaveFileModel, AlignmentModel, and WaveFileModel.

Definition at line 154 of file Model.h.

virtual Model* Model::getSourceModel ( ) const [inline, virtual]

If this model was derived from another, return the model it was derived from.

The assumption is that the source model's alignment will also apply to this model, unless some other property (such as a specific alignment model set on this model) indicates otherwise.

Definition at line 165 of file Model.h.

References m_sourceModel.

void Model::setAlignment ( AlignmentModel alignment) [virtual]

Specify an aligment between this model's timeline and that of a reference model.

The alignment model records both the reference and the alignment. This model takes ownership of the alignment model.

Definition at line 82 of file Model.cpp.

References aboutToDelete(), alignmentCompletionChanged(), completionChanged(), and m_alignment.

const AlignmentModel * Model::getAlignment ( ) const [virtual]

Retrieve the alignment model for this model.

This is not a generally useful function, as the alignment you really want may be performed by the source model instead. You should normally use getAlignmentReference, alignToReference and alignFromReference instead of this. The main intended application for this function is in streaming out alignments to the session file.

Definition at line 94 of file Model.cpp.

References m_alignment.

const Model * Model::getAlignmentReference ( ) const [virtual]

Return the reference model for the current alignment timeline, if any.

Definition at line 100 of file Model.cpp.

References getAlignmentReference(), AlignmentModel::getReferenceModel(), m_alignment, and m_sourceModel.

Referenced by getAlignmentReference().

int Model::alignToReference ( int  frame) const [virtual]

Return the frame number of the reference model that corresponds to the given frame number in this model.

Definition at line 110 of file Model.cpp.

References alignToReference(), getEndFrame(), AlignmentModel::getReferenceModel(), m_alignment, m_sourceModel, and AlignmentModel::toReference().

Referenced by alignToReference().

int Model::alignFromReference ( int  referenceFrame) const [virtual]

Return the frame number in this model that corresponds to the given frame number of the reference model.

Definition at line 125 of file Model.cpp.

References alignFromReference(), AlignmentModel::fromReference(), getEndFrame(), m_alignment, and m_sourceModel.

Referenced by alignFromReference().

int Model::getAlignmentCompletion ( ) const [virtual]

Return the completion percentage for the alignment model: 100 if there is no alignment model or it has been entirely calculated, or less than 100 if it is still being calculated.

Definition at line 139 of file Model.cpp.

References getAlignmentCompletion(), AlignmentModel::isReady(), m_alignment, and m_sourceModel.

Referenced by getAlignmentCompletion().

void Model::setRDFTypeURI ( QString  uri) [inline]

Set the event, feature, or signal type URI for the features contained in this model, according to the Audio Features RDF ontology.

Definition at line 223 of file Model.h.

References m_typeUri.

Referenced by FeatureExtractionModelTransformer::createOutputModels(), FeatureExtractionModelTransformer::getAdditionalModel(), RDFImporterImpl::getDataModelsDense(), and RDFImporterImpl::getDataModelsSparse().

QString Model::getRDFTypeURI ( ) const [inline]

Retrieve the event, feature, or signal type URI for the features contained in this model, if previously set with setRDFTypeURI.

Definition at line 230 of file Model.h.

References m_typeUri.

Referenced by FeatureExtractionModelTransformer::getAdditionalModel().

Reimplemented in FFTModel, and Dense3DModelPeakCache.

Definition at line 76 of file Model.cpp.

References m_sourceModel.

Referenced by setSourceModel().

void Model::modelChangedWithin ( int  startFrame,
int  endFrame 
) [signal]

Emitted when a model has been edited (or more data retrieved from cache, in the case of a cached model that generates slowly)

Reimplemented in AggregateWaveModel, and AlignmentModel.

Referenced by WaveFileModel::cacheFilled(), WaveFileModel::fillTimerTimedOut(), EditableDenseThreeDimensionalModel::setColumn(), EditableDenseThreeDimensionalModel::setCompletion(), and WritableWaveFileModel::WritableWaveFileModel().

void Model::completionChanged ( ) [signal]

Emitted when some internal processing has advanced a stage, but the model has not changed externally.

Views should respond by updating any progress meters or other monitoring, but not refreshing the actual view.

Reimplemented in AggregateWaveModel, and AlignmentModel.

Referenced by setAlignment(), and EditableDenseThreeDimensionalModel::setCompletion().

void Model::ready ( ) [signal]

Emitted when internal processing is complete (i.e.

when isReady() would return true, with completion at 100).

Referenced by WaveFileModel::cacheFilled(), WaveFileModel::isReady(), AggregateWaveModel::isReady(), and SparseModel< RegionRec >::isReady().

Emitted when the completion percentage changes for the calculation of this model's alignment model.

Referenced by setAlignment(), and setSourceModel().

void Model::aboutToBeDeleted ( ) [signal]

Emitted when something notifies this model (through calling aboutToDelete() that it is about to delete it.

Note that this depends on an external agent such as a Document object or owning model telling the model that it is about to delete it; there is nothing in the model to guarantee that this signal will be emitted before the actual deletion.

Referenced by aboutToDelete(), Dense3DModelPeakCache::Dense3DModelPeakCache(), and setSourceModel().

Model& Model::operator= ( const Model ) [protected]
QString XmlExportable::toXmlString ( QString  indent = "",
QString  extraAttributes = "" 
) const [virtual, inherited]

Convert this exportable object to XML in a string.

The default implementation calls toXml and returns the result as a string. Do not override this unless you really know what you're doing.

Definition at line 25 of file XmlExportable.cpp.

References XmlExportable::toXml().

Referenced by ModelTransformerFactory::getConfigurationForTransform(), and RDFTransformFactoryImpl::getTransforms().

QString XmlExportable::encodeColour ( int  r,
int  g,
int  b 
) [static, inherited]

Definition at line 54 of file XmlExportable.cpp.

int XmlExportable::getObjectExportId ( const void *  object) [static, inherited]
virtual bool Playable::canPlay ( ) const [inline, virtual, inherited]
virtual QString Playable::getDefaultPlayClipId ( ) const [inline, virtual, inherited]
virtual bool Playable::getDefaultPlayAudible ( ) const [inline, virtual, inherited]

Reimplemented in SparseTimeValueModel.

Definition at line 28 of file Playable.h.

Referenced by PlayParameterRepository::addPlayable().


Member Data Documentation

const int Model::COMPLETION_UNKNOWN = -1 [static]

Definition at line 147 of file Model.h.

QString Model::m_typeUri [protected]

Definition at line 303 of file Model.h.

Referenced by getRDFTypeURI(), and setRDFTypeURI().

bool Model::m_abandoning [protected]

Definition at line 304 of file Model.h.

Referenced by abandon(), and isAbandoning().

bool Model::m_aboutToDelete [protected]

Definition at line 305 of file Model.h.

Referenced by aboutToDelete(), and ~Model().


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