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

Private GIT Repository
finished conn mode of library
[blast.git] / Parameters.cpp
index c903f5d94be772d400ded37c64e1de0519b211b7..60d7971c07e228dc849b2f7875f652b77a0dc696 100644 (file)
@@ -69,8 +69,8 @@ void Parameters::clear() {
   refPathes.clear();\r
 }\r
 \r
-Graph* Parameters::createGraph() {\r
-  graph = new Graph();\r
+Graph* Parameters::createGraph(bool createTopGroupIfaces) {\r
+  graph = new Graph(createTopGroupIfaces);\r
   return graph;\r
 }\r
 \r
@@ -272,7 +272,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     if(!ok) throw(Exception(PROJECTFILE_CORRUPTED));\r
 \r
     if (idUpperScene == -1) {\r
-      topGroup = dispatcher->createTopScene();\r
+      topGroup = dispatcher->createTopScene(Dispatcher::Load);\r
       topScene->setId(idScene);\r
       groupItem = topScene->getGroupItem();      \r
       cout << "top group added to scene n°" << idScene << endl;\r
@@ -280,7 +280,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     else {\r
       cout << "trying to create scene n°" << idScene << " with upper scene n°" <<idUpperScene << endl;\r
       GroupScene* upperScene = searchSceneById(idUpperScene, topScene);\r
-      groupWidget = dispatcher->addNewEmptyGroup(upperScene,false);\r
+      groupWidget = dispatcher->addNewEmptyGroup(Dispatcher::Load, upperScene,false);\r
       groupWidget->getScene()->setId(idScene);\r
       groupItem = groupWidget->getScene()->getGroupItem();      \r
     }\r
@@ -302,7 +302,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
       cout << qPrintable(groupItem->getRefBlock()->getName()) << " has upper box item in " << qPrintable(groupItem->getParentItem()->getScene()->getGroupItem()->getRefBlock()->getName()) << endl;\r
     }    \r
   }\r
