Salome HOME
Fix for improvement IPAL9815 : Remove "Add Port" functionality as duplicate of "Edit...
[modules/superv.git] / src / GraphBase / DataFlowBase_PortsOfNode.hxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : DataFlowBase_PortsOfNode.hxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 #ifndef _DATAFLOWBASE_PORTSOFNODE_HXX
30 #define _DATAFLOWBASE_PORTSOFNODE_HXX
31
32 #include "DataFlowBase_Service.hxx"
33
34 #include "DataFlowBase_InDataStreamPort.hxx"
35 #include "DataFlowBase_OutDataStreamPort.hxx"
36
37 namespace GraphBase {
38
39   class PortsOfNode : public Service {
40
41     private:
42
43 // Only For getting Ports of InNodes and OutNode
44       map< string , int > _MapOfNodeInPorts ;
45       int _NodeInPortsSize ;
46       vector<InPort *> _NodeInPorts;
47
48       map< string , int > _MapOfNodeOutPorts ;
49       int _NodeOutPortsSize ;
50       vector<OutPort *> _NodeOutPorts;
51
52       int                    _DataStreamInPortsNumber ;
53       int                    _DataStreamOutPortsNumber ;
54
55     public:
56
57       PortsOfNode() ;
58       PortsOfNode( const char *DataFlowName ) ;
59       virtual ~PortsOfNode() ;
60
61       void DefPortsOfNode( CORBA::ORB_ptr ORB ,
62                            const SALOME_ModuleCatalog::Service& NodeService ,
63                            const char *const * NodeName ,
64                            const SUPERV::KindOfNode aKind ,
65                            int * Graph_prof_debug ,
66                            ofstream * Graph_fdebug ) ;
67
68       InPort * AddInPort( CORBA::ORB_ptr ORB ,
69                           const char *const * NodeName ,
70                           const SUPERV::KindOfNode aKind ,
71                           const char * InputParameterName ,
72                           const char * InputParameterType ,
73                           SUPERV::KindOfPort aKindOfPort ,
74                           int index ,
75                           int * Graph_prof_debug ,
76                           ofstream * Graph_fdebug ) ;
77       OutPort * AddOutPort( CORBA::ORB_ptr ORB ,
78                             const char *const * NodeName ,
79                             const SUPERV::KindOfNode aKind ,
80                             const char * OutputParameterName ,
81                             const char * InputParameterType ,
82                             SUPERV::KindOfPort aKindOfPort ,
83                             int index ,
84                             int * Graph_prof_debug ,
85                             ofstream * Graph_fdebug ) ;
86
87       void MoveInPort( const char * InputParameterName , int toindex ) ;
88       void MoveOutPort( const char * OutputParameterName , int toindex ) ;
89
90       void DelInPort( const char * InputParameterName ) ;
91       void DelOutPort( const char * OutputParameterName ) ;
92
93       int IncrDataStreamInPorts() {
94         _DataStreamInPortsNumber++ ;
95         return _DataStreamInPortsNumber ;
96       } ;
97       int DecrDataStreamInPorts() {
98         _DataStreamInPortsNumber-- ;
99         return _DataStreamInPortsNumber ;
100       } ;
101       int IncrDataStreamOutPorts() {
102         _DataStreamOutPortsNumber++ ;
103         return _DataStreamOutPortsNumber ;
104       } ;
105       int DecrDataStreamOutPorts() {
106         _DataStreamOutPortsNumber-- ;
107         return _DataStreamOutPortsNumber ;
108       } ;
109       int DataStreamInPortsNumber() {
110         return _DataStreamInPortsNumber ;
111       } ;
112       int DataStreamOutPortsNumber() {
113         return _DataStreamOutPortsNumber ;
114       } ;
115       void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) {
116         _DataStreamInPortsNumber = aDataStreamInPortsNumber ;
117       } ;
118       void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) {
119         _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ;
120       } ;
121       int HasDataStream() const {
122         return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ;
123       } ;
124
125       const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ;
126       const InPort * GetNodeInLoop() const {
127                    return _NodeInPorts[0] ; } ;
128       const InPort * GetNodeInGate() const {
129                    return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
130       const InPort * GetNodeInPort(int i) const {
131                    return _NodeInPorts[i] ; } ;
132       InPort * GetChangeNodeInLoop() const {
133                    return _NodeInPorts[0] ; } ;
134       InPort * GetChangeNodeInGate() const {
135                    return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
136       InPort * GetChangeNodeInPort(int i) const {
137                    return _NodeInPorts[i] ; } ;
138       const int GetNodeOutPortsSize() const { return _NodeOutPortsSize ; } ;
139       const OutPort * GetNodeOutLoop() const {
140                    return _NodeOutPorts[0] ; } ;
141       const OutPort * GetNodeOutGate() const {
142                    return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
143       const OutPort * GetNodeOutPort(int i) const {
144                    return _NodeOutPorts[i] ; } ;
145       OutPort * GetChangeNodeOutLoop() const {
146                    return _NodeOutPorts[0] ; } ;
147       OutPort * GetChangeNodeOutGate() const {
148                    return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
149       OutPort * GetChangeNodeOutPort(int i) const {
150                    return _NodeOutPorts[i] ; } ;
151
152       const InPort * GetInPort( const char *name ) ;
153       const OutPort * GetOutPort( const char *name ) ;
154       InPort * GetChangeInPort( const char *name ) ;
155       OutPort * GetChangeOutPort( const char *name ) ;
156
157       void ListPorts( ostream & , const bool klink = true ) const ;
158   };
159   
160 };
161
162 ostream & operator<< (ostream &,const SUPERV::KindOfNode &);
163
164 #endif