comparison data/fileio/CSVFileReader.cpp @ 1428:87ae75da6527

Convert some cerrs to SVCERRs. Apart from anything else, this makes MSVC2017 happy
author Chris Cannam
date Thu, 01 Mar 2018 14:43:40 +0000
parents 815f82508f96
children 48e9f538e6e9
comparison
equal deleted inserted replaced
1427:622d193a00dc 1428:87ae75da6527
32 #include <QStringList> 32 #include <QStringList>
33 #include <QTextStream> 33 #include <QTextStream>
34 34
35 #include <iostream> 35 #include <iostream>
36 #include <map> 36 #include <map>
37 #include <string>
37 38
38 using namespace std; 39 using namespace std;
39 40
40 CSVFileReader::CSVFileReader(QString path, CSVFormat format, 41 CSVFileReader::CSVFileReader(QString path, CSVFormat format,
41 sv_samplerate_t mainModelSampleRate) : 42 sv_samplerate_t mainModelSampleRate) :
135 } 136 }
136 } 137 }
137 138
138 if (!ok) { 139 if (!ok) {
139 if (m_warnings < warnLimit) { 140 if (m_warnings < warnLimit) {
140 cerr << "WARNING: CSVFileReader::load: " 141 SVCERR << "WARNING: CSVFileReader::load: "
141 << "Bad time format (\"" << s 142 << "Bad time format (\"" << s
142 << "\") in data line " 143 << "\") in data line "
143 << lineno+1 << endl; 144 << lineno+1 << endl;
144 } else if (m_warnings == warnLimit) { 145 } else if (m_warnings == warnLimit) {
145 cerr << "WARNING: Too many warnings" << endl; 146 SVCERR << "WARNING: Too many warnings" << endl;
146 } 147 }
147 ++m_warnings; 148 ++m_warnings;
148 } 149 }
149 150
150 return calculatedFrame; 151 return calculatedFrame;
382 383
383 firstEverValue = false; 384 firstEverValue = false;
384 385
385 if (!ok) { 386 if (!ok) {
386 if (warnings < warnLimit) { 387 if (warnings < warnLimit) {
387 cerr << "WARNING: CSVFileReader::load: " 388 SVCERR << "WARNING: CSVFileReader::load: "
388 << "Non-numeric value \"" 389 << "Non-numeric value \""
389 << list[i] 390 << list[i]
390 << "\" in data line " << lineno+1 391 << "\" in data line " << lineno+1
391 << ":" << endl; 392 << ":" << endl;
392 cerr << line << endl; 393 SVCERR << line << endl;
393 ++warnings; 394 ++warnings;
394 } else if (warnings == warnLimit) { 395 } else if (warnings == warnLimit) {
395 // cerr << "WARNING: Too many warnings" << endl; 396 // SVCERR << "WARNING: Too many warnings" << endl;
396 } 397 }
397 } 398 }
398 } 399 }
399 400
400 // SVDEBUG << "Setting bin values for count " << lineno << ", frame " 401 // SVDEBUG << "Setting bin values for count " << lineno << ", frame "
424 425
425 float v = 0.f; 426 float v = 0.f;
426 for (map<int, map<QString, float> >::iterator i = 427 for (map<int, map<QString, float> >::iterator i =
427 countLabelValueMap.end(); i != countLabelValueMap.begin(); ) { 428 countLabelValueMap.end(); i != countLabelValueMap.begin(); ) {
428 --i; 429 --i;
429 cerr << "count -> " << i->first << endl; 430 SVCERR << "count -> " << i->first << endl;
430 for (map<QString, float>::iterator j = i->second.begin(); 431 for (map<QString, float>::iterator j = i->second.begin();
431 j != i->second.end(); ++j) { 432 j != i->second.end(); ++j) {
432 j->second = v; 433 j->second = v;
433 cerr << "label -> " << j->first << ", value " << v << endl; 434 SVCERR << "label -> " << j->first << ", value " << v << endl;
434 v = v + 1.f; 435 v = v + 1.f;
435 } 436 }
436 } 437 }
437 438
438 map<RegionModel::Point, RegionModel::Point, 439 map<RegionModel::Point, RegionModel::Point,
441 model2a->getPoints().begin(); 442 model2a->getPoints().begin();
442 i != model2a->getPoints().end(); ++i) { 443 i != model2a->getPoints().end(); ++i) {
443 RegionModel::Point p(*i); 444 RegionModel::Point p(*i);
444 int count = labelCountMap[p.label]; 445 int count = labelCountMap[p.label];
445 v = countLabelValueMap[count][p.label]; 446 v = countLabelValueMap[count][p.label];
446 cerr << "mapping from label \"" << p.label << "\" (count " << count << ") to value " << v << endl; 447 // SVCERR << "mapping from label \"" << p.label << "\" (count " << count << ") to value " << v << endl;
447 RegionModel::Point pp(p.frame, v, p.duration, p.label); 448 RegionModel::Point pp(p.frame, v, p.duration, p.label);
448 pointMap[p] = pp; 449 pointMap[p] = pp;
449 } 450 }
450 451
451 for (map<RegionModel::Point, RegionModel::Point>::iterator i = 452 for (map<RegionModel::Point, RegionModel::Point>::iterator i =