Salome HOME
Updated copyright comment
[modules/yacs.git] / src / engine / Switch.cxx
index 99e6ba45ae1ca271e3643a563f67b16ca646540f..2085096cbef0ef1685b433238bb3745828e2647b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2006-2016  CEA/DEN, EDF R&D
+// Copyright (C) 2006-2024  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -60,7 +60,7 @@ std::string CollectorSwOutPort::getNameOfTypeOfCurrentInstance() const
   return _className;
 }
 
-void CollectorSwOutPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
+void CollectorSwOutPort::edRemoveAllLinksLinkedWithMe()
 {
   map<int, OutPort *>::iterator pt;
   if(_consumer)
@@ -80,20 +80,21 @@ void CollectorSwOutPort::getAllRepresented(std::set<OutPort *>& represented) con
     ((*pt).second)->getAllRepresented(represented);
 }
 
-bool CollectorSwOutPort::addInPort(InPort *inPort) throw(YACS::Exception)
+bool CollectorSwOutPort::addInPort(InPort *inPort)
 {
+  bool ret = false;
   if(_currentProducer)
     {//a specific link is beeing done
-      bool ret=_currentProducer->addInPort(inPort);
+      ret=_currentProducer->addInPort(inPort);
       _currentProducer=0;
-      return ret;
     }
   else//global links asked
     for(map<int, OutPort *>::iterator iter=_potentialProducers.begin();iter!=_potentialProducers.end();iter++)
-      (*iter).second->addInPort(inPort);
+      ret |= (*iter).second->addInPort(inPort);
+  return ret;
 }
 
