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 ,
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 ,
84 int * Graph_prof_debug ,
85 ofstream * Graph_fdebug ) ;
87 void MoveInPort( const char * InputParameterName , int toindex ) ;
88 void MoveOutPort( const char * OutputParameterName , int toindex ) ;
90 void DelInPort( const char * InputParameterName ) ;
91 void DelOutPort( const char * OutputParameterName ) ;
93 int IncrDataStreamInPorts() {
94 _DataStreamInPortsNumber++ ;
95 return _DataStreamInPortsNumber ;
97 int DecrDataStreamInPorts() {
98 _DataStreamInPortsNumber-- ;
99 return _DataStreamInPortsNumber ;
101 int IncrDataStreamOutPorts() {
102 _DataStreamOutPortsNumber++ ;
103 return _DataStreamOutPortsNumber ;
105 int DecrDataStreamOutPorts() {
106 _DataStreamOutPortsNumber-- ;
107 return _DataStreamOutPortsNumber ;
109 int DataStreamInPortsNumber() {
110 return _DataStreamInPortsNumber ;
112 int DataStreamOutPortsNumber() {
113 return _DataStreamOutPortsNumber ;
115 void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) {
116 _DataStreamInPortsNumber = aDataStreamInPortsNumber ;
118 void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) {
119 _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ;
121 int HasDataStream() const {
122 return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ;
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] ; } ;
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 ) ;
157 void ListPorts( ostream & , const bool klink = true ) const ;
162 ostream & operator<< (ostream &,const SUPERV::KindOfNode &);