changeset 515:1aefb666ecfc

* writer flush
author Chris Cannam
date Wed, 10 Dec 2008 16:24:31 +0000
parents 6acdddf6f99e
children 5ab561f664f2
files base/ProgressPrinter.cpp base/ProgressPrinter.h transform/FeatureWriter.h transform/FileFeatureWriter.cpp transform/FileFeatureWriter.h
diffstat 5 files changed, 20 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/base/ProgressPrinter.cpp	Wed Dec 10 13:21:10 2008 +0000
+++ b/base/ProgressPrinter.cpp	Wed Dec 10 16:24:31 2008 +0000
@@ -52,6 +52,12 @@
 }
 
 void
+ProgressPrinter::done()
+{
+    setProgress(100);
+}
+
+void
 ProgressPrinter::setProgress(int progress)
 {
     if (progress == m_lastProgress) return;
--- a/base/ProgressPrinter.h	Wed Dec 10 13:21:10 2008 +0000
+++ b/base/ProgressPrinter.h	Wed Dec 10 16:24:31 2008 +0000
@@ -34,6 +34,7 @@
 public slots:
     virtual void setMessage(QString);
     virtual void setProgress(int);
+    virtual void done();
 
 protected:
     QString m_prefix;
--- a/transform/FeatureWriter.h	Wed Dec 10 13:21:10 2008 +0000
+++ b/transform/FeatureWriter.h	Wed Dec 10 16:24:31 2008 +0000
@@ -67,6 +67,8 @@
                        const Vamp::Plugin::FeatureList &features,
                        std::string summaryType = "") = 0;
 
+    virtual void flush() { } // whatever the last stream was
+
     virtual void finish() = 0;
 };
 
--- a/transform/FileFeatureWriter.cpp	Wed Dec 10 13:21:10 2008 +0000
+++ b/transform/FileFeatureWriter.cpp	Wed Dec 10 16:24:31 2008 +0000
@@ -271,3 +271,12 @@
     return stream;
 }
             
+
+void
+FileFeatureWriter::flush()
+{
+    if (m_prevstream) {
+        m_prevstream->flush();
+    }
+}
+
--- a/transform/FileFeatureWriter.h	Wed Dec 10 13:21:10 2008 +0000
+++ b/transform/FileFeatureWriter.h	Wed Dec 10 16:24:31 2008 +0000
@@ -42,6 +42,8 @@
     virtual ParameterList getSupportedParameters() const;
     virtual void setParameters(map<string, string> &params);
 
+    virtual void flush();
+
 protected:
     enum FileWriteSupport {
         SupportOneFilePerTrackTransform = 1,