comparison rdf/RDFFeatureWriter.cpp @ 530:1d3fc01edc03

* Try to avoid leaving output files open after completion
author Chris Cannam
date Tue, 20 Jan 2009 18:10:56 +0000
parents 06a6612e7cf1
children b3a87e81c761
comparison
equal deleted inserted replaced
529:993e0a4f1343 530:1d3fc01edc03
125 exit(1); 125 exit(1);
126 } 126 }
127 127
128 if (m_startedStreamTransforms.find(stream) == 128 if (m_startedStreamTransforms.find(stream) ==
129 m_startedStreamTransforms.end()) { 129 m_startedStreamTransforms.end()) {
130 // cerr << "This stream is new, writing prefixes" << endl; 130 cerr << "This stream is new, writing prefixes" << endl;
131 writePrefixes(stream); 131 writePrefixes(stream);
132 if (m_singleFileName == "" && !m_stdout) { 132 if (m_singleFileName == "" && !m_stdout) {
133 writeSignalDescription(stream, trackId); 133 writeSignalDescription(stream, trackId);
134 } 134 }
135 } 135 }
220 220
221 void 221 void
222 RDFFeatureWriter::writeSignalDescription(QTextStream *sptr, 222 RDFFeatureWriter::writeSignalDescription(QTextStream *sptr,
223 QString trackId) 223 QString trackId)
224 { 224 {
225 std::cerr << "RDFFeatureWriter::writeSignalDescription" << std::endl;
226
225 QTextStream &stream = *sptr; 227 QTextStream &stream = *sptr;
226 228
227 /* 229 /*
228 * Describe signal we're analysing (AudioFile, Signal, TimeLine, etc.) 230 * Describe signal we're analysing (AudioFile, Signal, TimeLine, etc.)
229 */ 231 */
654 } 656 }
655 } 657 }
656 658
657 void RDFFeatureWriter::finish() 659 void RDFFeatureWriter::finish()
658 { 660 {
659 // cerr << "RDFFeatureWriter::finish()" << endl; 661 cerr << "RDFFeatureWriter::finish()" << endl;
660 662
661 // close any open dense feature literals 663 // close any open dense feature literals
662 664
663 for (map<StringTransformPair, StreamBuffer>::iterator i = 665 for (map<StringTransformPair, StreamBuffer>::iterator i =
664 m_openDenseFeatures.begin(); 666 m_openDenseFeatures.begin();
667 StreamBuffer &b = i->second; 669 StreamBuffer &b = i->second;
668 *(b.first) << b.second << "\" ." << endl; 670 *(b.first) << b.second << "\" ." << endl;
669 } 671 }
670 672
671 m_openDenseFeatures.clear(); 673 m_openDenseFeatures.clear();
672 } 674 m_startedStreamTransforms.clear();
673 675
674 676 FileFeatureWriter::finish();
677 }
678
679