1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : DataFlowBase_PortsOfNode.hxx
25 // Author : Jean Rahuel, CEA
29 #ifndef _DATAFLOWBASE_PORTSOFNODE_HXX
30 #define _DATAFLOWBASE_PORTSOFNODE_HXX
32 #include "DataFlowBase_Service.hxx"
34 #include "DataFlowBase_InDataStreamPort.hxx"
35 #include "DataFlowBase_OutDataStreamPort.hxx"
39 class PortsOfNode : public Service {
43 // Only For getting Ports of InNodes and OutNode
44 map< string , int > _MapOfNodeInPorts ;
45 int _NodeInPortsSize ;
46 vector<InPort *> _NodeInPorts;
48 map< string , int > _MapOfNodeOutPorts ;
49 int _NodeOutPortsSize ;
50 vector<OutPort *> _NodeOutPorts;
52 int _DataStreamInPortsNumber ;
53 int _DataStreamOutPortsNumber ;
58 PortsOfNode( const char *DataFlowName ) ;
59 virtual ~PortsOfNode() ;
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 ) ;
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 // const int DataStreamInPortsNumber ,
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 // const int DataStreamOutPortsNumber ,
84 int * Graph_prof_debug ,
85 ofstream * Graph_fdebug ) ;
87 void DelInPort( const char * InputParameterName ) ;
88 void DelOutPort( const char * OutputParameterName ) ;
90 int IncrDataStreamInPorts() {
91 _DataStreamInPortsNumber++ ;
92 return _DataStreamInPortsNumber ;
94 int DecrDataStreamInPorts() {
95 _DataStreamInPortsNumber-- ;
96 return _DataStreamInPortsNumber ;
98 int IncrDataStreamOutPorts() {
99 _DataStreamOutPortsNumber++ ;
100 return _DataStreamOutPortsNumber ;
102 int DecrDataStreamOutPorts() {
103 _DataStreamOutPortsNumber-- ;
104 return _DataStreamOutPortsNumber ;
106 int DataStreamInPortsNumber() {
107 return _DataStreamInPortsNumber ;
109 int DataStreamOutPortsNumber() {
110 return _DataStreamOutPortsNumber ;
112 void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) {
113 _DataStreamInPortsNumber = aDataStreamInPortsNumber ;
115 void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) {
116 _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ;
118 int HasDataStream() const {
119 return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ;
122 const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ;
123 const InPort * GetNodeInLoop() const {
124 return _NodeInPorts[0] ; } ;
125 const InPort * GetNodeInGate() const {
126 return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
127 const InPort * GetNodeInPort(int i) const {
128 return _NodeInPorts[i] ; } ;
129 InPort * GetChangeNodeInLoop() const {
130 return _NodeInPorts[0] ; } ;
131 InPort * GetChangeNodeInGate() const {
132 return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
133 InPort * GetChangeNodeInPort(int i) const {
134 return _NodeInPorts[i] ; } ;
135 const int GetNodeOutPortsSize() const { return _NodeOutPortsSize ; } ;
136 const OutPort * GetNodeOutLoop() const {
137 return _NodeOutPorts[0] ; } ;
138 const OutPort * GetNodeOutGate() const {
139 return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
140 const OutPort * GetNodeOutPort(int i) const {
141 return _NodeOutPorts[i] ; } ;
142 OutPort * GetChangeNodeOutLoop() const {
143 return _NodeOutPorts[0] ; } ;
144 OutPort * GetChangeNodeOutGate() const {
145 return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
146 OutPort * GetChangeNodeOutPort(int i) const {
147 return _NodeOutPorts[i] ; } ;
149 const InPort * GetInPort( const char *name ) ;
150 const OutPort * GetOutPort( const char *name ) ;
151 InPort * GetChangeInPort( const char *name ) ;
152 OutPort * GetChangeOutPort( const char *name ) ;
154 void ListPorts( ostream & , const bool klink = true ) const ;
159 ostream & operator<< (ostream &,const SUPERV::KindOfNode &);