Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/superv.git] / src / GraphBase / DataFlowBase_ComputingNode.hxx
index 65e38489bdb0521f54fadaa42bec6634042725b5..981989bd9eb5f4a44068ae89f6969d7e6b750e8c 100644 (file)
@@ -1,13 +1,27 @@
 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
 //
-//  Copyright (C) 2003  CEA/DEN, EDF R&D
-//
-//
+//  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.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 //  File   : DataFlowBase_ComputingNode.hxx
 //  Author : Jean Rahuel, CEA
 //  Module : SUPERV
-//  $Header:
 
 #ifndef _DATAFLOWBASE_COMPUTINGNODE_HXX
 #define _DATAFLOWBASE_COMPUTINGNODE_HXX
 
 #include "DataFlowBase_StreamNode.hxx"
 
+class CNode_Impl ;
+
 namespace GraphBase {
 
   class Graph ;
 
   class InLineNode ;
 
+  class LoopNode ;
+  class EndOfLoopNode ;
+  class EndOfSwitchNode ;
+
   class ComputingNode : public StreamNode {
 
     private:
@@ -30,7 +50,8 @@ namespace GraphBase {
       SALOME_NamingService * _NamingService ;
 //->StreamNode      int                  * _Graph_prof_debug ;
 //->StreamNode      ofstream             * _Graph_fdebug ;
-      SUPERV::CNode_var      _Node ;
+      SUPERV::CNode_var      _Node_var ;
+      CNode_Impl           * _Node_Impl ;
       void                 * _InNode ; // From GraphExecutor:: or GraphEditor::
       bool                   _ObjInterface ;
 
@@ -117,8 +138,8 @@ namespace GraphBase {
 //                       }
 //                     }
 //                        cdebug << _NodeName << " " << Name() << endl ;
-                        return _Node ; } ;
-      void SetObjRef(SUPERV::CNode_var aNode) {
+                         return _Node_var ; } ;
+      void SetObjRef( SUPERV::CNode_var aNode_var ) {
 //                        char * _NodeName ;
 //                        if ( CORBA::is_nil( _Node ) ) {
 //                          _NodeName = "NilRef" ;
@@ -128,9 +149,14 @@ namespace GraphBase {
 //                     }
 //                        cdebug << "ComputingNode::SetObjRef( " << _Node << " "
 //                               << _NodeName << " ) " << Name() << " --> " ;
-                        _Node = aNode ;
+                        _Node_var = aNode_var ;
 //                        cdebug << _Node << " " << _Node->Name() << " ) " << Name() << endl ;
                         } ;
+
+      CNode_Impl * ObjImpl() const { return _Node_Impl ; } ;
+      void SetObjImpl( CNode_Impl * aNode_Impl ) {
+                       _Node_Impl = aNode_Impl ; } ;
+
       void InNode( void * anInNode ) {
 //           cdebug << "GraphBase::ComputingNode::InNode " << Name() << endl ;
            _InNode = anInNode ; } ;
@@ -148,9 +174,12 @@ namespace GraphBase {
 //      const SALOME_ModuleCatalog::Service * Service() const ;
       SUPERV::SDate FirstCreation() const ;
       SUPERV::SDate LastModification() const ;
-      char* Author() const { return my_strdup( _Author ) ; } ;
-      char* EditorRelease() const { return my_strdup( _EditorRelease ) ; } ;
-      char * Comment() const { return my_strdup( _Comment ) ; } ;
+//JR 17.02.2005 Memory Leak      char* Author() const { return my_strdup( _Author ) ; } ;
+      char* Author() const { return _Author ; } ;
+//JR 17.02.2005 Memory Leak      char* EditorRelease() const { return my_strdup( _EditorRelease ) ; } ;
+      char* EditorRelease() const { return _EditorRelease ; } ;
+//JR 17.02.2005 Memory Leak      char * Comment() const { return my_strdup( _Comment ) ; } ;
+      char * Comment() const { return _Comment ; } ;
       int XCoordinate() const { return _X ; } ;
       int YCoordinate() const { return _Y ; } ;
 
@@ -168,7 +197,7 @@ namespace GraphBase {
                      const char * ServiceParameterName ,
                      char ** aNode , char ** aPort ) ;
 
-      bool IsLinked(const char * ToServiceParameterName ) ;
+      bool IsLinked(const char * ToServiceParameterName, bool isInput ) ; // mkr : PAL8060
       bool HasInput(const char * ToServiceParameterName ) ;
 
       GraphBase::SNode * GetInfo() ;
@@ -198,12 +227,12 @@ namespace GraphBase {
       void DelOutDataStreamPort( const char * OutputParameterName ) ;
 
       InDataStreamPort * AddInDataStreamPort( const char * InputParameterName ,
-                                              const SALOME_ModuleCatalog::DataStreamType InputParameterType ,
+                                              const char * InputParameterType ,
                                               const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
                                               const SUPERV::KindOfPort aKindOfPort ,
                                               int index = -1 ) ;
       OutDataStreamPort * AddOutDataStreamPort( const char * OutputParameterName ,
-                                                const SALOME_ModuleCatalog::DataStreamType OutputParameterType ,
+                                                const char * OutputParameterType ,
                                                 const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
                                                 const SUPERV::KindOfPort aKindOfPort ,
                                                 int index = -1 ) ;
@@ -217,10 +246,11 @@ namespace GraphBase {
                   << " + 1 Service " << ServiceName() << endl ;
            ToNode->IncrConnectedInPortsNumber() ; } ;
 
-      bool RemoveLinkedNode( GraphBase::ComputingNode * ToNode ) {
-           bool RetVal = GraphBase::StreamNode::RemoveLinkedNode( ToNode ) ;
+      bool RemoveLinkedNode( GraphBase::ComputingNode * ToNode ,
+                             bool DoLinkedFromNode = true ) {
+           bool RetVal = GraphBase::StreamNode::RemoveLinkedNode( ToNode , DoLinkedFromNode ) ;
            if ( RetVal ) {
-             cdebug << "GraphBase::StreamNode::RemoveLinkedNode to " << ToNode->Name() << " from "
+             cdebug << "ComputingNode::RemoveLinkedNode to " << ToNode->Name() << " from "
                     << Name() << " ConnectedInPortsNumber "
                     << ToNode->ConnectedInPortsNumber() - 1 << endl ;
              ToNode->DecrConnectedInPortsNumber() ;
@@ -232,10 +262,12 @@ namespace GraphBase {
            GraphBase::StreamNode::ReNameLinkedNode( OldNodeName , NewNodeName ) ; } ;
 
       void IncrConnectedInPortsNumber() {
-           cdebug << "IncrConnectedInPortsNumber " << Name() << " -> "
+           cdebug << "ComputingNode::IncrConnectedInPortsNumber " << Name() << " -> "
                   << _ConnectedInPortsNumber+1 << endl ;
            _ConnectedInPortsNumber++ ; } ;
       void DecrConnectedInPortsNumber() {
+           cdebug << "ComputingNode::DecrConnectedInPortsNumber " << Name() << " -> "
+                  << _ConnectedInPortsNumber-1 << endl ;
            _ConnectedInPortsNumber-- ; } ;
       int ConnectedInPortsNumber() const {
           return _ConnectedInPortsNumber ; } ;
@@ -254,6 +286,17 @@ namespace GraphBase {
           }
            return false ; } ;
 
+      bool CheckLoop( GraphBase::LoopNode * aLoopNode ,
+                      GraphBase::EndOfLoopNode * anEndLoopNode ,
+                      string & anErrorMessage ) const ;
+      bool CheckEndLoop( GraphBase::LoopNode * aLoopNode ,
+                         GraphBase::EndOfLoopNode * anEndLoopNode ,
+                         string & anErrorMessage ) const ;
+      bool InitBranchOfSwitchDone( bool AllInit , GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+                                   string & anErrorMessage ) ;
+      bool CheckSwitch( GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+                        string & anErrorMessage ) ;
+
 //      const GraphBase::ListOfParameters * GetListOfParameters() const ;
 
       const long CpuUsed() ;