src/GraphBase/DataFlowBase_InPort.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_InPort.hxx
00025 //  Author : Jean Rahuel, CEA
00026 //  Module : SUPERV
00027 //  $Header:
00028 
00029 #ifndef _DATAFLOWBASE_INPORT_HXX
00030 #define _DATAFLOWBASE_INPORT_HXX
00031 
00032 #include "DataFlowBase_Port.hxx"
00033 
00034 namespace GraphBase {
00035 
00036   class OutPort ;
00037 
00038   class InPort : public Port {
00039 
00040     private:
00041 
00042       SUPERV::GraphState   _PortState ;
00043       OutPort *            _OutPort ;
00044       OutPort *            _InitialOutPort ;
00045       bool                 _BranchOfSwitchLinked ; // For Check from Branches to EndOfSwitch links
00046 
00047     public:   
00048 
00049       InPort() ;
00050       InPort( const char *const * NodeName  ,
00051               const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
00052               const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ,
00053               const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ;
00054       virtual ~InPort() {
00055          cdebug << "GraphBase::InPort::~InPort " << PortName() << endl ; } ;
00056       virtual void destroy() {
00057          _OutPort = NULL ;
00058          _InitialOutPort = NULL ;
00059          cdebug << "GraphBase::InPort::destroy " << PortName() << " "
00060                 << NodeName() << endl ; } ;
00061 
00062       void PortState( SUPERV::GraphState aPortState ) {
00063 //           cdebug << pthread_self() << " " << PortName() << " from "
00064 //                  << NodeName() << " SUPERV::GraphState " << _State << " "
00065 //                  << " --> " << aPortState << " _EndSwitchPort "
00066 //                  << IsEndSwitch() << endl ;
00067            _PortState = aPortState ; } ;
00068       SUPERV::GraphState PortState() { return _PortState ; } ;
00069 
00070       OutPort * GetOutPort() {
00071            return _OutPort ; } ;
00072       OutPort * GetOutPort() const {
00073            return _OutPort ; } ;
00074       const StatusOfPort PortStatus() const ;
00075 
00076       bool IsNotConnected() const ;
00077 //      bool IsConnected() const ;
00078       bool IsPortConnected() const ;
00079       bool IsDataConnected() const ;
00080       bool IsExternConnected() const ;
00081 
00082       bool AddOutPort( OutPort * anOutPort ) {
00083            if ( _OutPort )
00084              return false ;
00085            _OutPort = anOutPort ;
00086            return true ; } ;
00087       bool ChangeOutPort( OutPort * anOutPort ) ;
00088       bool InitialOutPort() {
00089            if ( _InitialOutPort ) {
00090              _OutPort = _InitialOutPort ;
00091              _InitialOutPort = NULL ;
00092              return true ;
00093         }
00094            return false ; } ;
00095       bool RemoveOutPort( bool DoRemoveInPort = true ) ;
00096 
00097       bool BranchOfSwitchLinked( bool aInPortLinked ) {
00098            if ( aInPortLinked && _BranchOfSwitchLinked ) {
00099              return false ; // Already setted
00100         }
00101            _BranchOfSwitchLinked = aInPortLinked ;
00102            return true ; } ;
00103       bool BranchOfSwitchLinked() {
00104            return _BranchOfSwitchLinked ; } ;
00105 
00106       void StringValue(ostream & f ) const ;
00107 
00108   } ;
00109 
00110 } ;
00111 
00112 ostream & operator<< (ostream &,const GraphBase::InPort &);
00113 
00114 ostream & operator<< (ostream &,const SUPERV::GraphState &);
00115 
00116 #endif