-int CollectorSwOutPort::removeInPort(InPort *inPort, bool forward) throw(YACS::Exception)
+int CollectorSwOutPort::removeInPort(InPort *inPort, bool forward)
 {
   if(_currentProducer)
     {
@@ -113,7 +114,10 @@ CollectorSwOutPort::CollectorSwOutPort(Switch *master, InPort *port):OutPort("",
                                                                      Port(master),
                                                                      _consumer(port),_currentProducer(0)
 {
-  _name="Representant_of_"; _name+=master->getName(); _name+="_for_inport_"; _name+=master->getRootNode()->getInPortName(_consumer);
+  _name="Representant_of_";
+  _name+=master->getName();
+  _name+="_for_inport_";
+  _name+=port->getName();
 }
 
 CollectorSwOutPort::CollectorSwOutPort(const CollectorSwOutPort& other, Switch *master):OutPort("",master,other.edGetType()),
@@ -180,7 +184,7 @@ bool CollectorSwOutPort::removePotentialProducerForMaster()
   return _potentialProducers.empty();
 }
 
-bool CollectorSwOutPort::checkManagementOfPort(OutPort *port) throw(YACS::Exception)
+bool CollectorSwOutPort::checkManagementOfPort(OutPort *port)
 {
   for(map<int, OutPort *>::iterator iter=_potentialProducers.begin();iter!=_potentialProducers.end();iter++)
     if((*iter).second==port)
@@ -425,7 +429,7 @@ void Switch::partitionRegardingDPL(const PartDefinition *pd, std::map<ComposedNo
     (*it).second->partitionRegardingDPL(pd,zeMap);
 }
 
-void Switch::edRemoveChild(Node *node) throw(YACS::Exception)
+void Switch::edRemoveChild(Node *node)
 {
   map< int , Node * >::iterator iter=_mapOfNode.begin();
   for(;iter!=_mapOfNode.end();iter++)
@@ -452,7 +456,7 @@ std::list<InputPort *> Switch::getLocalInputPorts() const
   ret.push_back((InputPort *)&_condition);
   return ret;
 }
-OutPort *Switch::getOutPort(const std::string& name) const throw(YACS::Exception)
+OutPort *Switch::getOutPort(const std::string& name) const
 {
   for(map<InPort *, CollectorSwOutPort * >::const_iterator iter=_outPortsCollector.begin();iter!=_outPortsCollector.end();iter++)
     if(name==(*iter).second->getName())
@@ -463,14 +467,14 @@ OutPort *Switch::getOutPort(const std::string& name) const throw(YACS::Exception
   return StaticDefinedComposedNode::getOutPort(name);
 }
 
-InputPort *Switch::getInputPort(const std::string& name) const throw(YACS::Exception)
+InputPort *Switch::getInputPort(const std::string& name) const
 {
   if(name==SELECTOR_INPUTPORT_NAME)
     return (InputPort *)&_condition;
   return StaticDefinedComposedNode::getInputPort(name);
 }
 
-Node *Switch::getChildByShortName(const std::string& name) const throw(YACS::Exception)
+Node *Switch::getChildByShortName(const std::string& name) const
 {
   if(name==DEFAULT_NODE_NAME)
     {
@@ -497,12 +501,12 @@ Node *Switch::edSetDefaultNode(Node *node)
   return edSetNode(ID_FOR_DEFAULT_NODE,node);
 }
 
-Node *Switch::edReleaseDefaultNode() throw(YACS::Exception)
+Node *Switch::edReleaseDefaultNode()
 {
   return edReleaseCase(ID_FOR_DEFAULT_NODE);
 }
 
-Node *Switch::edReleaseCase(int caseId) throw(YACS::Exception)
+Node *Switch::edReleaseCase(int caseId)
 {
   map< int , Node * >::iterator iter=_mapOfNode.find(caseId);
   if(iter==_mapOfNode.end())
@@ -534,7 +538,7 @@ Node *Switch::edGetNode(int caseId)
  *           0 is returned if caseId is a new ID.
  *  \b WARNING : 'node' is held by 'this' after call, whereas returned node is no more held. 
  */
-Node *Switch::edSetNode(int caseId, Node *node) throw(YACS::Exception)
+Node *Switch::edSetNode(int caseId, Node *node)
 {
   if(!node)
     throw Exception("Switch::edSetNode : null node cannot be set as a case in switch node");
@@ -559,6 +563,7 @@ Node *Switch::edSetNode(int caseId, Node *node) throw(YACS::Exception)
           return ret;
         }
     }
+  return 0;
 }
 
 //! Change the case of a node
@@ -625,7 +630,7 @@ list<ProgressWeight> Switch::getProgressWeight() const
   return ret;
 }
 
-bool Switch::edAddChild(Node *node) throw(YACS::Exception)
+bool Switch::edAddChild(Node *node)
 {
   int aCase = getMaxCase() + 1;
   DEBTRACE(aCase);
@@ -682,13 +687,13 @@ void Switch::checkControlDependancy(OutPort *start, InPort *end, bool cross,
   throw Exception("Switch::checkControlDependancy : a link was dectected between 2 cases of a switch. Impossible !");
 }
 
-void Switch::checkNoCyclePassingThrough(Node *node) throw(YACS::Exception)
+void Switch::checkNoCyclePassingThrough(Node *node)
 {
   throw Exception("Switch::checkNoCyclePassingThrough : uncorrect control flow link relative to switch");
 }
 
 void Switch::checkLinkPossibility(OutPort *start, const std::list<ComposedNode *>& pointsOfViewStart,
-                                  InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd) throw(YACS::Exception)
+                                  InPort *end, const std::list<ComposedNode *>& pointsOfViewEnd)
 {
   throw Exception("Switch::checkLinkPossibility : A link between 2 different cases of a same Switch requested -> Impossible");
 }
@@ -710,7 +715,7 @@ void Switch::buildDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *fina
   port.first=newCollector;
 }
 
-void Switch::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
+void Switch::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView)
 {
   map<InPort *, CollectorSwOutPort * >::iterator iter=_outPortsCollector.find(finalTarget);
   if(iter==_outPortsCollector.end())
@@ -724,7 +729,7 @@ void Switch::getDelegateOf(std::pair<OutPort *, OutPort *>& port, InPort *finalT
   port.first=(*iter).second;
 }
 
-void Switch::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView) throw(YACS::Exception)
+void Switch::releaseDelegateOf(OutPort *portDwn, OutPort *portUp, InPort *finalTarget, const std::list<ComposedNode *>& pointsOfView)
 {
   set<OutPort *> repr;
   portDwn->getAllRepresented(repr);
@@ -811,7 +816,7 @@ std::string Switch::getMyQualifiedName(const Node *directSon) const
   return id;
 }
 
-std::string Switch::getCaseId(const Node *node) const throw(YACS::Exception)
+std::string Switch::getCaseId(const Node *node) const
 {
   const char sep='_';
   map<int, Node*>::const_iterator iter;