Salome HOME
Error Messages
[modules/superv.git] / src / GraphBase / DataFlowBase_InPort.hxx
index e425e486577eba1b0712fe4ed7bfe4f3e5112994..89217ab92de84f71768599827720291c1d53288c 100644 (file)
@@ -1,10 +1,30 @@
-//=============================================================================
-// File      : DataFlowBase_InPort.hxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
+//  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
+//
+//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
+// 
+//  This library is free software; you can redistribute it and/or 
+//  modify it under the terms of the GNU Lesser General Public 
+//  License as published by the Free Software Foundation; either 
+//  version 2.1 of the License. 
+// 
+//  This library is distributed in the hope that it will be useful, 
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
+//  Lesser General Public License for more details. 
+// 
+//  You should have received a copy of the GNU Lesser General Public 
+//  License along with this library; if not, write to the Free Software 
+//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
+// 
+//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+//
+//
+//
+//  File   : DataFlowBase_InPort.hxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
 
 #ifndef _DATAFLOWBASE_INPORT_HXX
 #define _DATAFLOWBASE_INPORT_HXX
@@ -17,21 +37,20 @@ namespace GraphBase {
 
   class InPort : public Port {
 
-    SUPERV::GraphState   _State ;
-    OutPort *            _OutPort ;
-    OutPort *            _InitialOutPort ;
+    private:
+
+      SUPERV::GraphState   _PortState ;
+      OutPort *            _OutPort ;
+      OutPort *            _InitialOutPort ;
+      bool                 _BranchOfSwitchLinked ; // For Check from Branches to EndOfSwitch links
 
     public:   
 
-      InPort() {
-           cout << "InPort()" << endl ;
-           _State = SUPERV::UndefinedState ;
-           _OutPort = NULL ;
-           _InitialOutPort = NULL ;
-      } ;
+      InPort() ;
       InPort( const char *const * NodeName  ,
               const SALOME_ModuleCatalog::ServicesParameter aserviceParameter ,
-              const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ) ;
+              const SUPERV::KindOfPort aKind = SUPERV::ServiceParameter ,
+              const SALOME_ModuleCatalog::DataStreamDependency aDependency = SALOME_ModuleCatalog::DATASTREAM_UNDEFINED ) ;
       virtual ~InPort() {
          cdebug << "GraphBase::InPort::~InPort " << PortName() << endl ; } ;
       virtual void destroy() {
@@ -40,31 +59,32 @@ namespace GraphBase {
          cdebug << "GraphBase::InPort::destroy " << PortName() << " "
                 << NodeName() << endl ; } ;
 
-      void State( SUPERV::GraphState aState ) {
-           cdebug << pthread_self() << " " << PortName() << " from "
-                  << NodeName() << " SUPERV::GraphState " << _State << " "
-                  << " --> " << aState << " _EndSwitchPort "
-                  << IsEndSwitch() << endl ;
-           _State = aState ; } ;
-      SUPERV::GraphState State() { return _State ; } ;
+      void PortState( SUPERV::GraphState aPortState ) {
+//           cdebug << pthread_self() << " " << PortName() << " from "
+//                  << NodeName() << " SUPERV::GraphState " << _State << " "
+//                  << " --> " << aPortState << " _EndSwitchPort "
+//                  << IsEndSwitch() << endl ;
+           _PortState = aPortState ; } ;
+      SUPERV::GraphState PortState() { return _PortState ; } ;
 
       OutPort * GetOutPort() {
            return _OutPort ; } ;
       OutPort * GetOutPort() const {
            return _OutPort ; } ;
-      bool IsConnected() const ;
+      const StatusOfPort PortStatus() const ;
+
+      bool IsNotConnected() const ;
+//      bool IsConnected() const ;
+      bool IsPortConnected() const ;
       bool IsDataConnected() const ;
+      bool IsExternConnected() const ;
+
       bool AddOutPort( OutPort * anOutPort ) {
            if ( _OutPort )
              return false ;
            _OutPort = anOutPort ;
            return true ; } ;
-      bool ChangeOutPort( OutPort * anOutPort ) {
-           if ( _InitialOutPort == NULL ) {
-             _InitialOutPort = _OutPort ;
-          }
-           _OutPort = anOutPort ;
-           return true ; } ;
+      bool ChangeOutPort( OutPort * anOutPort ) ;
       bool InitialOutPort() {
            if ( _InitialOutPort ) {
              _OutPort = _InitialOutPort ;
@@ -72,11 +92,16 @@ namespace GraphBase {
              return true ;
           }
            return false ; } ;
-      bool RemoveOutPort() {
-           if ( _OutPort == NULL )
-             return false ;
-           _OutPort = NULL ;
-           return RemoveCoords() ; } ;
+      bool RemoveOutPort() ;
+
+      bool BranchOfSwitchLinked( bool aInPortLinked ) {
+           if ( aInPortLinked && _BranchOfSwitchLinked ) {
+             return false ; // Already setted
+          }
+           _BranchOfSwitchLinked = aInPortLinked ;
+           return true ; } ;
+      bool BranchOfSwitchLinked() {
+           return _BranchOfSwitchLinked ; } ;
 
       void StringValue(ostream & f ) const ;
 
@@ -86,4 +111,6 @@ namespace GraphBase {
 
 ostream & operator<< (ostream &,const GraphBase::InPort &);
 
+ostream & operator<< (ostream &,const SUPERV::GraphState &);
+
 #endif