comparison framework/Document.h @ 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
comparison
equal deleted inserted replaced
52:43ad8d909e28 53:de2b3c6479c8
15 15
16 #ifndef _DOCUMENT_H_ 16 #ifndef _DOCUMENT_H_
17 #define _DOCUMENT_H_ 17 #define _DOCUMENT_H_
18 18
19 #include "layer/LayerFactory.h" 19 #include "layer/LayerFactory.h"
20 #include "plugin/transform/Transform.h" 20 #include "plugin/transform/Transformer.h"
21 #include "plugin/transform/PluginTransform.h" 21 #include "plugin/transform/PluginTransformer.h"
22 #include "base/Command.h" 22 #include "base/Command.h"
23 23
24 #include <map> 24 #include <map>
25 #include <set> 25 #include <set>
26 26
42 * 42 *
43 * - Any number of imported Model objects, which contain data without any 43 * - Any number of imported Model objects, which contain data without any
44 * requirement to remember where the data came from or how to 44 * requirement to remember where the data came from or how to
45 * regenerate it. 45 * regenerate it.
46 * 46 *
47 * - Any number of Model objects that were generated by a Transform 47 * - Any number of Model objects that were generated by a Transformer
48 * such as FeatureExtractionPluginTransform. For these, we also 48 * such as FeatureExtractionPluginTransformer. For these, we also
49 * record the source model and the name of the transform used to 49 * record the source model and the name of the transform used to
50 * generate the model so that we can regenerate it (potentially 50 * generate the model so that we can regenerate it (potentially
51 * from a different source) on demand. 51 * from a different source) on demand.
52 * 52 *
53 * - A flat list of Layer objects. Elsewhere, the GUI may distribute these 53 * - A flat list of Layer objects. Elsewhere, the GUI may distribute these
104 * transform itself, nor create a model. The caller can safely 104 * transform itself, nor create a model. The caller can safely
105 * add a model to the layer later, but note that all models used 105 * add a model to the layer later, but note that all models used
106 * by a transform layer _must_ be registered with the document 106 * by a transform layer _must_ be registered with the document
107 * using addDerivedModel below. 107 * using addDerivedModel below.
108 */ 108 */
109 Layer *createDerivedLayer(LayerFactory::LayerType, TransformId); 109 Layer *createDerivedLayer(LayerFactory::LayerType, TransformerId);
110 110
111 /** 111 /**
112 * Create and return a suitable layer for the given transform, 112 * Create and return a suitable layer for the given transform,
113 * running the transform and associating the resulting model with 113 * running the transform and associating the resulting model with
114 * the new layer. 114 * the new layer.
115 */ 115 */
116 Layer *createDerivedLayer(TransformId, 116 Layer *createDerivedLayer(TransformerId,
117 Model *inputModel, 117 Model *inputModel,
118 const PluginTransform::ExecutionContext &context, 118 const PluginTransformer::ExecutionContext &context,
119 QString configurationXml); 119 QString configurationXml);
120 120
121 /** 121 /**
122 * Delete the given layer, and also its associated model if no 122 * Delete the given layer, and also its associated model if no
123 * longer used by any other layer. In general, this should be the 123 * longer used by any other layer. In general, this should be the
141 /** 141 /**
142 * Get the main model (the source for playback sample rate, etc). 142 * Get the main model (the source for playback sample rate, etc).
143 */ 143 */
144 const WaveFileModel *getMainModel() const { return m_mainModel; } 144 const WaveFileModel *getMainModel() const { return m_mainModel; }
145 145
146 std::vector<Model *> getTransformInputModels(); 146 std::vector<Model *> getTransformerInputModels();
147 147
148 /** 148 /**
149 * Add a derived model associated with the given transform, 149 * Add a derived model associated with the given transform,
150 * running the transform and returning the resulting model. 150 * running the transform and returning the resulting model.
151 */ 151 */
152 Model *addDerivedModel(TransformId transform, 152 Model *addDerivedModel(TransformerId transform,
153 Model *inputModel, 153 Model *inputModel,
154 const PluginTransform::ExecutionContext &context, 154 const PluginTransformer::ExecutionContext &context,
155 QString configurationXml); 155 QString configurationXml);
156 156
157 /** 157 /**
158 * Add a derived model associated with the given transform. This 158 * Add a derived model associated with the given transform. This
159 * is necessary to register any derived model that was not created 159 * is necessary to register any derived model that was not created
160 * by the document using createDerivedModel or createDerivedLayer. 160 * by the document using createDerivedModel or createDerivedLayer.
161 */ 161 */
162 void addDerivedModel(TransformId, 162 void addDerivedModel(TransformerId,
163 Model *inputModel, 163 Model *inputModel,
164 const PluginTransform::ExecutionContext &context, 164 const PluginTransformer::ExecutionContext &context,
165 Model *outputModelToAdd, 165 Model *outputModelToAdd,
166 QString configurationXml); 166 QString configurationXml);
167 167
168 /** 168 /**
169 * Add an imported (non-derived, non-main) model. This is 169 * Add an imported (non-derived, non-main) model. This is
265 // and the transform name will be set appropriately. If the 265 // and the transform name will be set appropriately. If the
266 // transform name is set but source is NULL, then there was a 266 // transform name is set but source is NULL, then there was a
267 // transform involved but the (target) model has been modified 267 // transform involved but the (target) model has been modified
268 // since being generated from it. 268 // since being generated from it.
269 const Model *source; 269 const Model *source;
270 TransformId transform; 270 TransformerId transform;
271 PluginTransform::ExecutionContext context; 271 PluginTransformer::ExecutionContext context;
272 QString configurationXml; 272 QString configurationXml;
273 273
274 // Count of the number of layers using this model. 274 // Count of the number of layers using this model.
275 int refcount; 275 int refcount;
276 }; 276 };