Salome HOME
Update copyright information
[modules/superv.git] / src / GraphBase / DataFlowBase_PortsOfNode.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
23 //  File   : DataFlowBase_PortsOfNode.hxx
24 //  Author : Jean Rahuel, CEA
25 //  Module : SUPERV
26 //  $Header:
27 //
28 #ifndef _DATAFLOWBASE_PORTSOFNODE_HXX
29 #define _DATAFLOWBASE_PORTSOFNODE_HXX
30
31 #include "DataFlowBase_Service.hxx"
32
33 #include "DataFlowBase_InDataStreamPort.hxx"
34 #include "DataFlowBase_OutDataStreamPort.hxx"
35
36 namespace GraphBase {
37
38   class PortsOfNode : public Service {
39
40     private:
41
42 // Only For getting Ports of InNodes and OutNode
43       map< string , int > _MapOfNodeInPorts ;
44       int _NodeInPortsSize ;
45       vector<InPort *> _NodeInPorts;
46
47       map< string , int > _MapOfNodeOutPorts ;
48       int _NodeOutPortsSize ;
49       vector<OutPort *> _NodeOutPorts;
50
51       int                    _DataStreamInPortsNumber ;
52       int                    _DataStreamOutPortsNumber ;
53
54     public:
55
56       PortsOfNode() ;
57       PortsOfNode( const char *DataFlowName ) ;
58       virtual ~PortsOfNode() ;
59
60       void DefPortsOfNode( CORBA::ORB_ptr ORB ,
61                            const SALOME_ModuleCatalog::Service& NodeService ,
62                            const char *const * NodeName ,
63                            const SUPERV::KindOfNode aKind ,
64                            int * Graph_prof_debug ,
65                            ofstream * Graph_fdebug ) ;
66
67       InPort * AddInPort( CORBA::ORB_ptr ORB ,
68                           const char *const * NodeName ,
69                           const SUPERV::KindOfNode aKind ,
70                           const char * InputParameterName ,
71                           const char * InputParameterType ,
72                           SUPERV::KindOfPort aKindOfPort ,
73                           int index ,
74                           int * Graph_prof_debug ,
75                           ofstream * Graph_fdebug ) ;
76       OutPort * AddOutPort( CORBA::ORB_ptr ORB ,
77                             const char *const * NodeName ,
78                             const SUPERV::KindOfNode aKind ,
79                             const char * OutputParameterName ,
80                             const char * InputParameterType ,
81                             SUPERV::KindOfPort aKindOfPort ,
82                             int index ,
83                             int * Graph_prof_debug ,
84                             ofstream * Graph_fdebug ) ;
85
86       void MoveInPort( const char * InputParameterName , int toindex ) ;
87       void MoveOutPort( const char * OutputParameterName , int toindex ) ;
88
89       void DelInPort( const char * InputParameterName ) ;
90       void DelOutPort( const char * OutputParameterName ) ;
91
92       int IncrDataStreamInPorts() {
93         _DataStreamInPortsNumber++ ;
94         return _DataStreamInPortsNumber ;
95       } ;
96       int DecrDataStreamInPorts() {
97         _DataStreamInPortsNumber-- ;
98         return _DataStreamInPortsNumber ;
99       } ;
100       int IncrDataStreamOutPorts() {
101         _DataStreamOutPortsNumber++ ;
102         return _DataStreamOutPortsNumber ;
103       } ;
104       int DecrDataStreamOutPorts() {
105         _DataStreamOutPortsNumber-- ;
106         return _DataStreamOutPortsNumber ;
107       } ;
108       int DataStreamInPortsNumber() {
109         return _DataStreamInPortsNumber ;
110       } ;
111       int DataStreamOutPortsNumber() {
112         return _DataStreamOutPortsNumber ;
113       } ;
114       void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) {
115         _DataStreamInPortsNumber = aDataStreamInPortsNumber ;
116       } ;
117       void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) {
118         _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ;
119       } ;
120       int HasDataStream() const {
121         return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ;
122       } ;
123
124       const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ;
125       const InPort * GetNodeInLoop() const {
126                    return _NodeInPorts[0] ; } ;
127       const InPort * GetNodeInGate() const {
128                    return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
129       const InPort * GetNodeInPort(int i) const {
130                    return _NodeInPorts[i] ; } ;
131       InPort * GetChangeNodeInLoop() const {
132                    return _NodeInPorts[0] ; } ;
133       InPort * GetChangeNodeInGate() const {
134                    return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
135       InPort * GetChangeNodeInPort(int i) const {
136                    return _NodeInPorts[i] ; } ;
137       const int GetNodeOutPortsSize() const { return _NodeOutPortsSize ; } ;
138       const OutPort * GetNodeOutLoop() const {
139                    return _NodeOutPorts[0] ; } ;
140       const OutPort * GetNodeOutGate() const {
141                    return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
142       const OutPort * GetNodeOutPort(int i) const {
143                    return _NodeOutPorts[i] ; } ;
144       OutPort * GetChangeNodeOutLoop() const {
145                    return _NodeOutPorts[0] ; } ;
146       OutPort * GetChangeNodeOutGate() const {
147                    return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
148       OutPort * GetChangeNodeOutPort(int i) const {
149                    return _NodeOutPorts[i] ; } ;
150
151       const InPort * GetInPort( const char *name ) ;
152       const OutPort * GetOutPort( const char *name ) ;
153       InPort * GetChangeInPort( const char *name ) ;
154       OutPort * GetChangeOutPort( const char *name ) ;
155
156       void ListPorts( ostream & , const bool klink = true ) const ;
157   };
158   
159 };
160
161 ostream & operator<< (ostream &,const SUPERV::KindOfNode &);
162
163 #endif