]> AND Private Git Repository - blast.git/blobdiff - GroupInterface.cpp
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
modifying pattern methods to throw exceptions
[blast.git] / GroupInterface.cpp
index 67577900b5bb85c22261ff96d2d779b430924b25..ecc6ba72ab6e9235ecc830ec16fa962ac8c1bc95 100644 (file)
@@ -2,7 +2,7 @@
 #include "FunctionalInterface.h"
 #include "GroupBlock.h"
 
 #include "FunctionalInterface.h"
 #include "GroupBlock.h"
 
-GroupInterface::GroupInterface(AbstractBlock* _owner, const QString& _name, int _direction, int _purpose) throw(Exception) : ConnectedInterface(_owner,_name,AbstractInterface::Inherited,"",_direction,_purpose) {
+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));
 
   connectedFrom = NULL;
   if (! _owner->isGroupBlock()) throw(Exception(BLOCK_INVALID_TYPE));
 
   connectedFrom = NULL;
@@ -14,9 +14,7 @@ bool GroupInterface::isGroupInterface() {
 
 AbstractInterface *GroupInterface::clone() {
     GroupInterface *inter = new GroupInterface(owner,name,direction, purpose);
 
 AbstractInterface *GroupInterface::clone() {
     GroupInterface *inter = new GroupInterface(owner,name,direction, purpose);
-    inter->setWidth(width);    
-    inter->connectFrom(NULL);
-
+    inter->setWidth(width);        
     return inter;
 }
 
     return inter;
 }
 
@@ -43,7 +41,8 @@ bool GroupInterface::canConnectTo(AbstractInterface *iface) {
 
   */
   if (iface->isReferenceInterface()) return false;
 
   */
   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;
 
   if (this->getOwner() == iface->getOwner()->getParent()) {
     if ((direction == Input) && (iface->getDirection() == Input)) return true;