X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..e40a5399ec7887c2606f18575c809b0d05b09278:/ConnectedInterface.cpp diff --git a/ConnectedInterface.cpp b/ConnectedInterface.cpp index fbfa785..3724417 100644 --- a/ConnectedInterface.cpp +++ b/ConnectedInterface.cpp @@ -6,15 +6,27 @@ ConnectedInterface::ConnectedInterface(AbstractBlock* _owner) : AbstractInterface(_owner) { connectedFrom = NULL; + outputPattern = NULL; + inputModifier = 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) { - connectedFrom = NULL; +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; + inputModifier = 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 +37,37 @@ void ConnectedInterface::clearConnectedTo() { connectedTo.clear(); } -bool ConnectedInterface::connectTo(ConnectedInterface *iface) { +void ConnectedInterface::setOutputPattern(QList* pattern) { + if (outputPattern != NULL) delete outputPattern; + outputPattern = pattern; +} - 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 +75,7 @@ bool ConnectedInterface::connectFrom(ConnectedInterface *iface) { } return false; } +*/ /* getConnectionToParentGroup() : if an interface among connectedTo is an interface of the parent group @@ -66,3 +100,8 @@ ConnectedInterface *ConnectedInterface::getConnectionFromParentGroup() { } return NULL; } + +void ConnectedInterface::clearInputModifier() { + if (inputModifier != NULL) delete inputModifier; + inputModifier = NULL; +}