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