X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/d111eaf49741a0a79d372445f97c314a637e331e..3bbc311e444c1ef9ac66dd6861fb0acb13ddb72a:/ConnectedInterface.cpp diff --git a/ConnectedInterface.cpp b/ConnectedInterface.cpp index 69a484b..c053aad 100644 --- a/ConnectedInterface.cpp +++ b/ConnectedInterface.cpp @@ -25,16 +25,32 @@ void ConnectedInterface::clearConnectedTo() { connectedTo.clear(); } -bool ConnectedInterface::connectTo(ConnectedInterface *iface) { - - if (canConnectTo(iface)) { - connectedTo.append(iface); - return true; +void ConnectedInterface::connectTo(ConnectedInterface *iface) { + + connectedTo.append(iface); + iface->connectedFrom = this; + ConnectedInterface* asso1 = (ConnectedInterface*)associatedIface; + ConnectedInterface* asso2 = (ConnectedInterface*)(iface->associatedIface); + if ((asso1 != NULL) && (asso2 != NULL)) { + asso1->connectedTo.append(asso2); + asso2->connectedFrom = asso1; } +} - return false; +void ConnectedInterface::disconnectTo(ConnectedInterface *iface) { + + connectedTo.removeAll(iface); + iface->connectedFrom = NULL; + ConnectedInterface* asso1 = (ConnectedInterface*)associatedIface; + ConnectedInterface* asso2 = (ConnectedInterface*)(iface->associatedIface); + if ((asso1 != NULL) && (asso2 != NULL)) { + asso1->connectedTo.removeAll(asso2); + asso2->connectedFrom = NULL; + } } + +/* bool ConnectedInterface::connectFrom(ConnectedInterface *iface) { if (canConnectFrom(iface)) { connectedFrom = iface; @@ -42,6 +58,7 @@ bool ConnectedInterface::connectFrom(ConnectedInterface *iface) { } return false; } +*/ /* getConnectionToParentGroup() : if an interface among connectedTo is an interface of the parent group