X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/6a0ffdb10d7344d99e04c5518fca2b8295df94be..3fb762e7042d9b4a1cf78556ad9ed7f117cc53ba:/ReferenceBlock.cpp diff --git a/ReferenceBlock.cpp b/ReferenceBlock.cpp index 7e697eb..9b3959c 100644 --- a/ReferenceBlock.cpp +++ b/ReferenceBlock.cpp @@ -9,21 +9,16 @@ #include "Parameters.h" ReferenceBlock::ReferenceBlock(const QString _xmlFile) : AbstractBlock() { - xmlFile = _xmlFile; + xmlFile = _xmlFile; } void ReferenceBlock::addCategory(int id) { categories.append(id); } -void ReferenceBlock::setBriefDescription(const QString& str) { +void ReferenceBlock::setDescription(const QString& str) { if(str != NULL) - descriptionBrief = str; -} - -void ReferenceBlock::setDetailedDescription(const QString& str) { - if(str != NULL) - descriptionDetail = str; + description = str; } void ReferenceBlock::addImplementation(BlockImplementation *impl) { @@ -45,6 +40,16 @@ void ReferenceBlock::setHashMd5() { void ReferenceBlock::load(QDomElement &elt) throw(Exception) { + cout << "Block : get version" << endl; + QString verStr = elt.attribute("version","none"); + QString specialStr = elt.attribute("special","none"); + if (verStr != "none") { + setVersion(verStr); + } + else { + setVersion("0.0"); + } + setSpecialType(getSpecialTypeFromString(specialStr)); cout << "Block : get informations" << endl; QDomElement eltInfo = elt.firstChildElement("informations"); @@ -120,28 +125,16 @@ void ReferenceBlock::loadInformations(QDomElement &elt) throw(Exception) { // getting description cout << "Block info : get description" << endl; QDomElement eltDesc = eltCat.nextSiblingElement("description"); - // getting brief - QDomElement eltBrief = eltDesc.firstChildElement("brief"); - QDomNode nodeBriefTxt = eltBrief.firstChild(); - if (nodeBriefTxt.isNull()) { - descriptionBrief = "no brief description"; + // getting text + QDomNode nodeTxt = eltDesc.firstChild(); + if (nodeTxt.isNull()) { + description = "no description"; } else { - QDomText txtBrief = nodeBriefTxt.toText(); - descriptionBrief = txtBrief.data().trimmed(); - cout << "block brief desc : " << qPrintable(descriptionBrief) << endl; - } - // getting detailed - QDomElement eltDetail = eltBrief.nextSiblingElement("detailed"); - QDomNode nodeDetailTxt = eltDetail.firstChild(); - if (nodeDetailTxt.isNull()) { - descriptionDetail = "no detailed description"; - } - else { - QDomText txtDetail = nodeDetailTxt.toText(); - descriptionDetail = txtDetail.data().trimmed(); - cout << "block detail desc : " << qPrintable(descriptionDetail) << endl; - } + QDomText txtBrief = nodeTxt.toText(); + description = txtBrief.data().trimmed(); + cout << "block desc : " << qPrintable(description) << endl; + } } void ReferenceBlock::loadParameters(QDomElement &elt) throw(Exception) { @@ -436,8 +429,9 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << b.name; toWrite << b.xmlFile; - toWrite << b.descriptionBrief; - toWrite << b.descriptionDetail; + toWrite << b.specialType; + toWrite << b.version; + toWrite << b.description; toWrite << b.categories; toWrite << b.hashMd5; toWrite << b.params.size(); @@ -473,7 +467,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); toWrite << iface->getClockIfaceType(); - toWrite << iface->getClockIface(); + toWrite << iface->getClockIfaceString(); } } // secondly write control ifaces @@ -487,7 +481,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); toWrite << iface->getClockIfaceType(); - toWrite << iface->getClockIface(); + toWrite << iface->getClockIfaceString(); } } // secondly, write other ifaces @@ -501,7 +495,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); toWrite << iface->getClockIfaceType(); - toWrite << iface->getClockIface(); + toWrite << iface->getClockIfaceString(); } } toWrite << b.outputs.size(); @@ -516,7 +510,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); toWrite << iface->getClockIfaceType(); - toWrite << iface->getClockIface(); + toWrite << iface->getClockIfaceString(); } } // secondly, write other ifaces @@ -530,7 +524,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); toWrite << iface->getClockIfaceType(); - toWrite << iface->getClockIface(); + toWrite << iface->getClockIfaceString(); } } toWrite << b.bidirs.size(); @@ -543,7 +537,7 @@ QDataStream& operator<<(QDataStream &out, const ReferenceBlock &b) { toWrite << iface->getDirection(); toWrite << iface->getMultiplicity(); toWrite << iface->getClockIfaceType(); - toWrite << iface->getClockIface(); + toWrite << iface->getClockIfaceString(); } out << blockData; @@ -565,8 +559,9 @@ QDataStream& operator>>(QDataStream &in, ReferenceBlock &b) { in >> b.name; in >> b.xmlFile; - in >> b.descriptionBrief; - in >> b.descriptionDetail; + in >> b.specialType; + in >> b.version; + in >> b.description; in >> b.categories; in >> b.hashMd5; b.params.clear();