Salome HOME
d17dd513ef753d6be2a35b943314b04eada7bdd8
[modules/yacs.git] / src / engine / OutputPort.hxx
1 //  Copyright (C) 2006-2008  CEA/DEN, EDF R&D
2 //
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.
7 //
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.
12 //
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
16 //
17 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef __OUTPUTPORT_HXX__
20 #define __OUTPUTPORT_HXX__
21
22 #include "OutPort.hxx"
23 #include "DataFlowPort.hxx"
24 #include "ConversionException.hxx"
25
26 #include <set>
27
28 namespace YACS
29 {
30   namespace ENGINE
31   {
32     class InPort;
33     class Runtime;
34     class InputPort;
35     class OptimizerLoop;
36     class ElementaryNode;
37     class CollectorSwOutputPort;
38
39     class OutputPort : public DataFlowPort, public OutPort
40     {
41       friend class CollectorSwOutputPort; // for conect
42       friend class ElementaryNode;        // for disconnect...
43       friend class OptimizerLoop;         // for interceptors
44       friend class InputPort;
45       friend class Runtime;               // for port creation
46     public:
47       virtual ~OutputPort();
48       std::set<InPort *> edSetInPort() const;
49       bool isAlreadyLinkedWith(InPort *with) const;
50       bool isAlreadyInSet(InputPort *inputPort) const;
51       std::string getNameOfTypeOfCurrentInstance() const;
52       int removeInPort(InPort *inPort, bool forward) throw(Exception);
53       virtual bool edAddInputPort(InputPort *phyPort) throw(Exception);
54       virtual int edRemoveInputPort(InputPort *inputPort, bool forward) throw(Exception);
55       bool addInPort(InPort *inPort) throw(Exception);
56       void edRemoveAllLinksLinkedWithMe() throw(Exception);//entry point for forward port deletion
57       virtual void exInit();
58       virtual void checkBasicConsistency() const throw(Exception);
59       virtual OutputPort *clone(Node *newHelder) const = 0;
60       virtual std::string dump();
61
62       virtual void put(const void *data) throw(ConversionException);
63       virtual std::string typeName() {return "YACS__ENGINE__OutputPort";}
64
65     protected:
66       OutputPort(const OutputPort& other, Node *newHelder);
67       OutputPort(const std::string& name, Node *node, TypeCode* type);
68     protected:
69       const std::set<InputPort *>& getSetOfPhyLinks() const;
70     protected:
71       std::set<InputPort *> _setOfInputPort;//Key is for physical Data link
72     public:
73       static const char NAME[];
74     };
75   }
76 }
77
78 #endif