1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #include "OutPort.hxx"
22 #include "ComposedNode.hxx"
25 using namespace YACS::ENGINE;
28 InPort::InPort(const InPort& other, Node *newHelder):
29 DataPort(other,newHelder),Port(other,newHelder)
33 InPort::InPort(const std::string& name, Node *node, TypeCode* type):
34 DataPort(name,node,type),Port(node)
42 //! Returns number of \b physical backlinks \b NOT number of user backlinks.
43 int InPort::edGetNumberOfLinks() const
45 return _backLinks.size();
48 void InPort::edRemoveAllLinksLinkedWithMe() throw(YACS::Exception)
50 set<OutPort *> temp(_backLinks);//edRemoveLink called after causes invalidation of set iterator.
51 for(set<OutPort *>::iterator iter=temp.begin();iter!=temp.end();iter++)
53 set<OutPort *> trueBackOutputs;
54 (*iter)->getAllRepresented(trueBackOutputs);
55 for(set<OutPort *>::iterator iter2=trueBackOutputs.begin();iter2!=trueBackOutputs.end();iter2++)
56 _node->getRootNode()->edRemoveLink(*iter2,this);
62 //! Returns \b physical backlinks \b NOT user backlinks.
63 std::set<OutPort *> InPort::edSetOutPort() const
68 void InPort::edNotifyReferencedBy(OutPort *fromPort)
70 _backLinks.insert(fromPort);
74 void InPort::edNotifyDereferencedBy(OutPort *fromPort)
76 _backLinks.erase(fromPort);
80 void InPort::getAllRepresentants(std::set<InPort *>& repr) const
82 repr.insert((InPort *)this);