changeset 53:de2b3c6479c8

* Introduce new Transform class which contains data necessary to describe the context for a plugin -- the plugin's name and output, the step/block size etc (formerly spread across ExecutionContext and TransformFactory). Other code hasn't been updated to use this yet. * Rename existing Transform stuff to Transformers (because they run Transforms) I'm still not 100% sure about this change, don't rely on it.
author Chris Cannam
date Mon, 05 Nov 2007 15:31:06 +0000
parents 43ad8d909e28
children a798f5e6fc5e
files framework/Document.cpp framework/Document.h framework/MainWindowBase.cpp framework/MainWindowBase.h framework/SVFileReader.cpp framework/SVFileReader.h
diffstat 6 files changed, 74 insertions(+), 74 deletions(-) [+]
line wrap: on
line diff
--- a/framework/Document.cpp	Fri Nov 02 14:12:17 2007 +0000
+++ b/framework/Document.cpp	Mon Nov 05 15:31:06 2007 +0000
@@ -25,7 +25,7 @@
 #include "view/View.h"
 #include "base/PlayParameterRepository.h"
 #include "base/PlayParameters.h"
-#include "plugin/transform/TransformFactory.h"
+#include "plugin/transform/TransformerFactory.h"
 #include <QApplication>
 #include <QTextStream>
 #include <iostream>
@@ -42,7 +42,7 @@
     m_autoAlignment(false)
 {
     connect(this, SIGNAL(modelAboutToBeDeleted(Model *)),
-            TransformFactory::getInstance(),
+            TransformerFactory::getInstance(),
             SLOT(modelAboutToBeDeleted(Model *)));
 }
 
@@ -174,22 +174,22 @@
 
 Layer *
 Document::createDerivedLayer(LayerFactory::LayerType type,
-			     TransformId transform)
+			     TransformerId transform)
 {
     Layer *newLayer = createLayer(type);
     if (!newLayer) return 0;
 
     newLayer->setObjectName(getUniqueLayerName
-                            (TransformFactory::getInstance()->
-                             getTransformFriendlyName(transform)));
+                            (TransformerFactory::getInstance()->
+                             getTransformerFriendlyName(transform)));
 
     return newLayer;
 }
 
 Layer *
