changeset 102:fae326c22df5

Fix failure to support summary-only flag when reading transforms with summaries from a transform file
author Chris Cannam
date Wed, 01 Oct 2014 14:55:17 +0100
parents f254f74d6b14
children 344d5982bbf8
files runner/FeatureExtractionManager.cpp runner/FeatureExtractionManager.h runner/main.cpp tests/test-summaries.sh
diffstat 4 files changed, 19 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/runner/FeatureExtractionManager.cpp	Wed Oct 01 14:54:58 2014 +0100
+++ b/runner/FeatureExtractionManager.cpp	Wed Oct 01 14:55:17 2014 +0100
@@ -99,9 +99,9 @@
     return PluginSummarisingAdapter::UnknownSummaryType;
 }
 
-bool FeatureExtractionManager::setSummaryTypes(const set<string> &names,
-                                               bool summariesOnly,
-                                               const PluginSummarisingAdapter::SegmentBoundaries &boundaries)
+bool
+FeatureExtractionManager::setSummaryTypes(const set<string> &names,
+                                          const PluginSummarisingAdapter::SegmentBoundaries &boundaries)
 {
     for (SummaryNameSet::const_iterator i = names.begin();
          i != names.end(); ++i) {
@@ -111,11 +111,16 @@
         }
     }
     m_summaries = names;
-    m_summariesOnly = summariesOnly;
     m_boundaries = boundaries;
     return true;
 }
 
+void
+FeatureExtractionManager::setSummariesOnly(bool summariesOnly)
+{
+    m_summariesOnly = summariesOnly;
+}
+
 static PluginInputDomainAdapter::WindowType
 convertWindowType(WindowType t)
 {
--- a/runner/FeatureExtractionManager.h	Wed Oct 01 14:54:58 2014 +0100
+++ b/runner/FeatureExtractionManager.h	Wed Oct 01 14:55:17 2014 +0100
@@ -45,9 +45,10 @@
     void setDefaultSampleRate(int sampleRate);
 
     bool setSummaryTypes(const set<string> &summaryTypes,
-                         bool summariesOnly,
                          const Vamp::HostExt::PluginSummarisingAdapter::SegmentBoundaries &boundaries);
 
+    void setSummariesOnly(bool summariesOnly);
+
     bool addFeatureExtractor(Transform transform,
                              const vector<FeatureWriter*> &writers);
 
--- a/runner/main.cpp	Wed Oct 01 14:54:58 2014 +0100
+++ b/runner/main.cpp	Wed Oct 01 14:55:17 2014 +0100
@@ -586,13 +586,14 @@
 
     if (!requestedSummaryTypes.empty()) {
         if (!manager.setSummaryTypes(requestedSummaryTypes,
-                                     summaryOnly,
                                      boundaries)) {
             cerr << myname.toStdString()
                  << ": failed to set requested summary types" << endl;
             exit(1);
         }
     }
+
+    manager.setSummariesOnly(summaryOnly);
     
     vector<FeatureWriter *> writers;
 
--- a/tests/test-summaries.sh	Wed Oct 01 14:54:58 2014 +0100
+++ b/tests/test-summaries.sh	Wed Oct 01 14:55:17 2014 +0100
@@ -72,6 +72,12 @@
 compare $tmpfile ${sexpected}.csv || \
     faildiff "Output mismatch for transform $stransform" $tmpfile ${sexpected}.csv
 
+$r -t $stransform -w csv --csv-stdout --summary-only $infile > $tmpfile 2>/dev/null || \
+    fail "Fails to run transform $stransform with CSV output and summary-only"
+
+compare $tmpfile ${expected}-from-rdf-summaries-only.csv || \
+    faildiff "Output mismatch for transform $stransform with summary-only" $tmpfile ${expected}-from-rdf-summaries-only.csv
+
 $r -t $stransform -w rdf --rdf-stdout $infile > $tmpfile 2>/dev/null || \
     fail "Fails to run transform $stransform with RDF output"