X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/43fd94117de66d533ef9e58b2de85daa244da309..d111eaf49741a0a79d372445f97c314a637e331e:/GroupInterface.cpp diff --git a/GroupInterface.cpp b/GroupInterface.cpp index 1c10bff..6757790 100644 --- a/GroupInterface.cpp +++ b/GroupInterface.cpp @@ -2,7 +2,7 @@ #include "FunctionalInterface.h" #include "GroupBlock.h" -GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction) throw(Exception) : ConnectedInterface(_owner,_name,"expression","",_direction,AbstractInterface::Data) { +GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose) throw(Exception) : ConnectedInterface(_owner,_name,AbstractInterface::Inherited,"",_direction,_purpose) { if (! _owner->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE)); connectedFrom = NULL; @@ -13,10 +13,8 @@ bool GroupInterface::isGroupInterface() { } AbstractInterface *GroupInterface::clone() { - GroupInterface *inter = new GroupInterface(owner,name,direction); - inter->setWidth(width); - inter->setDirection(direction); - inter->setPurpose(purpose); + GroupInterface *inter = new GroupInterface(owner,name,direction, purpose); + inter->setWidth(width); inter->connectFrom(NULL); return inter; @@ -40,6 +38,7 @@ bool GroupInterface::canConnectTo(AbstractInterface *iface) { 3 - this is owned by a group and iface by its parent group 2.1 - this is an output, iface is an output of the group 2.2 - both are inout + */ @@ -59,6 +58,7 @@ bool GroupInterface::canConnectTo(AbstractInterface *iface) { if ((direction == Output) && (iface->getDirection() == Output)) return true; if ((direction == InOut) && (iface->getDirection() == InOut)) return true; } + return false; } @@ -80,6 +80,7 @@ bool GroupInterface::canConnectFrom(AbstractInterface *iface) { 3 - this is owned by a group and iface by its parent group 2.1 - this is an input, iface is an input of the group 2.2 - both are inout + 4 - this is owned by top group and iface is an output of a source block */ if (iface->isReferenceInterface()) return false; if (getConnectedFrom() != NULL) return false; @@ -97,6 +98,9 @@ bool GroupInterface::canConnectFrom(AbstractInterface *iface) { if ((direction == Input) && (iface->getDirection() == Input)) return true; if ((direction == InOut) && (iface->getDirection() == InOut)) return true; } + else if ((getOwner()->isTopGroupBlock()) && (iface->getOwner()->isSourceBlock())) { + if ((direction == Input) && (iface->getDirection() == Output)) return true; + } return false; }