]> AND Private Git Repository - blast.git/blobdiff - ReferenceBlock.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
started to code clkconvert output gen
[blast.git] / ReferenceBlock.cpp
index 7e697eb1baabb7bb5cf997543abf403a6ae35611..9b3959c052fccde774b6584e5bef6c39bab06de6 100644 (file)
@@ -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();