Salome HOME
1b0a935457a1da10a12fc41e5b1e77adbde790db
[modules/yacs.git] / src / engine / OutputPort.hxx
1 // Copyright (C) 2006-2020  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, or (at your option) any later version.
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
20 #ifndef __OUTPUTPORT_HXX__
21 #define __OUTPUTPORT_HXX__
22
23 #include "YACSlibEngineExport.hxx"
24 #include "OutPort.hxx"
25 #include "DataFlowPort.hxx"
26 #include "ConversionException.hxx"
27
28 #include <set>
29
30 namespace YACS
31 {
32   namespace ENGINE
33   {
34     class InPort;
35     class Runtime;
36     class InputPort;
37     class InPropertyPort;
38     class OptimizerLoop;
39     class ElementaryNode;
40     class CollectorSwOutputPort;
41
42     class YACSLIBENGINE_EXPORT OutputPort : public DataFlowPort, public OutPort
43     {
44       friend class CollectorSwOutputPort; // for conect
45       friend class ElementaryNode;        // for disconnect...
46       friend class OptimizerLoop;         // for interceptors
47       friend class InputPort;
48       friend class Runtime;               // for port creation
49       friend class ForLoop;               // for port creation
50     public:
51       virtual ~OutputPort();
52       std::set<InPort *> edSetInPort() const;
53       bool isAlreadyLinkedWith(InPort *withp) const;
54       bool isAlreadyInSet(InputPort *inputPort) const;
55       bool isConnected() const;
56       std::string getNameOfTypeOfCurrentInstance() const;
57       int removeInPort(InPort *inPort, bool forward) ;
58       virtual bool edAddInputPort(InputPort *phyPort) ;
59       virtual bool edAddInPropertyPort(InPropertyPort *phyPort) ;
60       virtual int edRemoveInputPort(InputPort *inputPort, bool forward) ;
61       bool addInPort(InPort *inPort) ;
62       void edRemoveAllLinksLinkedWithMe() ;//entry point for forward port deletion
63       virtual void exInit();
64       virtual void checkBasicConsistency() const ;
65       virtual OutputPort *clone(Node *newHelder) const = 0;
66       virtual std::string dump();
67
68       virtual void put(const void *data);
69       virtual std::string typeName() {return "YACS__ENGINE__OutputPort";}
70
71     protected:
72       OutputPort(const OutputPort& other, Node *newHelder);
73       OutputPort(const std::string& name, Node *node, TypeCode* type);
74     protected:
75       const std::set<InputPort *>& getSetOfPhyLinks() const;
76     protected:
77       std::set<InputPort *> _setOfInputPort;//Key is for physical Data link
78     public:
79       static const char NAME[];
80     };
81   }
82 }
83
84 #endif