-Document::createDerivedLayer(TransformId transform,
+Document::createDerivedLayer(TransformerId transform,
                              Model *inputModel, 
-                             const PluginTransform::ExecutionContext &context,
+                             const PluginTransformer::ExecutionContext &context,
                              QString configurationXml)
 {
     Model *newModel = addDerivedModel(transform, inputModel,
@@ -204,7 +204,7 @@
 	LayerFactory::getInstance()->getValidLayerTypes(newModel);
 
     if (types.empty()) {
-	std::cerr << "WARNING: Document::createLayerForTransform: no valid display layer for output of transform " << transform.toStdString() << std::endl;
+	std::cerr << "WARNING: Document::createLayerForTransformer: no valid display layer for output of transform " << transform.toStdString() << std::endl;
 	delete newModel;
 	return 0;
     }
@@ -231,8 +231,8 @@
     
     if (newLayer) {
 	newLayer->setObjectName(getUniqueLayerName
-                                (TransformFactory::getInstance()->
-                                 getTransformFriendlyName(transform)));
+                                (TransformerFactory::getInstance()->
+                                 getTransformerFriendlyName(transform)));
     }
 
     emit layerAdded(newLayer);
@@ -248,7 +248,7 @@
     emit modelAdded(m_mainModel);
 
     std::vector<Layer *> obsoleteLayers;
-    std::set<QString> failedTransforms;
+    std::set<QString> failedTransformers;
 
     // We need to ensure that no layer is left using oldMainModel or
     // any of the old derived models as its model.  Either replace the
@@ -289,8 +289,8 @@
 	    // This model was derived from the previous main
 	    // model: regenerate it.
 	    
-	    TransformId transform = m_models[model].transform;
-            PluginTransform::ExecutionContext context = m_models[model].context;
+	    TransformerId transform = m_models[model].transform;
+            PluginTransformer::ExecutionContext context = m_models[model].context;
 	    
 	    Model *replacementModel =
                 addDerivedModel(transform,
@@ -301,10 +301,10 @@
 	    if (!replacementModel) {
 		std::cerr << "WARNING: Document::setMainModel: Failed to regenerate model for transform \""
 			  << transform.toStdString() << "\"" << " in layer " << layer << std::endl;
-                if (failedTransforms.find(transform) == failedTransforms.end()) {
+                if (failedTransformers.find(transform) == failedTransformers.end()) {
                     emit modelRegenerationFailed(layer->objectName(),
                                                  transform);
-                    failedTransforms.insert(transform);
+                    failedTransformers.insert(transform);
                 }
 		obsoleteLayers.push_back(layer);
 	    } else {
@@ -343,9 +343,9 @@
 }
 
 void
-Document::addDerivedModel(TransformId transform,
+Document::addDerivedModel(TransformerId transform,
                           Model *inputModel,
-                          const PluginTransform::ExecutionContext &context,
+                          const PluginTransformer::ExecutionContext &context,
                           Model *outputModelToAdd,
                           QString configurationXml)
 {
@@ -394,9 +394,9 @@
 }
 
 Model *
-Document::addDerivedModel(TransformId transform,
+Document::addDerivedModel(TransformerId transform,
                           Model *inputModel,
-                          const PluginTransform::ExecutionContext &context,
+                          const PluginTransformer::ExecutionContext &context,
                           QString configurationXml)
 {
     Model *model = 0;
@@ -410,7 +410,7 @@
 	}
     }
 
-    model = TransformFactory::getInstance()->transform
+    model = TransformerFactory::getInstance()->transform
 	(transform, inputModel, context, configurationXml);
 
     if (!model) {
@@ -660,7 +660,7 @@
 }
 
 std::vector<Model *>
-Document::getTransformInputModels()
+Document::getTransformerInputModels()
 {
     std::vector<Model *> models;
 
@@ -687,9 +687,9 @@
 bool
 Document::canAlign() 
 {
-    TransformId id = "vamp:match-vamp-plugin:match:path";
-    TransformFactory *factory = TransformFactory::getInstance();
-    return factory->haveTransform(id);
+    TransformerId id = "vamp:match-vamp-plugin:match:path";
+    TransformerFactory *factory = TransformerFactory::getInstance();
+    return factory->haveTransformer(id);
 }
 
 void
@@ -710,7 +710,7 @@
     // MATCH plugin
 
     // 2. a SparseTimeValueModel, which is the model automatically
-    // created by FeatureExtractionPluginTransform when running the
+    // created by FeatureExtractionPluginTransformer when running the
     // MATCH plugin (thus containing the alignment path)
 
     // 3. an AlignmentModel, which stores the path model and carries
@@ -732,13 +732,13 @@
 
     Model *aggregate = new AggregateWaveModel(components);
 
-    TransformId id = "vamp:match-vamp-plugin:match:path";
+    TransformerId id = "vamp:match-vamp-plugin:match:path";
     
-    TransformFactory *factory = TransformFactory::getInstance();
+    TransformerFactory *factory = TransformerFactory::getInstance();
 
     Model *transformOutput = factory->transform
         (id, aggregate,
-         factory->getDefaultContextForTransform(id, aggregate),
+         factory->getDefaultContextForTransformer(id, aggregate),
          "<plugin param-serialise=\"1\"/>");
 
     SparseTimeValueModel *path = dynamic_cast<SparseTimeValueModel *>
--- a/framework/Document.h	Fri Nov 02 14:12:17 2007 +0000
+++ b/framework/Document.h	Mon Nov 05 15:31:06 2007 +0000
@@ -17,8 +17,8 @@
 #define _DOCUMENT_H_
 
 #include "layer/LayerFactory.h"
-#include "plugin/transform/Transform.h"
-#include "plugin/transform/PluginTransform.h"
+#include "plugin/transform/Transformer.h"
+#include "plugin/transform/PluginTransformer.h"
 #include "base/Command.h"
 
 #include <map>
@@ -44,8 +44,8 @@
  * requirement to remember where the data came from or how to
  * regenerate it.
  * 
- *  - Any number of Model objects that were generated by a Transform
- * such as FeatureExtractionPluginTransform.  For these, we also
+ *  - Any number of Model objects that were generated by a Transformer
+ * such as FeatureExtractionPluginTransformer.  For these, we also
  * record the source model and the name of the transform used to
  * generate the model so that we can regenerate it (potentially
  * from a different source) on demand.
@@ -106,16 +106,16 @@
      * by a transform layer _must_ be registered with the document
      * using addDerivedModel below.
      */
-    Layer *createDerivedLayer(LayerFactory::LayerType, TransformId);
+    Layer *createDerivedLayer(LayerFactory::LayerType, TransformerId);
 
     /**
      * Create and return a suitable layer for the given transform,
      * running the transform and associating the resulting model with
      * the new layer.
      */
-    Layer *createDerivedLayer(TransformId,
+    Layer *createDerivedLayer(TransformerId,
                               Model *inputModel, 
-                              const PluginTransform::ExecutionContext &context,
+                              const PluginTransformer::ExecutionContext &context,
                               QString configurationXml);
 
     /**
@@ -143,15 +143,15 @@
      */
     const WaveFileModel *getMainModel() const { return m_mainModel; }
 
-    std::vector<Model *> getTransformInputModels();
+    std::vector<Model *> getTransformerInputModels();
 
     /**
      * Add a derived model associated with the given transform,
      * running the transform and returning the resulting model.
      */
-    Model *addDerivedModel(TransformId transform,
+    Model *addDerivedModel(TransformerId transform,
                            Model *inputModel,
-                           const PluginTransform::ExecutionContext &context,
+                           const PluginTransformer::ExecutionContext &context,
                            QString configurationXml);
 
     /**
@@ -159,9 +159,9 @@
      * is necessary to register any derived model that was not created
      * by the document using createDerivedModel or createDerivedLayer.
      */
-    void addDerivedModel(TransformId,
+    void addDerivedModel(TransformerId,
                          Model *inputModel,
-                         const PluginTransform::ExecutionContext &context,
+                         const PluginTransformer::ExecutionContext &context,
                          Model *outputModelToAdd,
                          QString configurationXml);
 
@@ -267,8 +267,8 @@
 	// transform involved but the (target) model has been modified
 	// since being generated from it.
 	const Model *source;
-	TransformId transform;
-        PluginTransform::ExecutionContext context;
+	TransformerId transform;
+        PluginTransformer::ExecutionContext context;
         QString configurationXml;
 
 	// Count of the number of layers using this model.
--- a/framework/MainWindowBase.cpp	Fri Nov 02 14:12:17 2007 +0000
+++ b/framework/MainWindowBase.cpp	Mon Nov 05 15:31:06 2007 +0000
@@ -105,7 +105,7 @@
     m_playTarget(0),
     m_oscQueue(withOSCSupport ? new OSCQueue() : 0),
     m_recentFiles("RecentFiles", 20),
-    m_recentTransforms("RecentTransforms", 20),
+    m_recentTransformers("RecentTransforms", 20),
     m_documentModified(false),
     m_openingAudioFile(false),
     m_abandoning(false),
--- a/framework/MainWindowBase.h	Fri Nov 02 14:12:17 2007 +0000
+++ b/framework/MainWindowBase.h	Mon Nov 05 15:31:06 2007 +0000
@@ -27,7 +27,7 @@
 #include "base/PropertyContainer.h"
 #include "base/RecentFiles.h"
 #include "layer/LayerFactory.h"
-#include "plugin/transform/Transform.h"
+#include "plugin/transform/Transformer.h"
 #include "SVFileReader.h"
 #include "data/fileio/FileFinder.h"
 #include "data/fileio/FileSource.h"
@@ -249,7 +249,7 @@
     OSCQueue                *m_oscQueue;
 
     RecentFiles              m_recentFiles;
-    RecentFiles              m_recentTransforms;
+    RecentFiles              m_recentTransformers;
 
     bool                     m_documentModified;
     bool                     m_openingAudioFile;
--- a/framework/SVFileReader.cpp	Fri Nov 02 14:12:17 2007 +0000
+++ b/framework/SVFileReader.cpp	Mon Nov 05 15:31:06 2007 +0000
@@ -286,24 +286,24 @@
                           << " as target, not regenerating" << std::endl;
             } else {
                 m_currentDerivedModel = m_models[m_currentDerivedModelId] =
-                    m_document->addDerivedModel(m_currentTransform,
-                                                m_currentTransformSource,
-                                                m_currentTransformContext,
-                                                m_currentTransformConfiguration);
+                    m_document->addDerivedModel(m_currentTransformer,
+                                                m_currentTransformerSource,
+                                                m_currentTransformerContext,
+                                                m_currentTransformerConfiguration);
             }
         } else {
-            m_document->addDerivedModel(m_currentTransform,
-                                        m_currentTransformSource,
-                                        m_currentTransformContext,
+            m_document->addDerivedModel(m_currentTransformer,
+                                        m_currentTransformerSource,
+                                        m_currentTransformerContext,
                                         m_currentDerivedModel,
-                                        m_currentTransformConfiguration);
+                                        m_currentTransformerConfiguration);
         }
 
         m_addedModels.insert(m_currentDerivedModel);
         m_currentDerivedModel = 0;
         m_currentDerivedModelId = -1;
-        m_currentTransform = "";
-        m_currentTransformConfiguration = "";
+        m_currentTransformer = "";
+        m_currentTransformerConfiguration = "";
 
     } else if (name == "row") {
 	m_inRow = false;
@@ -1004,31 +1004,31 @@
     sourceId = attributes.value("source").trimmed().toInt(&sourceOk);
 
     if (sourceOk && haveModel(sourceId)) {
-        m_currentTransformSource = m_models[sourceId];
+        m_currentTransformerSource = m_models[sourceId];
     } else {
-        m_currentTransformSource = m_document->getMainModel();
+        m_currentTransformerSource = m_document->getMainModel();
     }
 
-    m_currentTransform = transform;
-    m_currentTransformConfiguration = "";
+    m_currentTransformer = transform;
+    m_currentTransformerConfiguration = "";
 
-    m_currentTransformContext = PluginTransform::ExecutionContext();
+    m_currentTransformerContext = PluginTransformer::ExecutionContext();
 
     bool ok = false;
     int channel = attributes.value("channel").trimmed().toInt(&ok);
-    if (ok) m_currentTransformContext.channel = channel;
+    if (ok) m_currentTransformerContext.channel = channel;
 
     int domain = attributes.value("domain").trimmed().toInt(&ok);
-    if (ok) m_currentTransformContext.domain = Vamp::Plugin::InputDomain(domain);
+    if (ok) m_currentTransformerContext.domain = Vamp::Plugin::InputDomain(domain);
 
     int stepSize = attributes.value("stepSize").trimmed().toInt(&ok);
-    if (ok) m_currentTransformContext.stepSize = stepSize;
+    if (ok) m_currentTransformerContext.stepSize = stepSize;
 
     int blockSize = attributes.value("blockSize").trimmed().toInt(&ok);
-    if (ok) m_currentTransformContext.blockSize = blockSize;
+    if (ok) m_currentTransformerContext.blockSize = blockSize;
 
     int windowType = attributes.value("windowType").trimmed().toInt(&ok);
-    if (ok) m_currentTransformContext.windowType = WindowType(windowType);
+    if (ok) m_currentTransformerContext.windowType = WindowType(windowType);
 
     QString startFrameStr = attributes.value("startFrame");
     QString durationStr = attributes.value("duration");
@@ -1045,8 +1045,8 @@
         if (!ok) duration = 0;
     }
 
-    m_currentTransformContext.startFrame = startFrame;
-    m_currentTransformContext.duration = duration;
+    m_currentTransformerContext.startFrame = startFrame;
+    m_currentTransformerContext.duration = duration;
 
     return true;
 }
@@ -1127,7 +1127,7 @@
     if (m_currentPlayParameters) {
         m_currentPlayParameters->setPlayPluginConfiguration(configurationXml);
     } else {
-        m_currentTransformConfiguration += configurationXml;
+        m_currentTransformerConfiguration += configurationXml;
     }
 
     return true;
--- a/framework/SVFileReader.h	Fri Nov 02 14:12:17 2007 +0000
+++ b/framework/SVFileReader.h	Mon Nov 05 15:31:06 2007 +0000
@@ -17,8 +17,8 @@
 #define _SV_FILE_READER_H_
 
 #include "layer/LayerFactory.h"
-#include "plugin/transform/Transform.h"
-#include "plugin/transform/PluginTransform.h"
+#include "plugin/transform/Transformer.h"
+#include "plugin/transform/PluginTransformer.h"
 
 #include <QXmlDefaultHandler>
 
@@ -216,10 +216,10 @@
     Model *m_currentDerivedModel;
     int m_currentDerivedModelId;
     PlayParameters *m_currentPlayParameters;
-    QString m_currentTransform;
-    Model *m_currentTransformSource;
-    PluginTransform::ExecutionContext m_currentTransformContext;
-    QString m_currentTransformConfiguration;
+    QString m_currentTransformer;
+    Model *m_currentTransformerSource;
+    PluginTransformer::ExecutionContext m_currentTransformerContext;
+    QString m_currentTransformerConfiguration;
     QString m_datasetSeparator;
     bool m_inRow;
     bool m_inLayer;