comparison runner/BinaryFeatureWriter.cpp @ 65:b2f70a775ddc

added configurable threading model
author gyorgyf
date Thu, 16 Feb 2012 19:06:33 +0000
parents 82248965fc74
children c98f0ece3e80
comparison
equal deleted inserted replaced
64:82248965fc74 65:b2f70a775ddc
83 83
84 if (append) 84 if (append)
85 stream = new ofstream(filename.c_str(), fstream::binary | ios_base::out | ios_base::in | ofstream::ate); 85 stream = new ofstream(filename.c_str(), fstream::binary | ios_base::out | ios_base::in | ofstream::ate);
86 else 86 else
87 stream = new ofstream(filename.c_str(), fstream::binary); 87 stream = new ofstream(filename.c_str(), fstream::binary);
88 88
89 if (!stream) 89 if (!stream || !stream->is_open()) {
90 { 90 if (append) {
91 cerr << "ERROR: BinaryFeatureWriter::OutputStream::open(): can't open file " << filename << endl; 91 cerr << endl << "NOTE: Writing new binary output file: " << filename << endl;
92 return false; 92 delete stream;
93 } 93 stream = NULL;
94 94 return open(filename,false);
95 if (append && !stream->is_open()) { 95 } else {
96 cerr << endl << "NOTE: Writing new binary output file: " << filename << endl; 96 cerr << "ERROR: BinaryFeatureWriter::OutputStream::open(): can't open file " << filename << endl;
97 delete stream; 97 return false;
98 stream = NULL; 98 }
99 return open(filename,false);
100 } 99 }
101 100
102 // verify input file format 101 // verify input file format
103 if (append) { 102 if (append) {
104 ifstream istream; 103 ifstream istream;
309 } 308 }
310 309
311 bool BinaryFeatureWriter::openBinaryFile() 310 bool BinaryFeatureWriter::openBinaryFile()
312 { 311 {
313 if (outputFile.rfind(".") == string::npos) 312 if (outputFile.rfind(".") == string::npos)
314 // if (!QString(outputFile.c_str()).contains("."))
315 return binary->open(outputFile + ".bin"); 313 return binary->open(outputFile + ".bin");
316 else 314 else
317 return binary->open(outputFile); 315 return binary->open(outputFile);
318 } 316 }
319 317