src/GraphBase/DataFlowBase_PortsOfNode.hxx

Go to the documentation of this file.
00001 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
00002 //
00003 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
00005 // 
00006 //  This library is free software; you can redistribute it and/or 
00007 //  modify it under the terms of the GNU Lesser General Public 
00008 //  License as published by the Free Software Foundation; either 
00009 //  version 2.1 of the License. 
00010 // 
00011 //  This library is distributed in the hope that it will be useful, 
00012 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
00013 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
00014 //  Lesser General Public License for more details. 
00015 // 
00016 //  You should have received a copy of the GNU Lesser General Public 
00017 //  License along with this library; if not, write to the Free Software 
00018 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
00019 // 
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 //
00023 //
00024 //  File   : DataFlowBase_PortsOfNode.hxx
00025 //  Author : Jean Rahuel, CEA
00026 //  Module : SUPERV
00027 //  $Header:
00028 
00029 #ifndef _DATAFLOWBASE_PORTSOFNODE_HXX
00030 #define _DATAFLOWBASE_PORTSOFNODE_HXX
00031 
00032 #include "DataFlowBase_Service.hxx"
00033 
00034 #include "DataFlowBase_InDataStreamPort.hxx"
00035 #include "DataFlowBase_OutDataStreamPort.hxx"
00036 
00037 namespace GraphBase {
00038 
00039   class PortsOfNode : public Service {
00040 
00041     private:
00042 
00043 // Only For getting Ports of InNodes and OutNode
00044       map< string , int > _MapOfNodeInPorts ;
00045       int _NodeInPortsSize ;
00046       vector<InPort *> _NodeInPorts;
00047 
00048       map< string , int > _MapOfNodeOutPorts ;
00049       int _NodeOutPortsSize ;
00050       vector<OutPort *> _NodeOutPorts;
00051 
00052       int                    _DataStreamInPortsNumber ;
00053       int                    _DataStreamOutPortsNumber ;
00054 
00055     public:
00056 
00057       PortsOfNode() ;
00058       PortsOfNode( const char *DataFlowName ) ;
00059       virtual ~PortsOfNode() ;
00060 
00061       void DefPortsOfNode( CORBA::ORB_ptr ORB ,
00062                            const SALOME_ModuleCatalog::Service& NodeService ,
00063                            const char *const * NodeName ,
00064                            const SUPERV::KindOfNode aKind ,
00065                            int * Graph_prof_debug ,
00066                            ofstream * Graph_fdebug ) ;
00067 
00068       InPort * AddInPort( CORBA::ORB_ptr ORB ,
00069                           const char *const * NodeName ,
00070                           const SUPERV::KindOfNode aKind ,
00071                           const char * InputParameterName ,
00072                           const char * InputParameterType ,
00073                           SUPERV::KindOfPort aKindOfPort ,
00074                           int index ,
00075                           int * Graph_prof_debug ,
00076                           ofstream * Graph_fdebug ) ;
00077       OutPort * AddOutPort( CORBA::ORB_ptr ORB ,
00078                             const char *const * NodeName ,
00079                             const SUPERV::KindOfNode aKind ,
00080                             const char * OutputParameterName ,
00081                             const char * InputParameterType ,
00082                             SUPERV::KindOfPort aKindOfPort ,
00083                             int index ,
00084                             int * Graph_prof_debug ,
00085                             ofstream * Graph_fdebug ) ;
00086 
00087       void MoveInPort( const char * InputParameterName , int toindex ) ;
00088       void MoveOutPort( const char * OutputParameterName , int toindex ) ;
00089 
00090       void DelInPort( const char * InputParameterName ) ;
00091       void DelOutPort( const char * OutputParameterName ) ;
00092 
00093       int IncrDataStreamInPorts() {
00094         _DataStreamInPortsNumber++ ;
00095      return _DataStreamInPortsNumber ;
00096       } ;
00097       int DecrDataStreamInPorts() {
00098         _DataStreamInPortsNumber-- ;
00099      return _DataStreamInPortsNumber ;
00100       } ;
00101       int IncrDataStreamOutPorts() {
00102         _DataStreamOutPortsNumber++ ;
00103      return _DataStreamOutPortsNumber ;
00104       } ;
00105       int DecrDataStreamOutPorts() {
00106         _DataStreamOutPortsNumber-- ;
00107      return _DataStreamOutPortsNumber ;
00108       } ;
00109       int DataStreamInPortsNumber() {
00110      return _DataStreamInPortsNumber ;
00111       } ;
00112       int DataStreamOutPortsNumber() {
00113      return _DataStreamOutPortsNumber ;
00114       } ;
00115       void DataStreamInPortsNumber( int aDataStreamInPortsNumber ) {
00116      _DataStreamInPortsNumber = aDataStreamInPortsNumber ;
00117       } ;
00118       void DataStreamOutPortsNumber(int aDataStreamOutPortsNumber ) {
00119      _DataStreamOutPortsNumber = aDataStreamOutPortsNumber ;
00120       } ;
00121       int HasDataStream() const {
00122      return _DataStreamInPortsNumber + _DataStreamOutPortsNumber ;
00123       } ;
00124 
00125       const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ;
00126       const InPort * GetNodeInLoop() const {
00127                    return _NodeInPorts[0] ; } ;
00128       const InPort * GetNodeInGate() const {
00129                    return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
00130       const InPort * GetNodeInPort(int i) const {
00131                    return _NodeInPorts[i] ; } ;
00132       InPort * GetChangeNodeInLoop() const {
00133                    return _NodeInPorts[0] ; } ;
00134       InPort * GetChangeNodeInGate() const {
00135                    return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
00136       InPort * GetChangeNodeInPort(int i) const {
00137                    return _NodeInPorts[i] ; } ;
00138       const int GetNodeOutPortsSize() const { return _NodeOutPortsSize ; } ;
00139       const OutPort * GetNodeOutLoop() const {
00140                    return _NodeOutPorts[0] ; } ;
00141       const OutPort * GetNodeOutGate() const {
00142                    return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
00143       const OutPort * GetNodeOutPort(int i) const {
00144                    return _NodeOutPorts[i] ; } ;
00145       OutPort * GetChangeNodeOutLoop() const {
00146                    return _NodeOutPorts[0] ; } ;
00147       OutPort * GetChangeNodeOutGate() const {
00148                    return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
00149       OutPort * GetChangeNodeOutPort(int i) const {
00150                    return _NodeOutPorts[i] ; } ;
00151 
00152       const InPort * GetInPort( const char *name ) ;
00153       const OutPort * GetOutPort( const char *name ) ;
00154       InPort * GetChangeInPort( const char *name ) ;
00155       OutPort * GetChangeOutPort( const char *name ) ;
00156 
00157       void ListPorts( ostream & , const bool klink = true ) const ;
00158   };
00159   
00160 };
00161 
00162 ostream & operator<< (ostream &,const SUPERV::KindOfNode &);
00163 
00164 #endif