diff transform/FileFeatureWriter.cpp @ 531:38b1ddf18d4b

* Try to avoid leaving output files open after completion
author Chris Cannam
date Tue, 20 Jan 2009 18:11:10 +0000
parents 12608139f6bc
children e0a1ff10cc7b
line wrap: on
line diff
--- a/transform/FileFeatureWriter.cpp	Tue Jan 20 18:10:56 2009 +0000
+++ b/transform/FileFeatureWriter.cpp	Tue Jan 20 18:11:10 2009 +0000
@@ -285,3 +285,23 @@
     }
 }
 
+
+void
+FileFeatureWriter::finish()
+{
+    cerr << "FileFeatureWriter::finish()" << endl;
+
+    if (m_singleFileName != "" || m_stdout) return;
+
+    while (!m_streams.empty()) {
+        m_streams.begin()->second->flush();
+        delete m_streams.begin()->second;
+        m_streams.erase(m_streams.begin());
+    }
+    while (!m_files.empty()) {
+        delete m_files.begin()->second;
+        m_files.erase(m_files.begin());
+    }
+    m_prevstream = 0;
+}
+