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

Private GIT Repository
modif in VHDLConverter
[blast.git] / ConnectedInterface.cpp
index 69a484bf764016e681441871e66862caf6d8854d..017401a6409d6e56b1d9a0218f452b77424817b0 100644 (file)
@@ -6,15 +6,25 @@
 \r
 ConnectedInterface::ConnectedInterface(AbstractBlock* _owner) : AbstractInterface(_owner) {\r
   connectedFrom = NULL;\r
 \r
 ConnectedInterface::ConnectedInterface(AbstractBlock* _owner) : AbstractInterface(_owner) {\r
   connectedFrom = NULL;\r
+  outputPattern = NULL;\r
+      \r
 }\r
 \r
 }\r
 \r
-ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) {\r
+ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width) : AbstractInterface(_owner, _name, _direction, _purpose, _type, _width) {\r
   connectedFrom = NULL;\r
   connectedFrom = NULL;\r
+  outputPattern = NULL;\r
 }\r
 \r
 }\r
 \r
+ConnectedInterface::~ConnectedInterface() {\r
+  if (outputPattern != NULL) delete outputPattern;\r
+}\r
+\r
+/* NB/ became useless since disconnectTo does the job\r
\r
 void ConnectedInterface::removeConnectedTo(ConnectedInterface *iface) {\r
 void ConnectedInterface::removeConnectedTo(ConnectedInterface *iface) {\r
-  connectedTo.removeOne(iface);\r
+  connectedTo.removeAll(iface);\r
 }\r
 }\r
+*/\r
 \r
 void ConnectedInterface::clearConnections() {\r
   connectedFrom = NULL;\r
 \r
 void ConnectedInterface::clearConnections() {\r
   connectedFrom = NULL;\r
@@ -25,16 +35,36 @@ void ConnectedInterface::clearConnectedTo() {
   connectedTo.clear();\r
 }\r
 \r
   connectedTo.clear();\r
 }\r
 \r
-bool ConnectedInterface::connectTo(ConnectedInterface *iface) {\r
-\r
-  if (canConnectTo(iface)) {\r
-    connectedTo.append(iface);\r
-    return true;\r
+void ConnectedInterface::setOutputPattern(QList<char>* pattern) {\r
+  if (outputPattern != NULL) delete outputPattern;\r
+  outputPattern = pattern; \r
+}\r
+void ConnectedInterface::connectTo(ConnectedInterface *iface) {\r
+  \r
+  connectedTo.append(iface);\r
+  iface->connectedFrom = this;\r
+  ConnectedInterface* asso1 = (ConnectedInterface*)associatedIface;\r
+  ConnectedInterface* asso2 = (ConnectedInterface*)(iface->associatedIface);\r
+  if ((asso1 != NULL) && (asso2 != NULL)) {\r
+    asso1->connectedTo.append(asso2);\r
+    asso2->connectedFrom = asso1;\r
   }\r
   }\r
+}\r
 \r
 \r
-  return false;\r
+void ConnectedInterface::disconnectTo(ConnectedInterface *iface) {\r
+  \r
+  connectedTo.removeAll(iface);\r
+  iface->connectedFrom = NULL;\r
+  ConnectedInterface* asso1 = (ConnectedInterface*)associatedIface;\r
+  ConnectedInterface* asso2 = (ConnectedInterface*)(iface->associatedIface);\r
+  if ((asso1 != NULL) && (asso2 != NULL)) {\r
+    asso1->connectedTo.removeAll(asso2);\r
+    asso2->connectedFrom = NULL;\r
+  }\r
 }\r
 \r
 }\r
 \r
+\r
+/*\r
 bool ConnectedInterface::connectFrom(ConnectedInterface *iface) {\r
   if (canConnectFrom(iface)) {\r
     connectedFrom = iface;\r
 bool ConnectedInterface::connectFrom(ConnectedInterface *iface) {\r
   if (canConnectFrom(iface)) {\r
     connectedFrom = iface;\r
@@ -42,6 +72,7 @@ bool ConnectedInterface::connectFrom(ConnectedInterface *iface) {
   }\r
   return false;\r
 }\r
   }\r
   return false;\r
 }\r
+*/\r
 \r
 /* getConnectionToParentGroup() :\r
    if an interface among connectedTo is an interface of the parent group\r
 \r
 /* getConnectionToParentGroup() :\r
    if an interface among connectedTo is an interface of the parent group\r