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

Private GIT Repository
modif in VHDLConverter
[blast.git] / Dispatcher.cpp
index 903518388f1a78828e0fc52b079b471f617c6eeb..a416f956083249311fa4679113c952dbcd40348c 100644 (file)
@@ -84,9 +84,7 @@ void Dispatcher::closeCurrentProject() {
 bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2) {
     
   ConnectedInterface* ref1 = iface1->refInter;
-  ConnectedInterface* ref2 = iface2->refInter;
-  ConnectedInterface* asso1 = (ConnectedInterface*)(iface1->refInter->getAssociatedIface());
-  ConnectedInterface* asso2 = (ConnectedInterface*)(iface2->refInter->getAssociatedIface());
+  ConnectedInterface* ref2 = iface2->refInter;  
   // connect both interface
 
   bool ok1 = false;
@@ -94,26 +92,12 @@ bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2)
 
   // test the ref1->ref2 connection
   if ((ref1->canConnectTo(ref2)) && (ref2->canConnectFrom(ref1))) {
-    ref1->connectTo(ref2);
-    /*
-    ref2->connectFrom(ref1);
-    if ((asso1 != NULL) && (asso2 != NULL)) {
-      asso1->connectTo(asso2);
-      asso2->connectFrom(asso1);
-    }
-    */
+    ref1->connectTo(ref2);    
     ok1 = true;
   }
   // if the frist one did not work, test ref2->ref1
   if ((ok1 == false) && (ref2->canConnectTo(ref1)) && (ref1->canConnectFrom(ref2))) {  
-    ref2->connectTo(ref1);
-    /*
-    ref1->connectFrom(ref2);
-    if ((asso1 != NULL) && (asso2 != NULL)) {
-      asso1->connectFrom(asso2);
-      asso2->connectTo(asso1);
-    }
-    */
+    ref2->connectTo(ref1);    
     ok2 = true;
   }
   if ((ok1 == true) || (ok2 == true)) {
@@ -122,6 +106,7 @@ bool Dispatcher::createConnection(InterfaceItem *iface1, InterfaceItem *iface2)
 
     unselectAllItems();
     params->unsaveModif = true;
+    cout << "created a connection from " << qPrintable(ref1->getName()) << " to " << qPrintable(ref2->getName()) << endl;
     return true;
   }
   return false;
@@ -351,6 +336,18 @@ void Dispatcher::renameInterface(InterfaceItem *item) {
   item->getOwner()->nameChanged();  
 }
 
+void Dispatcher::showPatterns(InterfaceItem *item) {
+  static QString fctName = "Dispatcher::showPatterns()";
+#ifdef DEBUG_FCTNAME
+  cout << "call to " << qPrintable(fctName) << endl;
+#endif
+  ConnectedInterface* iface = AI_TO_CON(item->refInter->getAssociatedIface());
+  foreach(char c, *(iface->getOutputPattern())) {
+    cout << (int)c;
+  }
+  cout << endl;
+}
+
 void Dispatcher::duplicateBoxItem(BoxItem *item){
   static QString fctName = "Dispatcher::duplicateBoxItem()";
 #ifdef DEBUG_FCTNAME
@@ -424,7 +421,7 @@ void Dispatcher::duplicateInterfaceItem(InterfaceItem *item) {
   // creating control interface if needed
   if (refI->getAssociatedIface() != NULL) {
     QString ctlName = cloneIface->getName()+"_enb";
-    ReferenceInterface* ctlIface = new ReferenceInterface(refB,ctlName,"boolean","1",cloneIface->getDirection(), AbstractInterface::Control, 1);
+    ReferenceInterface* ctlIface = new ReferenceInterface(refB,ctlName,cloneIface->getDirection(), AbstractInterface::Control,"boolean","1", AbstractInterface::LittleEndian, 1);
     refB->addInterface(ctlIface);
     if (! ctlIface->setAssociatedIface(cloneIface)) {
       cerr << "Abnormal case while cloning an interface and creating its associated control interface" << endl;
@@ -834,8 +831,7 @@ void Dispatcher::removeBoxItem(BoxItem *item) {
   removeAllBlockConnections(item);
 
   if (item->getRefBlock()->isFunctionalBlock()) {
-    FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());
-    GroupBlock* group = AB_TO_GRP(block->getParent());
+    FunctionalBlock* block = AB_TO_FUN(item->getRefBlock());    
     item->getScene()->removeBoxItem(item);
     params->getGraph()->removeFunctionalBlock(block);
   }