-  dispatcher->setSceneCounter(maxIdScene+1);\r
+  dispatcher->setSceneCounter(Dispatcher::Load, maxIdScene+1);\r
   cout << "groupItems loaded and windows created succefully!" << endl;\r
 \r
   /**********************************************************\r
@@ -457,7 +457,7 @@ GroupWidget *Parameters::loadProject(QDomElement root) throw(Exception) {
     InterfaceItem *iface2 = searchInterfaceItemById(to,topScene);\r
 \r
     if(iface1 != NULL && iface2 != NULL){\r
-      dispatcher->createConnection(iface1,iface2);\r
+      dispatcher->createConnection(Dispatcher::Load, iface1,iface2);\r
     } else {\r
       cout << "interfaces not found, connect canceled!" << endl;\r
     }\r
@@ -836,7 +836,7 @@ void Parameters::loadImplementationsFromXml() throw(Exception) {
       if (compList != "none") {\r
         QStringList compos = compList.split(",");\r
         foreach(QString s, compos) {\r
-          impl->addSource(s);\r
+          impl->addResource(s);\r
         }\r
       }\r
 \r
@@ -949,54 +949,64 @@ void Parameters::loadSources() throw(Exception) {
     cout << "analyzing " << qPrintable(sourcePathes.at(i)) << endl;\r
     QDir dir(sourcePathes.at(i));\r
     QStringList filter;\r
-    filter << "*.vhd";\r
+    filter << "*.vhd" << "*.ngc";\r
     dir.setNameFilters(filter);\r
     QStringList list = dir.entryList();\r
     for(int j=0;j<list.size();j++) {\r
       QString fileName = dir.absolutePath();\r
       fileName.append("/"+list.at(j));\r
 \r
-      cout << "parsing " << qPrintable(fileName) << " ... ";\r
-      QFile srcXML(fileName);\r
-      if (!srcXML.open(QIODevice::ReadOnly)) {\r
-        throw(Exception(IMPLFILE_NOACCESS));\r
+      if (list.at(j).endsWith(".ngc")) {\r
+        QString netName = list.at(j);\r
+        netName.truncate(list.at(j).size() -4);\r
+        cout << "found netlist " << qPrintable(netName) << endl;\r
+        availableResources.append(new ExternalResource(netName,fileName,ExternalResource::Netlist));\r
       }\r
-      QTextStream in(&srcXML);\r
-\r
-      QString line = in.readLine();\r
-      while (!line.isNull()) {\r
-        if (line.contains("package", Qt::CaseInsensitive)) {\r
-          QRegularExpression rxPack("^package (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
-          QRegularExpressionMatch matchPack = rxPack.match(line);\r
-          if (matchPack.hasMatch()) {\r
-            QString packName = matchPack.captured(1);\r
-            cout << "found package " << qPrintable(packName) << endl;\r
-            availableSources.append(new ExternalSource(packName,fileName,ExternalSource::Package));\r
-          }\r
+      else {\r
+        cout << "parsing " << qPrintable(fileName) << " ... ";\r
+        QFile srcXML(fileName);\r
+        if (!srcXML.open(QIODevice::ReadOnly)) {\r
+          throw(Exception(IMPLFILE_NOACCESS));\r
         }\r
-        else if (line.contains("entity", Qt::CaseInsensitive)) {\r
-          QRegularExpression rxEnt("^entity (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
-          QRegularExpressionMatch matchEnt = rxEnt.match(line);\r
-          if (matchEnt.hasMatch()) {\r
-            QString entityName = matchEnt.captured(1);\r
-            cout << "found entity " << qPrintable(entityName) << endl;\r
-            availableSources.append(new ExternalSource(entityName,fileName,ExternalSource::Code));\r
+        QTextStream in(&srcXML);\r
+\r
+        QString line = in.readLine();\r
+        while (!line.isNull()) {\r
+          if (line.contains("package", Qt::CaseInsensitive)) {\r
+            QRegularExpression rxPack("^package (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
+            QRegularExpressionMatch matchPack = rxPack.match(line);\r
+            if (matchPack.hasMatch()) {\r
+              QString packName = matchPack.captured(1);\r
+              cout << "found package " << qPrintable(packName) << endl;\r
+              availableResources.append(new ExternalResource(packName,fileName,ExternalResource::Package));\r
+            }\r
+          }\r
+          else if (line.contains("entity", Qt::CaseInsensitive)) {\r
+            QRegularExpression rxEnt("^entity (.+) is$",QRegularExpression::CaseInsensitiveOption);\r
+            QRegularExpressionMatch matchEnt = rxEnt.match(line);\r
+            if (matchEnt.hasMatch()) {\r
+              QString entityName = matchEnt.captured(1);\r
+              cout << "found entity " << qPrintable(entityName) << endl;\r
+              availableResources.append(new ExternalResource(entityName,fileName,ExternalResource::Code));\r
+            }\r
           }\r
+          line = in.readLine();\r
         }\r
-        line = in.readLine();\r
+        srcXML.close();\r
+        cout << "OK" << endl;\r
       }\r
-      srcXML.close();\r
-      cout << "OK" << endl;\r
-\r
     }\r
   }\r
 }\r
 \r
-ExternalSource* Parameters::searchSourceByName(const QString& name) {\r
-  foreach(ExternalSource* s, availableSources) {\r
-    if (s->getName() == name) return s;\r
+QList<ExternalResource *> Parameters::searchResourceByName(const QString& name) {\r
+  QList<ExternalResource*> listRes;\r
+  foreach(ExternalResource* s, availableResources) {\r
+    if (s->getName() == name) {\r
+      listRes.append(s);\r
+    }\r
   }\r
-  return NULL;\r
+  return listRes;\r
 }\r
 \r
 void Parameters::addAvailableBlock(ReferenceBlock *block) {\r