X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/43fd94117de66d533ef9e58b2de85daa244da309..2019e5afdaf7fd0ad21607848710348bbc3be256:/ConnectedInterface.cpp?ds=sidebyside diff --git a/ConnectedInterface.cpp b/ConnectedInterface.cpp index 69a484b..948388a 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) : AbstractInterface(_owner, _name, _type, _width, _direction, _purpose) { 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