comparison transform/FileFeatureWriter.cpp @ 512:e7a39c45a7a4

* close output streams a little sooner when writing features for more than one file (doesn't affect eventual output though)
author Chris Cannam
date Tue, 09 Dec 2008 16:53:37 +0000
parents 0944d13689b2
children 6acdddf6f99e
comparison
equal deleted inserted replaced
511:7207e3eba44f 512:e7a39c45a7a4
30 using namespace std; 30 using namespace std;
31 using namespace Vamp; 31 using namespace Vamp;
32 32
33 FileFeatureWriter::FileFeatureWriter(int support, 33 FileFeatureWriter::FileFeatureWriter(int support,
34 QString extension) : 34 QString extension) :
35 m_prevstream(0),
35 m_support(support), 36 m_support(support),
36 m_extension(extension), 37 m_extension(extension),
37 m_manyFiles(false), 38 m_manyFiles(false),
38 m_stdout(false), 39 m_stdout(false),
39 m_append(false), 40 m_append(false),
256 } else { 257 } else {
257 m_streams[file] = new QTextStream(file); 258 m_streams[file] = new QTextStream(file);
258 } 259 }
259 } 260 }
260 261
261 return m_streams[file]; 262 QTextStream *stream = m_streams[file];
263
264 if (m_prevstream && stream != m_prevstream) {
265 m_prevstream->flush();
266 }
267 m_prevstream = stream;
268
269 return stream;
262 } 270 }
263 271