X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..df84660fd98b39737692d57b68c8b2c2d34af0f1:/ConnectedInterface.cpp?ds=sidebyside diff --git a/ConnectedInterface.cpp b/ConnectedInterface.cpp index fbfa785..017401a 100644 --- a/ConnectedInterface.cpp +++ b/ConnectedInterface.cpp @@ -6,15 +6,25 @@ ConnectedInterface::ConnectedInterface(AbstractBlock* _owner) : AbstractInterface(_owner) { connectedFrom = NULL; + outputPattern = NULL; + } -ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, const QString& _type, const QString& _width, int _direction, int _purpose, int _level) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose, _level) { +ConnectedInterface::ConnectedInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose, const QString& _type, const QString& _width) : AbstractInterface(_owner, _name, _direction, _purpose, _type, _width) { connectedFrom = NULL; + outputPattern = NULL; } +ConnectedInterface::~ConnectedInterface() { + if (outputPattern != NULL) delete outputPattern; +} + +/* NB/ became useless since disconnectTo does the job + void ConnectedInterface::removeConnectedTo(ConnectedInterface *iface) { - connectedTo.removeOne(iface); + connectedTo.removeAll(iface); } +*/ void ConnectedInterface::clearConnections() { connectedFrom = NULL; @@ -25,16 +35,36 @@ void ConnectedInterface::clearConnectedTo() { connectedTo.clear(); } -bool ConnectedInterface::connectTo(ConnectedInterface *iface) { - - if (canConnectTo(iface)) { - connectedTo.append(iface); - return true; +void ConnectedInterface::setOutputPattern(QList* pattern) { + if (outputPattern != NULL) delete outputPattern; + outputPattern = pattern; +} +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 +72,7 @@ bool ConnectedInterface::connectFrom(ConnectedInterface *iface) { } return false; } +*/ /* getConnectionToParentGroup() : if an interface among connectedTo is an interface of the parent group