]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_OutPort.hxx
Salome HOME
NRI : First integration.
[modules/superv.git] / src / GraphBase / DataFlowBase_OutPort.hxx
1 //=============================================================================
2 // File      : DataFlowBase_OutPort.hxx
3 // Created   : 2002
4 // Author    : Jean Rahuel, CEA
5 // Project   : SALOME
6 // $Header:
7 //=============================================================================
8
9 #ifndef _DATAFLOWBASE_OUTPORT_HXX
10 #define _DATAFLOWBASE_OUTPORT_HXX
11
12 #include "DataFlowBase_DataPort.hxx"
13 #include "DataFlowBase_InPort.hxx"
14
15 namespace GraphBase {
16
17   class OutPort : public DataPort {
18
19     private:
20
21       StatusOfPort _Connected ;
22
23 // Inports connected to this OutPort
24       map< string , int >        _MapOfInPorts ;
25       int                        _InPortsSize ;
26       vector<InPort * >          _InPorts ;
27       vector<SUPERV::Link_var >  _Links ;
28
29     public:   
30
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 ;
36                _InPortsSize = 0 ;
37                Kind( aKind ) ; } ;
38       virtual ~OutPort() {
39          cdebug << "GraphBase::OutPort::~OutPort " << PortName() << endl ; } ;
40       virtual void destroy() {
41          int i ;
42          for ( i = 0 ; i < _InPortsSize ; i++ ) {
43            _MapOfInPorts.erase( _InPorts[ i ]->PortName() ) ;
44 //           _InPorts[ i ]->destroy() ; BUG ...
45            _InPorts[ i ]->RemoveOutPort() ;
46          }
47          _InPorts.resize( 0 ) ;
48          cdebug << "GraphBase::OutPort::destroy " << PortName() << " "
49                 << NodeName() << endl ; } ;
50
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 ) ; } ;
65
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 ] ; } ;
74
75 //      bool RemoveLinks() ;
76
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 ) ;
82
83       bool RemoveInPort( InPort * toPort ) ;
84       bool ReNameInPort( const char* OldNodePortName ,
85                          const char* NewNodePortName ) ;
86
87   } ;
88
89 } ;
90
91 ostream & operator<< (ostream &,const GraphBase::OutPort &);
92
93 #endif