X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/blast.git/blobdiff_plain/abbc64cf04a35ab3549d5c516f44c7c5921baa63..2019e5afdaf7fd0ad21607848710348bbc3be256:/GroupInterface.cpp?ds=sidebyside diff --git a/GroupInterface.cpp b/GroupInterface.cpp index 14f8b43..ecc6ba7 100644 --- a/GroupInterface.cpp +++ b/GroupInterface.cpp @@ -2,18 +2,9 @@ #include "FunctionalInterface.h" #include "GroupBlock.h" -GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _level) throw(Exception) : ConnectedInterface(_owner,_name,"expression","",_direction,AbstractInterface::Data,_level) { +GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose) throw(Exception) : ConnectedInterface(_owner,_name,"inherited","",_direction,_purpose) { if (! _owner->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE)); - /* If the owner group is the top group, then all its interfaces are at top level => force them to be top. - If not, force them to be basic - */ - if (((GroupBlock*)_owner)->isTop()) { - level = AbstractInterface::Top; - } - else { - level = AbstractInterface::Basic; - } connectedFrom = NULL; } @@ -22,13 +13,8 @@ bool GroupInterface::isGroupInterface() { } AbstractInterface *GroupInterface::clone() { - GroupInterface *inter = new GroupInterface(owner,name,direction,level); - inter->setWidth(width); - inter->setDirection(direction); - inter->setPurpose(purpose); - inter->setLevel(level); - inter->connectFrom(NULL); - + GroupInterface *inter = new GroupInterface(owner,name,direction, purpose); + inter->setWidth(width); return inter; } @@ -50,11 +36,13 @@ 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 + */ if (iface->isReferenceInterface()) return false; - if (iface->getConnectedFrom() != NULL) return false; + ConnectedInterface* connIface = AI_TO_CON(iface); + if (connIface->getConnectedFrom() != NULL) return false; if (this->getOwner() == iface->getOwner()->getParent()) { if ((direction == Input) && (iface->getDirection() == Input)) return true; @@ -69,6 +57,7 @@ bool GroupInterface::canConnectTo(AbstractInterface *iface) { if ((direction == Output) && (iface->getDirection() == Output)) return true; if ((direction == InOut) && (iface->getDirection() == InOut)) return true; } + return false; } @@ -90,6 +79,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; @@ -107,6 +97,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; }