diff transform/ModelTransformer.cpp @ 877:b109b88bfa85 tonioni

Callback handler for additional models at end of processing
author Chris Cannam
date Wed, 29 Jan 2014 15:58:15 +0000
parents 47aa3aeb687b
children fe3f7f8df3a3
line wrap: on
line diff
--- a/transform/ModelTransformer.cpp	Wed Jan 29 09:31:22 2014 +0000
+++ b/transform/ModelTransformer.cpp	Wed Jan 29 15:58:15 2014 +0000
@@ -18,6 +18,7 @@
 ModelTransformer::ModelTransformer(Input input, const Transform &transform) :
     m_input(input),
     m_detached(false),
+    m_detachedAdd(false),
     m_abandoned(false)
 {
     m_transforms.push_back(transform);
@@ -27,6 +28,7 @@
     m_transforms(transforms),
     m_input(input),
     m_detached(false),
+    m_detachedAdd(false),
     m_abandoned(false)
 {
 }
@@ -36,19 +38,12 @@
     m_abandoned = true;
     wait();
     if (!m_detached) {
-        Models mine = getOutputModels(); // including any additional ones
-        foreach (Model *m, mine) {
-            delete m;
-        }
+        Models mine = getOutputModels();
+        foreach (Model *m, mine) delete m;
+    }
+    if (!m_detachedAdd) {
+        Models mine = getAdditionalOutputModels();
+        foreach (Model *m, mine) delete m;
     }
 }
 
-ModelTransformer::Models
-ModelTransformer::getOutputModels()
-{
-    Models out(m_outputs);
-    Models add(getAdditionalOutputModels());
-    foreach (Model *m, add) out.push_back(m);
-    return out;
-}
-