]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_InPort.hxx
Salome HOME
DCQ:prepare 2.0.0
[modules/superv.git] / src / GraphBase / DataFlowBase_InPort.hxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : DataFlowBase_InPort.hxx
25 //  Author : Jean Rahuel, CEA
26 //  Module : SUPERV
27 //  $Header:
28
29 #ifndef _DATAFLOWBASE_INPORT_HXX
30 #define _DATAFLOWBASE_INPORT_HXX
31
32 #include "DataFlowBase_Port.hxx"
33
34 namespace GraphBase {
35
36   class OutPort ;
37
38   class InPort : public Port {
39
40     private:
41
42       SUPERV::GraphState   _State ;
43       OutPort *            _OutPort ;
44       OutPort *            _InitialOutPort ;
45
46     public:   
47
48       InPort() ;
49       InPort( const char *const * NodeName  ,
50               const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
51               const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ,
52               const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ;
53       virtual ~InPort() {
54          cdebug << "GraphBase::InPort::~InPort " << PortName() << endl ; } ;
55       virtual void destroy() {
56          _OutPort = NULL ;
57          _InitialOutPort = NULL ;
58          cdebug << "GraphBase::InPort::destroy " << PortName() << " "
59                 << NodeName() << endl ; } ;
60
61       void State( SUPERV::GraphState aState ) {
62 //           cdebug << pthread_self() << " " << PortName() << " from "
63 //                  << NodeName() << " SUPERV::GraphState " << _State << " "
64 //                  << " --> " << aState << " _EndSwitchPort "
65 //                  << IsEndSwitch() << endl ;
66            _State = aState ; } ;
67       SUPERV::GraphState State() { return _State ; } ;
68
69       OutPort * GetOutPort() {
70            return _OutPort ; } ;
71       OutPort * GetOutPort() const {
72            return _OutPort ; } ;
73       const StatusOfPort PortStatus() const ;
74       bool IsNotConnected() const ;
75 //      bool IsConnected() const ;
76       bool IsPortConnected() const ;
77       bool IsDataConnected() const ;
78       bool IsExternConnected() const ;
79       bool AddOutPort( OutPort * anOutPort ) {
80            if ( _OutPort )
81              return false ;
82            _OutPort = anOutPort ;
83            return true ; } ;
84       bool ChangeOutPort( OutPort * anOutPort ) {
85            if ( _InitialOutPort == NULL ) {
86              _InitialOutPort = _OutPort ;
87            }
88            _OutPort = anOutPort ;
89            return true ; } ;
90       bool InitialOutPort() {
91            if ( _InitialOutPort ) {
92              _OutPort = _InitialOutPort ;
93              _InitialOutPort = NULL ;
94              return true ;
95            }
96            return false ; } ;
97       bool RemoveOutPort() ;
98
99       void StringValue(ostream & f ) const ;
100
101   } ;
102
103 } ;
104
105 ostream & operator<< (ostream &,const GraphBase::InPort &);
106
107 ostream & operator<< (ostream &,const SUPERV::GraphState &);
108
109 #endif