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_InPort.hxx
25 // Author : Jean Rahuel, CEA
29 #ifndef _DATAFLOWBASE_INPORT_HXX
30 #define _DATAFLOWBASE_INPORT_HXX
32 #include "DataFlowBase_Port.hxx"
38 class InPort : public Port {
42 SUPERV::GraphState _PortState ;
44 OutPort * _InitialOutPort ;
45 bool _BranchOfSwitchLinked ; // For Check from Branches to EndOfSwitch links
50 InPort( const char *const * NodeName ,
51 const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
52 const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ,
53 const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ;
55 cdebug << "GraphBase::InPort::~InPort " << PortName() << endl ; } ;
56 virtual void destroy() {
58 _InitialOutPort = NULL ;
59 cdebug << "GraphBase::InPort::destroy " << PortName() << " "
60 << NodeName() << endl ; } ;
62 void PortState( SUPERV::GraphState aPortState ) {
63 // cdebug << pthread_self() << " " << PortName() << " from "
64 // << NodeName() << " SUPERV::GraphState " << _State << " "
65 // << " --> " << aPortState << " _EndSwitchPort "
66 // << IsEndSwitch() << endl ;
67 _PortState = aPortState ; } ;
68 SUPERV::GraphState PortState() { return _PortState ; } ;
70 OutPort * GetOutPort() {
72 OutPort * GetOutPort() const {
74 const StatusOfPort PortStatus() const ;
76 bool IsNotConnected() const ;
77 // bool IsConnected() const ;
78 bool IsPortConnected() const ;
79 bool IsDataConnected() const ;
80 bool IsExternConnected() const ;
82 bool AddOutPort( OutPort * anOutPort ) {
85 _OutPort = anOutPort ;
87 bool ChangeOutPort( OutPort * anOutPort ) ;
88 bool InitialOutPort() {
89 if ( _InitialOutPort ) {
90 _OutPort = _InitialOutPort ;
91 _InitialOutPort = NULL ;
95 bool RemoveOutPort() ;
97 bool BranchOfSwitchLinked( bool aInPortLinked ) {
98 if ( aInPortLinked && _BranchOfSwitchLinked ) {
99 return false ; // Already setted
101 _BranchOfSwitchLinked = aInPortLinked ;
103 bool BranchOfSwitchLinked() {
104 return _BranchOfSwitchLinked ; } ;
106 void StringValue(ostream & f ) const ;
112 ostream & operator<< (ostream &,const GraphBase::InPort &);
114 ostream & operator<< (ostream &,const SUPERV::GraphState &);