comparison data/model/EditableDenseThreeDimensionalModel.cpp @ 1677:f97d64b8674f single-point

Make XmlExportables store their export IDs and always obtain a new one, avoiding reuse when an object is allocated at the same heap location as a previous one. This makes the ID system stable enough to be used in the export tests.
author Chris Cannam
date Thu, 28 Mar 2019 11:55:02 +0000
parents 48e9f538e6e9
children 0d89abd631ac
comparison
equal deleted inserted replaced
1676:3b51df7695a4 1677:f97d64b8674f
524 QString indent, 524 QString indent,
525 QString extraAttributes) const 525 QString extraAttributes) const
526 { 526 {
527 QReadLocker locker(&m_lock); 527 QReadLocker locker(&m_lock);
528 528
529 // For historical reasons we read and write "resolution" as "windowSize" 529 // For historical reasons we read and write "resolution" as "windowSize".
530
531 // Our dataset doesn't have its own export ID, we just use
532 // ours. Actually any model could do that, since datasets aren't
533 // in the same id-space as models when re-read
530 534
531 SVDEBUG << "EditableDenseThreeDimensionalModel::toXml" << endl; 535 SVDEBUG << "EditableDenseThreeDimensionalModel::toXml" << endl;
532 536
533 Model::toXml 537 Model::toXml
534 (out, indent, 538 (out, indent,
535 QString("type=\"dense\" dimensions=\"3\" windowSize=\"%1\" yBinCount=\"%2\" minimum=\"%3\" maximum=\"%4\" dataset=\"%5\" startFrame=\"%6\" %7") 539 QString("type=\"dense\" dimensions=\"3\" windowSize=\"%1\" yBinCount=\"%2\" minimum=\"%3\" maximum=\"%4\" dataset=\"%5\" startFrame=\"%6\" %7")
536 .arg(m_resolution) 540 .arg(m_resolution)
537 .arg(m_yBinCount) 541 .arg(m_yBinCount)
538 .arg(m_minimum) 542 .arg(m_minimum)
539 .arg(m_maximum) 543 .arg(m_maximum)
540 .arg(getObjectExportId(&m_data)) 544 .arg(getExportId())
541 .arg(m_startFrame) 545 .arg(m_startFrame)
542 .arg(extraAttributes)); 546 .arg(extraAttributes));
543 547
544 out << indent; 548 out << indent;
545 out << QString("<dataset id=\"%1\" dimensions=\"3\" separator=\" \">\n") 549 out << QString("<dataset id=\"%1\" dimensions=\"3\" separator=\" \">\n")
546 .arg(getObjectExportId(&m_data)); 550 .arg(getExportId());
547 551
548 for (int i = 0; i < (int)m_binNames.size(); ++i) { 552 for (int i = 0; i < (int)m_binNames.size(); ++i) {
549 if (m_binNames[i] != "") { 553 if (m_binNames[i] != "") {
550 out << indent + " "; 554 out << indent + " ";
551 out << QString("<bin number=\"%1\" name=\"%2\"/>\n") 555 out << QString("<bin number=\"%1\" name=\"%2\"/>\n")