1 //=============================================================================
2 // File : DataFlowBase_OutPort.hxx
4 // Author : Jean Rahuel, CEA
7 //=============================================================================
9 #ifndef _DATAFLOWBASE_OUTPORT_HXX
10 #define _DATAFLOWBASE_OUTPORT_HXX
12 #include "DataFlowBase_DataPort.hxx"
13 #include "DataFlowBase_InPort.hxx"
17 class OutPort : public DataPort {
21 StatusOfPort _Connected ;
23 // Inports connected to this OutPort
24 map< string , int > _MapOfInPorts ;
26 vector<InPort * > _InPorts ;
27 vector<SUPERV::Link_var > _Links ;
31 OutPort( const char *const * NodeName ,
32 const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
33 const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ) :
34 DataPort( NodeName , aserviceParameter ) {
35 _Connected = NotConnected ;
39 cdebug << "GraphBase::OutPort::~OutPort " << PortName() << endl ; } ;
40 virtual void destroy() {
42 for ( i = 0 ; i < _InPortsSize ; i++ ) {
43 _MapOfInPorts.erase( _InPorts[ i ]->PortName() ) ;
44 // _InPorts[ i ]->destroy() ; BUG ...
45 _InPorts[ i ]->RemoveOutPort() ;
47 _InPorts.resize( 0 ) ;
48 cdebug << "GraphBase::OutPort::destroy " << PortName() << " "
49 << NodeName() << endl ; } ;
51 const StatusOfPort PortStatus() const {
52 return _Connected; } ;
53 void PortStatus(StatusOfPort c) { _Connected = c; } ;
54 const bool IsNotConnected() const {
55 return ( _Connected == NotConnected ) ; } ;
56 const bool IsConnected() const {
57 return ( _Connected != NotConnected ) ; } ;
58 const bool IsPortConnected() const {
59 return ( _Connected == PortConnected ||
60 _Connected == PortAndDataConnected ) ; } ;
61 const bool IsPortAndDataConnected() const {
62 return ( _Connected == PortAndDataConnected ) ; } ;
63 const bool IsDataConnected() const {
64 return ( _Connected == DataConnected ) ; } ;
66 const int InPortsSize() const {
67 return _InPortsSize ; } ;
68 const InPort * InPorts( const int i ) const {
69 return _InPorts[ i ] ; } ;
70 InPort * ChangeInPorts( const int i ) {
71 return _InPorts[ i ] ; } ;
72 SUPERV::Link_var LinkObjRef( const int i ) const {
73 return _Links[ i ] ; } ;
75 // bool RemoveLinks() ;
77 bool HasInPort() const ;
78 const InPort * GetInPort( const InPort * toPort ) ;
79 SUPERV::Link_var InPortObjRef( const InPort * toPort ) ;
80 bool AddInPort( InPort * toPort ) ;
81 bool AddInPortObjRef( InPort * toPort , SUPERV::Link_var aLink ) ;
83 bool RemoveInPort( InPort * toPort ) ;
84 bool ReNameInPort( const char* OldNodePortName ,
85 const char* NewNodePortName ) ;
91 ostream & operator<< (ostream &,const GraphBase::OutPort &);