Salome HOME
NRI : Merge delta [V1_2, V1_2c].
authornri <nri@opencascade.com>
Mon, 13 Oct 2003 14:05:38 +0000 (14:05 +0000)
committernri <nri@opencascade.com>
Mon, 13 Oct 2003 14:05:38 +0000 (14:05 +0000)
87 files changed:
src/GraphBase/DataFlowBase_Base.cxx
src/GraphBase/DataFlowBase_Base.hxx
src/GraphBase/DataFlowBase_ComputingNode.cxx
src/GraphBase/DataFlowBase_ComputingNode.hxx
src/GraphBase/DataFlowBase_DataNode.cxx
src/GraphBase/DataFlowBase_DataNode.hxx
src/GraphBase/DataFlowBase_DataPort.cxx
src/GraphBase/DataFlowBase_EndOfLoopNode.cxx
src/GraphBase/DataFlowBase_EndOfLoopNode.hxx
src/GraphBase/DataFlowBase_EndOfSwitchNode.cxx
src/GraphBase/DataFlowBase_EndOfSwitchNode.hxx
src/GraphBase/DataFlowBase_FactoryNode.cxx
src/GraphBase/DataFlowBase_FactoryNode.hxx
src/GraphBase/DataFlowBase_GOTONode.cxx
src/GraphBase/DataFlowBase_GOTONode.hxx
src/GraphBase/DataFlowBase_Graph.cxx
src/GraphBase/DataFlowBase_Graph.hxx
src/GraphBase/DataFlowBase_InLineNode.cxx
src/GraphBase/DataFlowBase_InLineNode.hxx
src/GraphBase/DataFlowBase_InPort.hxx
src/GraphBase/DataFlowBase_LoopNode.cxx
src/GraphBase/DataFlowBase_LoopNode.hxx
src/GraphBase/DataFlowBase_Port.cxx
src/GraphBase/DataFlowBase_Port.hxx
src/GraphBase/DataFlowBase_PortsOfNode.cxx
src/GraphBase/DataFlowBase_PortsOfNode.hxx
src/GraphBase/DataFlowBase_Service.cxx
src/GraphBase/DataFlowBase_Service.hxx
src/GraphBase/DataFlowBase_SwitchNode.cxx
src/GraphBase/DataFlowBase_SwitchNode.hxx
src/GraphBase/DataFlowBase_XmlHandler.cxx
src/GraphEditor/DataFlowEditor_DataFlow.cxx
src/GraphEditor/DataFlowEditor_DataFlow.hxx
src/GraphEditor/DataFlowEditor_DataFlow.lxx
src/GraphEditor/DataFlowEditor_InNode.cxx
src/GraphEditor/DataFlowEditor_InNode.hxx
src/GraphEditor/DataFlowEditor_OutNode.cxx
src/GraphEditor/DataFlowEditor_OutNode.hxx
src/GraphExecutor/DataFlowExecutor_DataFlow.hxx
src/GraphExecutor/DataFlowExecutor_DynInvoke.cxx
src/GraphExecutor/DataFlowExecutor_InNode.cxx
src/GraphExecutor/DataFlowExecutor_InNode.hxx
src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx
src/GraphExecutor/DataFlowExecutor_OutNode.cxx
src/GraphExecutor/DataFlowExecutor_OutNode.hxx
src/GraphExecutor/DataFlowExecutor_PyDynInvoke.cxx
src/SUPERVGUI/SUPERVGUI.cxx
src/SUPERVGUI/SUPERVGUI_Array.cxx
src/SUPERVGUI/SUPERVGUI_BrowseNodeDlg.cxx
src/SUPERVGUI/SUPERVGUI_ComputeNode.cxx
src/SUPERVGUI/SUPERVGUI_ControlNode.cxx
src/SUPERVGUI/SUPERVGUI_Def.h
src/SUPERVGUI/SUPERVGUI_GraphNode.cxx
src/SUPERVGUI/SUPERVGUI_GraphNode.h
src/SUPERVGUI/SUPERVGUI_Information.cxx
src/SUPERVGUI/SUPERVGUI_Main.cxx
src/SUPERVGUI/SUPERVGUI_Node.cxx
src/SUPERVGUI/SUPERVGUI_Node.h
src/SUPERVGUI/SUPERVGUI_Port.cxx
src/Supervision/CNode_Impl.cxx
src/Supervision/CNode_Impl.hxx
src/Supervision/ELNode_Impl.cxx
src/Supervision/ELNode_Impl.hxx
src/Supervision/ESNode_Impl.cxx
src/Supervision/ESNode_Impl.hxx
src/Supervision/FNode_Impl.cxx
src/Supervision/FNode_Impl.hxx
src/Supervision/GNode_Impl.cxx
src/Supervision/GNode_Impl.hxx
src/Supervision/Graph_Impl.cxx
src/Supervision/Graph_Impl.hxx
src/Supervision/INode_Impl.cxx
src/Supervision/INode_Impl.hxx
src/Supervision/LNode_Impl.cxx
src/Supervision/LNode_Impl.hxx
src/Supervision/Link_Impl.cxx
src/Supervision/Link_Impl.hxx
src/Supervision/Port_Impl.cxx
src/Supervision/Port_Impl.hxx
src/Supervision/SNode_Impl.cxx
src/Supervision/SNode_Impl.hxx
src/Supervision/SuperV.py
src/Supervision/SuperV_Impl.cxx
src/Supervision/SuperV_Impl.hxx
src/Supervision/Value_Impl.cxx
src/Supervision/Value_Impl.hxx
src/Supervision/batchmode_SuperV.py

index 22d6b6a4d5d6a0972f5ba43d098b1c01545a2413..7853f57b6f1756221f3f6daeb81ef1c026dced30 100644 (file)
@@ -29,7 +29,7 @@
 using namespace std;
 #include "DataFlowBase_Base.hxx"
 
-char *SuperVision_Version = "1.04" ;
+char *SuperVision_Version = "1.05" ;
 
 char *NULLSTRING = "" ;
 
@@ -41,10 +41,19 @@ GraphBase::Base::Base() {
 }
 
 void GraphBase::Base::SetDebug( CORBA::ORB_ptr ORB ,
-                                int * theprof_debug , ostream * thefdebug ) {
-  _Orb = CORBA::ORB::_duplicate( ORB ) ;
-  _prof_debug = theprof_debug ;
-  _fdebug = thefdebug ;
+                                int * theprof_debug , ofstream * thefdebug ) {
+  if ( _prof_debug == NULL ) {
+//    *thefdebug << "GraphBase::Base::SetDebug Done _fdebug " << _fdebug << " = thefdebug " << thefdebug
+//           << endl ;
+    if ( theprof_debug ) {
+      _Orb = CORBA::ORB::_duplicate( ORB ) ;
+      _prof_debug = theprof_debug ;
+      _fdebug = thefdebug ;
+    }
+  }
+//  cdebug_in << "GraphBase::Base::SetDebug" << endl ;
+//  cdebug << "GraphBase::Base::SetDebug" << endl ;
+//  cdebug_out << "GraphBase::Base::SetDebug" << endl ;
 }
 
 char * GraphBase::Base::ObjectToString( CORBA::Object_ptr obj ) const {
index 174a1ea18397e0a1917c3eec899a4ca46e292b9e..3b0a7fc9ae4b835491fb46c13a57dacf8785f79a 100644 (file)
 #ifndef _DATAFLOW_BASE_HXX
 #define _DATAFLOW_BASE_HXX
 
+//#include <strstream>
 #include <iostream>
 #include <fstream>
-#include <strstream>
+#include <sstream>
 #include <iomanip>
 #include <string>
 #include <map>
@@ -48,8 +49,6 @@
 #include "utilities.h"
 #include "OpUtil.hxx"
 
-#include "SALOME_NamingService.hxx"
-
 extern char *SuperVision_Version ;
 
 extern char *NULLSTRING ;
@@ -146,14 +145,14 @@ namespace GraphBase {
 
     public:   
 
-      int *     _prof_debug;
-      ostream * _fdebug;
+      int      * _prof_debug ;
+      ofstream * _fdebug ;
                      
       Base() ;
       virtual ~Base() {} ;
 
       void SetDebug( CORBA::ORB_ptr ORB ,
-                     int * prof_debug , ostream * fdebug ) ;
+                     int * prof_debug , ofstream * fdebug ) ;
 
       char * ObjectToString( CORBA::Object_ptr obj ) const ;
       CORBA::Object_ptr StringToObject(char * obj ) const ;
@@ -161,17 +160,14 @@ namespace GraphBase {
   } ;
 # ifdef _DEBUG_
 
-#   define cdebug \
-           if ( GraphBase::Base::_prof_debug ) \
-             *GraphBase::Base::_fdebug << "      " /*<< setw(3*(*GraphBase::Base::_prof_debug)) */<< " "
+//             *GraphBase::Base::_fdebug << "      " /*<< setw(3*(*GraphBase::Base::_prof_debug)) */<< " "
+
+#   define cdebug if ( GraphBase::Base::_fdebug )  *GraphBase::Base::_fdebug << "      " << " "
+
+#   define cdebug_in if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << endl << "-->" << " "
 
-#   define cdebug_in \
-           if ( GraphBase::Base::_prof_debug ) \
-             *GraphBase::Base::_fdebug << endl << "-->" /*<< setw(3*((*GraphBase::Base::_prof_debug)++)) */<< " "
+#   define cdebug_out if ( GraphBase::Base::_fdebug ) *GraphBase::Base::_fdebug << endl << "<--" << " "
 
-#   define cdebug_out \
-           if ( GraphBase::Base::_prof_debug ) \
-             *GraphBase::Base::_fdebug << endl << "<--" /*<< setw(3*(--(*GraphBase::Base::_prof_debug)))*/ << " "
 # else
 
 #   define cdebug while (false) std::cerr
index ad86cd829d763a4421e3fdcc3af6a8fd405fdd2b..bb47f9ecf99c25da549dcd3bd622cb32105e8f23 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_InLineNode.hxx"
 #include "DataFlowBase_LoopNode.hxx"
@@ -77,10 +77,7 @@ GraphBase::ComputingNode::ComputingNode() :
   _InNode = NULL ;
   _ThreadNo = pthread_self() ;
   _Name = NULL ;
-  cdebug << "GraphBase::Node::Node "  << this 
-          << " _Name "
-         << (void *) _Name << " " << _Name << " _Comment "
-         << (void *) _Comment << " "  << _Comment << " "  << endl ;
+  cdebug << "GraphBase::Node::Node "  << this << " "  << endl ;
 
 }
 
@@ -88,9 +85,10 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
                                          SALOME_NamingService* ptrNamingService ,
                                          const char * aDataFlowName ,
                                          int * Graph_prof_debug ,
-                                         ostream * Graph_fdebug ) :
+                                         ofstream * Graph_fdebug ) :
   GraphBase::PortsOfNode::PortsOfNode( aDataFlowName ) {
 
+  MESSAGE( "GraphBase::ComputingNode::ComputingNode( " << aDataFlowName << " Graph_fdebug " << Graph_fdebug ) ;
   InitFields( _Kind ,
               _FirstCreation ,
               _LastModification ,
@@ -106,26 +104,30 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
 
   _ORB = CORBA::ORB::_duplicate( ORB ) ;
   _NamingService = ptrNamingService ;
-  _Graph_prof_debug = Graph_prof_debug ;
-  _Graph_fdebug = Graph_fdebug ;
   _Node = SUPERV::CNode::_nil() ;
   _InNode = NULL ;
   _ThreadNo = pthread_self() ;
 
-  if ( aDataFlowName && strlen( aDataFlowName ) ) {
+  if ( aDataFlowName != NULLSTRING && strlen( aDataFlowName ) ) {
     _Name = new char[ strlen( aDataFlowName )+1 ] ;
     strcpy( _Name , aDataFlowName ) ;
   }
-  else
-    _Name = NULL ;
+  else {
+    _Name = NULLSTRING ;
+  }
   if ( Graph_prof_debug ) {
+//    MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug" ) ;
+//    cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug" << endl ;
+    _Graph_prof_debug = Graph_prof_debug ;
+    _Graph_fdebug = Graph_fdebug ;
     SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-//    MESSAGE( "Invalid DataFlow Name." );
   }
+//  else {
+//    cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
+//  }
   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
          << "' _Name "
-         << (void *) _Name << " '" << _Name << " _Comment "
-         << (void *) _Comment << " "  << _Comment << " "  << _FirstCreation
+         << (void *) _Name << " '" << _Name << " "  << _FirstCreation
          << " "  << _LastModification << endl ;
 }
 
@@ -143,13 +145,11 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
                                          const long   X ,
                                          const long   Y ,
                                          int * Graph_prof_debug ,
-                                         ostream * Graph_fdebug ) :
+                                         ofstream * Graph_fdebug ) :
   GraphBase::PortsOfNode::PortsOfNode() {
 
   _ORB = CORBA::ORB::_duplicate( ORB ) ;
   _NamingService = ptrNamingService ;
-  _Graph_prof_debug = Graph_prof_debug ;
-  _Graph_fdebug = Graph_fdebug ;
   _Node = SUPERV::CNode::_nil() ;
   _InNode = NULL ;
   _ThreadNo = pthread_self() ;
@@ -166,7 +166,7 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
   _FirstCreation.Month  = _LastModification.Month  = Tm->tm_mon + 1;
   _FirstCreation.Year   = _LastModification.Year   = Tm->tm_year + 1900; 
 
-  if ( NodeEditorRelease ) {
+  if ( NodeEditorRelease != NULLSTRING ) {
     _EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
     strcpy( _EditorRelease , NodeEditorRelease ) ;
   }
@@ -175,19 +175,21 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
     strcpy( _EditorRelease , SuperVision_Version ) ;
   }
 
-  if ( NodeAuthor ) {
+  if ( NodeAuthor != NULLSTRING ) {
     _Author = new char[ strlen( NodeAuthor ) + 1 ] ;
     strcpy( _Author  , NodeAuthor ) ;
   }
-  else
+  else {
     _Author = NULLSTRING ;
+  }
 
-  if ( NodeComment  ) {
+  if ( NodeComment != NULLSTRING ) {
     _Comment = new char[ strlen( NodeComment ) + 1 ] ;
     strcpy( _Comment  , NodeComment ) ;
   }
-  else
+  else {
     _Comment = NULLSTRING ;
+  }
 
   _SubGraphNumber = 0 ;
   _HeadNode = false ;
@@ -204,20 +206,27 @@ GraphBase::ComputingNode::ComputingNode( CORBA::ORB_ptr ORB ,
   _X = X ;
   _Y = Y ;
 
-  if ( Graph_prof_debug )
-    SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+//  MESSAGE( "GraphBase::ComputingNode::ComputingNode --> SetDebug " << Graph_prof_debug << " Graph_fdebug "
+//           << Graph_fdebug ) ;
+//  cout << "GraphBase::ComputingNode::ComputingNode --> SetDebug " << Graph_prof_debug << " Graph_fdebug "
+//       << Graph_fdebug << endl ;
+  _Graph_prof_debug = Graph_prof_debug ;
+  _Graph_fdebug = Graph_fdebug ;
+  SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+//  MESSAGE( "GraphBase::ComputingNode::ComputingNode SetDebug Done " << Graph_prof_debug << " Graph_fdebug "
+//           << Graph_fdebug << " aService.ServiceName " << aService.ServiceName ) ;
+//  cout << "GraphBase::ComputingNode::ComputingNode SetDebug Done " << Graph_prof_debug << " Graph_fdebug "
+//       << Graph_fdebug << endl ;
+//  cout << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << aNodeName << ","
+//       << akind << ")" << endl;
+  cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << "," << aNodeName << ","
+            << akind << ")" << endl;
+  
 
-    DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
-                    Graph_prof_debug , Graph_fdebug ) ;
+  DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
 
-  cdebug_in << "GraphBase::ComputingNode::ComputingNode(" << aService.ServiceName << ","
-            << aNodeName << "," << akind
-            << "," << NodeComment << ")" << endl;
-  
   cdebug << "GraphBase::ComputingNode::ComputingNode "  << this 
-         << " _Name "
-         << (void *) _Name << " '" << _Name << "' _Comment "
-         << (void *) _Comment << " "  << _Comment << " " 
+         << " _Name " << (void *) _Name << " '" << _Name
          << " KindOfNode " << _Kind
          << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
          << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
@@ -243,19 +252,21 @@ GraphBase::ComputingNode::~ComputingNode() {
 }
 
 bool GraphBase::ComputingNode::Name( const char * aName) {
+  cdebug_in << "GraphBase::ComputingNode::Name " << _Name << endl;
   if ( _Name ) {
     cdebug << "GraphBase::ComputingNode::ReName "  << _Name << " --> " << aName << endl ;
     delete [] _Name ;
   }
   _Name = new char[strlen(aName)+1] ;
   strcpy( _Name , aName ) ;
+  cdebug_out << "GraphBase::ComputingNode::Name " << _Name << endl;
   return true ;
 }
 
 SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
-  cdebug << "GraphBase::ComputingNode::FirstCreation "
-         << "' _Name " << _Name << " "  << _FirstCreation << " "  
-         << _LastModification << endl ;
+//  cdebug << "GraphBase::ComputingNode::FirstCreation "
+//         << "' _Name " << _Name << " "  << _FirstCreation << " "  
+//         << _LastModification << endl ;
   return _FirstCreation;
 }
 
@@ -284,18 +295,20 @@ bool GraphBase::ComputingNode::EditorRelease(const char * c){
 }
 
 bool GraphBase::ComputingNode::Author(const char * a) {
+  cdebug_in << "GraphBase::ComputingNode::Author " << _Author << endl;
   if ( _Author && _Author != NULLSTRING )
     delete _Author;
   _Author = my_strdup(a);
+  cdebug_out << "GraphBase::ComputingNode::Author " << _Author << endl;
   return true ;
 }
 
 bool GraphBase::ComputingNode::Comment(const char *c) {
-  cdebug_in << "GraphBase::ComputingNode::Comment" << endl;
+  cdebug_in << "GraphBase::ComputingNode::Comment " << _Comment << endl;
   if ( _Comment != NULLSTRING )
     delete [] _Comment;
   _Comment = my_strdup(c);
-  cdebug_out << "GraphBase::ComputingNode::Comment" << endl;
+  cdebug_out << "GraphBase::ComputingNode::Comment " << _Comment << endl;
   return true ;
 }
 
@@ -597,7 +610,12 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
     QDomElement inParametertype = Graph.createElement("inParameter-type") ;
     // mpv: Linux 8.0 compiler compatibility
 //    aField = Graph.createTextNode( (char *)ServiceInParameter()[i].Parametertype ) ;
-    aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametertype) ) ;
+    if ( strlen( ServiceInParameter()[i].Parametertype ) ) {
+      aField = Graph.createTextNode( strdup( ServiceInParameter()[i].Parametertype ) ) ;
+    }
+    else {
+      aField = Graph.createTextNode( "?" ) ;
+    }
     inParameter.appendChild(inParametertype) ;
     inParametertype.appendChild( aField ) ;
 //    f << Tabs << "                   <inParameter-name>"
@@ -606,7 +624,12 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
     QDomElement inParametername = Graph.createElement("inParameter-name") ;
     // mpv: Linux 8.0 compiler compatibility
 //    aField = Graph.createTextNode( (char *) ServiceInParameter()[i].Parametername ) ;
-    aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
+    if ( strlen( ServiceInParameter()[i].Parametername ) ) {
+      aField = Graph.createTextNode( strdup(ServiceInParameter()[i].Parametername) ) ;
+    }
+    else {
+      aField = Graph.createTextNode( "?" ) ;
+    }
     inParameter.appendChild(inParametername) ;
     inParametername.appendChild( aField ) ;
 //    f << Tabs << "           </inParameter>" << endl ;
@@ -625,7 +648,12 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
     QDomElement outParametertype = Graph.createElement("outParameter-type") ;
     // mpv: Linux 8.0 compiler compatibility
 //    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametertype ) ;
-    aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
+    if ( strlen( ServiceOutParameter()[i].Parametertype ) ) {
+      aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametertype) ) ;
+    }
+    else {
+      aField = Graph.createTextNode( "?" ) ;
+    }
     outParameter.appendChild(outParametertype) ;
     outParametertype.appendChild( aField ) ;
 //    f << Tabs << "                   <outParameter-name>"
@@ -634,7 +662,12 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
     QDomElement outParametername = Graph.createElement("outParameter-name") ;
     // mpv: Linux 8.0 compiler compatibility
 //    aField = Graph.createTextNode( (char *) ServiceOutParameter()[i].Parametername ) ;
-    aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
+    if ( strlen( ServiceOutParameter()[i].Parametername ) ) {
+      aField = Graph.createTextNode( strdup(ServiceOutParameter()[i].Parametername) ) ;
+    }
+    else {
+      aField = Graph.createTextNode( "?" ) ;
+    }
     outParameter.appendChild(outParametername) ;
     outParametername.appendChild( aField ) ;
 //    f << Tabs << "           </outParameter>" << endl ;
@@ -684,7 +717,7 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
     QDomElement PyFunction = Graph.createElement("PyFunction") ;
     PyFunctionlist.appendChild( PyFunction ) ;
     int j ;
-    for ( j = 0 ; j < (*PythonFunctions[i]).length() ; j++ ) {
+    for ( j = 0 ; j < (int ) (*PythonFunctions[i]).length() ; j++ ) {
       if ( j == 0 ) {
 //        if ( i == 0 ) {
 //          f << Tabs << "             <FuncName>" << FuncNames[i].c_str()
@@ -716,12 +749,12 @@ bool GraphBase::ComputingNode::SaveXML( QDomDocument & Graph , QDomElement & inf
 //       char * aCDATAChar = (char *) (*PythonFunctions[i])[j] ;
       char * aCDATAChar = strdup ((*PythonFunctions[i])[j]) ;
       int i ;
-      for ( i = 0 ; i < strlen( aCDATAChar ) ; i++ ) {
+      for ( i = 0 ; i < (int ) strlen( aCDATAChar ) ; i++ ) {
         if ( aCDATAChar[ i ] != ' ' ) {
           break ;
        }
       }
-      if ( i == strlen( aCDATAChar ) ) {
+      if ( i == (int ) strlen( aCDATAChar ) ) {
         aCDATA = Graph.createCDATASection( "?" ) ;
       }
       else {
@@ -820,13 +853,13 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
   else if ( IsComputingNode() ) {
     int i ;
     f << Name() << "_ServiceinParameter = []" << endl ;
-    for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
+    for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
       f << Name() << "_ServiceinParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
         << ServiceInParameter()[i].Parametertype << "' , '"
         << ServiceInParameter()[i].Parametername << "' ) )" << endl ;
     }
     f << Name() << "_ServiceoutParameter = []" << endl ;
-    for ( i = 0 ; i < ServiceOutParameter().length() ; i++ ) {
+    for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
       f << Name() << "_ServiceoutParameter.append( SALOME_ModuleCatalog.ServicesParameter( '"
         << ServiceOutParameter()[i].Parametertype << "' , '"
         << ServiceOutParameter()[i].Parametername << "' ) )" << endl ;
@@ -848,7 +881,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
     SUPERV::ListOfStrings aPyFunc ;
     if ( PythonFunctions.size() ) {
       aPyFunc = *PythonFunctions[0] ;
-      for ( i = 0 ; i < aPyFunc.length() ; i++ ) {
+      for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
         f << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
       }
     }
@@ -876,11 +909,11 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
         SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
         SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
         f << "PyMore" << Name() << " = []" << endl ;
-        for ( i = 0 ; i < aPyMore.length() ; i++ ) {
+        for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
           f << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
         }
         f << "PyNext" << Name() << " = []" << endl ;
-        for ( i = 0 ; i < aPyNext.length() ; i++ ) {
+        for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
           f << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
         }
         f << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
@@ -904,7 +937,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
           << aCoupledNode->YCoordinate() << " )" << endl ;
         SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
         f << "Py" << aCoupledNode->Name() << " = []" << endl ;
-        for ( i = 0 ; i < aPyFunc.length() ; i++ ) {
+        for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
           f << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
             << endl ;
         }
@@ -926,6 +959,18 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
       }
       delete [] EndName ;
     }
+  }
+
+  f << Name() << ".SetName( '" << Name() << "' )" << endl ;
+  f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
+  if ( IsFactoryNode() ) {
+    f << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
+  }
+  f << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
+  f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
+
+  if ( IsOneOfInLineNodes() ) {
+    int i ;
     for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
       const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
       if ( anInPort->IsInLine() ) {
@@ -942,14 +987,6 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
     }
   }
 
-  f << Name() << ".SetName( '" << Name() << "' )" << endl ;
-  f << Name() << ".SetAuthor( '" << Author() << "' )" << endl ;
-  if ( IsFactoryNode() ) {
-    f << Name() << ".SetContainer( '" << Computer << "' )" << endl ;
-  }
-  f << Name() << ".SetComment( '" << Comment() << "' )" << endl ;
-  f << Name() << ".Coords( " << XCoordinate << " , " << YCoordinate << " )" << endl ;
-
 #if 0
   if ( IsLoopNode() || IsSwitchNode() ) {
     f << EndName << ".SetName( '" << CoupledNode
@@ -975,8 +1012,7 @@ bool GraphBase::ComputingNode::SavePY( ostream &f , const char * aGraphName ,
   return true ;
 }
 
-void GraphBase::ComputingNode::NodeInfo(ostrstream & s) const {
-  int i ;
+void GraphBase::ComputingNode::NodeInfo(ostream & s) const {
   s << *this ;
   ListPorts( s , true ) ;
   s << ends ;
index 91a0f2d979fdab8fb64b895bab5e0be44bdafaf8..3774b2d5a01291d49f46bb745221d48be81b6bd0 100644 (file)
@@ -12,6 +12,8 @@
 #ifndef _DATAFLOWBASE_NODE_HXX
 #define _DATAFLOWBASE_NODE_HXX
 
+#include "SALOME_NamingService.hxx"
+
 #include "DataFlowBase_PortsOfNode.hxx"
 
 namespace GraphBase {
@@ -25,7 +27,7 @@ namespace GraphBase {
       CORBA::ORB_ptr         _ORB ;
       SALOME_NamingService * _NamingService ;
       int                  * _Graph_prof_debug ;
-      ostream              * _Graph_fdebug ;
+      ofstream             * _Graph_fdebug ;
       SUPERV::CNode_var      _Node ;
       void                 * _InNode ; // From GraphExecutor:: or GraphEditor::
       bool                   _ObjInterface ;
@@ -71,7 +73,7 @@ namespace GraphBase {
                      SALOME_NamingService* ptrNamingService ,
                      const char * DataFlowName ,
                      int * Graph_prof_debug = NULL ,
-                     ostream * Graph_fdebug = NULL ) ;
+                     ofstream * Graph_fdebug = NULL ) ;
       ComputingNode( CORBA::ORB_ptr ORB ,
                      SALOME_NamingService* ptrNamingService ,
                      const SALOME_ModuleCatalog::Service& NodeService ,
@@ -86,7 +88,7 @@ namespace GraphBase {
                      const long   X ,
                      const long   Y ,
                      int * Graph_prof_debug = NULL ,
-                     ostream * Graph_fdebug = NULL ) ;
+                     ofstream * Graph_fdebug = NULL ) ;
       virtual ~ComputingNode() ;
 
       SALOME_NamingService * NamingService() const {
@@ -281,7 +283,7 @@ namespace GraphBase {
                                const GraphBase::ListOfPythonFunctions PythonFunctions ,
                                int X , int Y ) const ;
 
-      void NodeInfo(ostrstream & s) const ;
+      void NodeInfo(ostream & s) const ;
 
       void ListLinks(ostream &f ) const ;
 
index 63051cd70240b62bdfab08a140ecdd68934e8e82..96cf474f10918cf4c31245fee41829988ee917eb 100644 (file)
@@ -70,12 +70,10 @@ void GraphBase::DataNode::DataService(
                        CORBA::ORB_ptr ORB ,
                        SALOME_ModuleCatalog::Service aService ,
                        int * Graph_prof_debug ,
-                       ostream * Graph_fdebug ) {
-//  cout << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
-//       << aService.ServiceName << endl ;
-//  DefPortsOfNode( aService , aService.ServiceName ) ;
+                       ofstream * Graph_fdebug ) {
+  cdebug << "GraphBase::DataNode::DataService : DataFlowPortsOfNode of "
+         << aService.ServiceName << endl ;
   DefPortsOfNode( ORB , aService , NamePtr() , Kind() ,
-//                  true , false , false , false ,
                   Graph_prof_debug , Graph_fdebug ) ;
 
   if ( _Created )
@@ -85,11 +83,10 @@ void GraphBase::DataNode::DataService(
   aReversedService.ServiceinParameter = aService.ServiceoutParameter ;
   aReversedService.ServiceoutParameter = aService.ServiceinParameter ;
   _DataFlowDataPorts = new PortsOfNode() ;
-//  cout << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
-//       << aReversedService.ServiceName << endl ;
+  cdebug << "GraphBase::DataNode::DataService : Mirrored DataFlowPortsOfNode of "
+         << aReversedService.ServiceName << endl ;
   _DataFlowDataPorts->DefPortsOfNode( ORB , aReversedService , NamePtr() ,
                                       Kind() ,
-//                                      true , false , false , false ,
                                       Graph_prof_debug , Graph_fdebug ) ;
   _Created = true ;
 }
@@ -139,12 +136,11 @@ int GraphBase::DataNode::CheckDataServerNodes() const {
   return ierr ;
 }
 
-void GraphBase::DataNode::ListDatas(ostrstream & f ) const {
+void GraphBase::DataNode::ListDatas(ostream & f ) const {
   _DataFlowDataPorts->ListPorts( f , false ) ;
 }
 
-void GraphBase::DataNode::DataNodeInfo(ostrstream & s ) const {
-  int i ;
+void GraphBase::DataNode::DataNodeInfo(ostream & s ) const {
   s << *this ;
   s << "Ports :" << endl ;
   ListPorts( s , true ) ;
index d3ed5e08b633ead510603d47a08e5626ea79d7b1..c2ceff037c27b894e518e449f1460e961715078c 100644 (file)
@@ -61,7 +61,7 @@ namespace GraphBase {
       void DataService( CORBA::ORB_ptr ORB ,
                         const SALOME_ModuleCatalog::Service aService ,
                         int * Graph_prof_debug ,
-                        ostream * Graph_fdebug ) ;
+                        ofstream * Graph_fdebug ) ;
 
       int CheckDataServerNodes() const ;
 
@@ -86,9 +86,9 @@ namespace GraphBase {
       InPort * GetChangeOutDataNodePort( const char * DataFlowOutPortName ) {
                return _DataFlowDataPorts->GetChangeInPort( DataFlowOutPortName ) ; } ;
 
-      void DataNodeInfo(ostrstream & s ) const ;
+      void DataNodeInfo(ostream & s ) const ;
 
-      void ListDatas(ostrstream & f) const ;
+      void ListDatas(ostream & f) const ;
 
 //      bool SaveXML( ostream &f , char *Tabs , 
       bool SaveXML( QDomDocument & Graph , QDomElement & info , 
index 43342835ed55901a0d527d41c77d723a63c176a3..a623fdf157e34bbe2e5a127bfd18f927978a2d42 100644 (file)
@@ -48,27 +48,51 @@ void GraphBase::DataPort::InitialValues(CORBA::Any aValue ) {
   CORBA::Any InitialValue ;
   cdebug << "InitialValues " << NodeName() << " " << PortName() << " " << PortType()
          << " : " ;
-  if ( !strcmp( Type , "string" ) ) {
+  if ( !strcmp( Type , "" ) ) {
+    cdebug << "void" << endl ;
+    InitialValue <<= (void *) NULL ;
+  }
+  else if ( !strcmp( Type , "string" ) ) {
     cdebug << "string" << endl ;
     InitialValue <<= (char *) NULL ;
   }
-  else if ( !strcmp( Type , "double" ) ) {
-    cdebug << "double" << endl ;
-    InitialValue <<= 0. ;
+  else if ( !strcmp( Type , "boolean" ) ) {
+    cdebug << "boolean" << endl ;
+    InitialValue <<= (long ) 0 ;
+  }
+  else if ( !strcmp( Type , "char" ) ) {
+    cdebug << "char" << endl ;
+    InitialValue <<= (long ) 0 ;
+  }
+  else if ( !strcmp( Type , "short" ) ) {
+    cdebug << "short" << endl ;
+    InitialValue <<= (long ) 0 ;
+  }
+  else if ( !strcmp( Type , "int" ) ) {
+    cdebug << "long" << endl ;
+    InitialValue <<= (long ) 0 ;
   }
   else if ( !strcmp( Type , "long" ) ) {
     cdebug << "long" << endl ;
     InitialValue <<= (long ) 0 ;
   }
-  else if ( !strcmp( Type , "objref" ) ) {
+  else if ( !strcmp( Type , "float" ) ) {
+    cdebug << "float" << endl ;
+    InitialValue <<= (double ) 0. ;
+  }
+  else if ( !strcmp( Type , "double" ) ) {
+    cdebug << "double" << endl ;
+    InitialValue <<= (double ) 0. ;
+  }
+  else { // Default
     cdebug << "objref" << endl ;
 //    InitialValue.replace(CORBA::_tc_Object, NULL);
     InitialValue <<= CORBA::Object::_nil() ;
   }
-  else {
-    cdebug << "InitialValues ERROR (other) " << Type << endl ;
-    InitialValue <<= (long ) 0 ;
-  }
+//  else {
+//    cdebug << "InitialValues ERROR (other) " << Type << endl ;
+//    InitialValue <<= (long ) 0 ;
+//  }
   _InitialValue = new CORBA::Any( InitialValue ) ;
   _Value = &_InitialValue ;
 }
@@ -88,43 +112,180 @@ void GraphBase::DataPort::Value( const CORBA::Any * aDataValue ) {
 //         << endl ;
 
   delete _theValue ;
-  _theValue = aDataValue ;
-  *_Value = aDataValue ;
-//  Done( true ) ;
 
-#if 0
-  cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
-         << " : " << _Value << " *_Value " << *_Value  << " " ;
-  switch (_theValue->type()->kind()) {
-  case CORBA::tk_string: {
+  string _Type = CORBA::string_dup( GetServicesParameter().Parametertype ) ;
+  const char * Type = _Type.c_str() ;
+  _Value = &_theValue ;
+//  cdebug << "NewValue " << NodeName() << " " << PortName() << " " << PortType()
+//         << " : " << aDataValue << " kind " << aDataValue->type()->kind() << " " ;
+  switch (aDataValue->type()->kind()) { // Input Value
+  case CORBA::tk_string: { // Input string Value
     char * t;
-    *_theValue >>= t;
-    cdebug << "Value( " << t << ") (string)";
+    *aDataValue >>= t;
+    cdebug << t << " (string)" ;
+    if ( !strcmp( Type , "string" ) ) { // SuperVision Value
+      _theValue = aDataValue ;
+      *_theValue >>= t;
+//      cdebug << " == Value( " << t << ") (string)";
+    }
+    else {
+      CORBA::Any * theValue = new CORBA::Any() ;
+      if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+           !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+        long l ;
+        sscanf( t , "%ld" , &l ) ;
+        *theValue <<= l ;
+        *theValue >>= l;
+//        cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+      }
+      else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+        double d ;
+        sscanf( t , "%lf" , &d ) ;
+        *theValue <<= d ;
+        *theValue >>= d;
+//        cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+      }
+      else { // Default
+        CORBA::Object_ptr ObjRef ;
+        try {
+          ObjRef = StringToObject( t ) ;
+          *theValue <<= ObjRef ;
+        }
+        catch( ... ) {
+          *theValue <<= CORBA::Object::_nil() ;
+        }
+        *theValue >>= ObjRef ;
+//        cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+//               << theValue->type()->kind() ;
+      }
+      _theValue = theValue ;
+      *_Value = theValue ;
+    }
     break;
   }
-  case CORBA::tk_double: {
-    double d;
-    *_theValue >>= d;
-    cdebug << "Value( " << d << ") (double)";
+  case CORBA::tk_long: { // Input long Value
+    long l;
+    *aDataValue >>= l;
+//    cdebug << "Value( " << l << ") (long)";
+    if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+         !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) { // SuperVision Value
+      _theValue = aDataValue ;
+      *_Value = aDataValue ;
+      *_theValue >>= l;
+//      cdebug << " == Value( " << l << ") (long)";
+    }
+    else {
+      CORBA::Any * theValue = new CORBA::Any() ;
+      if ( !strcmp( Type , "string" ) ) {
+        char t[40] ;
+        sprintf( t , "%ld" , l ) ;
+        *theValue <<=  t ;
+        char *tt ;
+        *theValue >>= tt ;
+//        cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
+      }
+      else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+        double d = l ;
+        *theValue <<= d ;
+        *theValue >>= d ;
+//        cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+      }
+      else { // Default
+        CORBA::Object_ptr ObjRef ;
+        *theValue <<= CORBA::Object::_nil() ;
+        *theValue >>= ObjRef ;
+//        cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+//               << theValue->type()->kind() ;
+      }
+      _theValue = theValue ;
+      *_Value = theValue ;
+    }
     break;
   }
-  case CORBA::tk_long: {
-    long l;
-    *_theValue >>= l;
-    cdebug << "Value( " << l << ") (long)";
+  case CORBA::tk_double: { // Input double Value
+    double d;
+    *aDataValue >>= d;
+//    cdebug << "Value( " << d << ") (double)";
+    if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) { // SuperVision Value
+      _theValue = aDataValue ;
+      *_Value = aDataValue ;
+      *_theValue >>= d;
+//      cdebug << " == Value( " << d << ") (double)";
+    }
+    else {
+      CORBA::Any * theValue = new CORBA::Any() ;
+      if ( !strcmp( Type , "string" ) ) {
+        char t[40] ;
+        sprintf( t , "%lf" , d ) ;
+        *theValue <<=  t ;
+        char *tt ;
+        *theValue >>= tt ;
+//        cdebug << " --> Value( " << t << ") (string) kind " << theValue->type()->kind() ;
+      }
+      else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+                !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+        long l = (long ) d ;
+        *theValue <<= l ;
+        *theValue >>= l;
+//        cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+      }
+      else { // Default
+        CORBA::Object_ptr ObjRef ;
+        *theValue <<= CORBA::Object::_nil() ;
+        *theValue >>= ObjRef ;
+//        cdebug << " --> Value( " << ObjectToString( ObjRef ) << ") (object reference) kind "
+//               << theValue->type()->kind() ;
+      }
+      _theValue = theValue ;
+      *_Value = theValue ;
+    }
     break;
   }
-  case CORBA::tk_objref: {
-    cdebug << "Value( " << ") (object reference)";
+  case CORBA::tk_objref: { // Input objref Value
+    CORBA::Object_ptr obj ;
+    *aDataValue >>= obj;
+//    cdebug << "Value( " << ObjectToString( obj ) << ") (object reference)";
+    if ( strcmp( Type , "string" ) &&
+         strcmp( Type , "boolean" ) && strcmp( Type , "char" ) &&
+         strcmp( Type , "short" ) && strcmp( Type , "long" ) &&
+         strcmp( Type , "double" ) ) { // SuperVision Default Value
+      _theValue = aDataValue ;
+      *_Value = aDataValue ;
+      *_theValue >>= obj;
+//      cdebug << " == Value( " << ObjectToString( obj ) << ") (object reference)";
+    }
+    else {
+      CORBA::Any * theValue = new CORBA::Any() ;
+      if ( !strcmp( Type , "string" ) ) {
+        *theValue <<=  ObjectToString( obj ) ;
+        *theValue >>= obj ;
+//        cdebug << " --> Value( " << ObjectToString( obj ) << ") (string) kind " << theValue->type()->kind() ;
+      }
+      else if ( !strcmp( Type , "boolean" ) || !strcmp( Type , "char" ) ||
+                !strcmp( Type , "short" ) || !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+        long l = (long ) obj ;
+        *theValue <<= l ;
+        *theValue >>= l;
+//        cdebug << " --> Value( " << l << ") (long) kind " << theValue->type()->kind() ;
+      }
+      else if ( !strcmp( Type , "float" ) || !strcmp( Type , "double" ) ) {
+        double d = (double ) 0. ;
+        *theValue <<= d ;
+        *theValue >>= d;
+//        cdebug << " --> Value( " << d << ") (double) kind " << theValue->type()->kind() ;
+      }
+      _theValue = theValue ;
+      *_Value = theValue ;
+    }
     break;
   }
   default: {
-    cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR";
+    cdebug << "Value" << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR kind "
+           << aDataValue->type()->kind() ;
     break;
   }
   }
   cdebug << endl ;
-#endif
   if ( pthread_mutex_unlock( &_MutexWait ) ) {
     perror( "unlock DataValue" ) ;
     exit( 0 ) ;
@@ -180,8 +341,14 @@ CORBA::Any const * GraphBase::DataPort::Value() const {
   const CORBA::Any *const Value = *_Value ;
   CORBA::Any * theValue ;
 //  cdebug  << pthread_self() << " Value " << NodeName() << " " << PortName() << " "
-//          << PortType() << " _Value " << _Value << " *_Value " << *_Value  << " kind "
-//          << Value->type()->kind() << " :" << endl ;
+//          << PortType() << " _Value " << _Value << " *_Value " << *_Value  << " Value->type "
+//          << Value->type() ;
+  if ( Value->type() ) {
+//    cdebug << " kind " << Value->type()->kind() << " :" << endl ;
+  }
+  else {
+//    cdebug << " Null" << endl ;
+  }
   if ( Done() ) {
     theValue = new CORBA::Any( *Value ) ;
     switch ( theValue->type()->kind() ) {
@@ -218,8 +385,8 @@ CORBA::Any const * GraphBase::DataPort::Value() const {
       break;
     }
     default: {
-      cdebug << "GraphBase::DataPort::Value() : "
-             << "(other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
+      cdebug << "GraphBase::DataPort::Value() : " << NodeName() << "( " << PortName() << " ) " << PortType()
+             << " (other(tk_string,tk_double,tk_long,tk_objref)) ERROR" << endl ;
       break;
     }
     }
index b88d1353a92eac9092714b1c7e1b1029c9156505..ae2a873be9b242c87640cae534b4d8dfd08a1ed3 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_EndOfLoopNode.hxx"
 
@@ -39,7 +39,7 @@ GraphBase::EndOfLoopNode::EndOfLoopNode( CORBA::ORB_ptr ORB ,
                                const long   X ,
                                const long   Y ,
                                int * Graph_prof_debug ,
-                               ostream * Graph_fdebug ) :
+                               ofstream * Graph_fdebug ) :
   GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName , 
                                  anInitPythonFunction ,
                                  NodeName , akind , NodeFirstCreation ,
index 2e3de4b5124be0155cb7524cbaf08e63617e9aec..70b1fa07e8231e058c03eb725e00e46b391106f6 100644 (file)
@@ -38,7 +38,7 @@ namespace GraphBase {
                 const long   X ,
                 const long   Y ,
                 int * Graph_prof_debug = NULL ,
-                ostream * Graph_fdebug = NULL ) ;
+                ofstream * Graph_fdebug = NULL ) ;
       virtual ~EndOfLoopNode() ;
 
   };
index da5459ac31b07b3e32e161cac6b5cb6f6b053bb0..dc3e23caf3f03db4bf23d536570d5f2b3bb8dc1d 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_EndOfSwitchNode.hxx"
 
@@ -39,7 +39,7 @@ GraphBase::EndOfSwitchNode::EndOfSwitchNode( CORBA::ORB_ptr ORB ,
                                    const long   X ,
                                    const long   Y ,
                                    int * Graph_prof_debug ,
-                                   ostream * Graph_fdebug ) :
+                                   ofstream * Graph_fdebug ) :
   GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName ,
                                  aPythonFunction ,
                                  NodeName , akind , NodeFirstCreation ,
index 501b7cf466b1ebeeaf4bdd4faf13b79d717c8d70..f36263455430534af9b16bb0f61141f72a507db1 100644 (file)
@@ -38,7 +38,7 @@ namespace GraphBase {
                   const long   X ,
                   const long   Y ,
                   int * Graph_prof_debug = NULL ,
-                  ostream * Graph_fdebug = NULL ) ;
+                  ofstream * Graph_fdebug = NULL ) ;
       virtual ~EndOfSwitchNode() ;
 
   };
index 52d09f5e0ec29a4cded1b36bfebb0a65a80b61cc..309573568adb91610b58309d080ac50cf57edeb1 100644 (file)
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_FactoryNode.hxx"
 
 static void InitFields( char *              &_ComponentName ,
                         char *              &_InterfaceName ,
                         char *              &_Computer ) {
-  time_t T = time(NULL);
-  struct tm * Tm = localtime(&T);
-
   _ComponentName = NULLSTRING ;
   _InterfaceName = NULLSTRING ;
 
@@ -48,7 +45,7 @@ GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
                        SALOME_NamingService* ptrNamingService ,
                        const char * aDataFlowName ,
                        int * Graph_prof_debug ,
-                       ostream * Graph_fdebug ) :
+                       ofstream * Graph_fdebug ) :
   GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
                                            Graph_prof_debug , Graph_fdebug ) {
 
@@ -70,11 +67,11 @@ GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
 }
 
 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
-                       SALOME_NamingService* ptrNamingService ,
+                       SALOME_NamingService * ptrNamingService ,
                        const SALOME_ModuleCatalog::Service& aService ,
-                       const char *ComponentName ,
-                       const char* InterfaceName ,
-                       const char *NodeName ,
+                       const char * ComponentName ,
+                       const char * InterfaceName ,
+                       const char * NodeName ,
                        const SUPERV::KindOfNode akind ,
                        const SUPERV::SDate NodeFirstCreation ,
                        const SUPERV::SDate NodeLastModification  ,
@@ -86,7 +83,7 @@ GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
                        const long   X ,
                        const long   Y ,
                        int * Graph_prof_debug ,
-                       ostream * Graph_fdebug ) :
+                       ofstream * Graph_fdebug ) :
   GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
                                            NodeName , akind ,
                                            NodeFirstCreation , NodeLastModification  ,
@@ -103,16 +100,16 @@ GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
   _InterfaceName = new char[strlen(InterfaceName)+1];
   strcpy(_InterfaceName , InterfaceName ) ;
 
-  if ( NodeComputer ) {
+  if ( NodeComputer != NULLSTRING) {
     _Computer = new char[ strlen( NodeComputer ) + 1 ] ;
     strcpy( _Computer  , NodeComputer ) ;
   }
-  else
+  else {
     _Computer = FACTORYSERVER ;
+  }
 
-  cdebug_in << "GraphBase::FactoryNode::FactoryNode(" << aService.ServiceName << ","
-            << ComponentName << "," << Name() << "," << akind
-            << "," << NodeComputer << "," << Comment() << ")" << endl;
+  cdebug_in << "GraphBase::FactoryNode::FactoryNode( '" << aService.ServiceName << "','"
+            << _ComponentName << "','" << Name() << "'," << akind << ",'" << _Computer << "'" << endl;
   
   cdebug << "GraphBase::FactoryNode::FactoryNode "  << this 
        << " _ComponentName " 
@@ -121,8 +118,8 @@ GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
        << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
        << (void *) Name() << " '" << Name() << "' _Computer "
        << (void *) _Computer << " "  << _Computer << " _Comment "
-       << (void *) Comment() << " "  << Comment() << " " 
-       << " KindOfNode " << Kind()
+       << (void *) Comment() << " '"  << Comment() << " " 
+       << "' KindOfNode " << Kind()
        << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
        << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
 
index 7c7e03d92e20d594c11d50ccdc2cff37245a0277..e4d86a8c732887c2a9d7e58834130f7541fef700 100644 (file)
@@ -35,7 +35,7 @@ namespace GraphBase {
             SALOME_NamingService* ptrNamingService ,
             const char * DataFlowName ,
             int * Graph_prof_debug = NULL ,
-            ostream * Graph_fdebug = NULL ) ;
+            ofstream * Graph_fdebug = NULL ) ;
       FactoryNode( CORBA::ORB_ptr ORB ,
             SALOME_NamingService* ptrNamingService ,
             const SALOME_ModuleCatalog::Service& NodeService ,
@@ -53,7 +53,7 @@ namespace GraphBase {
             const long   X ,
             const long   Y ,
             int * Graph_prof_debug = NULL ,
-            ostream * Graph_fdebug = NULL ) ;
+            ofstream * Graph_fdebug = NULL ) ;
       virtual ~FactoryNode() ;
 
       Engines::Container_var Container() const { return _Container ; } ;
index 1aba05f7e85871ad1460c552a700c558352a0719..e31dee649b4dc6a92a9232dc5f15158d8c8412bd 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_GOTONode.hxx"
 
@@ -40,7 +40,7 @@ GraphBase::GOTONode::GOTONode( CORBA::ORB_ptr ORB ,
                                const long   X ,
                                const long   Y ,
                                int * Graph_prof_debug ,
-                               ostream * Graph_fdebug ) :
+                               ofstream * Graph_fdebug ) :
   GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , FuncName , aPythonFunction ,
                                      NodeName , akind , NodeFirstCreation ,
                                      NodeLastModification  , NodeEditorRelease ,
index b3aa9c9d979faa620e8248248d2392ff1ca00165..97089aa88038927d3d74533dd8a1b978729f602b 100644 (file)
@@ -40,7 +40,7 @@ namespace GraphBase {
                   const long   X ,
                   const long   Y ,
                   int * Graph_prof_debug = NULL ,
-                  ostream * Graph_fdebug = NULL ) ;
+                  ofstream * Graph_fdebug = NULL ) ;
       virtual ~GOTONode() ;
 
       void CoupledNode( InLineNode * aCoupledNode ) {
index f9db952346299809c3f25d204bf05c3658c6b368..c57f950284bdd7b23397b71b568b9df17d4d2545 100644 (file)
@@ -42,26 +42,26 @@ GraphBase::Graph::Graph( CORBA::ORB_ptr ORB ,
                          const char *DataFlowName ,
                          const char * DebugFileName ) :
            DataNode( ORB ,ptrNamingService , DataFlowName ) {
-  cdebug << "GraphBase::Graph::Graph" << endl ;
+  Set_prof_debug( ORB , DebugFileName ) ;
+  cdebug << "GraphBase::Graph::Graph( " << DataFlowName << ")" << endl ;
   _Orb = CORBA::ORB::_duplicate( ORB ) ;
   _GraphNodesSize = 0 ;
-  Set_prof_debug( ORB , DebugFileName ) ;
 }
 
 GraphBase::Graph::Graph( CORBA::ORB_ptr ORB ,
                          SALOME_NamingService* ptrNamingService ,
-             const SALOME_ModuleCatalog::Service& DataFlowService ,
-             const char *DataFlowComponentName ,
-             const char *DataFlowInterfaceName ,
-             const char *DataFlowName ,
-             const SUPERV::KindOfNode DataFlowkind ,
-             const SUPERV::SDate DataFlowFirstCreation ,
-             const SUPERV::SDate DataFlowLastModification ,
-             const char * DataFlowEditorRelease ,
-             const char * DataFlowAuthor ,
-             const char * DataFlowComputer ,
-             const char * DataFlowComment ,
-             const char * DebugFileName ) :
+                         const SALOME_ModuleCatalog::Service& DataFlowService ,
+                         const char *DataFlowComponentName ,
+                         const char *DataFlowInterfaceName ,
+                         const char *DataFlowName ,
+                         const SUPERV::KindOfNode DataFlowkind ,
+                         const SUPERV::SDate DataFlowFirstCreation ,
+                         const SUPERV::SDate DataFlowLastModification ,
+                         const char * DataFlowEditorRelease ,
+                         const char * DataFlowAuthor ,
+                         const char * DataFlowComputer ,
+                         const char * DataFlowComment ,
+                         const char * DebugFileName ) :
            DataNode( ORB , ptrNamingService , DataFlowService ,
                      DataFlowName , DataFlowkind ,
                      DataFlowFirstCreation , DataFlowLastModification  ,
@@ -84,10 +84,9 @@ void GraphBase::Graph::Set_prof_debug( CORBA::ORB_ptr ORB ,
   if ( DebugFileName ) {
     _Graph_fdebug = new ofstream( DebugFileName );
     MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl)
+    SetDebug( ORB , &_Graph_prof_debug , _Graph_fdebug ) ;
   }
-  else
-    _Graph_fdebug = &(std::cerr);
-  SetDebug( ORB , &_Graph_prof_debug , _Graph_fdebug ) ;
+  cdebug << "GraphBase::Graph::Set_prof_debug redirect Trace to file " << DebugFileName << endl ;
 }
 
 GraphBase::SNode * GraphBase::Graph::GetInfo() const {
@@ -251,7 +250,7 @@ GraphBase::ListOfNodes * GraphBase::Graph::GetNodes() const {
 // Function : GetLinks
 // Purpose  : get a links list
 //----------------------------------------------------------------------
-GraphBase::ListOfLinks * GraphBase::Graph::GetLinks() const {
+GraphBase::ListOfLinks * GraphBase::Graph::GetLinks(bool AllLinks ) const {
   GraphBase::ListOfLinks * _list_links = 
                                new GraphBase::ListOfLinks;
 
@@ -261,31 +260,42 @@ GraphBase::ListOfLinks * GraphBase::Graph::GetLinks() const {
   int ind = 0 ;
   int k ;
   for ( k = 0 ; k < GraphNodesSize() ; k++ ) {
-    GraphBase::ComputingNode * aNode = GraphNodes( k ) ;
+    GraphBase::ComputingNode * fromNode = GraphNodes( k ) ;
     int i ;
-    for ( i = 0 ; i < aNode->GetNodeOutPortsSize() ; i++ ) {
-      const GraphBase::OutPort* fromPort = aNode->GetNodeOutPort( i ) ;
-//      cout << "GraphBase::Graph::GetLinks " << aNode->Name() << " "
-//           << fromPort->PortName() << " " << fromPort->IsPortConnected()
-//           << " " << fromPort->InPortsSize() << endl ;
-      if ( fromPort->IsPortConnected() ) {
+    for ( i = 0 ; i < fromNode->GetNodeOutPortsSize() ; i++ ) {
+      const GraphBase::OutPort* fromPort = fromNode->GetNodeOutPort( i ) ;
+//      if ( fromPort->IsPortConnected() && ( !fromPort->IsLoop() || AllLinks ) ) {
         int j ;
         for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
-          _list_links->resize( ind+1 );
-          (*_list_links)[ind].FromNodeName = CORBA::string_dup( aNode->Name() );
-          (*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
           const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
-          (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
-          (*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
-          (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
-          if ( toPort->IsEndSwitch() ) {
-            (*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ;
+// Desole pour ce cast mais avec les maps difficile de faire const ...
+          const GraphBase::ComputingNode * toNode = ((GraphBase::Graph * ) this)->GetGraphNode( toPort->NodeName() ) ;
+          if ( !(fromPort->IsLoop() && toPort->IsLoop() ) || AllLinks ) {
+            cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " ("
+                   << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
+                   << " --> " << toNode->Name() << "( " << toPort->PortName() << " ) "
+                   << " " << fromPort->InPortsSize() << " ports" << endl ;
+            _list_links->resize( ind+1 );
+            (*_list_links)[ind].FromNodeName = CORBA::string_dup( fromNode->Name() );
+            (*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
+            (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
+            (*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
+            (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
+            if ( toPort->IsEndSwitch() ) {
+              (*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ;
+           }
+            else {
+              (*_list_links)[ind++].aListOfCoords = *(toPort->Coords()) ;
+           }
          }
           else {
-            (*_list_links)[ind++].aListOfCoords = *(toPort->Coords()) ;
+            cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " "
+                   << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
+                   << " --> " << toNode->Name() << "( " << toPort->PortName() << " ) "
+                   << " " << fromPort->InPortsSize() << " ports ignored" << endl ;
          }
         }
-      }
+//      }
     }
   }
 
@@ -562,7 +572,7 @@ bool GraphBase::Graph::AddLink(
                        const char* ToServiceParameterName ,
                        const CORBA::Any aValue ) {
   bool RetVal ;
-  int index ;
+//  int index ;
   cdebug_in << "GraphBase::Graph::AddLink(" << FromNodeName << "("
             << FromServiceParameterName << ") ---> " << ToNodeName << "("
             << ToServiceParameterName << ") )" << endl;
@@ -617,7 +627,7 @@ bool GraphBase::Graph::AddLink(
                         GraphBase::OutPort *fromPort ,
                         GraphBase::ComputingNode *toNode ,
                         GraphBase::InPort *toPort ) {
-  bool RetVal ;
+//  bool RetVal ;
 
   if ( !fromNode ) {
     cdebug << "AddLink fromNode not found." << endl ;
@@ -789,8 +799,8 @@ bool GraphBase::Graph::RemoveLink( const char* FromNodeName ,
                                    const char* FromServiceParameterName ,
                                   const char* ToNodeName ,
                                    const char* ToServiceParameterName ) {
-  cdebug_in << "GraphBase::Graph::RemoveLink to " << ToNodeName << "("
-            << ToServiceParameterName << ")" << endl;
+  cdebug_in << "GraphBase::Graph::RemoveLink from " << FromNodeName << "(" << FromServiceParameterName << ")"
+            << " to " << ToNodeName << "(" << ToServiceParameterName << ")" << endl;
   bool RetVal = false ;
   GraphBase::ComputingNode * toNode = GetChangeGraphNode( ToNodeName ) ;
   if ( toNode ) {
@@ -802,11 +812,35 @@ bool GraphBase::Graph::RemoveLink( const char* FromNodeName ,
       anInPort->RemoveOutPort() ;
       const char * FromNodeName = anOutPort->NodeName() ;
       GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ;
-      if ( fromNode ) {
-        fromNode->RemoveLink( toNode ) ;
-      }
-      if ( fromNode->IsSwitchNode() ) {
-        anOutPort->Kind( SUPERV::InLineParameter ) ;
+      if ( RetVal ) {
+        if ( fromNode ) {
+          fromNode->RemoveLink( toNode ) ;
+        }
+        if ( fromNode->IsSwitchNode() ) {
+          anOutPort->Kind( SUPERV::InLineParameter ) ;
+        }
+#if 0
+        if ( fromNode->IsEndLoopNode() ) {
+          toNode = ((GraphBase::EndOfLoopNode * ) fromNode)->CoupledNode() ;
+          if ( toNode ) {
+            anInPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
+            RetVal = AddLink( fromNode , anOutPort , toNode , anInPort ) ;
+         }
+          else {
+            RetVal = false ;
+         }
+       }
+        if ( toNode->IsLoopNode() ) {
+          fromNode = ((GraphBase::LoopNode * ) toNode)->CoupledNode() ;
+          if ( fromNode ) {
+            anOutPort = fromNode->GetChangeOutPort( FromServiceParameterName ) ;
+            RetVal = AddLink( fromNode , anOutPort , toNode , toNode->GetChangeInPort( ToServiceParameterName ) ) ;
+         }
+          else {
+            RetVal = false ;
+         }
+       }
+#endif
       }
     }
   }
@@ -926,12 +960,12 @@ bool GraphBase::Graph::AddInputData( const char* ToNodeName ,
   return RetVal ;
 }
 
-bool GraphBase::Graph::ChangeInputData( const char* ToNodeName ,
-                                        const char* ToServiceParameterName ,
+bool GraphBase::Graph::ChangeInputData( const char * ToNodeName ,
+                                        const char * ToServiceParameterName ,
                                         const CORBA::Any aValue ) {
   bool RetVal = false ;
-  cdebug_in << "GraphBase::Graph::ChangeInputData(" << ToNodeName << ","
-            << ToServiceParameterName << " Any " ;
+  cdebug_in << "GraphBase::Graph::ChangeInputData( '" << ToNodeName << "' , '"
+            << ToServiceParameterName << "' , Any " ;
   switch (aValue.type()->kind()) {
     case CORBA::tk_string:
       char * t;
@@ -980,7 +1014,7 @@ bool GraphBase::Graph::ChangeInputData( const char* ToNodeName ,
     }
   }
   else {
-    cdebug << "ChangeInputData Node not found" << endl ;
+    cdebug << "ChangeInputData Node not found : " << ToNodeName << endl ;
   }
 
   cdebug_out << "GraphBase::Graph::ChangeInputData" << endl;
@@ -1117,10 +1151,10 @@ bool GraphBase::Graph::AddOutputData(
 
 bool GraphBase::Graph::CreateService() {
   cdebug_in << "GraphBase::Graph::CreateService" << endl;
-
+  bool RetVal = true ;
   SALOME_ModuleCatalog::Service aService ;
   int i , j ;
-  GraphBase::ComputingNode * iN ;
+  GraphBase::ComputingNode * aToNode ;
   int dostore ;
   int innbr ;
   int outnbr ;
@@ -1135,18 +1169,34 @@ bool GraphBase::Graph::CreateService() {
     innbr = 0 ;
     outnbr = 0 ;
     for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-      iN = GraphNodes( i ) ;
-      for ( j = 0 ; j < iN->GetNodeInPortsSize() ; j++ ) {
-        GraphBase::InPort *anInPort = iN->GetChangeNodeInPort(j) ;
-        if ( !anInPort->IsConnected() && !anInPort->IsGate() ) {
-//             !anInPort->IsLoop() ) {
-//        if ( !anInPort->IsGate() && !anInPort->IsConnected() &&
-//             !( iN->IsLoopNode() && anInPort->IsBus() && anInPort->IsParam() )) {
+      aToNode = GraphNodes( i ) ;
+      for ( j = 0 ; j < aToNode->GetNodeInPortsSize() ; j++ ) {
+        GraphBase::InPort *anInPort = aToNode->GetChangeNodeInPort(j) ;
+#if 0
+        if ( dostore == 0 &&
+             strcmp( anInPort->ServicesParameterType() , "string" ) &&
+             strcmp( anInPort->ServicesParameterType() , "long" ) &&
+             strcmp( anInPort->ServicesParameterType() , "double" ) &&
+             strcmp( anInPort->ServicesParameterType() , "objref" ) ) {
+          cdebug << "CreateService Node " << aToNode->Name() << ". Input port " << anInPort->PortName()
+                 << " has illegal type " << anInPort->ServicesParameterType() << endl ;
+          RetVal = false ;
+       }
+#endif
+        bool isfromcouplednode = false ;
+        if ( anInPort->IsConnected() && anInPort->GetOutPort() ) {
+          GraphBase::ComputingNode * aFromNode = GetChangeGraphNode( anInPort->GetOutPort()->NodeName() ) ;
+          if ( aFromNode->IsEndLoopNode() && ((GraphBase::EndOfLoopNode * ) aFromNode)->CoupledNode() == aToNode ) {
+            isfromcouplednode = true ;
+         }
+       }
+        if ( !anInPort->IsGate() && !anInPort->IsLoop() &&
+             ( !anInPort->IsConnected() || ( anInPort->IsConnected() && isfromcouplednode ) ) ) {
           if ( dostore == 0 ) {
-            cdebug << "CreateService " << iN->Name() << " Input port "
-                   << anInPort->PortName() << " is NOT connected " ;
+            cdebug << "CreateService " << aToNode->Name() << " Input port "
+                   << anInPort->PortName() << " " << anInPort->Kind() << " is NOT connected " ;
             if ( anInPort->GetOutPort() ) {
-              cdebug <<  *(anInPort->GetOutPort()) ;
+              cdebug << "DataConnected from " <<  *(anInPort->GetOutPort() ) ;
            }
             cdebug << endl ;
             innbr += 1 ;
@@ -1156,15 +1206,53 @@ bool GraphBase::Graph::CreateService() {
             aService.ServiceinParameter[innbr++].Parametername = CORBA::string_dup( anInPort->NodePortName() ) ;
          }
         }
+        else {
+          cdebug << "CreateService " << aToNode->Name() << " Input port " << anInPort->PortName() ;
+          if ( anInPort->IsConnected() ) {
+            cdebug << " is connected " ;
+         }
+          else {
+            cdebug << " is NOT connected " ;
+         }
+          if ( anInPort->IsGate() ) {
+            cdebug << " IsGate " ;
+         }
+          if ( anInPort->GetOutPort() ) {
+            cdebug << "DataConnected from " <<  *(anInPort->GetOutPort()) ;
+         }
+          else {
+            cdebug << "NOT DataConnected" ;
+         }
+          cdebug << endl ;
+       }
       }
-      if ( !iN->IsGOTONode() ) {
-        for ( j = 0 ; j < iN->GetNodeOutPortsSize() ; j++ ) {
-          GraphBase::OutPort *anOutPort = iN->GetChangeNodeOutPort(j) ;
+      GraphBase::ComputingNode * aFromNode = aToNode ;
+      for ( j = 0 ; j < aFromNode->GetNodeOutPortsSize() ; j++ ) {
+        GraphBase::OutPort *anOutPort = aFromNode->GetChangeNodeOutPort(j) ;
+        cdebug << "CreateService Node " << aFromNode->Name() << ". Output port[" << j << "] ";
+        if ( anOutPort ) {
+          cdebug << anOutPort->PortName() << " " << anOutPort->ServicesParameterType() << endl ;
+       }
+        else {
+          cdebug << " NULL" << endl ;
+       }
+#if 0
+        if ( dostore == 0 &&
+             strcmp( anOutPort->ServicesParameterType() , "string" ) &&
+             strcmp( anOutPort->ServicesParameterType() , "long" ) &&
+             strcmp( anOutPort->ServicesParameterType() , "double" ) &&
+             strcmp( anOutPort->ServicesParameterType() , "objref" ) ) {
+          cdebug << "CreateService Node " << aFromNode->Name() << ". Output port " << anOutPort->PortName()
+                 << " has illegal type " << anOutPort->ServicesParameterType() << endl ;
+          RetVal = false ;
+        }
+#endif
+        if ( !aFromNode->IsGOTONode() ) {
           if ( !anOutPort->IsGate() && 
-//!anOutPort->IsLoop() &&
-//               !( iN->IsEndLoopNode() && anOutPort->IsBus() ) &&
                ( anOutPort->IsNotConnected() || anOutPort->IsDataConnected() ) ) {
             if ( dostore == 0 ) {
+              cdebug << "CreateService " << aFromNode->Name() << " Output port "
+                     << anOutPort->PortName() << endl ;
               outnbr += 1 ;
            }
             else {
@@ -1195,12 +1283,10 @@ bool GraphBase::Graph::CreateService() {
 
 // Restore input datas :
   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-//    iN = (GraphEditor::InNode * ) GraphNodes( i ) ;
-    iN = GraphNodes( i ) ;
-    for ( j = 1 ; j < iN->GetNodeInPortsSize() ; j++ ) {
-      GraphBase::InPort *anInPort = iN->GetChangeNodeInPort(j) ;
+    aToNode = GraphNodes( i ) ;
+    for ( j = 0 ; j < aToNode->GetNodeInPortsSize() ; j++ ) {
+      GraphBase::InPort *anInPort = aToNode->GetChangeNodeInPort(j) ;
       if ( anInPort->IsDataConnected() ) {
-//        GraphBase::Graph::AddInputData( anInPort->NodeName() ,
         AddInputData( anInPort->NodeName() ,
                       anInPort->PortName() ,
                       anInPort->GetOutPort()->ValuePtr() ) ;
@@ -1209,7 +1295,7 @@ bool GraphBase::Graph::CreateService() {
   }
 
   cdebug_out << "GraphBase::Graph::CreateService" << endl;
-  return true ;
+  return RetVal ;
 }
 
 bool GraphBase::Graph::InLineServices() {
@@ -1307,7 +1393,7 @@ bool GraphBase::Graph::Sort() {
                << _CnxInPortsNumber[ i ] << endl ;
         if ( !_Sorted[ i ] && _CnxInPortsNumber[ i ] == 0 ) {
 // All inputs of GraphNodes( i ) are available
-          if ( _NodesNumber.size() != _LevelsNumber+1 ) {
+          if ( (int ) _NodesNumber.size() != _LevelsNumber+1 ) {
             _NodesNumber.resize( _LevelsNumber+1 ) ;
             _SortedNodes.resize( _LevelsNumber+1 ) ;
             _NodesNumber[ _LevelsNumber ] = -1 ;
@@ -1493,25 +1579,25 @@ bool GraphBase::Graph::ComputingNodes() const {
   cdebug << "GraphExecutor::GraphControl::ComputingNodes ()" << endl;
 
 //  list<GraphEditor::Node *> aComputingNodesList = _G->ComputingNodesList() ;
-//  list<GraphEditor::Node *>::iterator iN = aComputingNodesList.begin();
+//  list<GraphEditor::Node *>::iterator aNode = aComputingNodesList.begin();
 //  GraphEditor::Port *  iP;
 
-//  for (iN = _G->ComputingNodesList().begin(); iN !=_G->ComputingNodesList().end(); iN++) {
-//  while ( iN != aComputingNodesList.end() ) {
+//  for (aNode = _G->ComputingNodesList().begin(); aNode !=_G->ComputingNodesList().end(); aNode++) {
+//  while ( aNode != aComputingNodesList.end() ) {
   int i ;
-  GraphBase::ComputingNode * iN ;
+  GraphBase::ComputingNode * aNode ;
   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-    iN = GraphNodes( i ) ;
+    aNode = GraphNodes( i ) ;
     // Tous les ports d'entree de tous les noeuds de calcul sont bien connectes
     // Enregistrement eventuel dans la liste des noeuds "tete" de graphe
-//    if ((*iN)->GetNodeInPortsSize() == 0)
-//      _headNodes.push_front(*iN);
+//    if ((*aNode)->GetNodeInPortsSize() == 0)
+//      _headNodes.push_front(*aNode);
     int j ;
-    for ( j = 1; j < iN->GetNodeInPortsSize() ; j++ ) {
-      const GraphBase::InPort *iP = iN->GetNodeInPort(j);
+    for ( j = 1 ; j < aNode->GetNodeInPortsSize() ; j++ ) {
+      const GraphBase::InPort *iP = aNode->GetNodeInPort(j);
       if ( !iP->IsConnected() ){
        cdebug << "Le port d'entree " << iP->PortName()
-               << " du noeud de calcul " << iN->Name() << " du graphe  "
+               << " du noeud de calcul " << aNode->Name() << " du graphe  "
                << Name() << " n'est pas connecte "<< endl;
         RetVal = false ;
       };
@@ -1520,21 +1606,21 @@ bool GraphBase::Graph::ComputingNodes() const {
 
     // Tous les noeuds de calcul ont au moins un port de sortie connecte
     bool oneOutPortConnected = false;
-    for ( j = 1; j < iN->GetNodeOutPortsSize() ; j++) {
-      const GraphBase::OutPort *iP = iN->GetNodeOutPort(j);
+    for ( j = 1 ; j < aNode->GetNodeOutPortsSize() ; j++) {
+      const GraphBase::OutPort *iP = aNode->GetNodeOutPort(j);
       if ( iP->IsPortConnected() || iP->IsDataConnected() ){
        oneOutPortConnected = true ;
 //     break;
       }
       else {
        cdebug << "Le port de sortie " << iP->PortName()
-               << " du noeud de calcul " << iN->Name() << " du graphe  "
+               << " du noeud de calcul " << aNode->Name() << " du graphe  "
                << Name() << " n'est pas connecte "<< endl;
         RetVal = false ;
       }
     };
     if (!oneOutPortConnected) {
-       cdebug << "Le noeud de calcul " << iN->Name() << " du graphe  "
+       cdebug << "Le noeud de calcul " << aNode->Name() << " du graphe  "
                << Name() << " n'a aucun port de sortie connecte "<< endl;
 //     _computingError.push_front(2);
     }
@@ -1543,6 +1629,67 @@ bool GraphBase::Graph::ComputingNodes() const {
   return RetVal ;
 }
 
+bool GraphBase::Graph::LinkLoopNodes(bool & NewLink ) {
+  bool RetVal = true ;
+  NewLink = false ;
+  int i , j ;
+  cdebug_in << "GraphBase::Graph::LinkLoopNodes()" << endl;
+  for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+    GraphBase::ComputingNode * aNode = GraphNodes( i ) ;
+    if ( aNode->IsLoopNode() ) {
+      GraphBase::LoopNode * aLoopNode = (GraphBase::LoopNode * ) aNode ;
+      for ( j = 0 ; j < aLoopNode->GetNodeInPortsSize() ; j++ ) {
+        GraphBase::InPort *anInPort = aLoopNode->GetChangeNodeInPort(j) ;
+        if ( !anInPort->IsGate() && !anInPort->IsConnected() && !anInPort->IsDataConnected() ) {
+          if ( !AddLink( aLoopNode->CoupledNode() , aLoopNode->CoupledNode()->GetChangeNodeOutPort( j ) ,
+                         aLoopNode , anInPort ) ) {
+            cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->CoupledNode()->Name()
+                   << "( " << aLoopNode->CoupledNode()->GetChangeNodeOutPort( j )->PortName() << " ) --> "
+                   << aLoopNode->Name() << "( " << anInPort->PortName() << " )" << endl ;
+            RetVal = false ;
+         }
+          else {
+            NewLink = true ;
+         }
+       }
+      }
+      for ( j = 0 ; j < aLoopNode->CoupledNode()->GetNodeInPortsSize() ; j++ ) {
+        GraphBase::InPort *anInPort = aLoopNode->CoupledNode()->GetChangeNodeInPort( j ) ;
+        if ( !anInPort->IsConnected() ) {
+          if ( !AddLink( aLoopNode , aLoopNode->GetChangeNodeOutPort( j ) ,
+                         aLoopNode->CoupledNode() , anInPort ) ) {
+            cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->Name() << "( "
+                   << aLoopNode->GetChangeNodeOutPort( j )->PortName() << " ) --> "
+                   << aLoopNode->CoupledNode()->Name() << "( " << anInPort->PortName() << " )" << endl ;
+            RetVal = false ;
+         }
+          else {
+            NewLink = true ;
+         }
+       }
+      }
+    }
+    else if ( aNode->IsGOTONode() ) {
+      GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) aNode ;
+      GraphBase::OutPort *anOutGate = aGOTONode->GetChangeNodeOutGate() ;
+      if ( !anOutGate->IsConnected() ) {
+        if ( !AddLink( aGOTONode , anOutGate ,
+                       aGOTONode->CoupledNode() , aGOTONode->CoupledNode()->GetChangeNodeInGate() ) ) {
+          cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aGOTONode->Name() << "( "
+                 << anOutGate->PortName() << " ) --> " << aGOTONode->CoupledNode()->Name() << "( "
+                 << aGOTONode->CoupledNode()->GetChangeNodeInGate()->PortName() << " )" << endl ;
+          RetVal = false ;
+       }
+        else {
+          NewLink = true ;
+       }
+      }
+    }
+  }
+  cdebug_out << "GraphBase::Graph::LinkLoopNodes() " << RetVal << endl;
+  return RetVal ;
+}
+
 // Controle de la coherence des noeuds de calcul
 // Enregistrement dans la liste des noeuds "tete" de graphe
 
@@ -1568,32 +1715,32 @@ bool GraphBase::Graph::DataServerNodes() const {
   ierr = CheckDataServerNodes() ;
 
 //  list<GraphExecutor::InNode *> aComputingNodesList = _G->ComputingNodesList() ;
-//  list<GraphExecutor::InNode *>::iterator iN = aComputingNodesList.begin();
+//  list<GraphExecutor::InNode *>::iterator aNode = aComputingNodesList.begin();
   if ( GraphNodesSize() == 0 ) {
     ierr++ ;
   }
   else {
-    GraphBase::ComputingNode * iN ;
+    GraphBase::ComputingNode * aNode ;
     for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-      iN = GraphNodes( i ) ;
-//  while ( iN != aComputingNodesList.end() ) {
-      if ( iN->IsFactoryNode() ) {
-      GraphBase::FactoryNode * FiN = (GraphBase::FactoryNode * ) iN ;
-        if ( !strlen( FiN->Computer() ) ) {
-          cdebug << "ComputerName missing for node " << FiN->Name() ;
-          if ( !strlen( FiN->Computer() ) ) {
+      aNode = GraphNodes( i ) ;
+//  while ( aNode != aComputingNodesList.end() ) {
+      if ( aNode->IsFactoryNode() ) {
+      GraphBase::FactoryNode * FaNode = (GraphBase::FactoryNode * ) aNode ;
+        if ( !strlen( FaNode->Computer() ) ) {
+          cdebug << "ComputerName missing for node " << FaNode->Name() ;
+          if ( !strlen( FaNode->Computer() ) ) {
             ierr++ ;
             cdebug << endl ;
           }
           else {
-            cdebug << ". " << FiN->Computer() << " will be used." << endl ;
+            cdebug << ". " << FaNode->Computer() << " will be used." << endl ;
           }
        }
     }
 // For Outputs of the DataFlow :
-      for ( j = 0 ; j < iN->GetNodeOutPortsSize() ; j++ ) {
-        if ( !iN->GetNodeOutPort(j)->IsConnected() ) {
-        iN->AddLink( (GraphBase::ComputingNode *) this ) ;
+      for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+        if ( !aNode->GetNodeOutPort(j)->IsConnected() ) {
+          aNode->AddLink( (GraphBase::ComputingNode *) this ) ;
         }
       }
     }
index 4be973908cb87da4b2559e24fd30db2f351d5325..9b585d4c1c5d4c5fc882ad7802653a21dcd47cc5 100644 (file)
@@ -45,7 +45,7 @@ namespace GraphBase {
     private:
 
       int                 _Graph_prof_debug;
-      ostream           * _Graph_fdebug;
+      ofstream          * _Graph_fdebug;
       CORBA::ORB_ptr      _Orb ;
       SUPERV::Graph_var   _Graph ;
       Graph_Impl        * _GraphImpl ;
@@ -103,8 +103,11 @@ namespace GraphBase {
 
       void Set_prof_debug( CORBA::ORB_ptr ORB ,
                            const char * DebugFileName ) ;
-      int * Graph_prof_debug() { return &_Graph_prof_debug ; } ;
-      ostream * Graph_fdebug() { return _Graph_fdebug ; } ;
+      int * Graph_prof_debug() {
+//            MESSAGE( "Graph_prof_debug _Graph_prof_debug " << &_Graph_prof_debug << " _Graph_fdebug "
+//                     << _Graph_fdebug ) ;
+            return &_Graph_prof_debug ; } ;
+      ofstream * Graph_fdebug() { return _Graph_fdebug ; } ;
 
       SUPERV::Graph_var ObjRef() const { return _Graph ; } ;
       void SetObjRef( SUPERV::Graph_var aGraph ) {
@@ -214,7 +217,7 @@ namespace GraphBase {
 
       GraphBase::SNode * GetInfo() const ;
       GraphBase::ListOfNodes * GetNodes() const ;
-      GraphBase::ListOfLinks * GetLinks() const ;
+      GraphBase::ListOfLinks * GetLinks(bool AllLinks = false ) const ;
       GraphBase::ListOfGraphs * GetGraphs() const ;
       GraphBase::ListOfLinks * GetDatas() const ;
 //      SALOME_ModuleCatalog::Service * GetService() const ;
@@ -264,6 +267,7 @@ namespace GraphBase {
 
       bool Sort() ;
       bool ComputingNodes() const ;
+      bool LinkLoopNodes(bool & NewLink ) ;
       bool DataServerNodes() const ;
   
       long LevelMax() {
index b6285e696ec4d93d3a9622ee8c7600f3b33fd396..e182718d04dd54681bccc2faf3b08581931ae816 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_InLineNode.hxx"
 
@@ -24,7 +24,7 @@ GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
                                    SALOME_NamingService* ptrNamingService ,
                                    const char * aDataFlowName ,
                                    int * Graph_prof_debug ,
-                                   ostream * Graph_fdebug ) :
+                                   ofstream * Graph_fdebug ) :
   GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
                                            Graph_prof_debug , Graph_fdebug ) {
   _PythonFunction = SUPERV::ListOfStrings() ;
@@ -48,7 +48,7 @@ GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
                                    const long   X ,
                                    const long   Y ,
                                    int * Graph_prof_debug ,
-                                   ostream * Graph_fdebug ) :
+                                   ofstream * Graph_fdebug ) :
   GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
                                            NodeService ,
                                            NodeName , akind , NodeFirstCreation ,
@@ -85,7 +85,7 @@ GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
                                    const long   X ,
                                    const long   Y ,
                                    int * Graph_prof_debug ,
-                                   ostream * Graph_fdebug ) :
+                                   ofstream * Graph_fdebug ) :
   GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
                                            SALOME_ModuleCatalog::Service() ,
                                            NodeName , akind , NodeFirstCreation ,
@@ -131,8 +131,11 @@ GraphBase::InLineNode::~InLineNode() {
 void GraphBase::InLineNode::SetPythonFunction( const char * FuncName ,
                                                const SUPERV::ListOfStrings & aPythonFunction ) {
   int i ;
-  cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length()
-         << endl ;
+  cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length() ;
+  if ( aPythonFunction.length() == 1 ) {
+    cdebug << " aPythonFunction[ 0 ] '" << aPythonFunction[ 0 ] << "'" ;
+  }
+  cdebug << endl ;
   _FuncName = my_strdup( FuncName ) ;
   if ( ( aPythonFunction.length() == 0 ) ||
          ( aPythonFunction.length() == 1 && strlen( aPythonFunction[ 0 ] ) == 0 ) ) {
@@ -140,7 +143,7 @@ void GraphBase::InLineNode::SetPythonFunction( const char * FuncName ,
   }
   else {
     _PythonFunction.length( aPythonFunction.length() ) ;
-    for ( i = 0 ; i < aPythonFunction.length() ; i++ ) {
+    for ( i = 0 ; i < (int ) aPythonFunction.length() ; i++ ) {
       cdebug << aPythonFunction[ i ] << endl ;
       _PythonFunction[ i ] = CORBA::string_dup( aPythonFunction[ i ] ) ;
     }
index e818348880fa3f3adf612da43e3596f944e6f9be..0e341765dbad95ccd52fd08905043779fffa0c59 100644 (file)
@@ -33,7 +33,7 @@ namespace GraphBase {
                   SALOME_NamingService* ptrNamingService ,
                   const char * DataFlowName ,
                   int * Graph_prof_debug = NULL ,
-                  ostream * Graph_fdebug = NULL ) ;
+                  ofstream * Graph_fdebug = NULL ) ;
       InLineNode( CORBA::ORB_ptr ORB ,
                   SALOME_NamingService* ptrNamingService ,
                   const SALOME_ModuleCatalog::Service& NodeService ,
@@ -48,7 +48,7 @@ namespace GraphBase {
                   const long   X ,
                   const long   Y ,
                   int * Graph_prof_debug = NULL ,
-                  ostream * Graph_fdebug = NULL ) ;
+                  ofstream * Graph_fdebug = NULL ) ;
       InLineNode( CORBA::ORB_ptr ORB ,
                   SALOME_NamingService* ptrNamingService ,
                   const char * FuncName ,
@@ -64,7 +64,7 @@ namespace GraphBase {
                   const long   X ,
                   const long   Y ,
                   int * Graph_prof_debug = NULL ,
-                  ostream * Graph_fdebug = NULL ) ;
+                  ofstream * Graph_fdebug = NULL ) ;
       virtual ~InLineNode() ;
 
       void SetPythonFunction( const char * FuncName ,
index 497270dc01440c50b6f5c5ca57a11484ba172329..6aa2f797fcdd1ee5d90abf68010dbed87b74fc21 100644 (file)
@@ -44,7 +44,7 @@ namespace GraphBase {
     public:   
 
       InPort() {
-           cout << "InPort()" << endl ;
+//           cout << "InPort()" << endl ;
            _State = SUPERV::UndefinedState ;
            _OutPort = NULL ;
            _InitialOutPort = NULL ;
index 5166dec5259bb52d87f7010699b3e10dc361fd92..aa87e3021b23ae59e650d80331d8aeb60fe81b3c 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_LoopNode.hxx"
 
@@ -43,7 +43,7 @@ GraphBase::LoopNode::LoopNode( CORBA::ORB_ptr ORB ,
                                const long   X ,
                                const long   Y ,
                                int * Graph_prof_debug ,
-                               ostream * Graph_fdebug ) :
+                               ofstream * Graph_fdebug ) :
   GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , InitName , anInitPythonFunction ,
                                  NodeName , akind , NodeFirstCreation ,
                                  NodeLastModification  , NodeEditorRelease ,
index 08054aca64069dcb92d6f815e8e06d77bd1b24f1..833aeed39b98cb8aa7a4f59f4b7b9bd01530fc28 100644 (file)
@@ -49,7 +49,7 @@ namespace GraphBase {
                 const long   X ,
                 const long   Y ,
                 int * Graph_prof_debug = NULL ,
-                ostream * Graph_fdebug = NULL ) ;
+                ofstream * Graph_fdebug = NULL ) ;
       virtual ~LoopNode() ;
 
       void SetMorePythonFunction( const char * MoreName ,
index 2e773b6e49446eae96628c3780ba330162f10cb5..14a89f54232cb49f538d9f56a6826dc2cce01422 100644 (file)
@@ -39,7 +39,7 @@ bool GraphBase::Port::AddCoord( const int index ,
     return false ;
   }
   else {
-    if ( index <= 0 || index > _X.size()+1 )
+    if ( index <= 0 || index > (int ) _X.size()+1 )
       return false ;
     _X.resize( _X.size()+1 ) ;
     _Y.resize( _Y.size()+1 ) ;
@@ -66,7 +66,7 @@ bool GraphBase::Port::ChangeCoord( const int index ,
     return false ;
   }
   else {
-    if ( index <= 0 || index > _X.size() )
+    if ( index <= 0 || index > (int ) _X.size() )
       return false ;
     _X[ index - 1 ] = x ;
     _Y[ index - 1 ] = y ;
@@ -85,10 +85,10 @@ bool GraphBase::Port::RemoveCoord( const int index ) {
     return false ;
   }
   else {
-    if ( index <= 0 || index > _X.size() )
+    if ( index <= 0 || index > (int ) _X.size() )
       return false ;
     int i ;
-    for ( i = index - 1 ; i < _X.size() - 1 ; i++ ) {
+    for ( i = index - 1 ; i < (int ) _X.size() - 1 ; i++ ) {
       _X[ i ] = _X[ i+1 ] ;
       _Y[ i ] = _Y[ i+1 ] ;
     }
@@ -126,7 +126,7 @@ bool GraphBase::Port::GetCoord( int *x , int *y ) const {
     return false ;
   }
   else {
-    for ( i = 0 ; i < _X.size() ; i++ ) {
+    for ( i = 0 ; i < (int ) _X.size() ; i++ ) {
       x[ i ] = _X[ i ] ;
       y[ i ] = _Y[ i ] ;
     }
@@ -139,7 +139,7 @@ const GraphBase::ListOfCoords * GraphBase::Port::Coords() const {
   int i ;
   if ( !IsEndSwitch() ) {
     _list_Coords->resize( _X.size() );
-    for ( i = 0 ; i < _X.size() ; i++ ) {
+    for ( i = 0 ; i < (int ) _X.size() ; i++ ) {
       (*_list_Coords)[ i ].theX = _X[ i ] ;
       (*_list_Coords)[ i ].theY = _Y[ i ] ;
     }
@@ -152,7 +152,7 @@ bool GraphBase::Port::GetCoord( const int index , long &x , long &y ) const {
     return false ;
   }
   else {
-    if ( index <= 0 || index > _X.size() )
+    if ( index <= 0 || index > (int ) _X.size() )
       return false ;
     x = _X[ index - 1 ] ;
     y = _Y[ index - 1 ] ;
@@ -168,24 +168,30 @@ bool GraphBase::Port::GetCoord( const int index , long &x , long &y ) const {
 
 ostream & operator<< (ostream & f ,const SUPERV::KindOfPort & s ) {
   switch (s) {
+  case SUPERV::UndefinedParameter :
+    f << "UndefinedParameter";
+    break;
   case SUPERV::ServiceParameter :
     f << "ServiceParameter";
     break;
   case SUPERV::GateParameter :
     f << "GateParameter";
     break;
-  case SUPERV::LoopParameter :
-    f << "LoopParameter";
-    break;
   case SUPERV::InLineParameter :
     f << "InLineParameter";
     break;
+  case SUPERV::LoopParameter :
+    f << "LoopParameter";
+    break;
   case SUPERV::SwitchParameter :
     f << "SwitchParameter";
     break;
   case SUPERV::EndSwitchParameter :
     f << "EndSwitchParameter";
     break;
+  case SUPERV::GOTOParameter :
+    f << "GOTOParameter";
+    break;
   default :
     f << "UnknownKindOfPort";
     break;
index 72c842772e91af803b2c0251eb19218ccb024a46..ddee288874e49c16567ab990e82a0d6fe387e15a 100644 (file)
@@ -48,7 +48,7 @@ namespace GraphBase {
     public:   
 
     Port() {
-         cout << "Port()" << endl ;
+//         cout << "Port()" << endl ;
          _NodeName = NULL ;
          _Port = SUPERV::Port::_nil() ;
          _KindOfPort = SUPERV::UndefinedParameter ;
index a06b2a036ebf311e613861a0d1425b9510d0959d..da89abd630f548a37dece445954927ad044c7f95 100644 (file)
@@ -31,16 +31,18 @@ using namespace std;
 
 GraphBase::PortsOfNode::PortsOfNode() :
   GraphBase::Service::Service( SALOME_ModuleCatalog::Service() ) {
-  cdebug << "GraphBase::PortsOfNode::PortsOfNode "  << this 
-         << endl ;
+//  MESSAGE( "GraphBase::PortsOfNode::PortsOfNode "  << this ) ;
+//  cout << "GraphBase::PortsOfNode::PortsOfNode "  << this << endl ;
+//  cdebug << "GraphBase::PortsOfNode::PortsOfNode "  << this << endl ;
   _NodeInPortsSize = 0 ;
   _NodeOutPortsSize = 0 ;
 }
 
 GraphBase::PortsOfNode::PortsOfNode( const char *DataFlowName ) :
   GraphBase::Service::Service( SALOME_ModuleCatalog::Service() ) {
-  cdebug << "GraphBase::PortsOfNode::PortsOfNode "  << this 
-         << endl ;
+//  MESSAGE( "GraphBase::PortsOfNode::PortsOfNode "  << this ) ;
+//  cout << "GraphBase::PortsOfNode::PortsOfNode "  << this << endl ;
+//  cdebug << "GraphBase::PortsOfNode::PortsOfNode "  << this << endl ;
   _NodeInPortsSize = 0 ;
   _NodeOutPortsSize = 0 ;
 }
@@ -62,12 +64,8 @@ void GraphBase::PortsOfNode::DefPortsOfNode(
                            const SALOME_ModuleCatalog::Service& aService ,
                            const char *const * NodeName ,
                            const SUPERV::KindOfNode aKind ,
-//                           const bool DataFlowOrComputing ,
-//                           const bool WithInLoop ,
-//                           const bool WithInGate ,
-//                           const bool WithOutGate ,
                            int * Graph_prof_debug ,
-                           ostream * Graph_fdebug ) {
+                           ofstream * Graph_fdebug ) {
   int i ;
   cdebug_in << "DefPortsOfNode : " << *NodeName << endl ;
   const bool DataFlowOrComputing = (aKind == SUPERV::DataFlowNode) ||
@@ -116,26 +114,6 @@ void GraphBase::PortsOfNode::DefPortsOfNode(
 
   int iVec = 0 ;
   _NodeInPortsSize = aService.ServiceinParameter.length() ;
-  if ( WithInGate ) {
-    SALOME_ModuleCatalog::ServicesParameter anInGateParameter ;
-    _NodeInPortsSize = _NodeInPortsSize + 1 ;
-    iVec += 1 ;
-    char *aParametername = "InGate" ;
-    if ( aKind == SUPERV::EndSwitchNode ) {
-      aParametername = "Default" ;
-    }
-    anInGateParameter.Parametertype = CORBA::string_dup( "bool" ) ;
-    anInGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
-    _NodeInPorts.resize( _NodeInPortsSize );
-    _MapOfNodeInPorts[ aParametername ] = iVec ;
-    _NodeInPorts[iVec-1] = new GraphBase::InPort( NodeName , anInGateParameter ,
-                                                  SUPERV::GateParameter );
-//    _NodeInPorts[iVec-1]->Kind( SUPERV::GateParameter ) ;
-    _NodeInPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-    cdebug << "DefPortsOfNode : " << "_MapOfNodeInPorts[ " << aParametername
-           << " ] = " << iVec << " " << _NodeInPorts[iVec-1]->Kind() << " "
-            << _NodeInPorts[iVec-1]  << endl ;
-  }
   if ( WithInLoop ) {
     SALOME_ModuleCatalog::ServicesParameter anInLoopParameter ;
     _NodeInPortsSize = _NodeInPortsSize + 1 ;
@@ -144,21 +122,21 @@ void GraphBase::PortsOfNode::DefPortsOfNode(
     if ( aKind == SUPERV::EndLoopNode ) {
       aParametername = "DoLoop" ;
     }
-    anInLoopParameter.Parametertype = CORBA::string_dup( "bool" ) ;
+    anInLoopParameter.Parametertype = CORBA::string_dup( "long" ) ;
     anInLoopParameter.Parametername = CORBA::string_dup( aParametername ) ;
-    if ( _NodeInPortsSize > _NodeInPorts.size() ) {
+    if ( _NodeInPortsSize > (int ) _NodeInPorts.size() ) {
       _NodeInPorts.resize( _NodeInPortsSize );
     }
     _MapOfNodeInPorts[ aParametername ] = iVec ;
     _NodeInPorts[iVec-1] = new GraphBase::InPort( NodeName , anInLoopParameter ,
                                                   SUPERV::LoopParameter );
-//    _NodeInPorts[iVec-1]->Kind( SUPERV::LoopParameter ) ;
+//    MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
     _NodeInPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
     cdebug << "DefPortsOfNode : " << "_MapOfNodeInPorts[ " << aParametername
            << " ] = " << iVec << " " << _NodeInPorts[iVec-1]->Kind() << " "
             << _NodeInPorts[iVec-1]  << endl ;
   }
-  if ( _NodeInPortsSize > _NodeInPorts.size() ) {
+  if ( _NodeInPortsSize > (int ) _NodeInPorts.size() ) {
     _NodeInPorts.resize(_NodeInPortsSize);
   }
   cdebug << "NodeInPortsSize " << _NodeInPortsSize << endl ;
@@ -181,53 +159,55 @@ void GraphBase::PortsOfNode::DefPortsOfNode(
       const SALOME_ModuleCatalog::ServicesParameter aServiceParameter = aService.ServiceinParameter[i-iVec] ;
       _NodeInPorts[i] = new GraphBase::InPort( NodeName , aServiceParameter ,
                                                aPortKind );
+//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
       _NodeInPorts[i]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
       cdebug << i << ". " << *_NodeInPorts[i] << " " << _NodeInPorts[i]->Kind() << endl ;
     }
   }
-  
-  iVec = 0 ;
-  _NodeOutPortsSize = aService.ServiceoutParameter.length() ;
-  if ( WithOutGate ) {
-    SALOME_ModuleCatalog::ServicesParameter anOutGateParameter ;
-    _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
+  iVec += aService.ServiceinParameter.length() ;
+  if ( WithInGate ) {
+    SALOME_ModuleCatalog::ServicesParameter anInGateParameter ;
+    _NodeInPortsSize = _NodeInPortsSize + 1 ;
     iVec += 1 ;
-    char *aParametername = "OutGate" ;
-    if ( aKind == SUPERV::SwitchNode ) {
+    char *aParametername = "InGate" ;
+    if ( aKind == SUPERV::EndSwitchNode ) {
       aParametername = "Default" ;
     }
-    anOutGateParameter.Parametertype = CORBA::string_dup( "bool" ) ;
-    anOutGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
-    _NodeOutPorts.resize(_NodeOutPortsSize);
-    _MapOfNodeOutPorts[ aParametername ] = iVec ;
-    _NodeOutPorts[iVec-1] = new GraphBase::OutPort( NodeName , anOutGateParameter ,
-                                                    SUPERV::GateParameter );
-//    _NodeOutPorts[iVec-1]->Kind( SUPERV::GateParameter ) ;
-    _NodeOutPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-    cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername
-           << " ] = " << iVec << " " << _NodeOutPorts[iVec-1]->Kind() << " "
-            << _NodeOutPorts[iVec-1]  << endl ;
+    anInGateParameter.Parametertype = CORBA::string_dup( "long" ) ;
+    anInGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
+    _NodeInPorts.resize( _NodeInPortsSize );
+    _MapOfNodeInPorts[ aParametername ] = iVec ;
+    _NodeInPorts[iVec-1] = new GraphBase::InPort( NodeName , anInGateParameter ,
+                                                  SUPERV::GateParameter );
+//    MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
+    _NodeInPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+    cdebug << "DefPortsOfNode : " << "_MapOfNodeInPorts[ " << aParametername
+           << " ] = " << iVec << " " << _NodeInPorts[iVec-1]->Kind() << " "
+            << _NodeInPorts[iVec-1]  << endl ;
   }
+  
+  iVec = 0 ;
+  _NodeOutPortsSize = aService.ServiceoutParameter.length() ;
   if ( WithInLoop ) {
     SALOME_ModuleCatalog::ServicesParameter anOutLoopParameter ;
     _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
     iVec += 1 ;
     char *aParametername = "DoLoop" ;
-    anOutLoopParameter.Parametertype = CORBA::string_dup( "bool" ) ;
+    anOutLoopParameter.Parametertype = CORBA::string_dup( "long" ) ;
     anOutLoopParameter.Parametername = CORBA::string_dup( aParametername ) ;
-    if ( _NodeOutPortsSize > _NodeOutPorts.size() ) {
+    if ( _NodeOutPortsSize > (int ) _NodeOutPorts.size() ) {
       _NodeOutPorts.resize(_NodeOutPortsSize);
     }
     _MapOfNodeOutPorts[ aParametername ] = iVec ;
     _NodeOutPorts[iVec-1] = new GraphBase::OutPort( NodeName , anOutLoopParameter ,
                                                     SUPERV::LoopParameter );
-//    _NodeOutPorts[iVec-1]->Kind( SUPERV::LoopParameter ) ;
+//    MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
     _NodeOutPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
     cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername
            << " ] = " << iVec << " " << _NodeOutPorts[iVec-1]->Kind() << " "
             << _NodeOutPorts[iVec-1]  << endl ;
   }
-  if ( _NodeOutPortsSize > _NodeOutPorts.size() ) {
+  if ( _NodeOutPortsSize > (int ) _NodeOutPorts.size() ) {
     _NodeOutPorts.resize(_NodeOutPortsSize);
   }
   cdebug << "NodeOutPortsSize " << _NodeOutPortsSize << endl ;
@@ -250,22 +230,43 @@ void GraphBase::PortsOfNode::DefPortsOfNode(
       const SALOME_ModuleCatalog::ServicesParameter aServiceParameter = aService.ServiceoutParameter[i-iVec] ;
       _NodeOutPorts[i] = new GraphBase::OutPort( NodeName , aServiceParameter ,
                                                  aPortKind );
+//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
       _NodeOutPorts[i]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
       cdebug << i << ". " << *_NodeOutPorts[i] << " " << _NodeOutPorts[i]->Kind() << endl ;
     }
   }
+  iVec += aService.ServiceoutParameter.length() ;
+  if ( WithOutGate ) {
+    SALOME_ModuleCatalog::ServicesParameter anOutGateParameter ;
+    _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
+    iVec += 1 ;
+    char *aParametername = "OutGate" ;
+    if ( aKind == SUPERV::SwitchNode ) {
+      aParametername = "Default" ;
+    }
+    anOutGateParameter.Parametertype = CORBA::string_dup( "long" ) ;
+    anOutGateParameter.Parametername = CORBA::string_dup( aParametername ) ;
+    _NodeOutPorts.resize(_NodeOutPortsSize);
+    _MapOfNodeOutPorts[ aParametername ] = iVec ;
+    _NodeOutPorts[iVec-1] = new GraphBase::OutPort( NodeName , anOutGateParameter ,
+                                                    SUPERV::GateParameter );
+//    MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << aParametername << " --> SetDebug" ) ;
+    _NodeOutPorts[iVec-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+    cdebug << "DefPortsOfNode : " << "_MapOfNodeOutPorts[ " << aParametername
+           << " ] = " << iVec << " " << _NodeOutPorts[iVec-1]->Kind() << " "
+            << _NodeOutPorts[iVec-1]  << endl ;
+  }
   cdebug_out << "DefPortsOfNode : " << *NodeName << endl ;
 }
 
-GraphBase::InPort * GraphBase::PortsOfNode::AddInPort(
-                                            CORBA::ORB_ptr ORB ,
-                                            const char *const * NodeName ,
-                                            const SUPERV::KindOfNode aKind ,
-                                            const char * InputParameterName ,
-                                            const char * InputParameterType ,
-                                            int * Graph_prof_debug ,
-                                            ostream * Graph_fdebug ) {
-  cdebug_in << "DefPortsOfNode::InPort : " << *NodeName << " " << aKind << " "
+GraphBase::InPort * GraphBase::PortsOfNode::AddInPort( CORBA::ORB_ptr ORB ,
+                                                       const char *const * NodeName ,
+                                                       const SUPERV::KindOfNode aKind ,
+                                                       const char * InputParameterName ,
+                                                       const char * InputParameterType ,
+                                                       int * Graph_prof_debug ,
+                                                       ofstream * Graph_fdebug ) {
+  cdebug_in << "DefPortsOfNode::AddInPort : " << *NodeName << " " << aKind << " "
             << InputParameterName << " " << InputParameterType << endl ;
   GraphBase::InPort * anInPort = NULL ;
   if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
@@ -279,36 +280,53 @@ GraphBase::InPort * GraphBase::PortsOfNode::AddInPort(
     if ( anInPort == NULL ) {
       _NodeInPortsSize = _NodeInPortsSize + 1 ;
       _NodeInPorts.resize(_NodeInPortsSize);
-      _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize ;
       SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
       aServiceParameter.Parametername = InputParameterName ;
       aServiceParameter.Parametertype = InputParameterType ;
       SUPERV::KindOfPort aPortKind = SUPERV::ServiceParameter ;
-      _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName ,
-                                                                aServiceParameter ,
-                                                                aPortKind ) ;
-      _NodeInPorts[_NodeInPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
-      _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-      anInPort = _NodeInPorts[_NodeInPortsSize-1] ;
+      if ( aKind != SUPERV::EndLoopNode ) {
+        _NodeInPorts[ _NodeInPortsSize-1 ] = _NodeInPorts[ _NodeInPortsSize-2 ] ; // Gate - Default
+        _MapOfNodeInPorts.erase( _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ) ;
+        _MapOfNodeInPorts[ _NodeInPorts[ _NodeInPortsSize-1 ]->PortName() ] =  _NodeInPortsSize-1 + 1 ;
+        _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-2 + 1 ;
+        _NodeInPorts[_NodeInPortsSize-2] = new GraphBase::InPort( NodeName ,
+                                                                  aServiceParameter ,
+                                                                  aPortKind ) ;
+        _NodeInPorts[_NodeInPortsSize-2]->Kind( SUPERV::InLineParameter ) ;
+//        MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ;
+        _NodeInPorts[_NodeInPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+        anInPort = _NodeInPorts[_NodeInPortsSize-2] ;
+        cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
+      }
+      else {
+        _MapOfNodeInPorts[ InputParameterName ] = _NodeInPortsSize-1 + 1 ;
+        _NodeInPorts[_NodeInPortsSize-1] = new GraphBase::InPort( NodeName ,
+                                                                  aServiceParameter ,
+                                                                  aPortKind ) ;
+        _NodeInPorts[_NodeInPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
+//        MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << InputParameterName << " --> SetDebug" ) ;
+        _NodeInPorts[_NodeInPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+        anInPort = _NodeInPorts[_NodeInPortsSize-1] ;
+        cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
+      }
     }
     else {
       cdebug << "InPort already exists" << endl ;
     }
   }
-  cdebug_out << "DefPortsOfNode::InPort _NodeInPortsSize " << _NodeInPortsSize
+  cdebug_out << "DefPortsOfNode::AddInPort _NodeInPortsSize " << _NodeInPortsSize
              << " " << anInPort->Kind() << endl ;
   return anInPort ;
 }
 
-GraphBase::OutPort * GraphBase::PortsOfNode::AddOutPort(
-                                             CORBA::ORB_ptr ORB ,
-                                             const char *const * NodeName ,
-                                             const SUPERV::KindOfNode aKind ,
-                                             const char * OutputParameterName ,
-                                             const char * OutputParameterType ,
-                                             int * Graph_prof_debug ,
-                                             ostream * Graph_fdebug ) {
-  cdebug_in << "DefPortsOfNode::OutPort : " << *NodeName << " " << aKind << " "
+GraphBase::OutPort * GraphBase::PortsOfNode::AddOutPort( CORBA::ORB_ptr ORB ,
+                                                         const char * const * NodeName ,
+                                                         const SUPERV::KindOfNode aKind ,
+                                                         const char * OutputParameterName ,
+                                                         const char * OutputParameterType ,
+                                                         int * Graph_prof_debug ,
+                                                         ofstream * Graph_fdebug ) {
+  cdebug_in << "DefPortsOfNode::AddOutPort : " << *NodeName << " " << aKind << " "
             << OutputParameterName << " " << OutputParameterType << endl ;
   GraphBase::OutPort * anOutPort = NULL ;
   if ( aKind == SUPERV::InLineNode || aKind == SUPERV::LoopNode ||
@@ -319,22 +337,40 @@ GraphBase::OutPort * GraphBase::PortsOfNode::AddOutPort(
     if ( anOutPort == NULL ) {
       _NodeOutPortsSize = _NodeOutPortsSize + 1 ;
       _NodeOutPorts.resize(_NodeOutPortsSize);
-      _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize ;
       SALOME_ModuleCatalog::ServicesParameter aServiceParameter ;
       aServiceParameter.Parametername = OutputParameterName ;
       aServiceParameter.Parametertype = OutputParameterType ;
-      _NodeOutPorts[_NodeOutPortsSize-1] = new GraphBase::OutPort( NodeName ,
-                                                                   aServiceParameter ,
-                                                                   aPortKind );
-      _NodeOutPorts[_NodeOutPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
-      _NodeOutPorts[_NodeOutPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-      anOutPort = _NodeOutPorts[_NodeOutPortsSize-1] ;
+      if ( aKind == SUPERV::SwitchNode ) {
+        _NodeOutPorts[ _NodeOutPortsSize-1 ] = _NodeOutPorts[ _NodeOutPortsSize-2 ] ; // Default
+        _MapOfNodeOutPorts.erase( _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ) ;
+        _MapOfNodeOutPorts[ _NodeOutPorts[ _NodeOutPortsSize-1 ]->PortName() ] =  _NodeOutPortsSize-1 + 1 ;
+        _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize - 1 ;
+        _NodeOutPorts[_NodeOutPortsSize-2] = new GraphBase::OutPort( NodeName ,
+                                                                     aServiceParameter ,
+                                                                     aPortKind );
+        _NodeOutPorts[_NodeOutPortsSize-2]->Kind( SUPERV::InLineParameter ) ;
+//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ;
+        _NodeOutPorts[_NodeOutPortsSize-2]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+        anOutPort = _NodeOutPorts[_NodeOutPortsSize-2] ;
+        cdebug << "NodeInPorts[ " << _NodeInPortsSize-2 << " ]" << endl ;
+      }
+      else {
+        _MapOfNodeOutPorts[ OutputParameterName ] = _NodeOutPortsSize ;
+        _NodeOutPorts[_NodeOutPortsSize-1] = new GraphBase::OutPort( NodeName ,
+                                                                     aServiceParameter ,
+                                                                     aPortKind );
+        _NodeOutPorts[_NodeOutPortsSize-1]->Kind( SUPERV::InLineParameter ) ;
+//      MESSAGE( "GraphBase::PortsOfNode::DefPortsOfNode " << OutputParameterName << " --> SetDebug" ) ;
+        _NodeOutPorts[_NodeOutPortsSize-1]->SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
+        anOutPort = _NodeOutPorts[_NodeOutPortsSize-1] ;
+        cdebug << "NodeInPorts[ " << _NodeInPortsSize-1 << " ]" << endl ;
+      }
     }
     else {
       cdebug << "OutPort already exists" << endl ;
     }
   }
-  cdebug_out << "DefPortsOfNode::OutPort _NodeOutPortsSize "
+  cdebug_out << "DefPortsOfNode::AddOutPort _NodeOutPortsSize "
              << _NodeOutPortsSize << " " << anOutPort->Kind() << endl ;
   return anOutPort ;
 }
@@ -378,7 +414,7 @@ void GraphBase::PortsOfNode::DelOutPort( const char * OutputParameterName ) {
     _MapOfNodeOutPorts.erase( OutputParameterName ) ;
     _NodeOutPorts[ index ]->destroy() ;
     int i ;
-    for ( i = index ; i < _NodeOutPortsSize ; i++ ) {
+    for ( i = index ; i < _NodeOutPortsSize - 1 ; i++ ) {
       _MapOfNodeOutPorts.erase( _NodeOutPorts[ i+1 ]->PortName() ) ;
       _MapOfNodeOutPorts[ _NodeOutPorts[ i+1 ]->PortName() ] = i+1 ;
       _NodeOutPorts[ i ] = _NodeOutPorts[ i+1 ] ;
@@ -417,7 +453,7 @@ const GraphBase::OutPort *GraphBase::PortsOfNode::GetOutPort( const char *name)
  return GetChangeOutPort( name ) ;
 }
 
-GraphBase::InPort *GraphBase::PortsOfNode::GetChangeInPort( const char *name) {
+GraphBase::InPort *GraphBase::PortsOfNode::GetChangeInPort( const char * name) {
 //  cdebug_in << "GraphBase::PortsOfNode::GetChangePort " << name <<" " << way
 //            << endl;
 
@@ -435,7 +471,7 @@ GraphBase::InPort *GraphBase::PortsOfNode::GetChangeInPort( const char *name) {
   return pP;
 }
 
-GraphBase::OutPort *GraphBase::PortsOfNode::GetChangeOutPort( const char *name ) {
+GraphBase::OutPort *GraphBase::PortsOfNode::GetChangeOutPort( const char * name ) {
 //  cdebug_in << "GraphBase::PortsOfNode::GetChangePort " << name <<" " << way
 //            << endl;
 
@@ -485,7 +521,7 @@ bool GraphBase::PortsOfNode::RemoveLinks() {
 }
 #endif
 
-void GraphBase::PortsOfNode::ListPorts( ostrstream & f,
+void GraphBase::PortsOfNode::ListPorts( ostream & f,
                                         const bool klink ) const {
 
   int i ;
index 0b2263302555a6eb265ada5418a9127194d4ab24..395c81a2d50e71610bf85cd550d69b0ffb9a7563 100644 (file)
@@ -64,7 +64,7 @@ namespace GraphBase {
 //                           const bool WithInGate ,
 //                           const bool WithOutGate ,
                            int * Graph_prof_debug ,
-                           ostream * Graph_fdebug ) ;
+                           ofstream * Graph_fdebug ) ;
 
       InPort * AddInPort( CORBA::ORB_ptr ORB ,
                           const char *const * NodeName ,
@@ -72,36 +72,53 @@ namespace GraphBase {
                           const char * InputParameterName ,
                           const char * InputParameterType ,
                           int * Graph_prof_debug ,
-                          ostream * Graph_fdebug ) ;
+                          ofstream * Graph_fdebug ) ;
       OutPort * AddOutPort( CORBA::ORB_ptr ORB ,
                             const char *const * NodeName ,
                             const SUPERV::KindOfNode aKind ,
                             const char * OutputParameterName ,
                             const char * InputParameterType ,
                             int * Graph_prof_debug ,
-                            ostream * Graph_fdebug ) ;
+                            ofstream * Graph_fdebug ) ;
 //      void InOutPort( InPort * InputPort , OutPort * OutputPort ) ;
 
       void DelInPort( const char * InputParameterName ) ;
       void DelOutPort( const char * OutputParameterName ) ;
 
       const int GetNodeInPortsSize() const { return _NodeInPortsSize ; } ;
-      const InPort *GetNodeInPort(int i) const {
+      const InPort * GetNodeInLoop() const {
+                   return _NodeInPorts[0] ; } ;
+      const InPort * GetNodeInGate() const {
+                   return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
+      const InPort * GetNodeInPort(int i) const {
                    return _NodeInPorts[i] ; } ;
-      InPort *GetChangeNodeInPort(int i) const {
+      InPort * GetChangeNodeInLoop() const {
+                   return _NodeInPorts[0] ; } ;
+      InPort * GetChangeNodeInGate() const {
+                   return _NodeInPorts[GetNodeInPortsSize()-1] ; } ;
+      InPort * GetChangeNodeInPort(int i) const {
                    return _NodeInPorts[i] ; } ;
       const int GetNodeOutPortsSize() const { return _NodeOutPortsSize ; } ;
-      const OutPort *GetNodeOutPort(int i) const {
+      const OutPort * GetNodeOutLoop() const {
+                   return _NodeOutPorts[0] ; } ;
+      const OutPort * GetNodeOutGate() const {
+                   return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
+      const OutPort * GetNodeOutPort(int i) const {
                    return _NodeOutPorts[i] ; } ;
-      OutPort *GetChangeNodeOutPort(int i) const {
+      OutPort * GetChangeNodeOutLoop() const {
+                   return _NodeOutPorts[0] ; } ;
+      OutPort * GetChangeNodeOutGate() const {
+                   return _NodeOutPorts[GetNodeOutPortsSize()-1] ; } ;
+      OutPort * GetChangeNodeOutPort(int i) const {
                    return _NodeOutPorts[i] ; } ;
 
-      const InPort *GetInPort( const char *name ) ;
-      const OutPort *GetOutPort( const char *name ) ;
-      InPort *GetChangeInPort( const char *name ) ;
-      OutPort *GetChangeOutPort( const char *name ) ;
+      const InPort * GetInPort( const char *name ) ;
+      const OutPort * GetOutPort( const char *name ) ;
+      InPort * GetChangeInPort( const char *name ) ;
+      OutPort * GetChangeOutPort( const char *name ) ;
 
-      void ListPorts( ostrstream & , const bool klink = true ) const ;
+//      void ListPorts( ostream & , const bool klink = true ) const ;
+      void ListPorts( ostream & , const bool klink = true ) const ;
   };
   
 };
index 8ef3689a57d0a700197c8fd91a97618fd5edacc6..857188ce0e9e5d3b93d253f021724d655ae18aa7 100644 (file)
@@ -34,11 +34,11 @@ void GraphBase::Service::SetService( const SALOME_ModuleCatalog::Service aServic
   _Service.ServiceinParameter.length( aService.ServiceinParameter.length() ) ;
   _Service.ServiceoutParameter.length( aService.ServiceoutParameter.length() ) ;
   int i ;
-  for ( i = 0 ; i < _Service.ServiceinParameter.length() ; i++ ) {
+  for ( i = 0 ; i < (int ) _Service.ServiceinParameter.length() ; i++ ) {
     _Service.ServiceinParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceinParameter[ i ].Parametertype ) ;
     _Service.ServiceinParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceinParameter[ i ].Parametername ) ;
   }
-  for ( i = 0 ; i < _Service.ServiceoutParameter.length() ; i++ ) {
+  for ( i = 0 ; i < (int ) _Service.ServiceoutParameter.length() ; i++ ) {
     _Service.ServiceoutParameter[ i ].Parametertype = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametertype ) ;
     _Service.ServiceoutParameter[ i ].Parametername = CORBA::string_dup( aService.ServiceoutParameter[ i ].Parametername ) ;
   }
@@ -49,7 +49,7 @@ void GraphBase::Service::SetService( const SALOME_ModuleCatalog::Service aServic
 ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) {
   f << "Name          " << s.ServiceName << endl ;
   int i ;
-  for ( i = 0 ; i < s.ServiceinParameter.length() ; i++ ) {
+  for ( i = 0 ; i < (int ) s.ServiceinParameter.length() ; i++ ) {
     if ( i == 0 )
       f << "                 Inparameters  " << i ;
     else
@@ -57,7 +57,7 @@ ostream & operator<< (ostream & f ,const SALOME_ModuleCatalog::Service & s ) {
     f << ". " << s.ServiceinParameter[i].Parametername
       << ". " << s.ServiceinParameter[i].Parametertype << endl ;
   }
-  for ( i = 0 ; i < s.ServiceoutParameter.length() ; i++ ) {
+  for ( i = 0 ; i < (int ) s.ServiceoutParameter.length() ; i++ ) {
     if ( i == 0 )
       f << "                 Outparameters " << i ;
     else
index 4283b53ed86ab3787832a72b4122204dec38aab9..e6b7b057b55911b59014658b55d6186855522581 100644 (file)
@@ -44,6 +44,8 @@ namespace GraphBase {
 
     Service( const SALOME_ModuleCatalog::Service aService ) {
              SetService( aService ) ;
+//             MESSAGE( "GraphBase::Service::Service : " << _Service ) ;
+//             cout << "GraphBase::Service::Service : " << _Service << endl ;
              cdebug << "GraphBase::Service::Service : " << _Service << endl ;
              } ;
     Service( const char * aServiceName ) {
@@ -51,7 +53,7 @@ namespace GraphBase {
              cdebug << "GraphBase::Service::Service : " << _Service << endl ;
              _Instance = 0 ; } ;
     virtual ~Service() {
-             MESSAGE( "GraphBase::Service::~Service" );
+             cdebug << "GraphBase::Service::~Service" << endl ;
              } ;
 
     void SetService( const SALOME_ModuleCatalog::Service aService ) ;
index 411abe66bb7df12755dc4062931548f11d3fcb03..e75a394f9ce897803e017d359c139fc820878346 100644 (file)
@@ -10,8 +10,8 @@
 //  $Header:
 
 using namespace std;
-#include <strstream>
-#include <iostream>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowBase_SwitchNode.hxx"
 
@@ -39,7 +39,7 @@ GraphBase::SwitchNode::SwitchNode( CORBA::ORB_ptr ORB ,
                                    const long   X ,
                                    const long   Y ,
                                    int * Graph_prof_debug ,
-                                   ostream * Graph_fdebug ) :
+                                   ofstream * Graph_fdebug ) :
   GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , FuncName , aPythonFunction ,
                                  NodeName , akind , NodeFirstCreation ,
                                  NodeLastModification  , NodeEditorRelease ,
index 4f44757b41fc28ecce645bfbe8292d674771726f..de44def36e5d39e65763b3591f5ec375f488437b 100644 (file)
@@ -38,7 +38,7 @@ namespace GraphBase {
                   const long   X ,
                   const long   Y ,
                   int * Graph_prof_debug = NULL ,
-                  ostream * Graph_fdebug = NULL ) ;
+                  ofstream * Graph_fdebug = NULL ) ;
       virtual ~SwitchNode() ;
 
   };
index 9330837d4544013b78f392ebcdd1bfff9fba0763..662a680d903424cb92f5fe94b02bba4ba6739a09 100644 (file)
@@ -80,7 +80,7 @@ bool GraphBase::XmlHandler::startElement( const QString&, const QString&,
     dataflowxml = TRUE;
   }
   if ( dataflowxml ) {
-    fieldname[depth++] = qName ;
+    fieldname[depth++] = (const char * ) qName ;
   }
   if ( depth == maxlevel+1 )
     return false ;
@@ -296,7 +296,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth3-3" , qName ) ;
 // kind ok
-            sscanf( fieldvalue[depth].c_str() ,"%d" , &aNode.theKind ) ;
+            sscanf( fieldvalue[depth].c_str() ,"%d" , (int * ) &aNode.theKind ) ;
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
             step[4] = 0 ;
@@ -375,7 +375,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             char Date[23] ;
             strcpy( Date , fieldvalue[depth].c_str() ) ;
             int i ;
-            for ( i = 0 ; i < strlen(Date) ; i++ ) {
+            for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
               if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
                 Date[i] = ' ' ;
            }
@@ -406,7 +406,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
             char Date[23] ;
             strcpy( Date , fieldvalue[depth].c_str() ) ;
             int i ;
-            for ( i = 0 ; i < strlen(Date) ; i++ ) {
+            for ( i = 0 ; i < (int ) strlen(Date) ; i++ ) {
               if ( Date[i] == '/' || Date[i] == '-' || Date[i] == ':' )
                 Date[i] = ' ' ;
            }
@@ -486,7 +486,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "x-position" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth3-14" , qName ) ;
-            sscanf( fieldvalue[depth].c_str() , "%d" , &aNode.theCoords.theX ) ;
+            sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theX ) ;
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
 // x-position ok
@@ -498,7 +498,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "y-position" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth3-15" , qName ) ;
-            sscanf( fieldvalue[depth].c_str() , "%d" , &aNode.theCoords.theY ) ;
+            sscanf( fieldvalue[depth].c_str() , "%ld" , &aNode.theCoords.theY ) ;
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
 // y-position ok
@@ -755,7 +755,7 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "coord" ) {
             if ( fieldvalue[depth] != NULLSTRING )
               return returnfalse( this , "depth4-5" , qName ) ;
-            if ( VXSize == VX.size() ) {
+            if ( VXSize == (int ) VX.size() ) {
               VX.resize( VX.size() + 10 ) ;
               VY.resize( VY.size() + 10 ) ;
            }
@@ -867,7 +867,12 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "inParameter-type" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth5-4" , qName ) ;
-            aParameter.Parametertype = fieldvalue[depth].c_str() ;
+            if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+              aParameter.Parametertype = fieldvalue[depth].c_str() ;
+           }
+            else {
+              aParameter.Parametertype = "" ;
+           }
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
           }
@@ -878,7 +883,12 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "inParameter-name" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth5-5" , qName ) ;
-            aParameter.Parametername = fieldvalue[depth].c_str() ;
+            if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+              aParameter.Parametername = fieldvalue[depth].c_str() ;
+           }
+            else {
+              aParameter.Parametername = "" ;
+           }
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
           }
@@ -889,7 +899,12 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "outParameter-type" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth5-6" , qName ) ;
-            aParameter.Parametertype = fieldvalue[depth].c_str() ;
+            if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+              aParameter.Parametertype = fieldvalue[depth].c_str() ;
+           }
+            else {
+              aParameter.Parametertype = "" ;
+           }
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
           }
@@ -900,7 +915,12 @@ bool GraphBase::XmlHandler::endElement( const QString&,
           if ( qName == "outParameter-name" ) {
             if ( fieldvalue[depth] == NULLSTRING )
               return returnfalse( this , "depth5-7" , qName ) ;
-            aParameter.Parametername = fieldvalue[depth].c_str() ;
+            if ( strcmp( fieldvalue[depth].c_str() , "?" ) ) {
+              aParameter.Parametername = fieldvalue[depth].c_str() ;
+           }
+            else {
+              aParameter.Parametername = "" ;
+           }
             fieldvalue[depth] = NULLSTRING ;
             step[depth]++ ;
           }
@@ -1039,7 +1059,7 @@ bool GraphBase::XmlHandler::characters( const QString& ch ) {
   if ( depth < 0 || fieldvalue[depth] != NULLSTRING )
     return returnfalse( this , "characters " , ch ) ;
 
-  fieldvalue[depth] = ch ;
+  fieldvalue[depth] = (const char * ) ch ;
   return TRUE;
 }
 
index 40e263912dd27cb08d888434026dedca6c48e745..73654b3268e01be71723a2ced1bf871a633cbfe4 100644 (file)
@@ -41,15 +41,20 @@ GraphEditor::DataFlow::DataFlow() :
   cdebug_out << "GraphEditor::DataFlow::DataFlowEditor()" << endl;
 }
 
+//extern ostream * fdebug ;
+
 GraphEditor::DataFlow::DataFlow( CORBA::ORB_ptr ORB,
                                  SALOME_NamingService* ptrNamingService ,
                                  const char *DataFlowName ,
                                  const char * DebugFileName ) :
   OutNode( ORB, ptrNamingService , DataFlowName , DebugFileName ) {
+//  cout << "GraphEditor::DataFlow::DataFlow(" ;
   cdebug_in << "GraphEditor::DataFlow::DataFlow(" ;
   if ( DataFlowName ) {
-    cdebug << DataFlowName ;
+//    cout << DataFlowName << " , " << DebugFileName ;
+    cdebug << DataFlowName << " , " << DebugFileName;
   }
+//  cout << ")" << endl;
   cdebug << ")" << endl;
 
   _theNamingService = ptrNamingService ;
@@ -58,6 +63,7 @@ GraphEditor::DataFlow::DataFlow( CORBA::ORB_ptr ORB,
   _Executing = false ;
 
   cdebug_out << "GraphEditor::DataFlow::DataFlow" << endl;
+//  fdebug = new ofstream( DebugFileName ); // GraphBase::Base::_fdebug ;
 }
 
 GraphEditor::DataFlow::DataFlow(
index 2209f7c2ef07e0bfdde565b14d4d4e30240d86d8..23e65b19ea39db4305c73a026b83e7e7890c8479 100644 (file)
@@ -47,10 +47,10 @@ namespace GraphEditor {
     public:
 
       DataFlow();
-      DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService ,
+      DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService ,
                 const char * DataFlowName ,
                 const char * DebugFileName );
-      DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService* ptrNamingService ,
+      DataFlow( CORBA::ORB_ptr ORB, SALOME_NamingService * ptrNamingService ,
                 const SALOME_ModuleCatalog::Service& DataFlowService ,
                 const char * DataFlowComponentName ,
                 const char * DataFlowInterfaceName ,
@@ -58,11 +58,11 @@ namespace GraphEditor {
                 const SUPERV::KindOfNode DataFlowkind = SUPERV::ComputingNode ,
                 const SUPERV::SDate DataFlowFirstCreation = SUPERV::SDate() ,
                 const SUPERV::SDate DataFlowLastModification = SUPERV::SDate() ,
-                const char * DataFlowEditorRelease = NULL ,
-                const char * DataFlowAuthor = NULL ,
-                const char * DataFlowComputer = NULL ,
-                const char * DataFlowComment = NULL ,
-                const char * DebugFileName = NULL ) ;
+                const char * DataFlowEditorRelease = NULLSTRING ,
+                const char * DataFlowAuthor = NULLSTRING ,
+                const char * DataFlowComputer = NULLSTRING ,
+                const char * DataFlowComment = NULLSTRING ,
+                const char * DebugFileName = NULLSTRING ) ;
       virtual ~DataFlow();
 
       void ReadOnly() ;
@@ -70,12 +70,12 @@ namespace GraphEditor {
       char * DataNodeInfo() ;
       char * NodeInfo( const char * aNodeName ) ;
 
-      bool LoadDataFlow( const GraphBase::SGraph *aDataFlow ) ;
-      bool LoadXml( const char* myFileName ) ;
+      bool LoadDataFlow( const GraphBase::SGraph * aDataFlow ) ;
+      bool LoadXml( const char * myFileName ) ;
       bool LoadInfo( const GraphBase::SNode &aDataFlowInfo ) ;
 
-      bool SaveXml(const char* myFileName ) ;
-      bool SavePy(const char* myFileName ) ;
+      bool SaveXml(const char * myFileName ) ;
+      bool SavePy(const char * myFileName ) ;
 
 
 //      void DateModification() ;
@@ -90,125 +90,125 @@ namespace GraphEditor {
 
       GraphEditor::InNode * AddService (
                             SALOME_ModuleCatalog::Service& aService ,
-                            const char *NodeComponentName ,
-                            const char* NodeInterfaceName ) {
+                            const char * NodeComponentName ,
+                            const char * NodeInterfaceName ) {
              return AddNode( aService , NodeComponentName ,
                              NodeInterfaceName ) ; } ;
       GraphEditor::InNode * AddNode(
                         const SALOME_ModuleCatalog::Service& NodeService ,
-                        const char* NodeComponentName ,
-                        const char* NodeInterfaceName ,
-                        const char* NodeName = NULL ,
+                        const char * NodeComponentName ,
+                        const char * NodeInterfaceName ,
+                        const char * NodeName = NULLSTRING ,
                         const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
                         GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ,
                         GraphBase::ListOfPythonFunctions aPythonFunction = GraphBase::ListOfPythonFunctions() ,
                         const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
                         const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
-                        const char * NodeEditorRelease = NULL ,
-                        const char * NodeAuthor = NULL ,
-                        const char * NodeComputer = NULL ,
-                        const char * NodeComment = NULL ,
+                        const char * NodeEditorRelease = NULLSTRING ,
+                        const char * NodeAuthor = NULLSTRING ,
+                        const char * NodeComputer = NULLSTRING ,
+                        const char * NodeComment = NULLSTRING ,
                         const int NodeX = 0 ,
                         const int NodeY = 0 ) ;
       GraphEditor::InNode * GetNode( const char* NodeName ) ;
-      bool RemoveNode( const char* NodeName ) ;
-      bool ReNameNode( const char* OldNodeName ,
-                       const char* NewNodeName ) ;
+      bool RemoveNode( const char * NodeName ) ;
+      bool ReNameNode( const char * OldNodeName ,
+                       const char * NewNodeName ) ;
 
       const SALOME_ModuleCatalog::Service * NodeService( const char * NodeName ) ;
 
       void Coordinates( const int X , const int Y ) ;
       const int XCoordinate() ;
       const int YCoordinate() ;
-      void Coordinates( const char* NodeName , const int X , const int Y ) ;
-      const int XCoordinate( const char* NodeName ) ;
-      const int YCoordinate( const char* NodeName ) ;
+      void Coordinates( const char * NodeName , const int X , const int Y ) ;
+      const int XCoordinate( const char * NodeName ) ;
+      const int YCoordinate( const char * NodeName ) ;
 
-      const GraphBase::InPort *GetInPort( const char *name ) ;
-      const GraphBase::OutPort *GetOutPort( const char *name ) ;
-      GraphBase::InPort *GetChangeInPort( const char *name ) ;
-      GraphBase::OutPort *GetChangeOutPort( const char *name ) ;
+      const GraphBase::InPort * GetInPort( const char * name ) ;
+      const GraphBase::OutPort * GetOutPort( const char * name ) ;
+      GraphBase::InPort * GetChangeInPort( const char * name ) ;
+      GraphBase::OutPort * GetChangeOutPort( const char * name ) ;
 
       bool HasInput(const char * ToServiceParameterName ) ;
 
-      bool AddLinkValue( const char *FromNodeName ,
-                         const char *FromServiceParameterName ,
-                         const char *ToNodeName ,
-                         const char *ToServiceParameterName ,
+      bool AddLinkValue( const char * FromNodeName ,
+                         const char * FromServiceParameterName ,
+                         const char * ToNodeName ,
+                         const char * ToServiceParameterName ,
                          const CORBA::Any aValue ) {
            return AddLink( FromNodeName, FromServiceParameterName , ToNodeName ,
                            ToServiceParameterName , aValue ) ; } ;
-      bool AddLink( const char* FromNodeName ,
-                    const char* FromServiceParameterName ,
-                   const char* ToNodeName ,
-                    const char* ToServiceParameterName ,
+      bool AddLink( const char * FromNodeName ,
+                    const char * FromServiceParameterName ,
+                   const char * ToNodeName ,
+                    const char * ToServiceParameterName ,
                     const CORBA::Any aValue = CORBA::Any() ) ;
 
-      bool RemoveLink( const char* FromNodeName ,
-                       const char* FromServiceParameterName ,
-                       const char* ToNodeName ,
-                       const char* ToServiceParameterName ) ;
+      bool RemoveLink( const char * FromNodeName ,
+                       const char * FromServiceParameterName ,
+                       const char * ToNodeName ,
+                       const char * ToServiceParameterName ) ;
 
-      bool GetLink(const char* ToNodeName ,
-                   const char* ToServiceParameterName ,
-                   char** FromNodeName ,
-                   char** FromServiceParameterName ) ;
+      bool GetLink(const char * ToNodeName ,
+                   const char * ToServiceParameterName ,
+                   char ** FromNodeName ,
+                   char ** FromServiceParameterName ) ;
       GraphBase::SLink * GetLink( GraphBase::ComputingNode * aNode ,
                                   const char* ToServiceParameterName ) ;
 
-      bool AddLinkCoord( const char* FromNodeName ,
-                         const char* FromServiceParameterName ,
-                         const char* ToNodeName ,
-                         const char* ToServiceParameterName ,
+      bool AddLinkCoord( const char * FromNodeName ,
+                         const char * FromServiceParameterName ,
+                         const char * ToNodeName ,
+                         const char * ToServiceParameterName ,
                          const int nXY ,
-                         const int* X ,
-                         const int* Y ) ;
-      bool AddLinkCoord( const char* FromNodeName ,
-                         const char* FromServiceParameterName ,
-                         const char* ToNodeName ,
-                         const char* ToServiceParameterName ,
+                         const int * X ,
+                         const int * Y ) ;
+      bool AddLinkCoord( const char * FromNodeName ,
+                         const char * FromServiceParameterName ,
+                         const char * ToNodeName ,
+                         const char * ToServiceParameterName ,
                          const int index ,
                          const int X ,
                          const int Y ) ;
-      bool ChangeLinkCoord( const char* FromNodeName ,
-                            const char* FromServiceParameterName ,
-                            const char* ToNodeName ,
-                            const char* ToServiceParameterName ,
+      bool ChangeLinkCoord( const char * FromNodeName ,
+                            const char * FromServiceParameterName ,
+                            const char * ToNodeName ,
+                            const char * ToServiceParameterName ,
                             const int index ,
                             const int X ,
                             const int Y ) ;
-      bool RemoveLinkCoord( const char* FromNodeName ,
-                            const char* FromServiceParameterName ,
-                            const char* ToNodeName ,
-                            const char* ToServiceParameterName ,
+      bool RemoveLinkCoord( const char * FromNodeName ,
+                            const char * FromServiceParameterName ,
+                            const char * ToNodeName ,
+                            const char * ToServiceParameterName ,
                             const int index ) ;
-      int GetLinkCoordSize( const char* FromNodeName ,
-                            const char* FromServiceParameterName ,
-                            const char* ToNodeName ,
-                            const char* ToServiceParameterName ) ;
-      bool GetLinkCoord( const char* FromNodeName ,
-                         const char* FromServiceParameterName ,
-                         const char* ToNodeName ,
-                         const char* ToServiceParameterName ,
-                         int *X , int *Y ) ;
-      bool GetLinkCoord( const char* FromNodeName ,
-                         const char* FromServiceParameterName ,
-                         const char* ToNodeName ,
-                         const char* ToServiceParameterName ,
+      int GetLinkCoordSize( const char * FromNodeName ,
+                            const char * FromServiceParameterName ,
+                            const char * ToNodeName ,
+                            const char * ToServiceParameterName ) ;
+      bool GetLinkCoord( const char * FromNodeName ,
+                         const char * FromServiceParameterName ,
+                         const char * ToNodeName ,
+                         const char * ToServiceParameterName ,
+                         int * X , int * Y ) ;
+      bool GetLinkCoord( const char * FromNodeName ,
+                         const char * FromServiceParameterName ,
+                         const char * ToNodeName ,
+                         const char * ToServiceParameterName ,
                          const int index , long &X , long &Y ) ;
 
-      bool AddInputData( const char* ToNodeName ,
-                         const char* ToParameterName ,
+      bool AddInputData( const char * ToNodeName ,
+                         const char * ToParameterName ,
                          const CORBA::Any aValue = CORBA::Any() ) ;
-      bool AddInputSharedData( const char* ToNodeName1 ,
-                               const char* ToParameterName1 ,
-                               const char* ToNodeName2 ,
-                               const char* ToParameterName2 ) ;
-
-      const CORBA::Any *GetInData( const char * ToNodeName ,
-                                   const char * ToParameterName ) ;
-      const CORBA::Any *GetOutData( const char * FromNodeName ,
-                                    const char * FromParameterName ) ;
+      bool AddInputSharedData( const char * ToNodeName1 ,
+                               const char * ToParameterName1 ,
+                               const char * ToNodeName2 ,
+                               const char * ToParameterName2 ) ;
+
+      const CORBA::Any * GetInData( const char * ToNodeName ,
+                                    const char * ToParameterName ) ;
+      const CORBA::Any * GetOutData( const char * FromNodeName ,
+                                     const char * FromParameterName ) ;
 
       bool IsValid() ;
       bool IsExecutable() ;
index b248b3b0909c8199e8e7651e340e8f8708755561..1a783e87227fbb88ab3ee199888cbaaa919318af 100644 (file)
@@ -34,31 +34,30 @@ inline void GraphEditor::DataFlow::ReadOnly() {
 }
 
 inline char * GraphEditor::DataFlow::DataFlowInfo() {
-  ostrstream s;
+  ostringstream s;
   IsValid() ;
   GraphEditor::DataFlow::DataFlow aDataFlow = *this ;
   s << aDataFlow << ends ;
-  return CORBA::string_dup( s.str() );
+  return CORBA::string_dup( s.str().c_str() );
 }
 
 inline char * GraphEditor::DataFlow::DataNodeInfo() {
-  ostrstream s;
+  ostringstream s;
   IsValid() ;
   GraphBase::DataNode::DataNodeInfo( s ) ;
-  return CORBA::string_dup(s.str());
+  return CORBA::string_dup( s.str().c_str() );
 }
 
 inline char * GraphEditor::DataFlow::NodeInfo( const char * aNodeName ) {
-  ostrstream s;
+  ostringstream s;
   if ( GetGraphNode( aNodeName ) )
     GetGraphNode( aNodeName )->NodeInfo( s ) ;
   else
     s << aNodeName << " not found" << ends ;
-  return CORBA::string_dup( s.str() );
+  return CORBA::string_dup( s.str().c_str() );
 }
 
-inline bool GraphEditor::DataFlow::LoadDataFlow(
-                       const GraphBase::SGraph *aDataFlow ) {
+inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) {
   if ( _ReadOnly )
     return false ;
   _EditedAfterExecution = true ;
@@ -135,10 +134,22 @@ inline GraphEditor::InNode * GraphEditor::DataFlow::AddNode(
                       const char * NodeComment,
                       const int NodeX,
                       const int NodeY) {
-  if ( _ReadOnly )
+  if ( NodeName != NULLSTRING && strlen( NodeName ) ) {
+//    MESSAGE( "--> GraphEditor::DataFlow::AddNode( " << NodeName << " )" ) ;
+//    cout << "--> GraphEditor::DataFlow::AddNode( " << NodeName << " )" << endl ;
+    cdebug_in << "GraphEditor::DataFlow::AddNode( " << NodeName << " )" << endl ;
+  }
+  else {
+//    MESSAGE( "--> GraphEditor::DataFlow::AddNode( NULL )" ) ;
+//    cout << "--> GraphEditor::DataFlow::AddNode( NULL )" << endl ;
+    NodeName = NULLSTRING ;
+    cdebug_in << "GraphEditor::DataFlow::AddNode( NULL )" << endl ;
+  }
+  if ( _ReadOnly ) {
     return (GraphEditor::InNode * ) NULL ;
+  }
   _EditedAfterExecution = true ;
-  return GraphEditor::OutNode::AddNode( NodeService ,
+  GraphEditor::InNode * aNode = GraphEditor::OutNode::AddNode( NodeService ,
                                         aFuncName , aPythonFunction ,
                                         NodeComponentName ,
                                         NodeInterfaceName ,
@@ -147,7 +158,11 @@ inline GraphEditor::InNode * GraphEditor::DataFlow::AddNode(
                                         NodeLastModification ,
                                         NodeEditorRelease ,
                                         NodeAuthor , NodeComputer ,
-                                        NodeComment , NodeX , NodeY ) ; 
+                                        NodeComment , NodeX , NodeY ) ;
+//  MESSAGE( "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" ) ;
+//  cout << "<-- GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ;
+  cdebug_out << "GraphEditor::DataFlow::AddNode( " << aNode->Name() << " )" << endl ;
+  return aNode ;
 } ;
 
 inline GraphEditor::InNode * GraphEditor::DataFlow::GetNode( const char* NodeName ) {
@@ -155,24 +170,27 @@ inline GraphEditor::InNode * GraphEditor::DataFlow::GetNode( const char* NodeNam
 } ;
 
 inline bool GraphEditor::DataFlow::RemoveNode( const char* NodeName ) {
-  if ( _ReadOnly )
+  if ( _ReadOnly ) {
     return false ;
+  }
   _EditedAfterExecution = true ;
   return GraphEditor::OutNode::RemoveNode( NodeName ) ; 
 } ;
 
 inline bool GraphEditor::DataFlow::ReNameNode( const char* OldNodeName ,
                                                const char* NewNodeName ) {
-  if ( _ReadOnly )
+  if ( _ReadOnly ) {
     return false ;
+  }
   _EditedAfterExecution = true ;
   return GraphEditor::OutNode::ReNameNode( OldNodeName , NewNodeName ) ; 
 } ;
 
 inline const SALOME_ModuleCatalog::Service * GraphEditor::DataFlow::NodeService(
                                              const char * aNodeName ) {
-  if ( GetGraphNode( aNodeName ) )
+  if ( GetGraphNode( aNodeName ) ) {
     return GetGraphNode( aNodeName )->GetService() ;
+  }
   return NULL ;
 }
 
@@ -224,8 +242,9 @@ inline bool GraphEditor::DataFlow::AddLink( const char* FromNodeName ,
                                            const char* ToNodeName ,
                                             const char* ToServiceParameterName ,
                                            const CORBA::Any aValue ) {
-  if ( _ReadOnly )
+  if ( _ReadOnly ) {
     return false ;
+  }
   CORBA::Any const * theValue = GetNode( FromNodeName )->GetOutPort( FromServiceParameterName )->Value() ; // Keep the type !
   _EditedAfterExecution = true ;
   return GraphEditor::OutNode::AddLink( FromNodeName ,
@@ -355,8 +374,9 @@ inline bool GraphEditor::DataFlow::RemoveLink(
                          const char* FromServiceParameterName ,
                          const char* ToNodeName ,
                          const char* ToServiceParameterName ) {
-  if ( _ReadOnly )
+  if ( _ReadOnly ) {
     return false ;
+  }
   _EditedAfterExecution = true ;
   return GraphEditor::OutNode::RemoveLink( FromNodeName ,
                                            FromServiceParameterName ,
@@ -387,8 +407,9 @@ inline bool GraphEditor::DataFlow::AddInputData( const char* ToNodeName ,
   delete aNode ;
   delete aPort ;
 #endif
-  if ( !IsValid() )
+  if ( !IsValid() ) {
     return false ;
+  }
   return GraphBase::Graph::AddInputData( ToNodeName , ToParameterName ,
                                          aValue ) ; 
 } ;
@@ -397,8 +418,9 @@ inline bool GraphEditor::DataFlow::AddInputSharedData(const char* ToNodeName1 ,
                                                       const char* ToParameterName1 ,
                                                       const char* ToNodeName2 ,
                                                       const char* ToParameterName2 ) {
-  if ( !IsValid() )
+  if ( !IsValid() ) {
     return false ;
+  }
   return GraphEditor::OutNode::AddInputData( ToNodeName1 , ToParameterName1 ,
                                              ToNodeName2 , ToParameterName2 ) ;
 } ;
@@ -456,26 +478,30 @@ inline bool GraphEditor::DataFlow::IsReadOnly() {
 }
 
 inline long GraphEditor::DataFlow::LevelMax() {
-  if ( !IsValid() )
+  if ( !IsValid() ) {
     return 0 ;
+  }
   return GraphBase::Graph::LevelMax() ;
 }
 
 inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) {
-  if ( !IsValid() )
+  if ( !IsValid() ) {
     return ((SUPERV::ListOfStrings * ) NULL ) ;
+  }
   return GraphBase::Graph::LevelNodes( aLevel ) ;
 }
 
 inline long GraphEditor::DataFlow::ThreadsMax() {
-  if ( !IsValid() )
+  if ( !IsValid() ) {
     return 0 ;
+  }
   return GraphBase::Graph::ThreadsMax() ;
 }
 
 inline long GraphEditor::DataFlow::GraphsNumber() {
-  if ( !IsValid() )
+  if ( !IsValid() ) {
     return 0 ;
+  }
   return GraphBase::Graph::GraphsNumber() ;
 }
 
index 034c99e097b880557548bd59c75072d115e9b3f6..28044aa31d82309b31a733fcf901f54c5159f76a 100644 (file)
 //  Module : SUPERV
 
 using namespace std;
-#include <string.h>
-#include <strstream>
-#include <iostream>
+//#include <string.h>
+//#include <sstream>
+//#include <iostream>
 
 #include "DataFlowEditor_InNode.hxx"
 
 GraphEditor::InNode::InNode() {
 }
 
+//ostream * fdebug = NULL ;
 GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB, 
-                            SALOME_NamingService* ptrNamingService ,
+                            SALOME_NamingService * ptrNamingService ,
                              GraphBase::ListOfFuncName aFuncName ,
                              GraphBase::ListOfPythonFunctions aPythonFunction ,
                              const SALOME_ModuleCatalog::Service& aService ,
                              const char * ComponentName ,
-                             const char* NodeInterfaceName ,
+                             const char * NodeInterfaceName ,
                              const char * NodeName ,
                              const SUPERV::KindOfNode akind ,
                              const SUPERV::SDate NodeFirstCreation ,
@@ -53,9 +54,15 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                              const int X ,
                              const int Y ,
                              int * Graph_prof_debug,
-                             ostream * Graph_fdebug) {
+                             ofstream * Graph_fdebug) {
   SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-
+//  cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
+  cdebug_in << "GraphEditor::InNode::InNode" << endl ;
+//  if ( GraphBase::Base::_fdebug )
+//    *GraphBase::Base::_fdebug << endl << "xxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
+//  if ( fdebug )
+//    (*fdebug) << endl << "xxxxxx-->" << " " << "GraphEditor::InNode::InNode" << endl ;
+//  cout << "GraphEditor::InNode::InNode GraphBase::Base::_fdebug " << GraphBase::Base::_fdebug << endl ;
   _ComputingNode = NULL ;
   _FactoryNode = NULL ;
   _InLineNode = NULL ;
@@ -66,7 +73,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
   _EndOfSwitchNode = NULL ;
   switch ( akind ) {
   case SUPERV::ComputingNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::ComputingNode : " << NodeName << endl ;
     _ComputingNode = new GraphBase::ComputingNode( ORB , ptrNamingService , aService ,
                                                    NodeName , akind ,
                                                    NodeFirstCreation ,
@@ -78,7 +85,8 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
     break ;
   }
   case SUPERV::FactoryNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName ;
+//    cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
     _FactoryNode = new GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
                                                ComponentName , NodeInterfaceName ,
                                                NodeName , akind ,
@@ -88,11 +96,12 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                                                NodeComputer , NodeComment ,
                                                GeneratedName , X , Y ,
                                                Graph_prof_debug , Graph_fdebug ) ;
+//    cout << "GraphEditor::InNode::InNode SUPERV::FactoryNode : " << NodeName << endl ;
     _ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ;
     break ;
   }
   case SUPERV::InLineNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::InLineNode : " << NodeName << endl ;
     _InLineNode = new GraphBase::InLineNode( ORB , ptrNamingService ,
                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
                                              NodeName , akind ,
@@ -105,7 +114,7 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
     break ;
   }
   case SUPERV::GOTONode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName << endl ;
     _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService ,
                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
                                          NodeName , akind ,
@@ -115,10 +124,11 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                                          X , Y ,
                                          Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::LoopNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::LoopNode : " << NodeName << endl ;
     _LoopNode = new GraphBase::LoopNode( ORB , ptrNamingService ,
                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
                                          aFuncName[1].c_str() , *aPythonFunction[1] ,
@@ -131,10 +141,11 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                                          Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::EndLoopNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfLoopNode : " << NodeName << endl ;
     _EndOfLoopNode = new GraphBase::EndOfLoopNode(
                                          ORB , ptrNamingService ,
                                          aFuncName[0].c_str() , *aPythonFunction[0] ,
@@ -146,10 +157,11 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                                          Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::SwitchNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::SwitchNode : " << NodeName << endl ;
     _SwitchNode = new GraphBase::SwitchNode( ORB , ptrNamingService ,
                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
                                              NodeName , akind ,
@@ -160,10 +172,11 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                                              Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::EndSwitchNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName ;
+    cdebug << "GraphEditor::InNode::InNode SUPERV::EndOfSwitchNode : " << NodeName << endl ;
     _EndOfSwitchNode = new GraphBase::EndOfSwitchNode(
                                              ORB , ptrNamingService ,
                                              aFuncName[0].c_str() , *aPythonFunction[0] ,
@@ -175,12 +188,19 @@ GraphEditor::InNode::InNode( CORBA::ORB_ptr ORB,
                                              Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
+  case SUPERV::DataFlowNode : {
+    cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::DataFlowNode : " << NodeName << endl ;
+  }
+  case SUPERV::UnknownNode : {
+    cdebug << "GraphEditor::InNode::InNode ERROR SUPERV::UnknownNode : " << NodeName << endl ;
+  }
   }
-  cdebug << "GraphEditor::InNode::InNode "  << (void *) this
-         << " _ComputingNode " << (void *) _ComputingNode  ;
   _ComputingNode->InNode( this ) ;
+  cdebug_out << "GraphEditor::InNode::InNode " << (void *) this
+             << " _ComputingNode " << (void *) _ComputingNode  << endl ;
 }
 
 GraphEditor::InNode::~InNode() {
index 2c8cfd9f3b2da2f3df0c6430365855563a5c924d..c94afc48bf00d144886214c2ab67e31ceddb334c 100644 (file)
@@ -71,7 +71,7 @@ namespace GraphEditor {
               const int NodeX ,
               const int NodeY ,
               int * Graph_prof_debug = NULL ,
-              ostream * Graph_fdebug = NULL ) ;
+              ofstream * Graph_fdebug = NULL ) ;
       virtual ~InNode() ;
 
       char * Name() const { return _ComputingNode->Name() ; } ;
@@ -184,17 +184,17 @@ namespace GraphEditor {
 
       GraphBase::InPort * AddInPort( const char * InputParameterName ,
                                      const char * InputParameterType ) {
-                          return _ComputingNode->AddInPort( InputParameterName ,
+                          return _InLineNode->AddInPort( InputParameterName ,
                                                             InputParameterType ) ; } ;
       GraphBase::OutPort * AddOutPort( const char * OutputParameterName ,
                                        const char * OutputParameterType ) {
-                           return _ComputingNode->AddOutPort( OutputParameterName ,
+                           return _InLineNode->AddOutPort( OutputParameterName ,
                                                               OutputParameterType ) ; } ;
 
       void DelInPort( const char * InputParameterName ) {
-           _ComputingNode->DelInPort( InputParameterName ) ; } ;
+           _InLineNode->DelInPort( InputParameterName ) ; } ;
       void DelOutPort( const char * OutputParameterName ) {
-           _ComputingNode->DelOutPort( OutputParameterName ) ; } ;
+           _InLineNode->DelOutPort( OutputParameterName ) ; } ;
 
       bool IsLinked(const char * ToServiceParameterName ) {
            return _ComputingNode->IsLinked( ToServiceParameterName ) ; } ;
index bdb00d8aed514d2314f76c0cd4252db735d57147..7b3d503d70fc5f5cf9bea633ec40d5b9cfe57ed5 100644 (file)
@@ -25,6 +25,8 @@
 //  Module : SUPERV
 
 using namespace std;
+#include <sstream>
+#include <iostream>
 #include "DataFlowEditor_OutNode.hxx"
 #include "DataFlowBase_EndOfLoopNode.hxx"
 #include "DataFlowBase_EndOfSwitchNode.hxx"
@@ -43,8 +45,8 @@ GraphEditor::OutNode::OutNode() :
 }
 
 GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB ,
-                               SALOME_NamingService* ptrNamingService ,
-                               const char *DataFlowName ,
+                               SALOME_NamingService * ptrNamingService ,
+                               const char * DataFlowName ,
                                const char * DebugFileName ) :
              Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
   cdebug_in << "GraphEditor::OutNode::OutNode(" ;
@@ -63,11 +65,11 @@ GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB ,
 
 GraphEditor::OutNode::OutNode(
                      CORBA::ORB_ptr ORB ,
-                     SALOME_NamingService* ptrNamingService ,
+                     SALOME_NamingService * ptrNamingService ,
                      const SALOME_ModuleCatalog::Service& DataFlowService ,
-                     const char *DataFlowComponentName ,
-                     const char *DataFlowInterfaceName ,
-                     const char *DataFlowName ,
+                     const char * DataFlowComponentName ,
+                     const char * DataFlowInterfaceName ,
+                     const char * DataFlowName ,
                      const SUPERV::KindOfNode DataFlowkind ,
                      const SUPERV::SDate DataFlowFirstCreation ,
                      const SUPERV::SDate DataFlowLastModification ,
@@ -95,35 +97,27 @@ GraphEditor::OutNode::~OutNode() {
 //  delete _GT ;
 }
 
-bool GraphEditor::OutNode::LoadDataFlow(
-                         const GraphBase::SGraph *aDataFlow ) {
+bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) {
   bool RetVal = false ;
   cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << aDataFlow->Info.theName.c_str()
             << endl;
-//  if ( GraphBase::Service::ServiceName() == NULL ||
-//       !strlen( GraphBase::Service::ServiceName() ) || !aConstructor ) {
   if ( !_Imported ) {
     RetVal = LoadInfo( aDataFlow->Info ) ;
     _Imported = true ;
   }
-  else
+  else {
     RetVal = true ;
+  }
 
-    map< string , int > aMapOfNodes ;
-    if ( RetVal )
-      RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ;
-    if ( RetVal )
-      RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ;
-    if ( RetVal ) {
-      Valid() ;
-      RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ;
-    }
-//  }
-//  else {
-//    cdebug << "GraphEditor::OutNode::LoadDataFlow Error. ServiceName : "
-//            << (void *) GraphBase::Service::ServiceName() << " '" 
-//           << GraphBase::Service::ServiceName() << "'" << endl ;
-//  }
+  map< string , int > aMapOfNodes ;
+  if ( RetVal )
+    RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ;
+  if ( RetVal )
+    RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ;
+  if ( RetVal ) {
+    Valid() ;
+    RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ;
+  }
   cdebug_out << "GraphEditor::OutNode::LoadDataFlow" << endl;
   return RetVal ;
 }
@@ -131,17 +125,16 @@ bool GraphEditor::OutNode::LoadDataFlow(
 bool GraphEditor::OutNode::LoadXml( const char* myFileName ) {
   bool RetVal = false ;
   GraphBase::SGraph aDataFlow ;
-  cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
   if ( myFileName == NULL ) {
+    cdebug << "GraphEditor::OutNode::LoadXml() No file" << endl;
     _Imported = true ;
     RetVal = true ;
   }
   else if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) {
+    cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
     RetVal = LoadDataFlow( &aDataFlow ) ;
-//    if ( RetVal )
-//      RetVal = Name( aDataFlow.Info.theName.c_str() ) ;
+    cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl;
   }
-  cdebug_out << "GraphEditor::OutNode::LoadXml" << endl;
   return RetVal ;
 } 
 
@@ -171,92 +164,59 @@ bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes ,
   GraphEditor::InNode * anInNode ;
   cdebug_in << "GraphEditor::OutNode::LoadNodes" << endl ;
   int i ;
-  for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
     GraphBase::SNode aNode = aListOfNodes[ i ] ;
-//    if ( aConstructor ) {
-//      anInNode = AddNode( aNode.theService , aNode.theComponentName.c_str() ,
-//                        aNode.theInterfaceName.c_str() ,
-//                        aNode.theName.c_str() ,
-//                        aNode.theKind ,
-//                        aNode.theFirstCreation , aNode.theLastModification ,
-//                        aNode.theEditorRelease.c_str() ,
-//                        aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
-//                        aNode.theComment.c_str() ,
-//                        aNode.theCoords.theX , aNode.theCoords.theY ) ;
-//    }
-//    else {
-      const char * aNodeName = aNode.theName.c_str() ;
-      if ( aNode.theListOfFuncName.size() == 0 ) {
-        aNode.theListOfFuncName.resize( 1 ) ;
-        aNode.theListOfFuncName[ 0 ] = "" ;
-        aNode.theListOfPythonFunctions.resize( 1 ) ;
-        aNode.theListOfPythonFunctions[ 0 ] = new SUPERV::ListOfStrings() ;
-      }
-      if ( GetGraphNode( aNode.theName.c_str() ) )
-        aNodeName = NULL ;
-      anInNode = AddNode( aNode.theService ,
-                          aNode.theListOfFuncName ,
-                          aNode.theListOfPythonFunctions ,
-                          aNode.theComponentName.c_str() ,
-                          aNode.theInterfaceName.c_str() , aNodeName ,
-                          aNode.theKind ,
-                          aNode.theFirstCreation , aNode.theLastModification ,
-                          aNode.theEditorRelease.c_str() ,
-                          aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
-                          aNode.theComment.c_str() ,
-                          aNode.theCoords.theX , aNode.theCoords.theY ) ;
-      string * aNodetheName = new string( aNode.theName ) ;
-      aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ;
-      if ( anInNode->IsOneOfInLineNodes() ) {
-        anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
-                  _Orb , aNode.theService , anInNode->NamePtr() ,
-                  anInNode->Kind() ,
-//                  false , // DataFlowOrComputing
-//                  anInNode->IsLoopNode() || anInNode->IsEndLoopNode() , // WithInLoop
-//                  anInNode->IsInLineNode() || anInNode->IsLoopNode() || anInNode->IsSwitchNode() || anInNode->IsEndSwitchNode() , // WithInGate
-//                  anInNode->IsInLineNode() || anInNode->IsSwitchNode() || anInNode->IsGOTONode() , // WithOutGate
+    const char * aNodeName = aNode.theName.c_str() ;
+    if ( aNode.theListOfFuncName.size() == 0 ) {
+      aNode.theListOfFuncName.resize( 1 ) ;
+      aNode.theListOfFuncName[ 0 ] = "" ;
+      aNode.theListOfPythonFunctions.resize( 1 ) ;
+      aNode.theListOfPythonFunctions[ 0 ] = new SUPERV::ListOfStrings() ;
+    }
+    if ( GetGraphNode( aNode.theName.c_str() ) ) {
+      aNodeName = NULL ;
+    }
+    anInNode = AddNode( aNode.theService ,
+                        aNode.theListOfFuncName ,
+                        aNode.theListOfPythonFunctions ,
+                        aNode.theComponentName.c_str() ,
+                        aNode.theInterfaceName.c_str() , aNodeName ,
+                        aNode.theKind ,
+                        aNode.theFirstCreation , aNode.theLastModification ,
+                        aNode.theEditorRelease.c_str() ,
+                        aNode.theAuthor.c_str() , aNode.theContainer.c_str() ,
+                        aNode.theComment.c_str() ,
+                        aNode.theCoords.theX , aNode.theCoords.theY ) ;
+    string * aNodetheName = new string( aNode.theName ) ;
+    aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ;
+    if ( anInNode->IsOneOfInLineNodes() ) {
+      anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
+                _Orb , aNode.theService , anInNode->NamePtr() ,
+                anInNode->Kind() ,
                   Graph_prof_debug() , Graph_fdebug() ) ;
-        GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
-        GraphBase::LoopNode * aLNode = NULL ;
-        if ( aINode->IsLoopNode() ) {
-          aLNode = anInNode->LoopNode() ;
-          aLNode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
-                                     *aNode.theListOfPythonFunctions[ 0 ] ) ;
-          aLNode->SetMorePythonFunction( aNode.theListOfFuncName[ 1 ].c_str() ,
-                                         *aNode.theListOfPythonFunctions[ 1 ] ) ;
-          aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() ,
-                                         *aNode.theListOfPythonFunctions[ 2 ] ) ;
-        }
-        else if ( aINode->IsInLineNode() || aINode->IsGOTONode() ||
-                  aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
-          aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
-                                     *aNode.theListOfPythonFunctions[ 0 ] ) ;
-        }
+      GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
+      GraphBase::LoopNode * aLNode = NULL ;
+      if ( aINode->IsLoopNode() ) {
+        aLNode = anInNode->LoopNode() ;
+        aLNode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
+                                   *aNode.theListOfPythonFunctions[ 0 ] ) ;
+        aLNode->SetMorePythonFunction( aNode.theListOfFuncName[ 1 ].c_str() ,
+                                       *aNode.theListOfPythonFunctions[ 1 ] ) ;
+        aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() ,
+                                       *aNode.theListOfPythonFunctions[ 2 ] ) ;
       }
-#if 0
-      if ( aNode.theListOfParameters.size() ) {
-        int j ;
-        for ( j = 0 ; j < aNode.theListOfParameters.size() ; j++ ) {
-          if ( IsInLineNode() ) {
-            GraphBase::InPort * InputPort = anInNode->AddInPort(
-                 aNode.theListOfParameters[ j ].theInParameter.Parametername ,
-                 aNode.theListOfParameters[ j ].theInParameter.Parametertype ) ;
-            GraphBase::OutPort * OutputPort = anInNode->AddOutPort(
-                 aNode.theListOfParameters[ j ].theOutParameter.Parametername ,
-                 aNode.theListOfParameters[ j ].theOutParameter.Parametertype ) ;
-            anInNode->InOutPort( InputPort , OutputPort ) ;
-         }
-       }
+      else if ( aINode->IsInLineNode() || aINode->IsGOTONode() ||
+                aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
+        aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
+                                   *aNode.theListOfPythonFunctions[ 0 ] ) ;
       }
-#endif
-//      cout << "LoadNodes " << aNodetheName << " "
-//           << GetGraphNodeIndex( anInNode->Name() ) << endl ;
-      delete aNodetheName ;
-//    }
-    if ( !anInNode )
+    }
+    delete aNodetheName ;
+    if ( !anInNode ) {
       return false ;
+    }
   }
-  for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
     GraphBase::SNode aNode = aListOfNodes[ i ] ;
     cdebug << "GraphEditor::OutNode::LoadNodes " << aNode.theName.c_str() << " Coupled to "
            << aNode.theCoupledNode.c_str() << endl ;
@@ -277,7 +237,7 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes ,
   cdebug_in << "GraphEditor::OutNode::LoadLinks" << endl ;
 //  MESSAGE( "GraphEditor::OutNode::LoadLinks" );
   int i , j ;
-  for ( i = 0 ; i < aListOfLinks.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfLinks.size() ; i++ ) {
     GraphBase::SLink aLink = aListOfLinks[ i ] ;
     string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
     string * aLinkToNodeName = new string( aLink.ToNodeName.c_str() ) ;
@@ -285,16 +245,22 @@ bool GraphEditor::OutNode::LoadLinks(map< string , int > & aMapOfNodes ,
            << aLink.FromServiceParameterName.c_str() << " ) --> "
            << aLinkToNodeName->c_str() << "( "
            << aLink.FromServiceParameterName.c_str() << " )" << endl ;
-    RetVal = AddLink( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
-                      aLink.FromServiceParameterName.c_str() ,
-                      GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
-                      aLink.ToServiceParameterName.c_str() ,
-                      *((GraphBase::ComputingNode *) GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ))->GetOutPort( aLink.FromServiceParameterName.c_str() )->Value() ) ;
+    if ( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) &&
+         GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) {
+      RetVal = AddLink( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
+                        aLink.FromServiceParameterName.c_str() ,
+                        GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
+                        aLink.ToServiceParameterName.c_str() ,
+                        *((GraphBase::ComputingNode *) GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ))->GetOutPort( aLink.FromServiceParameterName.c_str() )->Value() ) ;
+    }
+    else {
+      RetVal = false ;
+    }
 //                      aLink.aLinkValue ) ;
     if ( !RetVal )
       break ;
     else {
-      for ( j = 0 ; j < aLink.aListOfCoords.size() ; j++ ) {
+      for ( j = 0 ; j < (int ) aLink.aListOfCoords.size() ; j++ ) {
         RetVal = AddLinkCoord( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
                                aLink.FromServiceParameterName.c_str() ,
                                GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() ,
@@ -319,7 +285,7 @@ bool GraphEditor::OutNode::LoadDatas(map< string , int > & aMapOfNodes ,
   cdebug_in << "GraphEditor::OutNode::LoadDatas" << endl ;
 //  MESSAGE( "GraphEditor::OutNode::LoadDatas" );
   int i ;
-  for ( i = 0 ; i < aListOfDatas.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) {
     GraphBase::SLink aLink = aListOfDatas[ i ] ;
     if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) ) {
       cdebug << "GraphEditor::OutNode::LoadDatas Warning "
@@ -377,7 +343,7 @@ GraphBase::SGraph * GraphEditor::OutNode::GetDataFlow() {
   GraphBase::SGraph * aDataFlow = new GraphBase::SGraph;
   aDataFlow->Info = *GetInfo() ;
   aDataFlow->Nodes = *GetNodes() ;
-  aDataFlow->Links = *GetLinks() ;
+  aDataFlow->Links = *GetLinks( true ) ;
   aDataFlow->Datas = *GetDatas() ;
   return aDataFlow ;
 }
@@ -410,13 +376,13 @@ const int GraphEditor::OutNode::YCoordinate( const char* NodeName ) {
   return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->YCoordinate() ;
 }
 
-GraphEditor::InNode *GraphEditor::OutNode::AddNode(
+GraphEditor::InNode * GraphEditor::OutNode::AddNode(
                       const SALOME_ModuleCatalog::Service& NodeService ,
                       GraphBase::ListOfFuncName aFuncName ,
                       GraphBase::ListOfPythonFunctions aPythonFunction ,
-                      const char *NodeComponentName ,
-                      const char* NodeInterfaceName ,
-                      const char *theNodeName ,
+                      const char * NodeComponentName ,
+                      const char * NodeInterfaceName ,
+                      const char * theNodeName ,
                       const SUPERV::KindOfNode NodeKindOfNode ,
                       const SUPERV::SDate NodeFirstCreation ,
                       const SUPERV::SDate NodeLastModification  ,
@@ -426,8 +392,19 @@ GraphEditor::InNode *GraphEditor::OutNode::AddNode(
                       const char * NodeComment ,
                       const int NodeX ,
                       const int NodeY ) {
-  cdebug_in << "GraphEditor::OutNode::AddNode(" << NodeComponentName << " , "
-            << theNodeName << ")" << endl;
+  cdebug_in << "GraphEditor::OutNode::AddNode( " ;
+  if ( NodeComponentName != NULLSTRING && strlen( NodeComponentName ) ) {
+    cdebug << NodeComponentName << " , " ;
+  }
+  else {
+    cdebug << "NodeComponentName[NULL] )" << endl;
+  }
+  if ( theNodeName != NULLSTRING && strlen( theNodeName ) ) {
+    cdebug << theNodeName << " )" << endl;
+  }
+  else {
+    cdebug << "NodeName[NULL] )" << endl;
+  }
   char * RetVal = NULLSTRING ;
   GraphEditor::InNode *Nd = NULL ;
   char * aNodeName = NULL ;
@@ -438,7 +415,7 @@ GraphEditor::InNode *GraphEditor::OutNode::AddNode(
        NodeKindOfNode == SUPERV::SwitchNode ||
        NodeKindOfNode == SUPERV::EndSwitchNode ||
        NodeKindOfNode == SUPERV::GOTONode ) {
-    if ( theNodeName == NULL || strlen( theNodeName ) == 0 ) {
+    if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) {
       if ( NodeKindOfNode == SUPERV::InLineNode ) {
         ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = my_strdup( "InLine" ) ;
       }
@@ -461,20 +438,21 @@ GraphEditor::InNode *GraphEditor::OutNode::AddNode(
     else {
       ((SALOME_ModuleCatalog::Service& ) NodeService).ServiceName = CORBA::string_dup( theNodeName ) ;
     }
-    theNodeName = NULL ;
+    theNodeName = NULLSTRING ;
   }
-  if ( theNodeName == NULL ) {
+  if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) {
     aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ;
     strcpy( aNodeName , NodeService.ServiceName ) ;
     if ( GetGraphNode( NodeService.ServiceName ) ) {
       GeneratedName = true ;
       while ( GetGraphNode( aNodeName ) ) {
-        if ( aNodeName )
+        if ( aNodeName ) {
           delete [] aNodeName ;
+       }
         int num = GetServiceNameNumber( NodeService.ServiceName ) ;
-        ostrstream s ;
-        s << num << ends ;
-        const char * n_instance = s.str() ;
+        ostringstream astr ;
+        astr << num << ends ;
+        const char * n_instance = astr.str().c_str() ;
         int lname = strlen( NodeService.ServiceName ) + 1 +
                     strlen( n_instance ) + 1 ;
         aNodeName = new char[lname] ;
@@ -490,7 +468,7 @@ GraphEditor::InNode *GraphEditor::OutNode::AddNode(
       strcpy( aNodeName , theNodeName ) ;
     }
   }
-  if ( aNodeName != NULL ) {
+  if ( aNodeName != NULLSTRING ) {
     Nd = new GraphEditor::InNode( _Orb , NamingService() ,
                                   aFuncName , aPythonFunction , NodeService ,
                                   NodeComponentName , NodeInterfaceName ,
@@ -693,15 +671,23 @@ bool GraphEditor::OutNode::Valid() {
 }
 
 bool GraphEditor::OutNode::Executable() {
-
   cdebug_in << "GraphEditor::OutNode::Executable" << endl;
-  if ( !IsValid() )
+  bool NewLink ;
+  if ( LinkLoopNodes( NewLink ) ) {
+    if ( NewLink ) {
+      _Valid = false ;
+    }
+  }
+  else {
+    cdebug << "This DataFlow is not executable." << endl ;
+    _Executable = false ;
+  }
+  if ( !IsValid() ) {
     Valid() ;
-  if ( !IsValid() )
+  }
+  if ( !IsValid() ) {
     return false ;
-//  if ( !_GT )
-//  GraphExecutor::GraphControl _GT = new GraphExecutor::GraphControl( this );
-
+  }
   if ( DataServerNodes() )
     _Executable = true ;
   else {
@@ -860,7 +846,7 @@ bool GraphEditor::OutNode::LinkSaveXML( QDomDocument & Graph , QDomElement & lin
   link.appendChild( coordlist ) ;
   
   int i ;
-  for ( i = 0 ; i < aLink.aListOfCoords.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
 //    f << Tabs << "   <coord>" << endl ;
     QDomElement coord = Graph.createElement( "coord" ) ;
     coordlist.appendChild( coord ) ;
@@ -941,7 +927,7 @@ bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName ,
     f << ")" << endl ;
   }
   int i ;
-  for ( i = 0 ; i < aLink.aListOfCoords.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
     f << aLink.ToNodeName.c_str()
       << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , "
       << aLink.aListOfCoords[ i ].theX << " , "
@@ -1043,8 +1029,8 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) {
 //  f << "     <link-list>" << endl ;
   QDomElement linklist = Graph.createElement( "link-list" ) ;
   dataflow.appendChild( linklist ) ;
-  const GraphBase::ListOfLinks * Links = GetLinks() ;
-  for ( i = 0 ; i < Links->size() ; i++ ) {
+  const GraphBase::ListOfLinks * Links = GetLinks( true ) ;
+  for ( i = 0 ; i < (int ) Links->size() ; i++ ) {
 //    f << "           <link>" << endl ;
     QDomElement link = Graph.createElement( "link" ) ;
     linklist.appendChild( link ) ;
@@ -1058,7 +1044,7 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) {
   QDomElement datalist = Graph.createElement( "data-list" ) ;
   dataflow.appendChild( datalist ) ;
   const GraphBase::ListOfLinks * Datas = GetDatas() ;
-  for ( i = 0 ; i < Datas->size() ; i++ ) {
+  for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
 //    f << "           <data>" << endl ;
     QDomElement data = Graph.createElement( "data" ) ;
     datalist.appendChild( data ) ;
@@ -1099,6 +1085,7 @@ bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) {
 
 bool GraphEditor::OutNode::SavePY( ostream & f ) {
   int i ;
+  int j ;
   f << endl << "# Generated python file of Graph " << Name() << endl << endl ;
 
   f << "from SuperV import *" << endl ;
@@ -1109,6 +1096,7 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
   f << endl << "# Creation of Factory Nodes" << endl ;
   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
     if ( GraphNodes( i )->IsFactoryNode() ) {
+      f << endl ;
       ((GraphBase::FactoryNode * ) GraphNodes( i ))->SavePY( f , Name() ,
                 GraphNodes( i )->XCoordinate() ,
                 GraphNodes( i )->YCoordinate() ) ;
@@ -1122,6 +1110,9 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
         f << endl << "# Creation of Computing Nodes" << endl ;
         first = false ;
       }
+      else {
+        f << endl ;
+      }
       ((GraphBase::ComputingNode * ) GraphNodes( i ))->SavePY( f , Name() ,
                 GraphNodes( i )->XCoordinate() ,
                 GraphNodes( i )->YCoordinate() ) ;
@@ -1135,6 +1126,9 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
         f << endl << "# Creation of InLine Nodes" << endl ;
         first = false ;
       }
+      else {
+        f << endl ;
+      }
       ((GraphBase::InLineNode * ) GraphNodes( i ))->SavePY( f , Name() ,
                 GraphNodes( i )->XCoordinate() ,
                 GraphNodes( i )->YCoordinate() ) ;
@@ -1148,6 +1142,9 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
         f << endl << "# Creation of Loop Nodes" << endl ;
         first = false ;
       }
+      else {
+        f << endl ;
+      }
       ((GraphBase::LoopNode * ) GraphNodes( i ))->SavePY( f , Name() ,
                 GraphNodes( i )->XCoordinate() ,
                 GraphNodes( i )->YCoordinate() ) ;
@@ -1161,6 +1158,9 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
         f << endl << "# Creation of Switch Nodes" << endl ;
         first = false ;
       }
+      else {
+        f << endl ;
+      }
       ((GraphBase::SwitchNode * ) GraphNodes( i ))->SavePY( f , Name() ,
                 GraphNodes( i )->XCoordinate() ,
                 GraphNodes( i )->YCoordinate() ) ;
@@ -1174,6 +1174,9 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
         f << endl << "# Creation of GOTO Nodes" << endl ;
         first = false ;
       }
+      else {
+        f << endl ;
+      }
       ((GraphBase::GOTONode * ) GraphNodes( i ))->SavePY( f , Name() ,
                 GraphNodes( i )->XCoordinate() ,
                 GraphNodes( i )->YCoordinate() ) ;
@@ -1183,68 +1186,46 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
   const GraphBase::ListOfLinks * Links = GetLinks() ;
   bool intervar ;
   map< string , int > aMapOfOutPorts ;
-  first = true ;
-  for ( i = 0 ; i < Links->size() ; i++ ) {
-    if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsComputingNode() &&
-         GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsComputingNode() ) {
-      if ( first ) {
-        f << endl
-          << "# Creation of intermediate Output variables and of Computing Links"
-          << endl ;
-        first = false ;
-      }
-      char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) +
-                                   strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ;
-      strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ;
-      strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ;
-      if ( aMapOfOutPorts[ NodePort ] == 0 ) {
-        aMapOfOutPorts[ NodePort ] = i + 1 ;
-        intervar = true ;
-      }
-      else {
-        intervar = false ;
-      }
-      LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ;
-      delete [] NodePort ;
-    }
-  }
-
-#if 0
   first = true ;
   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
-    if ( GraphNodes( i )->IsInLineNode() ||
-         GraphNodes( i )->IsGOTONode() ) {
-      int j ;
-      for ( j = 0 ; j < GraphNodes( i )->GetNodeInPortsSize() ; j++ ) {
-        if ( GraphNodes( i )->GetNodeInPort( j )->IsBus() ) {
-          if ( first ) {
-            f << endl
-              << "# Creation of Output variables and of Bus Ports"
-              << endl ;
-            first = false ;
-          }
-          f << GraphNodes( i )->Name() << ".InOutPort( '"
-            << GraphNodes( i )->GetNodeInPort( j )->PortName() << "' , '"
-            << GraphNodes( i )->GetNodeInPort( j )->PortType() << "' , '"
-            << GraphNodes( i )->GetNodeOutPort( GraphNodes( i )->GetNodeInPort( j )->PortIndex() )->PortName()
-            << "' , '"
-            << GraphNodes( i )->GetNodeOutPort( GraphNodes( i )->GetNodeInPort( j )->PortIndex() )->PortType()
-            << "' )" << endl ;
-       }
+    for ( j = 0 ; j < (int ) Links->size() ; j++ ) {
+      if ( !strcmp( GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) {
+        if ( first ) {
+          f << endl
+            << "# Creation of Links"
+            << endl ;
+          first = false ;
+        }
+        else {
+          f << endl ;
+        }
+        char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) +
+                                     strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ;
+        strcpy( NodePort , (*Links)[ j ].FromNodeName.c_str() ) ;
+        strcat( NodePort , (*Links)[ j ].FromServiceParameterName.c_str() ) ;
+        if ( aMapOfOutPorts[ NodePort ] == 0 ) {
+          aMapOfOutPorts[ NodePort ] = j + 1 ;
+          intervar = true ;
+        }
+        else {
+          intervar = false ;
+        }
+        LinkSavePY( f , Name() , (*Links)[ j ] , intervar , false ) ;
+        delete [] NodePort ;
       }
     }
   }
-#endif
 
+#if 0
   first = true ;
   for ( i = 0 ; i < Links->size() ; i++ ) {
-    if ( !( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsComputingNode() &&
-           GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsComputingNode() ) &&
-         !( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsGOTONode() &&
-           GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsInLineNode() ) ) {
+    if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsSwitchNode() ||
+         GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsSwitchNode() ||
+         GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsEndSwitchNode() ||
+         GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsEndSwitchNode() ) {
       if ( first ) {
         f << endl
-          << "# Creation of intermediate Output variables and of Control Links"
+          << "# Creation of Switch Links"
           << endl ;
         first = false ;
       }
@@ -1289,10 +1270,11 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
       delete [] NodePort ;
     }
   }
+#endif
 
   const GraphBase::ListOfLinks * Datas = GetDatas() ;
   first = true ;
-  for ( i = 0 ; i < Datas->size() ; i++ ) {
+  for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
     if ( first ) {
       f << endl << "# Creation of Input datas" << endl ;
       first = false ;
@@ -1302,13 +1284,13 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
 
   first = true ;
   const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = ServiceInParameter() ;
-  for ( i = 0 ; i < ListOfInParam.length() ; i++ ) {
+  for ( i = 0 ; i < (int ) ListOfInParam.length() ; i++ ) {
     string _aParam = CORBA::string_dup(ListOfInParam[ i ].Parametername) ;
     const char * aParam = _aParam.c_str() ;
     char * aNodeName ;
     char * aPortName ;
-    int j , k ;
-    for ( j = 0 ; j < strlen( aParam ) ; j++ ) {
+    int j ;
+    for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) {
       if ( aParam[ j ] == '\\' ) {
         aNodeName = new char[ j+1 ] ;
         strncpy( aNodeName , aParam , j ) ;
@@ -1332,13 +1314,13 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
 
   f << endl << "# Creation of Output variables" << endl ;
   const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = ServiceOutParameter() ;
-  for ( i = 0 ; i < ListOfOutParam.length() ; i++ ) {
+  for ( i = 0 ; i < (int ) ListOfOutParam.length() ; i++ ) {
     string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ;
     const char * aParam = _aParam.c_str() ;
     char * aNodeName ;
     char * aPortName ;
-    int j , k ;
-    for ( j = 0 ; j < strlen( aParam ) ; j++ ) {
+    int j ;
+    for ( j = 0 ; j < (int ) strlen( aParam ) ; j++ ) {
       if ( aParam[ j ] == '\\' ) {
         aNodeName = new char[ j+1 ] ;
         strncpy( aNodeName , aParam , j ) ;
@@ -1358,7 +1340,7 @@ bool GraphEditor::OutNode::SavePY( ostream & f ) {
 
 
 
-ostrstream & operator<< (ostrstream & f,const GraphEditor::OutNode & G) {
+ostream & operator<< (ostream & f,const GraphEditor::OutNode & G) {
   f << (GraphBase::ComputingNode ) G ;
   f << endl ;
 
index 780bee93dd2e9502c1d2cddd4bb868fc6ec6e652..c36b24378cfd837c76c300c24f1a97aaf603e78d 100644 (file)
@@ -280,7 +280,7 @@ namespace GraphEditor {
 
 };
 
-ostrstream & operator << (ostrstream &,const GraphEditor::OutNode & G);
+ostream & operator << (ostream &,const GraphEditor::OutNode & G);
 ostream & operator << (ostream &,const SUPERV::SDate &);
 
 #endif
index 02064933daab14c3da1b359878f4862e6292cdc8..3d94a13d00b9169e5c89f2ba2b8e6b72227b6191 100644 (file)
@@ -51,11 +51,11 @@ namespace GraphExecutor {
                 const SUPERV::KindOfNode DataFlowkind = SUPERV::ComputingNode ,
                 const SUPERV::SDate DataFlowFirstCreation = SUPERV::SDate() ,
                 const SUPERV::SDate DataFlowLastModification = SUPERV::SDate() ,
-                const char * DataFlowEditorRelease = NULL ,
-                const char * DataFlowAuthor = NULL ,
-                const char * DataFlowComputer = NULL ,
-                const char * DataFlowComment = NULL ,
-                const char * DebugFileName = NULL ) ;
+                const char * DataFlowEditorRelease = NULLSTRING ,
+                const char * DataFlowAuthor = NULLSTRING ,
+                const char * DataFlowComputer = NULLSTRING ,
+                const char * DataFlowComment = NULLSTRING ,
+                const char * DebugFileName = NULLSTRING ) ;
       virtual ~DataFlow();
 
       bool LoadDataFlow( const GraphBase::SGraph &aDataFlow ) ;
index 8e4ae74b8deb5be97a2c53fd352e4822a99ee33c..dba4753571490f3445df170f8ce343e39f21bd5b 100644 (file)
@@ -36,80 +36,159 @@ using namespace CORBA ;
 
 
 
-void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr obj ,
+void GraphExecutor::InNode::DynInvoke(Engines::Component_ptr objComponent ,
                                      const char *method , 
                                      ServicesAnyData * inParams , int nInParams ,
                                      ServicesAnyData * outParams , int nOutParams ) {
-  Request_var req = obj->_request( method ) ;
-  const char *s ;
+  Request_var req = objComponent->_request( method ) ;
+  const char *ArgName ;
+  int Type ;
 
-  NVList_ptr arguments =req->arguments() ;
+  NVList_ptr arguments = req->arguments() ;
 
   int i ;
 
   int n_in  = nInParams ;
   int n_out = nOutParams ;
 
+  char * aComponent = ObjectToString( objComponent ) ;
+  MESSAGE( aComponent << "->" << method ) ;
   for ( i = 0 ; i < n_in ; i++ ) {
     CORBA::Any & data = inParams[i].Value ;
-    s                 = inParams[i].Name.c_str() ;
-    arguments->add_value( s , data , CORBA::ARG_IN ) ;
-#if 0
-    switch ( data.type()->kind() ) {
-    case CORBA::tk_string :
+    ArgName           = inParams[i].Name.c_str() ;
+    Type              = data.type()->kind() ;
+    arguments->add_value( ArgName , data , CORBA::ARG_IN ) ;
+//#if 0
+    switch ( Type ) {
+    case CORBA::tk_string : {
       char * t ;
       data >>= t ;
-      MESSAGE( "ArgIn" << i << " : " << s << " Value " << t << " (string)") ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
       break ;
-    case CORBA::tk_double :
-      double d ;
-      data >>= d ;
-      MESSAGE( "ArgIn" << i << " : " << s << " Value " << d << " (double)") ;
+    }
+    case CORBA::tk_boolean : {
+      bool b ;
+      data >>= (CORBA::Any::to_boolean ) b ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
+      break ;
+    }
+    case CORBA::tk_char : {
+      unsigned char c ;
+      data >>= (CORBA::Any::to_char ) c ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
+      break ;
+    }
+    case CORBA::tk_short : {
+      short s ;
+      data >>= s ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
       break ;
-    case CORBA::tk_long :
+    }
+    case CORBA::tk_long : {
       long l ;
       data >>= l ;
-      MESSAGE( "ArgIn" << i << " : " << s << " Value " << l << " (long)") ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
       break ;
-    case CORBA::tk_objref :
-      MESSAGE( "ArgIn" << i << " : " << s << " Value " << "(object reference)") ;
+    }
+    case CORBA::tk_float : {
+      float f ;
+      data >>= f ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
       break ;
-    default :
-      MESSAGE( "ArgIn" << i << " : " << s << " Value " << "(other ERROR)") ;
     }
-    MESSAGE() ;
-#endif
+    case CORBA::tk_double : {
+      double d ;
+      data >>= d ;
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
+      break ;
+    }
+    case CORBA::tk_objref : {
+      CORBA::Object_ptr obj ;
+      char * retstr = "Catched ERROR";
+      try {
+        data >>= obj ;
+        retstr = ObjectToString( obj ) ;
+      }
+      catch( ... ) {
+      }
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
+      break ;
+    }
+    default : {
+      MESSAGE( "ArgIn" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
+    }
+    }
+    MESSAGE("") ;
+//#endif
   }
 
   for ( i = 0 ; i < n_out ; i++ ) {
     CORBA::Any & data = outParams[i].Value ;
-    s                 = outParams[i].Name.c_str() ;
-    arguments->add_value( s , data , CORBA::ARG_OUT ) ;
-#if 0
-    switch ( data.type()->kind() ) {
-    case CORBA::tk_string :
+    ArgName           = outParams[i].Name.c_str() ;
+    Type              = data.type()->kind() ;
+    arguments->add_value( ArgName , data , CORBA::ARG_OUT ) ;
+//#if 0
+    switch ( Type ) {
+    case CORBA::tk_string : {
       char * t ;
       data >>= t ;
-      MESSAGE( "ArgOut" << i << " : " << s << " Value " << t << " (string)") ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << t << " (string)" ) ;
       break ;
-    case CORBA::tk_double :
-      double d ;
-      data >>= d ;
-      MESSAGE( "ArgOut" << i << " : " << s << " Value " << d << " (double)") ;
+    }
+    case CORBA::tk_boolean : {
+      bool b ;
+      data >>= (CORBA::Any::to_boolean ) b ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << b << " (boolean)" ) ;
       break ;
-    case CORBA::tk_long :
+    }
+    case CORBA::tk_char : {
+      unsigned char c ;
+      data >>= (CORBA::Any::to_char ) c ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << (int ) c << " (char)" ) ;
+      break ;
+    }
+    case CORBA::tk_short : {
+      short s ;
+      data >>= s ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << s << " (short)" ) ;
+      break ;
+    }
+    case CORBA::tk_long : {
       long l ;
       data >>= l ;
-      MESSAGE( "ArgOut" << i << " : " << s << " Value " << l << " (long)") ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << l << " (long)" ) ;
       break ;
-    case CORBA::tk_objref :
-      MESSAGE( "ArgOut" << i << " : " << s << " Value " << "(object reference)") ;
+    }
+    case CORBA::tk_float : {
+      float f ;
+      data >>= f ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << f << " (float)" ) ;
+      break ;
+    }
+    case CORBA::tk_double : {
+      double d ;
+      data >>= d ;
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << d << " (double)" ) ;
       break ;
-    default :
-      MESSAGE( "ArgOut" << i << " : " << s << " Value " << "(other ERROR)") ;
     }
-    MESSAGE() ;
-#endif
+    case CORBA::tk_objref : {
+      CORBA::Object_ptr obj ;
+      char * retstr = "Catched ERROR";
+      try {
+        data >>= obj ;
+        retstr = ObjectToString( obj ) ;
+      }
+      catch( ... ) {
+      }
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << retstr << "(object reference)" ) ;
+      break ;
+    }
+    default : {
+      MESSAGE( "ArgOut" << i << " : " << ArgName << " Value " << "(other ERROR) kind " << Type ) ;
+    }
+    }
+    MESSAGE("") ;
+//#endif
   }
 
   req->invoke();
@@ -133,7 +212,6 @@ void GraphExecutor::InNode::DynInvoke( Engines::Component_ptr obj ,
                                       const char * aGraphName ,
                                       const char * aNodeName ) {
   Request_var req = obj->_request( method ) ;
-  const char *s;
 
   NVList_ptr arguments =req->arguments() ;
 
index b2b6be333b4b90f27a80565f6e00de8e27f3ecb1..8663bad398e2d1a1ff9f102c7881f8798db16078 100644 (file)
@@ -1,11 +1,32 @@
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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   : DataFlowExecutor_InNode.cxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
+
 using namespace std;
-//=============================================================================
-// File      : DataFlowBase_InNode.cxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
 
 #include <stdlib.h>
 #include <iostream>
@@ -16,7 +37,7 @@ using namespace std;
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_Component)
-#include "SALOME_NamingService.hxx"
+//#include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 
 #include "DataFlowBase_FactoryNode.hxx"
@@ -28,7 +49,8 @@ using namespace std;
 
 #include "DataFlowExecutor_OutNode.hxx"
 
-static void InitInNode( SUPERV::ControlState &_ControlState ,
+static void InitInNode( int &_RewindStack ,
+                        SUPERV::ControlState &_ControlState ,
                         SUPERV::AutomatonState &_currentState ,
                         GraphExecutor::InNode ** _aReStartNode ,
                         bool & _PyFuncRunned ,
@@ -51,6 +73,7 @@ static void InitInNode( SUPERV::ControlState &_ControlState ,
                         GraphExecutor::FiniteStateMachine * theAutomaton ,
                         CORBA::ORB_ptr * _Orb ,
                         CORBA::ORB_ptr ORB ) {
+  _RewindStack = 0 ;
   _ControlState = SUPERV::VoidState ;
   _currentState = SUPERV::UnKnownState ;
   *_aReStartNode = NULL ;
@@ -104,7 +127,8 @@ GraphExecutor::FiniteStateMachine * theAutomaton = new
 //GraphExecutor::InNode::InNode() :
 //     GraphBase::FactoryNode() {
 GraphExecutor::InNode::InNode() {
-  InitInNode( _ControlState ,
+  InitInNode( _RewindStack ,
+              _ControlState ,
               _currentState ,
               &_aReStartNode ,
               _PyFuncRunned ,
@@ -148,7 +172,7 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
                const int NodeX ,
                const int NodeY ,
                int * Graph_prof_debug,
-               ostream * Graph_fdebug) {
+               ofstream * Graph_fdebug) {
 //               ostream * Graph_fdebug = NULL ) :
 //             GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
 //                                     ComponentName , NodeInterfaceName ,
@@ -158,7 +182,8 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
 //                                     NodeComputer , NodeComment , GeneratedName ,
 //                                     0 , 0 ,
 //                                     Graph_prof_debug , Graph_fdebug ) {
-  InitInNode( _ControlState ,
+  InitInNode( _RewindStack ,
+              _ControlState ,
               _currentState ,
               &_aReStartNode ,
               _PyFuncRunned ,
@@ -243,6 +268,7 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
                                          NodeX , NodeY ,
                                          Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::LoopNode : {
@@ -259,6 +285,7 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
                                          Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _LoopNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::EndLoopNode : {
@@ -274,6 +301,7 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
                                          Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::SwitchNode : {
@@ -288,6 +316,7 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
                                              Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _SwitchNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
   case SUPERV::EndSwitchNode : {
@@ -303,8 +332,15 @@ GraphExecutor::InNode::InNode(CORBA::ORB_ptr ORB,
                                              Graph_prof_debug , Graph_fdebug ) ;
     _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
     _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
+    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
     break ;
   }
+  case SUPERV::DataFlowNode : {
+    cdebug << "GraphEditor::InNode::InNode SUPERV::DataFlowNode ERROR : " << NodeName ;
+  }
+  case SUPERV::UnknownNode : {
+    cdebug << "GraphEditor::InNode::InNode SUPERV::UnknownNode ERROR : " << NodeName ;
+  }
   }
   cdebug << "GraphExecutor::InNode::InNode "  << (void *) this
          << " _ComputingNode " << (void *) _ComputingNode  ;
@@ -329,6 +365,32 @@ void GraphExecutor::InNode::UnLockDataWait() {
   }
 }
 
+Engines::Component_var GraphExecutor::InNode::Component() const {
+  if ( IsFactoryNode() ) {
+    return _FactoryNode->Component() ;
+  }
+  else {
+    CORBA::Any const * anAnyComponent = GetChangeNodeInPort( 0 )->GetOutPort()->Value() ; // this
+    CORBA::Object_ptr obj ;
+    try {
+      *anAnyComponent >>= obj ;
+      return Engines::Component::_narrow( obj ) ;
+    }
+    catch( ... ) {
+      cdebug << "GraphExecutor::InNode::Component Component catch" << endl ;
+    }
+  }
+  return Engines::Component::_nil() ;
+}
+
+Engines::Container_var GraphExecutor::InNode::Container() const {
+  if ( IsFactoryNode() ) {
+    return _FactoryNode->Container() ;
+  }
+  return Engines::Container::_nil() ;
+}
+
+
 bool GraphExecutor::InNode::Ping() {
 //  cdebug_in << "GraphExecutor::InNode::Ping" << endl;
   bool RetVal ;
@@ -1020,7 +1082,7 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode )
       }
     }
 //    if ( ( anInPort->IsGate() || anInPort->IsBus() ) && anOutPort == NULL ) {
-    if ( ( anInPort->IsGate() ) && anOutPort == NULL ) {
+    if ( anInPort->IsGate() && anOutPort == NULL ) {
       Pc-- ;
     }
     else {
@@ -1110,29 +1172,84 @@ void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode )
   cdebug << "CurrentState = " << theAutomaton->StateName( _currentState )
          << endl;
 
-#if 0
-  GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) _OutNode->GetGraphNode( "label_begin" ) ;
-  const GraphBase::InPort * anInPort = anInNode->GetNodeInPort(0) ;
-  GraphBase::OutPort * anOutPort = anInPort->GetLink() ;
-  if ( anOutPort ) {
-    cdebug << "InPort" << i << " : " << anInPort->PortName() << " from OutPort "
-           << anOutPort->PortName() << " from Node " << anOutPort->NodeName()
-           << " with state " ;
-    if ( anOutPort->State() == SUPERV::WaitingState ) {
-      cdebug << "WaitingState" ;
+  cdebug_out << "GraphExecutor::InNode::InitialState" << endl;
+}
+
+const long GraphExecutor::InNode::CpuUsed( bool tot ) {
+  CORBA::Long cpu = 0 ;
+//  cdebug_in << "GraphExecutor::InNode::CpuUsed( " << tot << " )" << Name() << endl ;
+  if ( IsOneOfInLineNodes() ) {
+//    cdebug << "CpuUsed " << Name() << " --> PyCpuUsed()" << endl ;
+//    cout << "CpuUsed " << Name() << " --> PyCpuUsed()" << endl ;
+    cpu = PyCpuUsed( tot ) ;
+  }
+  else {
+    if ( !CORBA::is_nil( Component() ) ) {
+//      cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl()" << endl ;
+//      cout << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl()" << endl ;
+      try {
+        cpu = Component()->CpuUsed_impl() ;
+      }
+      catch ( ... ) {
+        cdebug << "CpuUsed " << Name() << " --> Component()->CpuUsed_impl() ERROR catched " << endl ;
+        cpu = 0 ;
+      }
     }
-    else if ( anOutPort->State() == SUPERV::ReadyState ) {
-      cdebug << "ReadyState" ;
+  }
+//  cdebug_out << "GraphExecutor::InNode::CpuUsed " << Name() << " CpuUsed : " << cpu << endl ;
+//  cout << "CpuUsed " << Name() << " CpuUsed : " << cpu << endl ;
+  return cpu ;
+}
+
+#include <sys/time.h>
+#include <sys/resource.h>
+#include <unistd.h>
+
+long GraphExecutor::InNode::PyCpu() {
+  struct rusage usage ;
+  long cpu ;
+  if ( getrusage( RUSAGE_SELF , &usage ) == -1 ) {
+    perror("GraphExecutor::InNode::PyCpu") ;
+    return 0 ;
+  }
+//  return usage.ru_utime.__time_t tv_sec ;
+//  cdebug << pthread_self() << "PyCpu " << Name() << " " << usage.ru_utime.tv_sec << " "
+//         << usage.ru_utime.tv_usec << " " << usage.ru_stime.tv_sec << " " << usage.ru_stime.tv_usec
+//         << endl ;
+  cpu = usage.ru_utime.tv_sec ;
+  return cpu ;
+}
+
+long GraphExecutor::InNode::PyCpuUsed( bool tot ) {
+  long cpu ;
+  if ( _PyTotCpuUsed == -1 ) {
+    if ( _Pythread == pthread_self() ) {
+//      cdebug << pthread_self() << "GraphExecutor::InNode::PyCpuUsed(" << tot << ") " << Name()
+//             << " _PyTotCpuUsed " <<  _PyTotCpuUsed << " PyCpu() " << PyCpu() << " - " << " _PyCpuUsed "
+//             << _PyCpuUsed << endl ;
+      cpu = PyCpu() - _PyCpuUsed ;
+      if ( tot ) {
+        _PyTotCpuUsed = cpu ;
+      }
     }
     else {
-      cdebug << "???" ;
+      cpu = 0 ;
     }
-    cdebug << " PortConnected("
-           << anOutPort->IsPortConnected() << ") DataConnected("
-           << anOutPort->IsDataConnected() << ")" << endl ;
   }
-#endif
+  else {
+    cpu = _PyTotCpuUsed ;
+  }
+//  cdebug << pthread_self() << "GraphExecutor::InNode::PyCpuUsed(" << tot << ") " << Name() << "_PyTotCpuUsed"
+//         <<  _PyTotCpuUsed << " CpuUsed : " << cpu << endl ;
+  return cpu ;
+}
 
-  cdebug_out << "GraphExecutor::InNode::InitialState" << endl;
+void GraphExecutor::InNode::SetPyCpuUsed() {
+  _PyTotCpuUsed = -1 ;
+  _PyCpuUsed = 0 ;
+  _Pythread = pthread_self() ;
+  _PyCpuUsed = PyCpu() ;
+//  cdebug << pthread_self() << "GraphExecutor::InNode::SetPyCpuUsed " << Name() << " _PyCpuUsed : "
+//         << _PyCpuUsed << endl ;
 }
 
index 7fdf945881c9285fb53becb86a6289a5eeaad2cf..ec6d305a92277bfcd76767ac9b2f7d90df135473 100644 (file)
@@ -1,10 +1,30 @@
-//=============================================================================
-// File      : DataFlowBase_InNode.hxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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_InNode.hxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
 
 #ifndef _DATAFLOWEXECUTOR_INNODE_HXX
 #define _DATAFLOWEXECUTOR_INNODE_HXX
@@ -55,7 +75,10 @@ namespace GraphExecutor {
 
       bool                             _createNewThread ;
       bool                             _createNewThreadIf ;
+      int                              _RewindStack ;
+      SUPERV::AutomatonState           _OldState ;
       SUPERV::AutomatonState           _currentState ;
+      GraphExecutor::NodeEvent         _CurrentEvent ;
       SUPERV::ControlState             _ControlState ;
       SUPERV::AutomatonState           _NextState ;
       GraphExecutor::StateEventAction  _NextAction ;
@@ -83,13 +106,17 @@ namespace GraphExecutor {
       bool                             _KillSync ;
       pthread_cond_t                   _StopWait ;
 
+      pthread_t                        _Pythread ;
+      long                             _PyCpuUsed ;
+      long                             _PyTotCpuUsed ;
+
       GraphExecutor::FiniteStateMachine * _Automaton ;
     
-      CORBA::ORB_ptr _Orb;
+      CORBA::ORB_ptr                    _Orb;
 
-      GraphExecutor::OutNode * _OutNode ;
+      GraphExecutor::OutNode          * _OutNode ;
 
-      char * _DataFromNode ;
+      char                            * _DataFromNode ;
 
     public:
 
@@ -104,15 +131,15 @@ namespace GraphExecutor {
               GraphBase::ListOfPythonFunctions aPythonFunction = GraphBase::ListOfPythonFunctions() ,
               const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
               const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
-              const char * NodeEditorRelease = NULL ,
-              const char * NodeAuthor = NULL ,
-              const char * NodeComputer = NULL ,
-              const char * NodeComment = NULL ,
+              const char * NodeEditorRelease = NULLSTRING ,
+              const char * NodeAuthor = NULLSTRING ,
+              const char * NodeComputer = NULLSTRING ,
+              const char * NodeComment = NULLSTRING ,
               const bool   GeneratedName = false ,
               const int NodeX = 0 ,
               const int NodeY = 0 ,
               int * Graph_prof_debug = NULL ,
-              ostream * Graph_fdebug = NULL ) ;
+              ofstream * Graph_fdebug = NULL ) ;
       virtual ~InNode() ;
 
       pthread_t ThreadNo() {
@@ -176,10 +203,8 @@ namespace GraphExecutor {
       GraphBase::LoopNode * LoopNode() {
                             return _LoopNode ; } ;
 
-      Engines::Component_var Component() const {
-                             return _FactoryNode->Component() ; } ;
-      Engines::Container_var Container() const {
-                             return _FactoryNode->Container() ; } ;
+      Engines::Component_var Component() const ;
+      Engines::Container_var Container() const ;
       void SetContainer(Engines::Container_var aContainer) {
                         _FactoryNode->SetContainer( aContainer ) ; } ;
       void SetComponent(Engines::Component_var anObjComponent) {
@@ -223,14 +248,30 @@ namespace GraphExecutor {
 
       const int GetNodeInPortsSize() const {
                 return _ComputingNode->GetNodeInPortsSize() ; } ;
+      const GraphBase::InPort *GetNodeInLoop() const {
+                              return _ComputingNode->GetNodeInLoop() ; } ;
+      const GraphBase::InPort *GetNodeInGate() const {
+                              return _ComputingNode->GetNodeInGate() ; } ;
       const GraphBase::InPort *GetNodeInPort(int i) const {
                               return _ComputingNode->GetNodeInPort( i ) ; } ;
+      GraphBase::InPort *GetChangeNodeInLoop() const {
+                        return _ComputingNode->GetChangeNodeInLoop() ; } ;
+      GraphBase::InPort *GetChangeNodeInGate() const {
+                        return _ComputingNode->GetChangeNodeInGate() ; } ;
       GraphBase::InPort *GetChangeNodeInPort(int i) const {
                         return _ComputingNode->GetChangeNodeInPort( i ) ; } ;
       const int GetNodeOutPortsSize() const {
                 return _ComputingNode->GetNodeOutPortsSize() ; } ;
+      const GraphBase::OutPort *GetNodeOutLoop() const {
+                               return _ComputingNode->GetNodeOutLoop() ; } ;
+      const GraphBase::OutPort *GetNodeOutGate() const {
+                               return _ComputingNode->GetNodeOutGate() ; } ;
       const GraphBase::OutPort *GetNodeOutPort(int i) const {
                                return _ComputingNode->GetNodeOutPort( i ) ; } ;
+      GraphBase::OutPort *GetChangeNodeOutLoop() const {
+                         return _ComputingNode->GetChangeNodeOutLoop() ; } ;
+      GraphBase::OutPort *GetChangeNodeOutGate() const {
+                         return _ComputingNode->GetChangeNodeOutGate() ; } ;
       GraphBase::OutPort *GetChangeNodeOutPort(int i) const {
                          return _ComputingNode->GetChangeNodeOutPort( i ) ; } ;
 
@@ -272,14 +313,16 @@ namespace GraphExecutor {
       bool CreateNewThread() { return _createNewThread ; } ;
       bool CreateNewThreadIf() { return _createNewThreadIf ; } ;
       void NewThread( pthread_t aThread ) ;
-      void ExitThread() ; 
+      void ExitThread() ;
+      void RewindStack( int aRewindStack ) { _RewindStack = aRewindStack ; } ;
+      int RewindStack() const { return _RewindStack ; } ;
 
       SUPERV::AutomatonState State() const {
              return _currentState; };
       void State(SUPERV::AutomatonState aState ) {
-           cdebug << "GraphExecutor::InNode::State( "
-                  << Automaton()->StateName( _currentState ) << " --> "
-                  << Automaton()->StateName( aState ) << " )"  << endl ;
+//           cdebug << "GraphExecutor::InNode::State( "
+//                  << Automaton()->StateName( _currentState ) << " --> "
+//                  << Automaton()->StateName( aState ) << " )"  << endl ;
            _currentState = aState ; } ;
       SUPERV::ControlState ControlState() const {
              return _ControlState; };
@@ -377,14 +420,20 @@ namespace GraphExecutor {
 
       void InParametersSet( bool & Err ,
                             int  nInParams ,
-                            ServicesAnyData * aListOfInParameters ) ;
-      void InOutParameters( int nOutParams ,
-                            ServicesAnyData * aListOfOutParameters ) ;
-      bool OutParameters( bool Err , SUPERV::GraphState NewState ,
-                          int nOutParams ,
-                          ServicesAnyData * aListOfOutParameters ) ;
+                            ServicesAnyData * InParametersList ) ;
+      void InOutParametersSet( int nOutParams ,
+                               ServicesAnyData * OutParametersList ) ;
+      bool OutParametersSet( bool Err , SUPERV::GraphState NewState ,
+                             int nOutParams ,
+                             ServicesAnyData * OutParametersList ) ;
       void coutbegin() ;
       void coutexit() ;
+
+      const long CpuUsed( bool tot = false ) ;
+
+      long PyCpuUsed( bool tot = false ) ;
+      void SetPyCpuUsed() ;
+      long PyCpu() ;
     } ;
 
 } ;
index 847324d35d3ad966558fd801917bc53612ef04d8..70deb4eda87f36ad181dd85a2a8306ab0790afb0 100644 (file)
@@ -1,11 +1,32 @@
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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_InNodeThreads.cxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
+
 using namespace std;
-//=============================================================================
-// File      : DataFlowBase_InNodeThreads.cxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
 
 #include <stdlib.h>
 #include <iostream>
@@ -18,31 +39,31 @@ using namespace std;
 
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(SALOME_Component)
-#include "SALOME_NamingService.hxx"
+//#include "SALOME_NamingService.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 
 //#include "DataFlowExecutor_InNode.hxx"
 
 #include "DataFlowExecutor_OutNode.hxx"
 
-static char *containerName = "FactoryServer" ;
+//static char *containerName = "FactoryServer" ;
 
 int GraphExecutor::InNode::SendEvent(
                    const GraphExecutor::NodeEvent anEvent ) {  
-  SUPERV::AutomatonState old_state ;
 
+  _CurrentEvent = (GraphExecutor::NodeEvent ) anEvent ;
   cdebug << pthread_self() << "/" << ThreadNo() << " -->SendEvent Node "  << Name() 
          << " ControlState : "
          << Automaton()->ControlStateName( ControlState() )
         << " Event : " << Automaton()->EventName( anEvent )
-        << " State : " << Automaton()->StateName( State() ) << endl;
+        << " State : " << Automaton()->StateName( State() ) << " _RewindStack " << _RewindStack  << endl;
 
-  old_state = State() ;
-  _NextState = Automaton()->NextState( old_state , anEvent ) ;
-  if ( _NextState == old_state ) {
+  _OldState = State() ;
+  _NextState = Automaton()->NextState( _OldState , anEvent ) ;
+  if ( _NextState == _OldState ) {
     cdebug << pthread_self() << "/" << ThreadNo()
            << " GraphExecutor::InNodeThreads::SendEvent SameStates "
-           << old_state << endl ;
+           << _OldState << endl ;
     _NextAction = GraphExecutor::VoidAction ;
   }
   else {
@@ -50,25 +71,26 @@ int GraphExecutor::InNode::SendEvent(
   }
 
 //  State( _NextState ) ;
-//  if ( old_state == SUPERV::SuccessedExecutingState ||
-//       old_state == SUPERV::ErroredExecutingState ) {
+//  if ( _OldState == SUPERV::SuccessedExecutingState ||
+//       _OldState == SUPERV::ErroredExecutingState ) {
 //    DoneAction() ;
 //  }
 
   cdebug << pthread_self() << "/" << ThreadNo() << " SendedEvent Node "
          << Name() << endl << " ControlState : "
          << Automaton()->ControlStateName( ControlState() ) << endl
-         << " OldState : " << Automaton()->StateName( old_state ) << endl
+         << " OldState : " << Automaton()->StateName( _OldState ) << endl
          << " Event : " << Automaton()->EventName( anEvent ) << endl
          << " NextState : " << Automaton()->StateName( _NextState ) << endl
          << " Action : " << Automaton()->ActionName( _NextAction ) << endl
-         << " CreateNewThread " << CreateNewThread() << endl ;
+         << " CreateNewThread " << CreateNewThread() << endl
+         << " _RewindStack " << _RewindStack  << endl ;
 
 #if 0
   cout << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name()
        << endl << " ControlState : "
        << Automaton()->ControlStateName( ControlState() ) << endl
-       << " OldState : " << Automaton()->StateName( old_state ) << endl
+       << " OldState : " << Automaton()->StateName( _OldState ) << endl
        << " Event : " << Automaton()->EventName( anEvent ) << endl
        << " NextState : " << Automaton()->StateName( _NextState ) << endl
        << " Action : " << Automaton()->ActionName( _NextAction ) << endl
@@ -77,7 +99,7 @@ int GraphExecutor::InNode::SendEvent(
 
   int sts = executeAction() ;
 
-  cdebug << pthread_self() << "/" << ThreadNo() << " <- SendEvent Node " << Name() 
+  cdebug << pthread_self() << "/" << ThreadNo() << " <--- SendEvent Node " << Name() 
         << " Event : " << Automaton()->EventName( anEvent )
         << " State : " << Automaton()->StateName( State() )
          << endl;
@@ -395,11 +417,16 @@ void GraphExecutor::InNode::StopAction() {
 }
 
 int GraphExecutor::InNode::executeAction() {
+  if ( !CreateNewThread() && _RewindStack > 101 ) {
+    CreateNewThread( true ) ;
+    ThreadNo( 0 ) ;
+  }
   if ( CreateNewThread() ) {
     CreateNewThread( false ) ;
     if ( ThreadNo() == 0 ) {
+      _RewindStack = 1 ;
       cdebug << pthread_self() << "/" << ThreadNo()
-             << " executeAction start Thread "
+             << " executeAction start Thread _RewindStack " << _RewindStack << " "
              << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")"
              << endl;
       pthread_t T;
@@ -409,10 +436,18 @@ int GraphExecutor::InNode::executeAction() {
       while ( (pthread_sts = pthread_create(&T, NULL, run_function, this )) ) {
         char * msg = "Cannot pthread_create " ;
         perror( msg ) ;
-        cdebug << ThreadNo() << " " << msg << endl ;
+        cdebug << ThreadNo() << " " << msg << " --> sleep(5)" << endl ;
         cdebug << ThreadNo() << " PTHREAD_THREADS_MAX : "
-               << PTHREAD_THREADS_MAX << " " << pthread_sts << endl ;
-//        sleep( 1 ) ;
+               << PTHREAD_THREADS_MAX << " pthread_create status : " ;
+        if ( pthread_sts == EAGAIN ) {
+          cdebug << "EAGAIN(" << pthread_sts << ")" << endl ;
+          cdebug << "It seems to me that with gdb we are limited to 256 threads because of defunct" << endl ;
+       }
+        else {
+          cdebug << pthread_sts << endl ;
+       }
+        string smsg = msg ;
+        delete [] msg ;
         pthread_exit( msg ) ;
       }
       cdebug << pthread_self() << "/" << ThreadNo()
@@ -420,19 +455,16 @@ int GraphExecutor::InNode::executeAction() {
     }
     else {
       cdebug << pthread_self() << "/" << ThreadNo()
-             << " executeAction restart Thread "
+             << " executeAction restart Thread _RewindStack " << _RewindStack << " "
              << Automaton()->StateName( State() ) << " "
              << Automaton()->ActionName( _NextAction ) << "(" << Name()
              << ") ReStartAction ==>" << endl;
-      SUPERV::AutomatonState oldstate = State() ;
       State( SUPERV::SuspendedSuccessedState ) ;
       if ( !ReStartAction( this , GraphExecutor::ReStartEvent ) ) {
-//        State( oldstate ) ;
         cdebug << pthread_self() << "/" << ThreadNo()
                << " executeAction STATE & CALLED "
                << Automaton()->ActionName( _NextAction ) << "(" << Name()
                << ") ERROR-DEBUG " << endl;
-//        return ExecuteAction() ;
       }
       else {
         cdebug << pthread_self() << "/" << ThreadNo() << " executeAction NO CALL "
@@ -442,23 +474,24 @@ int GraphExecutor::InNode::executeAction() {
     }
   }
   else {
+    if ( _CurrentEvent == ExecuteEvent ) {
+      _RewindStack += 1 ;
+    }
     cdebug << pthread_self() << "/" << ThreadNo() << " executeAction call "
-           << Automaton()->ActionName( _NextAction ) << "(" << Name() << ")"
+           << Automaton()->ActionName( _NextAction ) << "(" << Name() << ") _RewindStack " << _RewindStack
            << endl;
     return ExecuteAction() ;
   }
-  return 1;
+  return 1 ;
 }
 
 void GraphExecutor::InNode::coutbegin() {
   cdebug << ThreadNo() << " " << pthread_self() << " run_function begin"
-         << " " << Name() << " " << Automaton()->StateName( State() )
-         << endl ;
+         << " " << Name() << " " << Automaton()->StateName( State() ) << endl ;
 }
 void GraphExecutor::InNode::coutexit() {
-  cdebug << pthread_self() << "/" << ThreadNo() << " run_function pthread_exit"
-         << " " << Name() << " " << Automaton()->StateName( State() )
-         << endl ;
+  cdebug << pthread_self() << "/" << ThreadNo() << " run_function pthread_exit _RewindStack " << _RewindStack
+         << " " << Name() << " " << Automaton()->StateName( State() ) << endl ;
 }
 void * run_function(void *p) {
   GraphExecutor::InNode *aNode = (GraphExecutor::InNode *) p;
@@ -474,11 +507,12 @@ void * run_function(void *p) {
   }
   aNode->ExecuteAction() ;
   char * msg = new char[40] ;
-  sprintf( msg , "%d" , aNode->ThreadNo() ) ;
+  sprintf( msg , "%d" , (int ) aNode->ThreadNo() ) ;
   strcat( msg , " thread exit" ) ;
   aNode->coutexit() ;
   aNode->ExitThread() ;
   string smsg = msg ;
+  delete [] msg ;
   pthread_exit( (void * ) smsg.c_str() ) ;
   return msg ;
 }
@@ -649,16 +683,16 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
   bool LoopBeginning = false ;
   bool SwitchFinished = false ;
 
-  if ( IsEndLoopNode() && !GetChangeNodeInPort( 0 )->GetOutPort()->BoolValue() ) {
+  if ( IsEndLoopNode() && !GetChangeNodeInLoop()->GetOutPort()->BoolValue() ) {
     LoopFinished = true ; // End of Loop
   }
-  if ( IsLoopNode() && GetChangeNodeInPort( 1 )->GetOutPort()->BoolValue() ) {
+  if ( IsLoopNode() && GetChangeNodeInLoop()->GetOutPort()->BoolValue() ) {
     LoopBeginning = true ; // Beginning of Loop
   }
-  if ( IsEndSwitchNode() && !GetChangeNodeInPort( 0 )->GetOutPort()->BoolValue() ) {
+  if ( IsEndSwitchNode() && !GetChangeNodeInGate()->GetOutPort()->BoolValue() ) {
     SwitchFinished = true ;
   }
-  for ( k = 0 ; k < GetNodeInPortsSize() ; k++ ) {
+  for ( k = 0 ; k < (unsigned int ) GetNodeInPortsSize() ; k++ ) {
     GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ;
     GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
     if ( anInPort->IsGate() && anOutPort == NULL ) {
@@ -681,7 +715,6 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
 #endif
         cdebug << endl ;
       }
-//      else if ( LoopBeginning && anInPort->IsDataConnected() ) {
       else if ( IsLoopNode() && anInPort->IsDataConnected() ) {
         anInPort->State( SUPERV::ReadyState ) ;
         InReady += 1 ;
@@ -938,8 +971,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
   bool Err = false ;
 
   int nInParams = GetNodeInPortsSize()  ;
-  ServicesAnyData * aListOfInParameters = new ServicesAnyData[nInParams];
-  InParametersSet( Err , nInParams , aListOfInParameters ) ;
+  ServicesAnyData * InParametersList = new ServicesAnyData[nInParams];
+  InParametersSet( Err , nInParams , InParametersList ) ;
 
   Engines::Container_var myContainer ;
   Engines::Component_var myObjComponent ;
@@ -950,7 +983,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
     if ( IsComputingNode() ) {
       ObjInterface( true ) ;
       CORBA::Object_ptr obj ;
-      aListOfInParameters[1].Value >>= obj ;
+      InParametersList[0].Value >>= obj ;
       CORBA::Object_var objvar = CORBA::Object_var( obj ) ;
       myObjComponent = Engines::Component::_narrow( objvar ) ;
     }
@@ -963,7 +996,7 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                                      myContainer , myObjComponent ) ;
 //    if ( !Err && nInParams > 1 &&
 //         strcmp( ComponentName() , InterfaceName() ) &&
-//         aListOfInParameters[ 1 ].Value.type()->kind() ==
+//         InParametersList[ 1 ].Value.type()->kind() ==
 //                                                  CORBA::tk_objref ) {
 //    }
 //    else {
@@ -981,8 +1014,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
   }
 
   int nOutParams = GetNodeOutPortsSize()  ;
-  ServicesAnyData * aListOfOutParameters = new ServicesAnyData[nOutParams];
-  InOutParameters( nOutParams , aListOfOutParameters ) ;
+  ServicesAnyData * OutParametersList = new ServicesAnyData[nOutParams];
+  InOutParametersSet( nOutParams , OutParametersList ) ;
 
 //  if ( strlen( ComponentName() ) ) {
     if ( Err || ControlState() == SUPERV::ToKillState ||
@@ -994,14 +1027,20 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
     else {
       if ( !Err ) {
         cdebug << ThreadNo() << " Run( '" << ServiceName() << "'" ;
-        for ( i = 0 ; i < nInParams ; i++ ) {
-          cdebug << " , " << aListOfInParameters[ i ].Name ;
+        for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
+          cdebug << " , " << InParametersList[ i ].Name << "[kind"
+                 << InParametersList[ i ].Value.type()->kind() << "]" ;
+        }
+        for ( i = 0 ; i < (int ) ServiceOutParameter().length() ; i++ ) {
+          cdebug << " , " << OutParametersList[ i ].Name << "[kind"
+                 << OutParametersList[ i ].Value.type()->kind() << "]" ;
         }
         cdebug << ")" << endl ;
 
         if ( IsOneOfInLineNodes() ) {
           bool StsPyDynInvoke = true ;
-          _OutNode->PThreadLock() ;
+          _OutNode->PyThreadLock() ;
+          SetPyCpuUsed() ;
           try {
             if ( IsInLineNode() && (*InLineNode()->PythonFunction()).length() &&
                  strlen( InLineNode()->PyFuncName() ) ) {
@@ -1010,18 +1049,18 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                      << "' IsInLineNode PyDynInvoke"  << endl ;
               StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                InLineNode()->PyFuncName() ,
-                               &aListOfInParameters[1] , ServiceInParameter().length() ,
-                               &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                               &InParametersList[0] , ServiceInParameter().length() ,
+                               &OutParametersList[0] , ServiceOutParameter().length() ) ;
            }
             else if ( IsLoopNode() ) {
-              if ( GetNodeInPort( 1 )->GetOutPort()->BoolValue() ) { // InLoop Port
+              if ( GetNodeInLoop()->GetOutPort()->BoolValue() ) { // InLoop Port
                 cdebug << ThreadNo() << " !ObjInterface " << Name()
                        << " IsLoopNode PyDynInvoke '" << InLineNode()->PyFuncName()
                        << "'" << endl ;
                 StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                InLineNode()->PyFuncName() ,
-                               &aListOfInParameters[2] , ServiceInParameter().length() ,
-                               &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                               &InParametersList[1] , ServiceInParameter().length() ,
+                               &OutParametersList[1] , ServiceOutParameter().length() ) ;
              }
               else {
                 cdebug << ThreadNo() << " !ObjInterface " << Name()
@@ -1029,8 +1068,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                        << "'" << endl ;
                 StsPyDynInvoke = PyDynInvoke( LoopNode()->PyNextMethod() ,
                              LoopNode()->PyNextName() ,
-                             &aListOfInParameters[2] , ServiceInParameter().length() ,
-                             &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                             &InParametersList[1] , ServiceInParameter().length() ,
+                             &OutParametersList[1] , ServiceOutParameter().length() ) ;
              }
               if ( StsPyDynInvoke ) {
                 cdebug << ThreadNo() << " !ObjInterface " << Name()
@@ -1038,40 +1077,59 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                        << "' Copy of " << ServiceInParameter().length()
                        << " OutParameters" << endl ;
                 int i ;
-                for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
-                  aListOfInParameters[2 + i].Value = aListOfOutParameters[1+ i].Value ;
-                  aListOfInParameters[2 + i].Name = aListOfOutParameters[1+ i].Name ;
-                  switch ( aListOfInParameters[2 + i].Value.type()->kind() ) {
+                for ( i = 1 ; i <= (int ) ServiceInParameter().length() ; i++ ) {
+                  InParametersList[i].Value = OutParametersList[i].Value ;
+                  InParametersList[i].Name = OutParametersList[i].Name ;
+//#if 0
+                  switch ( InParametersList[i].Value.type()->kind() ) {
                   case CORBA::tk_string :
-                    cdebug << "Arg" << i << " : "
-                           << aListOfInParameters[2 + i].Name.c_str()
-                           << " Value(string) " << endl ;
+                    char * t;
+                    InParametersList[i].Value >>= t ;
+                    cdebug << "ArgOut->In" << i << " : "
+                           << InParametersList[i].Name.c_str()
+                           << " Value(string) " << t << endl ;
                     break ;
                   case CORBA::tk_double :
-                    cdebug << "Arg" << i << " : "
-                           << aListOfInParameters[2 + i].Name.c_str()
-                           << " Value(double) " << endl ;
+                    double d;
+                    InParametersList[i].Value >>= d;
+                    cdebug << "ArgOut->In" << i << " : "
+                           << InParametersList[i].Name.c_str()
+                           << " Value(double) " << d << endl ;
                     break ;
                   case CORBA::tk_long :
-                    cdebug << "Arg" << i << " : "
-                           << aListOfInParameters[2 + i].Name.c_str()
-                           << " Value(long) " << endl ;
+                    long l;
+                    InParametersList[i].Value >>= l;
+                    cdebug << "ArgOut->In" << i << " : "
+                           << InParametersList[i].Name.c_str()
+                           << " Value(long) " << l << endl ;
                     break ;
                   case CORBA::tk_objref :
-                    cdebug << "Arg" << i << " : "
-                           << aListOfInParameters[2 + i].Name.c_str()
-                           << " Value(object reference) " << endl ;
+                    CORBA::Object_ptr obj ;
+                    char * retstr ;
+                    try {
+                      InParametersList[i].Value >>= obj ;
+                      retstr = ObjectToString( obj );
+                      cdebug << "ArgOut->In" << i << " : "
+                             << InParametersList[i].Name.c_str()
+                             << " Value(object reference) " << retstr << endl ;
+                    }
+                    catch ( ... ) {
+                      cdebug << "ArgOut->In" << i << " : "
+                             << InParametersList[i].Name.c_str()
+                             << " Value(object reference) Catched ERROR" << endl ;
+                   }
                     break ;
                   default :
-                    cdebug << "Arg" << i << " : "
-                           << aListOfInParameters[2 + i].Name.c_str()
+                    cdebug << "ArgOut->In" << i << " : "
+                           << InParametersList[i].Name.c_str()
                            << " Value(other) ERROR" << endl ;
                  }
+//#endif
                }
                 StsPyDynInvoke = PyDynInvoke( LoopNode()->PyMoreMethod() ,
                            LoopNode()->PyMoreName() ,
-                           &aListOfInParameters[2] , ServiceInParameter().length() ,
-                           &aListOfOutParameters[0] , ServiceOutParameter().length()+1 ) ;
+                           &InParametersList[1] , ServiceInParameter().length() ,
+                           &OutParametersList[0] , ServiceOutParameter().length()+1 ) ;
              }
               else {
                 Err = true ;
@@ -1087,8 +1145,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                      << "' IsSwitchNode PyDynInvoke"  << endl ;
               StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                InLineNode()->PyFuncName() ,
-                               &aListOfInParameters[1] , ServiceInParameter().length() ,
-                               &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                               &InParametersList[0] , ServiceInParameter().length() ,
+                               &OutParametersList[0] , ServiceOutParameter().length() ) ;
            }
             else if ( IsGOTONode() && (*GOTONode()->PythonFunction()).length() &&
                       strlen( InLineNode()->PyFuncName() ) ) {
@@ -1097,8 +1155,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                      << "' IsGOTONode PyDynInvoke"  << endl ;
               StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                InLineNode()->PyFuncName() ,
-                               &aListOfInParameters[1] , ServiceInParameter().length() ,
-                               &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                               &InParametersList[0] , ServiceInParameter().length() ,
+                               &OutParametersList[0] , ServiceOutParameter().length() ) ;
            }
             else if ( IsEndSwitchNode() && (*InLineNode()->PythonFunction()).length() &&
                       strlen( InLineNode()->PyFuncName() ) ) {
@@ -1107,8 +1165,8 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                      << "' IsSwitchNode PyDynInvoke"  << endl ;
               StsPyDynInvoke = PyDynInvoke( InLineNode()->PyRunMethod() ,
                                InLineNode()->PyFuncName() ,
-                               &aListOfInParameters[1] , ServiceInParameter().length() ,
-                               &aListOfOutParameters[0] , ServiceOutParameter().length() ) ;
+                               &InParametersList[0] , ServiceInParameter().length() ,
+                               &OutParametersList[0] , ServiceOutParameter().length() ) ;
            }
             else if ( (*InLineNode()->PythonFunction()).length() == 0 ||
                       strlen( InLineNode()->PyFuncName() ) == 0 ) {
@@ -1116,47 +1174,47 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                      << " Copy of " << ServiceInParameter().length()
                      << " OutParameters" << endl ;
               int i ;
-              int argind0 = 0 ;
-              if ( IsEndSwitchNode() ) {
-                argind0 = 0 ;
+              int argout0 = 0 ;
+              int argin0 = 0 ;
+              if ( IsEndLoopNode() ) {
+                argout0 = 1 ;
+                argin0 = 1 ; // after DoLoop
              }
-              else if ( IsEndLoopNode() || IsGOTONode() ) {
-                argind0 = 1 ;
-             }
-              for ( i = 0 ; i < ServiceInParameter().length() ; i++ ) {
-                aListOfOutParameters[argind0 + i].Value = aListOfInParameters[ 1 + i].Value ;
-//                aListOfOutParameters[argind0 + i].Name = aListOfInParameters[argind0 + i].Name ;
-                switch ( aListOfInParameters[ 1 + i].Value.type()->kind() ) {
+              for ( i = 0 ; i < (int ) ServiceInParameter().length() ; i++ ) {
+                OutParametersList[argout0 + i].Value = InParametersList[argin0 + i].Value ;
+//#if 0
+                switch ( InParametersList[argin0 + i].Value.type()->kind() ) {
                 case CORBA::tk_string :
-                  cdebug << "Arg" << i << " : "
-                         << aListOfInParameters[ 1 + i].Name.c_str()
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
                          << " Value(string) "
-                         << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+                         << OutParametersList[argin0 + i].Name.c_str() << endl ;
                   break ;
                 case CORBA::tk_double :
-                  cdebug << "Arg" << i << " : "
-                         << aListOfInParameters[ 1 + i].Name.c_str()
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
                          << " Value(double) "
-                         << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+                         << OutParametersList[argin0 + i].Name.c_str() << endl ;
                   break ;
                 case CORBA::tk_long :
-                  cdebug << "Arg" << i << " : "
-                         << aListOfInParameters[ 1 + i].Name.c_str()
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
                          << " Value(long) "
-                         << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+                         << OutParametersList[ i ].Name.c_str() << endl ;
                   break ;
                 case CORBA::tk_objref :
-                  cdebug << "Arg" << i << " : "
-                         << aListOfInParameters[ 1 + i].Name.c_str()
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
                          << " Value(object reference) "
-                         << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+                         << OutParametersList[argin0 + i].Name.c_str() << endl ;
                   break ;
                 default :
-                  cdebug << "Arg" << i << " : "
-                         << aListOfInParameters[ 1 + i].Name.c_str()
+                  cdebug << "ArgOut->In" << argin0 + i << " : "
+                         << InParametersList[argin0 + i].Name.c_str()
                          << " Value(other) ERROR "
-                         << aListOfOutParameters[argind0 + i].Name.c_str() << endl ;
+                         << OutParametersList[argin0 + i].Name.c_str() << endl ;
                }
+//#endif
              }
            }
             if ( !StsPyDynInvoke ) {
@@ -1172,10 +1230,10 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                    << " Python Dynamic Call Exception catched ERROR"
                    << endl ;
          }
-          _OutNode->PThreadUnLock() ;
+          CpuUsed( true ) ;
+          _OutNode->PyThreadUnLock() ;
        }
-//        else if ( !ObjInterface() ) {
-        else if ( IsFactoryNode() ) {
+        else {
           try {
             try {
               DynInvoke( myObjComponent, "Names" ,
@@ -1191,16 +1249,16 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                      << " IsComputingNode DynInvoke"  << endl ;
               DynInvoke( myObjComponent,
                          ServiceName() ,
-                         &aListOfInParameters[1] , ServiceInParameter().length() ,
-                         &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                         &InParametersList[1] , ServiceInParameter().length()-1 ,
+                         &OutParametersList[0] , ServiceOutParameter().length() ) ;
            }
             else if ( IsFactoryNode() ) {
               cdebug << ThreadNo() << " !ObjInterface " << Name()
                      << " IsFactoryNode DynInvoke"  << endl ;
               DynInvoke( myObjComponent,
                          ServiceName() ,
-                         &aListOfInParameters[1] , ServiceInParameter().length() ,
-                         &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
+                         &InParametersList[0] , ServiceInParameter().length() ,
+                         &OutParametersList[0] , ServiceOutParameter().length() ) ;
            }
           }
           catch( ... ) {
@@ -1210,28 +1268,6 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                    << endl ;
          }
         }
-        else {
-          try {
-            try {
-              DynInvoke( myObjComponent, "Names" ,
-                         _OutNode->Name() , Name() ) ;
-            }
-            catch( ... ) {
-           }
-            cdebug << ThreadNo() << " ObjInterface " << Name() << " DynInvoke"
-                   << endl ;
-            DynInvoke( myObjComponent ,
-                       ServiceName() ,
-                       &aListOfInParameters[2] , ServiceInParameter().length()-1 ,
-                       &aListOfOutParameters[1] , ServiceOutParameter().length() ) ;
-         }
-          catch( ... ) {
-            Err = true ;
-            cdebug << ThreadNo() << " ObjInterface " << Name()
-                   << " Node(Interface) Dynamic Call Exception catched ERROR"
-                   << endl ;
-         }
-        }
       }
     }
 //  }
@@ -1259,12 +1295,12 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
     NewEvent = GraphExecutor::SuccessEvent ;
   }
 
-  bool ErrOut = OutParameters( Err , PortState , nOutParams , aListOfOutParameters ) ;
+  bool ErrOut = OutParametersSet( Err , PortState , nOutParams , OutParametersList ) ;
   if ( !ErrOut ) {
     NewEvent = GraphExecutor::ErrorEvent ;
   }
-  delete [] aListOfInParameters ;
-  delete [] aListOfOutParameters ;
+  delete [] InParametersList ;
+  delete [] OutParametersList ;
 
   SendEvent( NewEvent );
 
@@ -1436,17 +1472,19 @@ void GraphExecutor::InNode::SetWaitingStates(GraphExecutor::InNode * EndNode ) {
     else if ( anInPort->State() != SUPERV::WaitingState ) {
       if ( !docdebug ) {
         cdebug << ThreadNo()
-               << " --> GraphExecutor::InNodeThreads::SetWaitingStates "
-               << Name() << endl;
+               << " --> GraphExecutor::InNodeThreads::SetWaitingStates " << Name() << endl;
         docdebug = true ;
       }
       anInPort->State( SUPERV::WaitingState ) ;
     }
   }
   for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
-    if ( !( IsGOTONode() && i == 0 ) && !( IsEndLoopNode() && i <= 1 ) ) {
-      for ( j = 0 ; j < GetChangeNodeOutPort( i )->InPortsSize() ; j++ ) {
-        GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->GetChangeGraphNode( GetChangeNodeOutPort( i )->ChangeInPorts( j )->NodeName() )->GetInNode() ;
+    for ( j = 0 ; j < GetChangeNodeOutPort( i )->InPortsSize() ; j++ ) {
+      GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
+//      if ( !( IsGOTONode() && i == 0 ) && !( IsEndLoopNode() && i <= 1 ) ) {
+      if ( !( IsGOTONode() && anOutPort->IsGate() ) &&
+           !( IsEndLoopNode() && ( anOutPort->IsGate() || anOutPort->IsLoop() ) ) ) {
+        GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ;
         if ( aNode != EndNode ) {
           aNode->SetWaitingStates( EndNode ) ;
        }
@@ -1469,73 +1507,89 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
   DoneAction() ;
 
   if ( IsGOTONode() ||
-       ( IsEndLoopNode() && GetNodeInPort(0)->GetOutPort()->BoolValue() ) ) {
-//    int index ;
-//    if ( IsGOTONode() ) {
-//      index = 0 ;
-//    }
-//    else {
-//      index = 1 ;
-//      CORBA::Any * anAny = new CORBA::Any() ;
-//      *anAny <<= (long ) 0 ;
-//      GetChangeNodeOutPort(1)->Value( anAny ) ; // Loop(InLoop) = false 
-//    }
-//    const GraphBase::OutPort * GateOutPort = GetNodeOutPort(index) ;
-    const GraphBase::OutPort * GateOutPort = GetNodeOutPort(0) ;
-    for ( i = 0 ; i < GateOutPort->InPortsSize() ; i++ ) {
-      const GraphBase::InPort * anInPort = GateOutPort->InPorts( i ) ;
+       ( IsEndLoopNode() && GetNodeInLoop()->GetOutPort()->BoolValue() ) ) {
+    const GraphBase::OutPort * aGateOutPort ;
+    if ( IsGOTONode() ) {
+      aGateOutPort = GetNodeOutGate() ;
+    }
+    else {
+      aGateOutPort = GetNodeOutLoop() ;
+    }
+    for ( i = 0 ; i < aGateOutPort->InPortsSize() ; i++ ) {
+      const GraphBase::InPort * anInPort = aGateOutPort->InPorts( i ) ;
       GraphExecutor::InNode * aLabelNode = (GraphExecutor::InNode *) _OutNode->GetChangeGraphNode( anInPort->NodeName() )->GetInNode() ;
+      cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode "
+             << aLabelNode->Name() << " from port " << anInPort->PortName() << endl ;
       aLabelNode->SetWaitingStates( this ) ;
-      for ( j = 1 ; j < GetNodeOutPortsSize() ; j++ ) {
+      for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) {
+        const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ;
+        if ( anInPort->GetOutPort() ) {
+          cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : "
+                 << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")"
+                 << endl ;
+       }
+      }
+      for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) {
         GraphBase::OutPort * aBusParamOutPort = GetChangeNodeOutPort( j ) ;
-        GraphBase::InPort * aBusParamChangeInPort = NULL ;
-//        if ( aBusParamOutPort->IsLoop() ) {
-//          aBusParamChangeInPort = aLabelNode->GetChangeInPort( "InitLoop" ) ;
-//     }
-//        else {
-          aBusParamChangeInPort = aLabelNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
-//     }
-        if ( aBusParamChangeInPort ) {
-          aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ;
-          if ( !aLabelNode->IsLockedDataWait() ) {
-            res = aLabelNode->SendSomeDataReady( Name() ) ;
-            if ( res ) {
-              if ( firsttoNode == NULL &&
-                   aLabelNode->ThreadNo() == pthread_self() ) {
-                firsttoNode = aLabelNode ;
-                cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode "
-                       << aLabelNode->Name() << endl ;
-              }
-              else if ( firstzeroNode == NULL &&
-                        aLabelNode->ThreadNo() == 0 ) {
-                firstzeroNode = aLabelNode ;
-             }
-              else {
-                SomeDataNodes.push_back( aLabelNode ) ;
-                cdebug << ThreadNo() << " Successed_SuccessAction push "
-                       << SomeDataNodes.size() << " " << aLabelNode->Name()
-                       << endl ;
+        if ( !aBusParamOutPort->IsGate() ) {
+          GraphBase::InPort * aBusParamChangeInPort = NULL ;
+          if ( aBusParamOutPort->IsLoop() ) {
+            aBusParamChangeInPort = aLabelNode->GetChangeNodeInLoop() ;
+         }
+          else {
+            aBusParamChangeInPort = aLabelNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
+         }
+          if ( aBusParamChangeInPort ) {
+            aBusParamChangeInPort->ChangeOutPort( aBusParamOutPort ) ;
+            cdebug << ThreadNo() << " Successed_SuccessAction " << Name() << " ChangeOutPort to HeadNode "
+                   << aLabelNode->Name() << "(" << aBusParamChangeInPort->PortName() << ") from port "
+                   << aBusParamOutPort->PortName() << endl ;
+            if ( !aLabelNode->IsLockedDataWait() ) {
+              res = aLabelNode->SendSomeDataReady( Name() ) ;
+              if ( res ) {
+                if ( firsttoNode == NULL &&
+                     aLabelNode->ThreadNo() == pthread_self() ) {
+                  firsttoNode = aLabelNode ;
+                  cdebug << ThreadNo() << " Successed_SuccessAction firsttoNode "
+                         << aLabelNode->Name() << endl ;
+                }
+                else if ( firstzeroNode == NULL &&
+                          aLabelNode->ThreadNo() == 0 ) {
+                  firstzeroNode = aLabelNode ;
+               }
+                else {
+                  SomeDataNodes.push_back( aLabelNode ) ;
+                  cdebug << ThreadNo() << " Successed_SuccessAction push "
+                         << SomeDataNodes.size() << " " << aLabelNode->Name()
+                         << endl ;
+               }
              }
            }
-         }
+            else {
+              cdebug << ThreadNo()
+                     << " Successed_SuccessAction Loop to HeadNode "
+                     << aLabelNode->Name() << " with datas from " << Name() << "("
+                     << aBusParamOutPort->PortName() << ") to port "
+                     << aBusParamChangeInPort->PortName() << endl;
+           }
+         }
           else {
-            cdebug << ThreadNo()
-                   << " Successed_SuccessAction Loop to HeadNode "
-                   << aLabelNode->Name() << " with datas from "
-                   << aBusParamOutPort->PortName() << " to port "
-                   << aBusParamChangeInPort->PortName() << endl;
+            cdebug << ThreadNo() << " ERROR in Successed_SuccessAction of " << Name()
+                   << " NO port " << aBusParamOutPort->PortName() << " in "
+                   << aLabelNode->Name() << endl;
          }
-       }
-        else {
-          cdebug << ThreadNo() << " ERROR in Successed_SuccessAction of " << Name()
-                 << " NO port " << aBusParamOutPort->PortName() << " in "
-                 << aLabelNode->Name() << endl;
         }
       }
-//      const GraphBase::OutPort * aGateOutPort = GetNodeOutPort( index ) ;
-//      const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInPort( index ) ;
-      const GraphBase::OutPort * aGateOutPort = GetNodeOutPort( 0 ) ; // DoLoop or OutGate
-      const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInPort( 0 ) ;
+      for ( j = 0 ; j < aLabelNode->GetNodeInPortsSize() ; j++ ) {
+        const GraphBase::InPort * anInPort = aLabelNode->GetNodeInPort( j ) ;
+        if ( anInPort->GetOutPort() ) {
+          cdebug << aLabelNode->Name() << "(" << anInPort->PortName() << ") value : "
+                 << anInPort->GetOutPort()->NodeName() << "(" << anInPort->GetOutPort()->PortName() << ")"
+                 << endl ;
+       }
+      }
+//      const GraphBase::OutPort * aGateOutPort = GetNodeOutPort( 0 ) ; // DoLoop or OutGate
+      const GraphBase::InPort * aGateInPort = aLabelNode->GetNodeInGate() ;
       if ( aGateInPort ) {
         if ( aGateInPort->GetOutPort() ) {
           aGateInPort->GetOutPort()->Value( aGateOutPort->Value() ) ;
@@ -1580,15 +1634,15 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
       cdebug << " " << LinkedNodes( i )->Name() ;
     }
     cdebug << endl;
-    SUPERV::ControlState aControl = ControlState() ;
+//    SUPERV::ControlState aControl = ControlState() ;
     for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
       bool IgnoreForEndLoop = false ;
       toNode = (GraphExecutor::InNode *) LinkedNodes( i )->GetInNode() ;
       cdebug << ThreadNo() << " Successed_SuccessAction of " << Name()
              << " [" << i << "] " << LinkedNodes( i )->Name() << endl ;
       if ( toNode && !toNode->IsDataFlowNode() ) {
-        GraphBase::InPort * toGateInPort = toNode->GetChangeNodeInPort(0) ;
         if ( IsComputingNode() && toNode->IsInLineNode() ) {
+          GraphBase::InPort * toGateInPort = toNode->GetChangeNodeInGate() ;
           toGateInPort->State( SUPERV::ReadyState ) ;
           GraphBase::OutPort * GateOutPort = toGateInPort->GetOutPort() ;
           if ( GateOutPort ) {
@@ -1599,14 +1653,15 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
         }
       }
       if ( toNode && IsLoopNode() ) {
-        GraphBase::OutPort * fromLoopOutPort = GetChangeNodeOutPort(0) ;
-        if ( !fromLoopOutPort->BoolValue() ) {
+        GraphBase::OutPort * fromLoopOutPort = GetChangeNodeOutLoop() ;
+        if ( !fromLoopOutPort->BoolValue() ) { // Ne pas faire la boucle
           if ( strcmp( toNode->Name() , CoupledNode()->Name() ) ) {
-            IgnoreForEndLoop = true ; // toNode is the EndLoopNode
+            IgnoreForEndLoop = true ;
          }
-          else {
+          else { // toNode is the EndLoopNode
             GraphBase::InPort * toLoopInPort ;
-            toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+//            toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+            toLoopInPort = toNode->GetChangeNodeInLoop() ;
             if ( toLoopInPort->State() != SUPERV::ReadyState ) {
               toLoopInPort->State( SUPERV::ReadyState ) ;
            }
@@ -1623,7 +1678,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
       }
       if ( toNode && !IgnoreForEndLoop ) {
         if ( toNode && toNode->IsLoopNode() ) {
-          GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+//          GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInPort(1) ;
+          GraphBase::InPort * toLoopInPort = toNode->GetChangeNodeInLoop() ;
           toLoopInPort->State( SUPERV::ReadyState ) ;
           GraphBase::OutPort * LoopOutPort = toLoopInPort->GetOutPort() ;
           LoopOutPort->PortStatus( DataConnected );
@@ -1696,6 +1752,7 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
            << " Successed_SuccessAction pop firsttoNode "
            << SomeDataNodes.size() << " " << firsttoNode->Name() << endl ;
     firsttoNode->CreateNewThreadIf( false ) ;
+    firsttoNode->RewindStack( RewindStack() ) ;
     if ( firsttoNode->State() == SUPERV::SuccessedState ) {
       cdebug << pthread_self() << "/" << ThreadNo() << " " << Name()
              << " : " << firsttoNode->Name() << " "
@@ -1946,10 +2003,10 @@ int GraphExecutor::InNode::SuspendedErrored_ReStartAndSuspendAction() {
 void GraphExecutor::InNode::InParametersSet(
                             bool & Err ,
                             int  nInParams ,
-                            ServicesAnyData * aListOfInParameters ) {
+                            ServicesAnyData * InParametersList ) {
   int i ;
   for ( i = 0 ; i < nInParams ; i++ ) {
-    ServicesAnyData D = aListOfInParameters[i];
+    ServicesAnyData D = InParametersList[i];
     GraphBase::InPort * anInPort = GetChangeNodeInPort(i) ;
     GraphBase::OutPort * theOutPort = anInPort->GetOutPort() ;
     if ( anInPort->IsGate() && theOutPort == NULL ) {
@@ -1957,7 +2014,6 @@ void GraphExecutor::InNode::InParametersSet(
              << anInPort->GetServicesParameter().Parametertype
              << " is inactive. " << anInPort->Kind() << endl ;
     }
-//    else if ( theOutPort->State() == SUPERV::ReadyState ) {
     else if ( anInPort->State() == SUPERV::ReadyState ) {
       if ( anInPort->IsGate() ) {
         CORBA::Any * anAny = new CORBA::Any() ;
@@ -1965,42 +2021,136 @@ void GraphExecutor::InNode::InParametersSet(
         theOutPort->Value( anAny ) ;
       }
       anInPort->State( SUPERV::WaitingState ) ;
-//      const CORBA::Any * theValue = theOutPort->Value() ;
       D.Name = CORBA::string_dup( anInPort->GetServicesParameter().Parametername ) ;
-//      D.Value = *theValue ; // CORBA::Any
-      D.Value = *theOutPort->Value() ; // CORBA::Any
       cdebug << ThreadNo() << " ArgIn" << i << " " << anInPort->Kind() ;
-      cdebug << D.Name << " " << anInPort->GetServicesParameter().Parametertype
-             << " : " ;
+      cdebug << "      " << D.Name << " " << anInPort->GetServicesParameter().Parametertype << " : " ;
+      D.Value = *theOutPort->Value() ; // CORBA::Any
       string _Type = CORBA::string_dup( anInPort->GetServicesParameter().Parametertype ) ;
       const char * Type = _Type.c_str() ;
-      switch (D.Value.type()->kind()) {
+      switch ( D.Value.type()->kind() ) { // { string , long , double , objref }
       case CORBA::tk_string:
         char * t;
         D.Value >>= t;
-        cdebug << t << " (string)" << endl ;
+        cdebug << t << " (string)" ;
         if ( !strcmp( Type , "string" ) ) {
         }
-        else if ( !strcmp( Type , "double" ) ) {
-          double d ;
-          sscanf( t , "%lf" , &d ) ;
-          D.Value <<= d ;
-          theOutPort->Value( D.Value ) ;
+        else if ( !strcmp( Type , "boolean" ) ) {
+          bool b ;
+          long d ;
+          sscanf( t , "%ld" , &d ) ;
+          b = (bool ) d ;
+          D.Value <<=  (CORBA::Any::from_boolean ) b ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "char" ) ) {
+          unsigned char c ;
+          long d ;
+          sscanf( t , "%ld" , &d ) ;
+          c = (short ) d ;
+          D.Value <<=  (CORBA::Any::from_char ) c ;
+          cdebug << "string '" << t << "' --> " << d << " --> char " << c ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+        else if ( !strcmp( Type , "short" ) ) {
+          short s ;
+          long d ;
+          sscanf( t , "%ld" , &d ) ;
+          s = (short ) d ;
+          D.Value <<=  s ;
+          cdebug << "string '" << t << "' --> " << d << " --> short " << s ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
           long l ;
           sscanf( t , "%ld" , &l ) ;
           D.Value <<=  l ;
-          theOutPort->Value( D.Value ) ;
+          cdebug << "string '" << t << " --> long " << l ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "float" ) ) {
+          double d ;
+          sscanf( t , "%lf" , &d ) ;
+          float f = d ;
+          D.Value <<= f ;
+          cdebug << "string '" << t << "' --> " << setw(25) << setprecision(18) << d << " --> float " << " = "
+                 << setw(25) << setprecision(18) << f ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "objref" ) ) {
+        else if ( !strcmp( Type , "double" ) ) {
+          double d ;
+          sscanf( t , "%lf" , &d ) ;
+          D.Value <<= d ;
+          cdebug << "string '" << t << " --> double " << setw(25) << setprecision(18) << d ;
+//          theOutPort->Value( D.Value ) ;
+        }
+//        else if ( !strcmp( Type , "objref" ) ) {
+        else { // Default
           CORBA::Object_ptr ObjRef ;
-          ObjRef = StringToObject( t ) ;
-          D.Value <<= ObjRef ;
-          theOutPort->Value( D.Value ) ;
+          try {
+            ObjRef = StringToObject( t ) ;
+            D.Value <<= ObjRef ;
+         }
+          catch( ... ) {
+            D.Value <<= CORBA::Object::_nil() ;
+         }
+//          theOutPort->Value( D.Value ) ;
         }
-        else {
+//        else {
+//          cdebug << " (other ERROR)" << endl ;
+//        }
+        cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
+        break;
+      case CORBA::tk_long:
+        long l;
+        D.Value >>= l;
+        cdebug << l << " (long)" << endl ;
+        if ( !strcmp( Type , "string" ) ) {
+          char t[40] ;
+          sprintf( t , "%ld" , l ) ;
+          D.Value <<= t ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "boolean" ) ) {
+          bool b ;
+          b = (bool ) l ;
+          D.Value <<=  (CORBA::Any::from_boolean ) b ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "char" ) ) {
+          unsigned char c ;
+          c = (unsigned char ) l ;
+          D.Value <<=  (CORBA::Any::from_char ) c ;
+//          theOutPort->Value( D.Value ) ;
         }
+        else if ( !strcmp( Type , "short" ) ) {
+          short s ;
+          s = (short ) l ;
+          D.Value <<=  s ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+        }
+        else if ( !strcmp( Type , "float" ) ) {
+          float f ;
+          f = (float ) l ;
+          D.Value <<= f ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "double" ) ) {
+          double d ;
+          d = (double ) l ;
+          D.Value <<= d ;
+//          theOutPort->Value( D.Value ) ;
+        }
+//        else if ( !strcmp( Type , "objref" ) ) {
+        else { // Default
+          D.Value <<= CORBA::Object::_nil() ;
+//          theOutPort->Value( D.Value ) ;
+        }
+//        else {
+//          cdebug << " (other ERROR)" << endl ;
+//        }
+        cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
         break;
       case CORBA::tk_double:
         double d;
@@ -2008,64 +2158,122 @@ void GraphExecutor::InNode::InParametersSet(
         cdebug << d << " (double)" << endl ;
         if ( !strcmp( Type , "string" ) ) {
           char t[40] ;
-          sprintf( t , "lf" , d ) ;
+          sprintf( t , "%lf" , d ) ;
           D.Value <<= t ;
-          theOutPort->Value( D.Value ) ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "double" ) ) {
+        else if ( !strcmp( Type , "boolean" ) ) {
+          bool b ;
+          b = (bool ) d ;
+          D.Value <<=  (CORBA::Any::from_boolean ) b ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "char" ) ) {
+          unsigned char c ;
+          c = (unsigned char ) d ;
+          D.Value <<=  (CORBA::Any::from_char ) c ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+        else if ( !strcmp( Type , "short" ) ) {
+          short s ;
+          s = (short ) d ;
+          D.Value <<=  s ;
+//          theOutPort->Value( D.Value ) ;
+        }
+        else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
           long l ;
           l = (long ) d ;
           D.Value <<= l ;
-          theOutPort->Value( D.Value ) ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "objref" ) ) {
+        else if ( !strcmp( Type , "float" ) ) {
+          float f ;
+          f = (float ) d ;
+          D.Value <<= f ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else {
+        else if ( !strcmp( Type , "double" ) ) {
         }
+//        else if ( !strcmp( Type , "objref" ) ) {
+        else { // Default
+          D.Value <<= CORBA::Object::_nil() ;
+//          theOutPort->Value( D.Value ) ;
+        }
+//        else {
+//          cdebug << " (other ERROR)" << endl ;
+//        }
+        cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
         break;
-      case CORBA::tk_long:
-        long l;
-        D.Value >>= l;
-        cdebug << l << " (long)" << endl ;
+      case CORBA::tk_objref:
         if ( !strcmp( Type , "string" ) ) {
-          char t[40] ;
-          sprintf( t , "lf" , l ) ;
-          D.Value <<= t ;
-          theOutPort->Value( D.Value ) ;
+          CORBA::Object_ptr ObjRef ;
+          char * retstr ;
+          try {
+            D.Value >>= ObjRef ;
+            retstr = ObjectToString( ObjRef ) ;
+            D.Value <<= retstr ;
+//            theOutPort->Value( D.Value ) ;
+          }
+          catch( ... ) {
+            if ( i != 0 ) {
+              Err = true ;
+           }
+            cdebug << "ToString( object ) Catched ERROR" << endl ;
+          }
         }
-        else if ( !strcmp( Type , "double" ) ) {
-          double d ;
-          d = l ;
-          D.Value <<= d ;
-          theOutPort->Value( D.Value ) ;
+        else if ( !strcmp( Type , "boolean" ) ) {
+          bool b = 0 ;
+          D.Value <<=  (CORBA::Any::from_boolean ) b ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+        else if ( !strcmp( Type , "char" ) ) {
+          unsigned char c = 0 ;
+          D.Value <<=  (CORBA::Any::from_char ) c ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else if ( !strcmp( Type , "objref" ) ) {
+        else if ( !strcmp( Type , "short" ) ) {
+          short s = 0 ;
+          D.Value <<=  s ;
+//          theOutPort->Value( D.Value ) ;
         }
-        else {
+        else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
+          long l = 0 ;
+          D.Value <<= l ;
+//          theOutPort->Value( D.Value ) ;
         }
-        break;
-      case CORBA::tk_objref:
-        CORBA::Object_ptr obj ;
-        char * retstr ;
-        try {
-          D.Value >>= obj ;
-//          retstr = _Orb->object_to_string(obj );
-          retstr = ObjectToString( obj ) ;
-          cdebug << retstr << endl ;
+        else if ( !strcmp( Type , "float" ) ) {
+          float f = 0 ;
+          D.Value <<= f ;
+//          theOutPort->Value( D.Value ) ;
         }
-        catch( ... ) {
-          if ( i != 0 ) {
-            Err = true ;
-         }
-          cdebug << "ToString( object ) Catched ERROR" << endl ;
+        else if ( !strcmp( Type , "double" ) ) {
+          double d = 0 ;
+          D.Value <<= d ;
+//          theOutPort->Value( D.Value ) ;
         }
+//        else if ( !strcmp( Type , "objref" ) ) {
+        else { // Default
+          CORBA::Object_ptr obj ;
+          char * retstr ;
+          try {
+            D.Value >>= obj ;
+            retstr = ObjectToString( obj ) ;
+            cdebug << retstr << endl ;
+          }
+          catch( ... ) {
+            if ( i != 0 ) {
+              Err = true ;
+           }
+            cdebug << "ToString( object ) Catched ERROR" << endl ;
+          }
+        }
+//        else {
+//          cdebug << " (other ERROR)" << endl ;
+//        }
+        cdebug << " --> call_kind " << D.Value.type()->kind() << endl ;
         break;
       default:
-        cdebug << " (other ERROR)" << endl ;
+        cdebug << " (other ERROR) " << D.Value.type()->kind() << endl ;
       }
     }
     else {
@@ -2076,16 +2284,16 @@ void GraphExecutor::InNode::InParametersSet(
              << anInPort->GetServicesParameter().Parametername << endl ;
       Err = true ;
     }
-    aListOfInParameters[i] = D ;
+    InParametersList[i] = D ;
   }
 }
 
-void GraphExecutor::InNode::InOutParameters(
+void GraphExecutor::InNode::InOutParametersSet(
                             int nOutParams ,
-                            ServicesAnyData * aListOfOutParameters ) {
+                            ServicesAnyData * OutParametersList ) {
   int i ;
   for ( i = 0 ; i < nOutParams ; i++ ) {
-    ServicesAnyData D = aListOfOutParameters[i] ;
+    ServicesAnyData D = OutParametersList[i] ;
 
     D.Name = GetChangeNodeOutPort(i)->GetServicesParameter().Parametername;
     string _Type = CORBA::string_dup(GetChangeNodeOutPort(i)->GetServicesParameter().Parametertype) ;
@@ -2096,190 +2304,321 @@ void GraphExecutor::InNode::InOutParameters(
     if ( !strcmp( Type , "string" ) ) {
       D.Value <<= (char *) NULL ;
     }
-    else if ( !strcmp( Type , "double" ) ) {
-      D.Value <<= 0. ;
+    else if ( !strcmp( Type , "boolean" ) ) {
+      bool b = 0 ;
+      D.Value <<=  (CORBA::Any::from_boolean ) b ;
+    }
+    else if ( !strcmp( Type , "char" ) ) {
+      unsigned char c = 0 ;
+      D.Value <<=  (CORBA::Any::from_char ) c ;
+    }
+    else if ( !strcmp( Type , "short" ) ) {
+      short s = 0 ;
+      D.Value <<=  s ;
     }
-    else if ( !strcmp( Type , "long" ) || !strcmp( Type , "bool" ) ) {
+    else if ( !strcmp( Type , "int" ) || !strcmp( Type , "long" ) ) {
       D.Value <<= (long ) 0 ;
     }
+    else if ( !strcmp( Type , "float" ) ) {
+      float f = 0 ;
+      D.Value <<= f ;
+    }
+    else if ( !strcmp( Type , "double" ) ) {
+      double d = 0 ;
+      D.Value <<= d ;
+    }
     else {
-//      D.Value.replace(CORBA::_tc_Object, NULL);
       D.Value <<= CORBA::Object::_nil() ;
     }
-//    GetChangeNodeOutPort(i)->Value( D.Value ) ;
 //#if 0
-    switch (D.Value.type()->kind()) {
+    switch (D.Value.type()->kind()) { // { string , long , double , objref }
     case CORBA::tk_string:
       char * t;
       D.Value >>= t;
       cdebug << ThreadNo() << " " << t << "(string)" << endl ;
       break;
-    case CORBA::tk_double:
-      double d;
-      D.Value >>= d;
-      cdebug << ThreadNo() << " " << d << "(double)" << endl ;
+    case CORBA::tk_boolean:
+      bool b ;
+      D.Value >>= (CORBA::Any::to_boolean ) b;
+      cdebug << ThreadNo() << " " << b << "(boolean)" << endl ;
+      break;
+    case CORBA::tk_char:
+      unsigned char c ;
+      D.Value >>= (CORBA::Any::to_char ) c;
+      cdebug << ThreadNo() << " " << c << "(char)" << endl ;
+      break;
+    case CORBA::tk_short:
+      short s;
+      D.Value >>= s;
+      cdebug << ThreadNo() << " " << s << "(short)" << endl ;
       break;
     case CORBA::tk_long:
       long l;
       D.Value >>= l;
       cdebug << ThreadNo() << " " << l << "(long)" << endl ;
       break;
+    case CORBA::tk_float:
+      float f;
+      D.Value >>= f;
+      cdebug << ThreadNo() << " " << f << "(float)" << endl ;
+      break;
+    case CORBA::tk_double:
+      double d;
+      D.Value >>= d;
+      cdebug << ThreadNo() << " " << d << "(double)" << endl ;
+      break;
     case CORBA::tk_objref:
-      cdebug << ThreadNo() << " " << "(object)" << endl ;
+      try {
+        CORBA::Object_ptr obj ;
+        char * retstr ;
+        D.Value >>= obj ;
+        retstr = ObjectToString( obj ) ;
+        cdebug << ThreadNo() << retstr << endl ;
+      }
+      catch( ... ) {
+        cdebug << "ToString( object ) Catched ERROR" << endl ;
+      }
       break;
     default:
       cdebug << ThreadNo() << " " << "(other ERROR)" << endl ;
     }
 //#endif
-    aListOfOutParameters[i] = D ;
+    OutParametersList[i] = D ;
   }
 }
 
-bool GraphExecutor::InNode::OutParameters(
+bool GraphExecutor::InNode::OutParametersSet(
                             bool Err ,
                             SUPERV::GraphState NewState ,
                             int nOutParams ,
-                            ServicesAnyData * aListOfOutParameters ) {
+                            ServicesAnyData * OutParametersList ) {
   bool RetVal = true ;
   int i ;
   GraphBase::OutPort * aGateOutPort = NULL ;
   bool OrSwitch = false ;
-  GraphBase::OutPort * anOutPort = GetChangeNodeOutPort(0) ;
-  for ( i = 0 ; i < nOutParams ; i++ ) {
-    anOutPort = GetChangeNodeOutPort(i) ;
-    if ( Err ) {
-      anOutPort->State( NewState ) ;
-      anOutPort->Done( true ) ;
-    }
-    else {
-      cdebug << ThreadNo() << " " << "Out" << i << " " << Name() << " "
-             << anOutPort->PortName() << " " << anOutPort->Kind() ;
-      if ( anOutPort->IsGate() ) {
-        aGateOutPort = anOutPort ;
-        cdebug << " Gate " ;
-        long l = 1;
-        aListOfOutParameters[i].Value <<= l;
-        anOutPort->Value( aListOfOutParameters[i].Value );
-      }
-      else if ( anOutPort->IsLoop() ) {
-        cdebug << " Loop " ;
-        anOutPort->Value( aListOfOutParameters[i].Value );
-// InLoop Port of EndLoopNode is ready :
-        anOutPort->ChangeInPorts(0)->State( SUPERV::ReadyState ) ;
-      }
-      else if ( anOutPort->IsSwitch() ) {
-        cdebug << " Switch " ;
-        anOutPort->Value( aListOfOutParameters[i].Value );
-        if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) {
-          if ( OrSwitch && anOutPort->BoolValue() ) {
-            cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true WARNING"
-                   << endl ;
-//            RetVal = false ;
-         }
-          else {
-            OrSwitch = OrSwitch | anOutPort->BoolValue() ;
-         }
-       }
-        cdebug << "OrSwitch " << OrSwitch ;
+  if ( nOutParams ) {
+    GraphBase::OutPort * anOutPort ;
+    for ( i = 0 ; i < nOutParams ; i++ ) {
+      anOutPort = GetChangeNodeOutPort(i) ;
+      if ( Err ) {
+        anOutPort->State( NewState ) ;
+        anOutPort->Done( true ) ;
       }
       else {
-        cdebug << " Param " ;
-        anOutPort->Value( aListOfOutParameters[i].Value );
-      }
-//      else if ( anOutPort->IsBus() ) {
-//        cdebug << " Bus " ;
-//        anOutPort->Value( GetNodeInPort( anOutPort->PortIndex() )->GetOutPort()->Value() );
-//      }
-      anOutPort->State( NewState ) ;
-      anOutPort->Done( true ) ;
-      int j ;
-      for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
-        bool fromGOTO = false ;
-        GraphBase::OutPort * aGOTOPort = _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetChangeNodeInPort( 0 )->GetOutPort() ;
-        if ( aGOTOPort ) {
-          fromGOTO = aGOTOPort->IsGOTO() ;
+        cdebug << ThreadNo() << " " << "Out" << i << " " << Name() << " "
+               << anOutPort->PortName() << " " << anOutPort->Kind() ;
+        ServicesAnyData D = OutParametersList[i] ;
+        switch (D.Value.type()->kind()) { // { string , long , double , objref }
+        case CORBA::tk_string: {
+          char * t;
+          D.Value >>= t;
+          cdebug << ThreadNo() << " " << t << "(string)" << endl ;
+          break;
        }
-        if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) {
-          cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
-                 << anOutPort->ChangeInPorts( j )->PortName() << ","
-                 << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from "
-                 << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
-                 << "("
-                 << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
-                 << ") to " << anOutPort->NodeName() << "("
-                 << anOutPort->PortName() << ")" << endl ;
-          anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ;
+        case CORBA::tk_boolean: {
+          bool b ;
+          D.Value >>= (CORBA::Any::to_boolean ) b;
+          long l = (long ) b ;
+          D.Value <<= l ;
+          cdebug << ThreadNo() << " " << b << "(boolean)" << endl ;
+          break;
        }
-        else {
-          cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
-                 << anOutPort->ChangeInPorts( j )->PortName() << ","
-                 << anOutPort->ChangeInPorts( j )->Kind() << ") NOT changed from "
-                 << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
-                 << "("
-                 << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
-                 << ") to " << anOutPort->NodeName() << "("
-                 << anOutPort->PortName() << ")" << endl ;
+        case CORBA::tk_char: {
+          unsigned char c ;
+          D.Value >>= (CORBA::Any::to_char ) c;
+          long l = (long ) c ;
+          D.Value <<= l ;
+          cdebug << ThreadNo() << " " << c << "(char)" << endl ;
+          break;
        }
-      }
-#if 0
-      switch (anOutPort->Value()->type()->kind()) {
-      case CORBA::tk_string:
-        char * t;
-        (*anOutPort->Value()) >>= t;
-        cdebug << ThreadNo() << " Out" << i << " : " << t << "(string)" << endl ;
-        break;
-      case CORBA::tk_double:
-        double d;
-        (*anOutPort->Value()) >>= d;
-        cdebug << ThreadNo() << " Out" << i << " : " << d << "(double)" << endl ;
-        break;
-      case CORBA::tk_long:
-        long l;
-        (*anOutPort->Value()) >>= l;
-        cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ;
-        break;
-      case CORBA::tk_objref:
-        CORBA::Object_ptr obj ;
-        char * retstr ;
-        try {
-          (*anOutPort->Value()) >>= obj ;
-          retstr = _Orb->object_to_string(obj );
-          cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
-                 << retstr << endl ;
+        case CORBA::tk_short: {
+          short s;
+          D.Value >>= s;
+          long l = (long ) s ;
+          D.Value <<= l ;
+          cdebug << ThreadNo() << " " << s << "(short)" << endl ;
+          break;
        }
-        catch ( ... ) {
-          cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
-                 << "Catched ERROR" << endl ;
+        case CORBA::tk_long: {
+          long l;
+          D.Value >>= l;
+          cdebug << ThreadNo() << " " << l << "(long)" << endl ;
+          break;
        }
-        break;
-      default:
-        cdebug << ThreadNo() << " Out" << i << " : " << "(other ERROR)" << endl ;
-        RetVal = false ;
+        case CORBA::tk_float: {
+          float f;
+          D.Value >>= f;
+          double d = (double ) f ;
+          D.Value <<= d ;
+          cdebug << ThreadNo() << " " << f << "(float)" << endl ;
+          break;
+       }
+        case CORBA::tk_double: {
+          double d;
+          D.Value >>= d;
+          cdebug << ThreadNo() << " " << d << "(double)" << endl ;
+          break;
+       }
+        case CORBA::tk_objref: {
+          try {
+            CORBA::Object_ptr obj ;
+            char * retstr ;
+            D.Value >>= obj ;
+            retstr = ObjectToString( obj ) ;
+            cdebug << ThreadNo() << retstr << endl ;
+          }
+          catch( ... ) {
+            cdebug << "ToString( object ) Catched ERROR" << endl ;
+          }
+          break;
+       }
+        default: {
+          cdebug << ThreadNo() << " " << "(other ERROR)" << endl ;
+       }
+        }
+        OutParametersList[i] = D ;
+        if ( anOutPort->IsGate() ) {
+          aGateOutPort = anOutPort ;
+          cdebug << " Gate " ;
+          long l = 1;
+          OutParametersList[i].Value <<= l;
+          anOutPort->Value( OutParametersList[i].Value );
+        }
+        else if ( anOutPort->IsLoop() ) {
+          cdebug << " Loop " ;
+          anOutPort->Value( OutParametersList[i].Value );
+// InLoop Port of EndLoopNode is ready :
+          anOutPort->ChangeInPorts(0)->State( SUPERV::ReadyState ) ;
+        }
+        else if ( anOutPort->IsSwitch() ) {
+          cdebug << " Switch " ;
+          anOutPort->Value( OutParametersList[i].Value );
+          if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) {
+            if ( OrSwitch && anOutPort->BoolValue() ) {
+              cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true WARNING"
+                     << endl ;
+           }
+            else {
+              OrSwitch = OrSwitch | anOutPort->BoolValue() ;
+           }
+         }
+          cdebug << "OrSwitch " << OrSwitch ;
+        }
+        else {
+          cdebug << " Param " ;
+          anOutPort->Value( OutParametersList[i].Value );
+        }
+        anOutPort->State( NewState ) ;
+        anOutPort->Done( true ) ;
+        int j ;
+        for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
+          bool fromGOTO = false ;
+          GraphBase::OutPort * aGOTOPort = _OutNode->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetChangeNodeInGate()->GetOutPort() ;
+          if ( aGOTOPort ) {
+            fromGOTO = aGOTOPort->IsGOTO() ;
+         }
+          if ( anOutPort->ChangeInPorts( j )->IsEndSwitch() || fromGOTO ) {
+            cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
+                   << anOutPort->ChangeInPorts( j )->PortName() << ","
+                   << anOutPort->ChangeInPorts( j )->Kind() << ") WILL BE changed from "
+                   << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
+                   << "("
+                   << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
+                   << ") to " << anOutPort->NodeName() << "("
+                   << anOutPort->PortName() << ")" << endl ;
+            anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ;
+         }
+          else {
+            cdebug << anOutPort->ChangeInPorts( j )->NodeName() << "("
+                   << anOutPort->ChangeInPorts( j )->PortName() << ","
+                   << anOutPort->ChangeInPorts( j )->Kind() << ") NOT changed from "
+                   << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName()
+                   << "("
+                   << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName()
+                   << ") to " << anOutPort->NodeName() << "("
+                   << anOutPort->PortName() << ")" << endl ;
+         }
+        }
+//#if 0
+        switch (anOutPort->Value()->type()->kind()) {
+        case CORBA::tk_string:
+          char * t;
+          (*anOutPort->Value()) >>= t;
+          cdebug << ThreadNo() << " Out" << i << " : " << t << "(string)" << endl ;
+          break;
+        case CORBA::tk_boolean:
+          bool b ;
+          (*anOutPort->Value()) >>= (CORBA::Any::to_boolean ) b;
+          cdebug << ThreadNo() << " Out" << i << " : " << b << "(boolean)" << endl ;
+          break;
+        case CORBA::tk_char:
+          unsigned char c ;
+          (*anOutPort->Value()) >>= (CORBA::Any::to_char ) c;
+          cdebug << ThreadNo() << " Out" << i << " : " << c << "(char)" << endl ;
+          break;
+        case CORBA::tk_short:
+          short s;
+          (*anOutPort->Value()) >>= s;
+          cdebug << ThreadNo() << " Out" << i << " : " << s << "(short)" << endl ;
+          break;
+        case CORBA::tk_long:
+          long l;
+          (*anOutPort->Value()) >>= l;
+          cdebug << ThreadNo() << " Out" << i << " : " << l << "(long)" << endl ;
+          break;
+        case CORBA::tk_float:
+          float f;
+          (*anOutPort->Value()) >>= f;
+          cdebug << ThreadNo() << " Out" << i << " : " << f << "(float)" << endl ;
+          break;
+        case CORBA::tk_double:
+          double d;
+          (*anOutPort->Value()) >>= d;
+          cdebug << ThreadNo() << " Out" << i << " : " << d << "(double)" << endl ;
+          break;
+        case CORBA::tk_objref:
+          CORBA::Object_ptr obj ;
+          char * retstr ;
+          try {
+            (*anOutPort->Value()) >>= obj ;
+            retstr = ObjectToString( obj );
+            cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
+                   << retstr << endl ;
+         }
+          catch ( ... ) {
+            cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
+                   << "Catched ERROR" << endl ;
+         }
+          break;
+        default:
+          cdebug << ThreadNo() << " Out" << i << " : " << "(other ERROR)" << endl ;
+          RetVal = false ;
+        }
+//#endif
       }
-#endif
-    }
-  }
-  if ( aGateOutPort && IsSwitchNode() ) {
-    if ( OrSwitch ) {
-      cdebug << ThreadNo() << " " << "Out0 " << Name() << " Close of "
-             << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
-      long l = 0;
-      aListOfOutParameters[0].Value <<= l ;
-      aGateOutPort->Value( aListOfOutParameters[0].Value ) ;
     }
-    else {
-      cdebug << ThreadNo() << " " << "Out0 " << Name() << " Open of "
-             << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
-      long l = 1;
-      aListOfOutParameters[0].Value <<= l ;
-      aGateOutPort->Value( aListOfOutParameters[0].Value ) ;
-      int i ;
-      for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
-        GraphBase::InPort * anInPort ;
-        anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ;
-        if ( anInPort ) {
-          anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ;
-       }
+    if ( aGateOutPort && IsSwitchNode() ) {
+      if ( OrSwitch ) {
+//        cdebug << ThreadNo() << " " << "Out0 " << Name() << " Close of "
+//               << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
+        long l = 0;
+        OutParametersList[0].Value <<= l ;
+        aGateOutPort->Value( OutParametersList[0].Value ) ;
+      }
+      else {
+//        cdebug << ThreadNo() << " " << "Out0 " << Name() << " Open of "
+//               << aGateOutPort->PortName() << " " << aGateOutPort->Kind() ;
+        long l = 1;
+        OutParametersList[0].Value <<= l ;
+        aGateOutPort->Value( OutParametersList[0].Value ) ;
+        int i ;
+        for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+          GraphBase::InPort * anInPort ;
+          anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ;
+          if ( anInPort ) {
+            anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ;
+         }
+        }
       }
     }
   }
index 5f30b8901841630a503e8f998cddce7f49dfb6da..1d8705d451bf3d7dcbc61eb3c5b5eb7a90fb7128 100644 (file)
@@ -1,11 +1,32 @@
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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_OutNode.cxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
+
 using namespace std;
-//=============================================================================
-// File      : DataFlowBase_OutNode.cxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
 
 #include "DataFlowExecutor_OutNode.hxx"
 
@@ -13,7 +34,7 @@ using namespace std;
 
 extern GraphExecutor::FiniteStateMachine * theAutomaton ;
 
-static const char *ComponentName = "SalomeSuperVisionComponent" ;
+// static const char *ComponentName = "SalomeSuperVisionComponent" ;
 
 extern int _ArgC ;
 extern char ** _ArgV ;
@@ -28,6 +49,7 @@ GraphExecutor::OutNode::OutNode() :
   _State = SUPERV::UnKnownState ;
   _PyInitialized = false ;
   pthread_mutex_init( &_MutexWait , NULL ) ;
+  pthread_mutex_init( &_PyMutexWait , NULL ) ;
   if ( pthread_cond_init( &_EventWait , NULL ) ) {
     perror("pthread_cond_init( &_EventWait , NULL )") ;
     exit( 0 ) ;
@@ -53,6 +75,7 @@ GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB,
   _PyInitialized = false ;
   _Orb = CORBA::ORB::_duplicate( ORB ) ;
   pthread_mutex_init( &_MutexWait , NULL ) ;
+  pthread_mutex_init( &_PyMutexWait , NULL ) ;
   if ( pthread_cond_init( &_EventWait , NULL ) ) {
     perror("pthread_cond_init( &_EventWait , NULL )") ;
     exit( 0 ) ;
@@ -93,6 +116,7 @@ GraphExecutor::OutNode::OutNode(
   _PyInitialized = false ;
   _Orb = CORBA::ORB::_duplicate( ORB ) ;
   pthread_mutex_init( &_MutexWait , NULL ) ;
+  pthread_mutex_init( &_PyMutexWait , NULL ) ;
   if ( pthread_cond_init( &_EventWait , NULL ) ) {
     perror("pthread_cond_init( &_EventWait , NULL )") ;
     exit( 0 ) ;
@@ -178,7 +202,7 @@ bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNode
   GraphExecutor::InNode * anInNode ;
   cdebug << "GraphExecutor::OutNode::LoadNodes" << endl ;
   int i ;
-  for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
     GraphBase::SNode aNode = aListOfNodes[ i ] ;
     anInNode = AddNode( aNode.theService ,
                         aNode.theListOfFuncName ,
@@ -234,7 +258,7 @@ bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNode
     }
 #endif
   }
-  for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
     GraphBase::SNode aNode = aListOfNodes[ i ] ;
     anInNode = (GraphExecutor::InNode * ) GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ;
     cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() << "IsOneOfGOTONodes "
@@ -253,7 +277,7 @@ bool GraphExecutor::OutNode::LoadLinks(const GraphBase::ListOfLinks &aListOfLink
   cdebug << "GraphExecutor::OutNode::LoadLinks " << aListOfLinks.size()
          << endl ;
   int i ;
-  for ( i = 0 ; i < aListOfLinks.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfLinks.size() ; i++ ) {
     GraphBase::SLink aLink = aListOfLinks[ i ] ;
     RetVal = AddLink( aLink.FromNodeName.c_str() ,
                       aLink.FromServiceParameterName.c_str() ,
@@ -272,7 +296,7 @@ bool GraphExecutor::OutNode::LoadDatas(const GraphBase::ListOfLinks &aListOfData
   cdebug << "GraphExecutor::OutNode::LoadDatas " << aListOfDatas.size()
          << endl ;
   int i ;
-  for ( i = 0 ; i < aListOfDatas.size() ; i++ ) {
+  for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) {
     GraphBase::SLink aLink = aListOfDatas[ i ] ;
     if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) )
       RetVal = GraphBase::Graph::AddInputData( aLink.ToNodeName.c_str() ,
@@ -354,7 +378,10 @@ bool GraphExecutor::OutNode::Valid() {
 
   _Executable = false ;
 
-  CreateService() ;
+  if ( !CreateService() ) {
+    cdebug << "This DataFlow has invalid type(s)." << endl ;
+    return false ;
+  }
 
   if ( !Sort() ) {
     cdebug << "This DataFlow is not valid." << endl ;
@@ -437,14 +464,14 @@ bool GraphExecutor::OutNode::Run( const bool AndSuspend ) {
         anInNode->State( SUPERV::DataWaitingState ) ;
         anInNode->ControlState( SUPERV::ToSuspendStartState ) ;
         if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) {
-          cdebug << "InNode::SendEvent( SomeDataReadyEvent ) Node "
+          cdebug << "InNode::SendEvent( SomeDataReadyEvent ) ERROR Node "
                  << anInNode->Name() << endl ;
           return false ;
         }
         anInNode->SuspendedWait() ;
       }
       else if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) {
-        cdebug << "InNode::SendEvent( RunningEvent ) Node "
+        cdebug << "InNode::SendEvent( ExecuteEvent ) ERROR Node "
                << anInNode->Name() << endl ;
         return false ;
       }
@@ -551,6 +578,11 @@ void GraphExecutor::OutNode::CheckAllDone() {
              << " GraphAutomatonState " << theAutomaton->StateName( AutomatonState() )
              << " State " << State() << " Threads " << _Threads << " SuspendedThreads "
              << _SuspendedThreads << endl ;
+  if ( _Done ) {
+    MESSAGE("================================================================================") ;
+    MESSAGE( Name() << " IS DONE" ) ;
+    MESSAGE("================================================================================") ;
+  }
 }
 
 void GraphExecutor::OutNode::PThreadLock( pthread_mutex_t * aMutex , char * errmsg ) {
@@ -579,22 +611,22 @@ void GraphExecutor::OutNode::PThreadUnLock( pthread_mutex_t * aMutex , char * er
   }
 }
 
-void GraphExecutor::OutNode::PThreadLock() {
-  cout << " GraphExecutor::OutNode::PThreadLock " << pthread_self() << endl ;
-  if ( pthread_mutex_lock( &_MutexWait ) ) {
-    perror( "GraphExecutor::OutNode::PThreadLock" ) ;
+void GraphExecutor::OutNode::PyThreadLock() {
+//  cout << " GraphExecutor::OutNode::PyThreadLock " << pthread_self() << endl ;
+  if ( pthread_mutex_lock( &_PyMutexWait ) ) {
+    perror( "GraphExecutor::OutNode::PyThreadLock" ) ;
     exit( 0 ) ;
   }
-  cout << " GraphExecutor::OutNode::PThreadLocked " << pthread_self() << endl ;
+//  cout << " GraphExecutor::OutNode::PyThreadLocked " << pthread_self() << endl ;
 }
 
-void GraphExecutor::OutNode::PThreadUnLock() {
-  cout << " GraphExecutor::OutNode::PThreadUnLock " << pthread_self() << endl ;
-  if ( pthread_mutex_unlock( &_MutexWait ) ) {
-    perror( "GraphExecutor::OutNode::PThreadUnLock" ) ;
+void GraphExecutor::OutNode::PyThreadUnLock() {
+//  cout << " GraphExecutor::OutNode::PyThreadUnLock " << pthread_self() << endl ;
+  if ( pthread_mutex_unlock( &_PyMutexWait ) ) {
+    perror( "GraphExecutor::OutNode::PyThreadUnLock" ) ;
     exit( 0 ) ;
   }
-  cout << " GraphExecutor::OutNode::PThreadUnLocked " << pthread_self() << endl ;
+//  cout << " GraphExecutor::OutNode::PyThreadUnLocked " << pthread_self() << endl ;
 }
 
 void GraphExecutor::OutNode::NewThread() {
@@ -1008,13 +1040,22 @@ bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode ,
   }
 //  cdebug_out << "PushEvent Threads " << Threads() << " SuspendedThreads "
 //             << SuspendedThreads() << endl ;
+  if ( _EventNodes.size() > 101 ) {
+    while ( _EventNodes.size() > 31 ) {
+      _EventNodes.pop_front() ;
+      _Events.pop_front() ;
+      _States.pop_front() ;
+    }
+  }
   if ( pthread_mutex_unlock( &_MutexWait ) ) {
     perror("PushEvent pthread_mutex_unlock ") ;
     exit( 0 ) ;
   }
+  return true ;
 }
 
 bool GraphExecutor::OutNode::StateWait( SUPERV::GraphState aState ) {
+  return false ;
 }
 
 bool GraphExecutor::OutNode::Event( char ** aNodeName ,
@@ -1038,7 +1079,7 @@ bool GraphExecutor::OutNode::Event( char ** aNodeName ,
   anEvent = SUPERV::UndefinedEvent ;
   aState = SUPERV::UndefinedState ;
   if ( ( IsDone() || IsKilled() || IsStopped() ) && _EventNodes.size() == 0 ) {
-    cdebug << "EventLoop IsDone()/IsKilled()/IsStopped() && _EventNodes.size() == 0" << endl ;
+//    cdebug << "EventLoop IsDone()/IsKilled()/IsStopped() && _EventNodes.size() == 0" << endl ;
     RetVal = false ;
   }
   else if ( !WithWait && _EventNodes.size() == 0 ) {
@@ -1048,10 +1089,10 @@ bool GraphExecutor::OutNode::Event( char ** aNodeName ,
   }
   else if ( RetVal ) {
     while ( !IsSuspended() && _EventNodes.size() == 0 ) {
-      cdebug << "EventLoop pthread_cond_wait _EventWait" << endl ;
+//      cdebug << "EventLoop pthread_cond_wait _EventWait" << endl ;
       pthread_cond_wait( &_EventWait , &_MutexWait );
-      cdebug << "EventLoop pthread_cond_waited _EventWait"
-             << " _EventNodes.size() " << _EventNodes.size() << endl ;
+//      cdebug << "EventLoop pthread_cond_waited _EventWait"
+//             << " _EventNodes.size() " << _EventNodes.size() << endl ;
     }
     if ( _EventNodes.size() ) {
       ThreadsNumber = Threads() ;
@@ -1070,11 +1111,11 @@ bool GraphExecutor::OutNode::Event( char ** aNodeName ,
     RetVal = false ;
   }
   if ( anEvent != SUPERV::NoEvent ) {
-    cdebug << pthread_self() << "EventLoop "
-           << NodeName << " " << theAutomaton->StateName( theState )
-           << " _EventNodes.size() " << _EventNodes.size()
-           << " Threads " << Threads() << " SuspendedThreads "
-           << SuspendedThreads() << " RetVal " << RetVal << endl ;
+//    cdebug << pthread_self() << "EventLoop "
+//           << NodeName << " " << theAutomaton->StateName( theState )
+//           << " _EventNodes.size() " << _EventNodes.size()
+//           << " Threads " << Threads() << " SuspendedThreads "
+//           << SuspendedThreads() << " RetVal " << RetVal << endl ;
   }
   if ( pthread_mutex_unlock( &_MutexWait ) ) {
     perror("EventLoop pthread_mutex_lock ") ;
@@ -1250,8 +1291,8 @@ SUPERV::GraphState GraphExecutor::OutNode::State( const char * NodeName ) {
     GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *)aCNode->GetInNode() ;
     if ( anInNode ) {
       aret = anInNode->State() ;
-      cdebug << "GraphExecutor::OutNode::State( " << NodeName << " ) "
-             << theAutomaton->StateName( AutomatonGraphState( aret ) ) << endl ;
+//      cdebug << "GraphExecutor::OutNode::State( " << NodeName << " ) "
+//             << theAutomaton->StateName( AutomatonGraphState( aret ) ) << endl ;
     }
   }
 //  cdebug_out << "GraphExecutor::OutNode::State" << endl ;
@@ -1491,12 +1532,22 @@ bool GraphExecutor::OutNode::Suspend() {
   }
   State( SUPERV::SuspendedState ) ;
   cdebug_out << "GraphExecutor::OutNode::Suspend" << endl ;
+  if ( RetVal ) {
+    MESSAGE("================================================================================") ;
+    MESSAGE( Name() << " IS SUSPENDED" ) ;
+    MESSAGE("================================================================================") ;
+  }
   return RetVal ;
 }
 bool GraphExecutor::OutNode::Resume() {
   bool RetVal = false ;
   cdebug_in << "GraphExecutor::OutNode::Resume" << endl;
   cdebug_out << "GraphExecutor::OutNode::Resume" << endl ;
+  if ( RetVal ) {
+    MESSAGE("================================================================================") ;
+    MESSAGE( Name() << " IS RESUMED" ) ;
+    MESSAGE("================================================================================") ;
+  }
   return RetVal ;
 }
 
@@ -1532,6 +1583,11 @@ bool GraphExecutor::OutNode::Kill() {
   }
   State( SUPERV::KilledState ) ;
   cdebug_out << "GraphExecutor::OutNode::Kill" << endl ;
+  if ( RetVal ) {
+    MESSAGE("================================================================================") ;
+    MESSAGE( Name() << " IS KILLED" ) ;
+    MESSAGE("================================================================================") ;
+  }
   return RetVal ;
 }
 
@@ -1540,6 +1596,11 @@ bool GraphExecutor::OutNode::Stop() {
   cdebug_in << "GraphExecutor::OutNode::Stop" << endl;
   Kill() ;
   cdebug_out << "GraphExecutor::OutNode::Stop" << endl ;
+  if ( RetVal ) {
+    MESSAGE("================================================================================") ;
+    MESSAGE( Name() << " IS STOPPED" ) ;
+    MESSAGE("================================================================================") ;
+  }
   return RetVal ;
 }
 bool GraphExecutor::OutNode::ReRun() {
@@ -1610,7 +1671,7 @@ bool GraphExecutor::OutNode::DoneWait() {
     exit( 0 ) ;
   }
   aret = IsDone() ;
-  while ( !aret && !IsSuspended() ) {
+  while ( !aret && !IsSuspended() && IsRunning() ) {
     cdebug << "DoneWait pthread_cond_wait _EventWait" << endl;
     pthread_cond_wait( &_EventWait , &_MutexWait );
     aret = IsDone() ;
@@ -1706,9 +1767,8 @@ long GraphExecutor::OutNode::LastLevelDone() {
 }
 
 
-const CORBA::Any *GraphExecutor::OutNode::GetInData(
-                              const char * NodeName ,
-                              const char * ServiceParameterName ) {
+const CORBA::Any *GraphExecutor::OutNode::GetInData( const char * NodeName ,
+                                                     const char * ServiceParameterName ) {
 //  cdebug_in << "GraphExecutor::OutNode::GetInData " << NodeName << " "
 //            << ServiceParameterName << endl ;
   const CORBA::Any * retdata = PortInData( NodeName , ServiceParameterName ) ;
@@ -1716,9 +1776,8 @@ const CORBA::Any *GraphExecutor::OutNode::GetInData(
   return retdata ;
 }
 
-const CORBA::Any *GraphExecutor::OutNode::GetOutData(
-                              const char * NodeName ,
-                              const char * ServiceParameterName ) {
+const CORBA::Any *GraphExecutor::OutNode::GetOutData( const char * NodeName ,
+                                                      const char * ServiceParameterName ) {
 //  cdebug_in << "GraphExecutor::OutNode::GetOutData " << NodeName << " "
 //            << ServiceParameterName << endl ;
   const CORBA::Any * retdata = PortOutData( NodeName , ServiceParameterName ) ;
@@ -1726,3 +1785,19 @@ const CORBA::Any *GraphExecutor::OutNode::GetOutData(
   return retdata ;
 }
 
+const long GraphExecutor::OutNode::CpuUsed() {
+  return GraphBase::Graph::CpuUsed() ;
+}
+
+const long GraphExecutor::OutNode::CpuUsed( const char * aNodeName ) {
+  GraphBase::ComputingNode * aNode = GetChangeGraphNode( aNodeName ) ;
+  if ( aNode ) {
+    GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) aNode->GetInNode() ;
+    if ( anInNode ) {
+      return anInNode->CpuUsed() ;
+    }
+  }
+  return 0 ;
+}
+
+
index fb54a37259d9a525a8d87573ee394b1dfb360ac3..e16f0ef66dbc746449db85edaa77d1861ad2086f 100644 (file)
@@ -1,10 +1,30 @@
-//=============================================================================
-// File      : DataFlowBase_OutNode.hxx
-// Created   : 2002
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  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_OutNode.hxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
 
 #ifndef _DATAFLOWEXECUTOR_OUTNODE_HXX
 #define _DATAFLOWEXECUTOR_OUTNODE_HXX
@@ -28,6 +48,7 @@ namespace GraphExecutor {
       SUPERV::ControlState    _ControlState ;
       bool                    _Done ;
 
+      pthread_mutex_t                  _PyMutexWait ;
       pthread_mutex_t                  _MutexWait ;
       pthread_cond_t                   _EventWait ;
       pthread_cond_t                   _JoinWait ;
@@ -83,10 +104,10 @@ namespace GraphExecutor {
                         const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
                         const SUPERV::SDate NodeFirstCreation = SUPERV::SDate() ,
                         const SUPERV::SDate NodeLastModification = SUPERV::SDate() ,
-                        const char * NodeEditorRelease = NULL ,
-                        const char * NodeAuthor = NULL ,
-                        const char * NodeComputer = NULL ,
-                        const char * NodeComment = NULL ,
+                        const char * NodeEditorRelease = NULLSTRING ,
+                        const char * NodeAuthor = NULLSTRING ,
+                        const char * NodeComputer = NULLSTRING ,
+                        const char * NodeComment = NULLSTRING ,
                         const int NodeX = 0 ,
                         const int NodeY = 0 ) ;
 
@@ -115,8 +136,8 @@ namespace GraphExecutor {
 
       void PThreadLock( pthread_mutex_t * aMutex , char * errmsg ) ;
       void PThreadUnLock( pthread_mutex_t * aMutex , char * errmsg ) ;
-      void PThreadLock() ;
-      void PThreadUnLock() ;
+      void PyThreadLock() ;
+      void PyThreadUnLock() ;
 
       void NewThread() ;
       void ExitThread() ;
@@ -203,6 +224,8 @@ namespace GraphExecutor {
                                    const char *ToParameterName ) ;
       const CORBA::Any *GetOutData( const char *FromNodeName ,
                                     const char *FromParameterName ) ;
+      const long CpuUsed() ;
+      const long CpuUsed( const char *aNodeName ) ;
   };
 };
 
index 38adfb702a682af70512d709deaf5180919b0ecc..9df177be3ba08565dd7f8782f2e39309768ed3ab 100644 (file)
@@ -1,11 +1,15 @@
+//  SUPERV GraphExecutor : contains classes that permit execution of graphs and particularly the execution automaton
+//
+//  Copyright (C) 2003  CEA/DEN, EDF R&D
+//
+//
+//
+//  File   : DataFlowExecutor_PyDynInvoke.cxx
+//  Author : Jean Rahuel, CEA
+//  Module : SUPERV
+//  $Header:
+
 using namespace std;
-//=============================================================================
-// File      : DataFlowExecutor_PyDynInvoke.cxx
-// Created   : 2003
-// Author    : Jean Rahuel, CEA
-// Project   : SALOME
-// $Header:
-//=============================================================================
 
 #include <stdarg.h>
 #include <map>
@@ -26,28 +30,29 @@ static PyMethodDef MethodPyRunMethod[] = {
 bool GraphExecutor::InNode::InitPython() {
   cdebug_in << "InitPython" << endl ;
 
-  PyObject * Module = Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
-  PyObject * Dictionnary = PyModule_GetDict( Module ) ;
+//  PyObject * Module = Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
+  Py_InitModule( "InitPyRunMethod" , MethodPyRunMethod ) ;
+//  PyObject * Dictionnary = PyModule_GetDict( Module ) ;
 //  InitPyDynInvokeError = PyErr_NewException( "InitPyDynInvokeError" , NULL , NULL ) ;
 //  PyDict_SetItemString( Dictionnary , InitPyDynInvokeError ) ;
   cdebug << ThreadNo() << "Py_Initialized() " << endl ;
 
   string aPyFunc ;
-  aPyFunc = "print 'InitPyRunMethod'\n" ;
-  aPyFunc += "import InitPyRunMethod\n" ;
-  aPyFunc += "print 'sys'\n" ;
+//  aPyFunc = "print 'InitPyRunMethod'\n" ;
+  aPyFunc = "import InitPyRunMethod\n" ;
+//  aPyFunc += "print 'sys'\n" ;
   aPyFunc += "import sys\n" ;
-  aPyFunc += "print 'CORBA'\n" ;
+//  aPyFunc += "print 'CORBA'\n" ;
   aPyFunc += "import CORBA\n" ;
-  aPyFunc += "print 'omniORB'\n" ;
+//  aPyFunc += "print 'omniORB'\n" ;
   aPyFunc += "import omniORB\n" ;
-  aPyFunc += "print 'PyObjRef'\n" ;
+//  aPyFunc += "print 'PyObjRef'\n" ;
   aPyFunc += "def PyObjRef( IORObjStr ) :\n" ;
-  aPyFunc += "    print 'PyObjRef',IORObjStr\n" ;
+//  aPyFunc += "    print 'PyObjRef',IORObjStr\n" ;
   aPyFunc += "    orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
-  aPyFunc += "    print 'PyObjRef orb',orb\n" ;
+//  aPyFunc += "    print 'PyObjRef orb',orb\n" ;
   aPyFunc += "    objref = orb.string_to_object( IORObjStr )\n" ;
-  aPyFunc += "    print 'PyObjRef IORObjStr objref',IORObjStr,objref\n" ;
+//  aPyFunc += "    print 'PyObjRef IORObjStr objref',IORObjStr,objref\n" ;
   aPyFunc += "    return objref\n" ;
   aPyFunc += "InitPyRunMethod.RunMethod( PyObjRef )\n" ;
   if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
@@ -61,11 +66,11 @@ bool GraphExecutor::InNode::InitPython() {
   aPyFunc += "import CORBA\n" ;
   aPyFunc += "import omniORB\n" ;
   aPyFunc += "def PyObjIor( ObjRef ) :\n" ;
-  aPyFunc += "    print 'PyObjIor',ObjRef\n" ;
+//  aPyFunc += "    print 'PyObjIor',ObjRef\n" ;
   aPyFunc += "    orb = CORBA.ORB_init( sys.argv , CORBA.ORB_ID )\n" ;
-  aPyFunc += "    print 'PyObjIor orb',orb\n" ;
+//  aPyFunc += "    print 'PyObjIor orb',orb\n" ;
   aPyFunc += "    objIor = orb.object_to_string( ObjRef )\n" ;
-  aPyFunc += "    print 'PyObjIor ObjRef objIor',ObjRef,objIor\n" ;
+//  aPyFunc += "    print 'PyObjIor ObjRef objIor',ObjRef,objIor\n" ;
   aPyFunc += "    return objIor\n" ;
   aPyFunc += "InitPyRunMethod.RunMethod( PyObjIor )\n" ;
   if ( PyRun_SimpleString( (char *) aPyFunc.c_str() ) ) {
@@ -88,7 +93,7 @@ PyObject * GraphExecutor::InNode::InitPyDynInvoke(
             << (*aPythonFunction).length() << endl ;
 
   if ( (*aPythonFunction).length() ) {
-    int i ;
+    unsigned int i ;
     aPyFunc += "import InitPyRunMethod\n" ;
     for ( i = 0 ; i < (*aPythonFunction).length() ; i++ ) {
       aPyFunc += (*aPythonFunction)[ i ] ;
@@ -157,17 +162,17 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
 
   PyObject * ArgsList = NULL ;
   PyObject * ArgValue = NULL ;
-  PyObject * ArgResult = NULL ;
   PyObject * Result = NULL ;
   PyObject * MyPyObjRefList = NULL ;
   PyObject * ResultObj = NULL ;
   PyObject * MyPyObjIorList = NULL ;
   PyObject * ResultIor = NULL ;
 
-  ArgsList = PyTuple_New( n_in ) ;
   CORBA::Object_ptr ObjRef ;
   char * IORObjRef ;
 
+  ArgsList = PyTuple_New( n_in ) ;
+
   for ( i = 0 ; i < n_in ; i++ ) {
     data = inParams[i].Value ;
     sname = inParams[i].Name.c_str() ;
@@ -178,16 +183,38 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
       ArgValue = Py_BuildValue( "s" , t ) ;
       PyTuple_SetItem( ArgsList , i , ArgValue ) ;
       cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << t << " (string) "
-             << ArgsList->ob_refcnt << endl ;
+             << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
       break ;
     }
-    case CORBA::tk_double : {
-      double d ;
-      data >>= d ;
-      ArgValue = Py_BuildValue( "d" , d ) ;
+    case CORBA::tk_boolean : {
+      bool b ;
+      data >>= (CORBA::Any::to_boolean ) b ;
+      ArgValue = Py_BuildValue( "b" , b ) ;
+      PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+      cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << b
+             << " (boolean) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
+      break ;
+    }
+    case CORBA::tk_char : {
+      unsigned char c ;
+      data >>= (CORBA::Any::to_char ) c ;
+      ArgValue = Py_BuildValue( "c" , c ) ;
+      PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+      cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << c
+             << " (char) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
+      break ;
+    }
+    case CORBA::tk_short : {
+      short s ;
+      data >>= s ;
+      ArgValue = Py_BuildValue( "h" , s ) ;
       PyTuple_SetItem( ArgsList , i , ArgValue ) ;
-      cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << d << " (double) " 
-             << ArgsList->ob_refcnt << endl ;
+      cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << s
+             << " (short) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
       break ;
     }
     case CORBA::tk_long : {
@@ -196,7 +223,28 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
       ArgValue = Py_BuildValue( "l" , l ) ;
       PyTuple_SetItem( ArgsList , i , ArgValue ) ;
       cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << l
-             << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ;
+             << " (long) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
+      break ;
+    }
+    case CORBA::tk_float : {
+      float f ;
+      data >>= f ;
+      ArgValue = Py_BuildValue( "f" , f ) ;
+      PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+      cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << f
+             << " (float) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
+      break ;
+    }
+    case CORBA::tk_double : {
+      double d ;
+      data >>= d ;
+      ArgValue = Py_BuildValue( "d" , d ) ;
+      PyTuple_SetItem( ArgsList , i , ArgValue ) ;
+      cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value " << d
+             << " (double) ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
       break ;
     }
     case CORBA::tk_objref : {
@@ -206,16 +254,23 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
       IORObjRef = ObjectToString( ObjRef ) ;
       ObjValue = Py_BuildValue( "s" , IORObjRef ) ;
       PyTuple_SetItem( MyPyObjRefList , 0 , ObjValue ) ;
-      cdebug << "ArgIn" << i << " : " << sname << method << " " << " Value " << IORObjRef << " (objref) "
-             << MyPyObjRefList->ob_refcnt << endl ;
+      cdebug << "ArgIn" << i << " : " << sname << " " << method << " " << " Value " << IORObjRef << " (objref) "
+             << MyPyObjRef->ob_refcnt << "/" << MyPyObjRefList->ob_refcnt << endl ;
       ResultObj = PyEval_CallObject( MyPyObjRef , MyPyObjRefList ) ;
-      cdebug << "MyPyObjRefList->ob_refcnt" << MyPyObjRefList->ob_refcnt << " "
-             << "ResultObj->ob_refcnt" << ResultObj->ob_refcnt << endl ;
-      PyObject_Print( ResultObj , stdout , 0 ) ;
-      PyTuple_SetItem( ArgsList , i , ResultObj ) ;
+      cdebug << "ObjValue->ob_refcnt" << ObjValue->ob_refcnt << endl ;
+      ArgValue = Py_BuildValue( "O" , ResultObj ) ;
+      PyTuple_SetItem( ArgsList , i , ArgValue ) ;
       cdebug << "ArgIn" << i << " : " << sname << " " << method << " Value  (objref) ArgsList->ob_refcnt"
-             << ArgsList->ob_refcnt << " ResultObj->ob_refcnt" << ResultObj->ob_refcnt
-             << endl ;
+             << ArgsList->ob_refcnt << " ArgValue->ob_refcnt" << ArgValue->ob_refcnt << endl ;
+      cdebug << "MyPyObjRefList->ob_refcnt " << MyPyObjRefList->ob_refcnt-1 << endl ;
+      Py_DECREF( MyPyObjRefList ) ;
+      if ( CORBA::is_nil( ObjRef ) ) {
+        ResultObj = NULL ;
+      }
+      else {
+        cdebug << "ResultObj->ob_refcnt " << ResultObj->ob_refcnt-1 << endl ;
+        Py_DECREF( ResultObj ) ;
+      }
       break ;
     }
     default : {
@@ -224,140 +279,228 @@ bool GraphExecutor::InNode::PyDynInvoke( PyObject * MyPyRunMethod ,
     }
   }
 
-  Result = PyEval_CallObject( MyPyRunMethod , ArgsList ) ;
-  cdebug << "ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ;
-
-  if ( Result == NULL ) {
-    cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error Result == NULL" << endl ;
-    RetVal = false ;
+  if (!PyCallable_Check( MyPyRunMethod )) {
+    RetVal = false;
+    return RetVal;
   }
   else {
-    for ( i = 0 ; i < n_out ; i++ ) {
-      data = outParams[i].Value ;
-      sname = outParams[i].Name.c_str() ;
-      switch ( data.type()->kind() ) {
-      case CORBA::tk_string : {
-        char * t ;
-        ArgValue = PyTuple_GetItem( Result , i ) ;
-        if ( ArgValue == NULL ) {
-          ArgValue = Result ;
+    Result = PyEval_CallObject( MyPyRunMethod , ArgsList ) ;
+    cdebug << "ArgsList->ob_refcnt" << ArgsList->ob_refcnt << endl ;
+    
+    if ( Result == NULL ) {
+      cdebug_out << "GraphExecutor::InNode::PyDynInvoke " << method << " Error Result == NULL" << endl ;
+      RetVal = false ;
+    }
+    else {
+      for ( i = 0 ; i < n_out ; i++ ) {
+       data = outParams[i].Value ;
+       sname = outParams[i].Name.c_str() ;
+       switch ( data.type()->kind() ) {
+       case CORBA::tk_string : {
+         char * t = "" ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( !PyString_Check( ArgValue ) ) {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ;
+         }
+         else {
+           t = PyString_AsString( ArgValue ) ;
+         }
+         data <<= t ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+           << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        if ( !PyString_Check( ArgValue ) ) {
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (string)" << endl ;
+       case CORBA::tk_boolean : {
+         bool b = false ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( !PyInt_Check( ArgValue ) ) {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (boolean)" << endl ;
+         }
+         else {
+           b = PyInt_AsLong( ArgValue ) ;
+         }
+         data <<= (CORBA::Any::from_boolean ) b ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << b << " (boolean)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+           << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        t = PyString_AsString( ArgValue ) ;
-        data <<= t ;
-        cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << t << " (string)"
-               << endl ;
-        break ;
-      }
-      case CORBA::tk_double : {
-        double d ;
-        ArgValue = PyTuple_GetItem( Result , i ) ;
-        if ( !PyFloat_Check( ArgValue ) ) {
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ;
+       case CORBA::tk_char : {
+         unsigned char c = 0 ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( !PyInt_Check( ArgValue ) ) {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (char)" << endl ;
+         }
+         else {
+           c = PyInt_AsLong( ArgValue ) ;
+         }
+         data <<= (CORBA::Any::from_char ) c ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << c << " (char)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+           << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        if ( ArgValue == NULL ) {
-          ArgValue = Result ;
+       case CORBA::tk_short : {
+         short s = 0 ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( !PyInt_Check( ArgValue ) ) {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (short)" << endl ;
+         }
+         else {
+           s = PyInt_AsLong( ArgValue ) ;
+         }
+         data <<= s ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << s << " (short)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+           << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        d = PyFloat_AsDouble( ArgValue ) ;
-        data <<= d ;
-        cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
-               << endl ;
-        break ;
-      }
-      case CORBA::tk_long : {
-        long l ;
-        ArgValue = PyTuple_GetItem( Result , i ) ;
-        if ( ArgValue == NULL ) {
-          ArgValue = Result ;
+       case CORBA::tk_long : {
+         long l = 0 ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( PyLong_Check( ArgValue ) ) {
+           l = PyLong_AsLong( ArgValue ) ;
+         }
+         else if ( PyInt_Check( ArgValue ) ) {
+           l = PyInt_AsLong( ArgValue ) ;
+         }
+         else {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (CORBA::tk_long)" << endl ;
+         }
+         data <<= l ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+             << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        if ( !PyInt_Check( ArgValue ) ) {
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (long)" << endl ;
+       case CORBA::tk_float : {
+         float f = 0 ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( !PyFloat_Check( ArgValue ) ) {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (float)" << endl ;
+         }
+         else {
+           f = PyFloat_AsDouble( ArgValue ) ;
+         }
+         data <<= f ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << f << " (float)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+           << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        l = PyInt_AsLong( ArgValue ) ;
-        data <<= l ;
-        cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << l << " (long)" << endl ;
-        break ;
-      }
-      case CORBA::tk_objref : {
-        MyPyObjIorList = PyTuple_New( 1 ) ;
-        PyObject * ObjIor = PyTuple_GetItem( Result , i ) ;
-        if ( ObjIor == NULL ) {
-          ObjIor = Result ;
+       case CORBA::tk_double : {
+         double d = 0 ;
+         if ( PyTuple_Check( Result ) ) {
+           ArgValue = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ArgValue = Result ;
+         }
+         if ( !PyFloat_Check( ArgValue ) ) {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " ERROR (double)" << endl ;
+         }
+         else {
+           d = PyFloat_AsDouble( ArgValue ) ;
+         }
+         data <<= d ;
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << d << " (double)"
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ArgValue->ob_refcnt"
+           << ArgValue->ob_refcnt << endl ;
+         break ;
        }
-        cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "<< endl ;
-        cout << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) : " ;
-        Py_INCREF( ObjIor ) ;
-        PyObject_Print( ObjIor , stdout , 0 ) ;
-        PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
-        Py_DECREF( ObjIor ) ;
-        ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ;
-//        ObjRef = PyCObject_AsVoidPtr( ArgValue ) ;
-//        ObjRef = (CORBA::Object_ptr ) PyLong_AsVoidPtr( ArgValue ) ;
-        char * IOR = NULL ;
-//        ArgValue = PyTuple_GetItem( Result , i ) ;
-        if ( ResultIor ) {
-          IOR = PyString_AsString( ResultIor ) ;
-          ObjRef = StringToObject( IOR ) ;
-          data <<= ObjRef ;
-          IORObjRef = ObjectToString( ObjRef ) ;
-          cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "
-                 << IORObjRef << endl ;
+       case CORBA::tk_objref : {
+         PyObject * ObjIor ;
+         MyPyObjIorList = PyTuple_New( 1 ) ;
+         if ( PyTuple_Check( Result ) ) {
+           ObjIor = PyTuple_GetItem( Result , i ) ;
+         }
+         else {
+           ObjIor = Result ;
+         }
+         cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(object reference) "
+           << " ArgsList->ob_refcnt" << ArgsList->ob_refcnt << " ObjIor->ob_refcnt"
+           << ObjIor->ob_refcnt << endl ;
+         Py_INCREF( ObjIor ) ;
+//        PyObject_Print( ObjIor , stdout , 0 ) ;
+         PyTuple_SetItem( MyPyObjIorList , 0 , ObjIor ) ;
+         ResultIor = PyEval_CallObject( MyPyObjIor , MyPyObjIorList ) ;
+         cdebug << "ObjIor->ob_refcnt " << ObjIor->ob_refcnt-1 << endl ;
+         Py_DECREF( ObjIor ) ;
+         cdebug << "MyPyObjIorList->ob_refcnt " << MyPyObjIorList->ob_refcnt-1 << endl ;
+         Py_DECREF( MyPyObjIorList ) ;
+         cdebug << "MyPyObjIor->ob_refcnt " << MyPyObjIor->ob_refcnt << endl ;
+         if ( ResultIor ) {
+           char * IOR = NULL ;
+           IOR = PyString_AsString( ResultIor ) ;
+           ObjRef = StringToObject( IOR ) ;
+           data <<= ObjRef ;
+           IORObjRef = ObjectToString( ObjRef ) ;
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << IORObjRef << " (objref) "
+             << endl ;
+           if ( CORBA::is_nil( ObjRef ) ) {
+             ResultIor = NULL ;
+           }
+           else {
+             cdebug << "ResultIor->ob_refcnt " << ResultIor->ob_refcnt-1 << endl ;
+             Py_DECREF( ResultIor ) ;
+           }
+         }
+         else {
+           cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL"
+             << method << " " << endl ;
+           RetVal = false ;
+         }
+         break ;
        }
-        else {
-          cdebug_out << "GraphExecutor::InNode::PyDynInvoke Error ResultIor == NULL"
-                     << method << " " << endl ;
-          RetVal = false ;
+         default : {
+           cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(other ERROR)" << endl ;
+         }
        }
-        break ;
+       outParams[i].Value = data ;
       }
-      default : {
-        cdebug << "ArgOut" << i << " : " << sname << " " << method << " Value " << "(other ERROR)" << endl ;
-      }
-      }
-      outParams[i].Value = data ;
-    }
-
-    if ( MyPyObjIorList ) {
-      int cnt = MyPyObjIorList->ob_refcnt ;
-      while ( cnt > 0 ) {
-        cnt = MyPyObjIorList->ob_refcnt - 1 ;
-        Py_DECREF( MyPyObjIorList ) ;
-        cdebug << "MyPyObjIorList->ob_refcnt" << MyPyObjIorList->ob_refcnt << endl ;
-      }
-    }
-    if ( ResultIor ) {
-      int cnt = ResultIor->ob_refcnt ;
-      while ( cnt > 0 ) {
-        cnt = ResultIor->ob_refcnt - 1 ;
-        Py_DECREF( ResultIor ) ;
-        cdebug << "ResultIor->ob_refcnt" << ResultIor->ob_refcnt << endl ;
-      }
-    }
-    Py_DECREF( Result ) ;
-  }
-
-  Py_DECREF( ArgsList ) ;
-  if ( MyPyObjRefList ) {
-    int cnt = MyPyObjRefList->ob_refcnt ;
-    while ( cnt > 0 ) {
-      cnt = MyPyObjRefList->ob_refcnt - 1 ;
-      Py_DECREF( MyPyObjRefList ) ;
-      cdebug << "MyPyObjRefList->ob_refcnt" << MyPyObjRefList->ob_refcnt << endl ;
-    }
-  }
-  if ( ResultObj ) {
-    int cnt = ResultObj->ob_refcnt ;
-    while ( cnt > 0 ) {
-      cnt = ResultObj->ob_refcnt - 1 ;
-      Py_DECREF( ResultObj ) ;
-      cdebug << "ResultObj->ob_refcnt" << ResultObj->ob_refcnt << endl ;
+      
+      cdebug << "Result->ob_refcnt" << Result->ob_refcnt-1 << endl ;
+      Py_DECREF( Result ) ;
     }
+    
+    cdebug << "GraphExecutor::InNode::PyDynInvoke ArgsList->ob_refcnt"
+      << ArgsList->ob_refcnt-1 << endl ;
+    Py_DECREF( ArgsList ) ;
+    
+    cdebug_out << "GraphExecutor::InNode::PyDynInvoke " << method << endl ;
+    
+    return RetVal ;
   }
 
-  cdebug_out << "GraphExecutor::InNode::PyDynInvoke " << method << endl ;
-
-  return RetVal ;
-
 }
index 5158492d978f22422cca46d16327940701772fad..142ee04470c5f92786231fca00f633ce58daf1b7 100644 (file)
@@ -53,11 +53,10 @@ SUPERVGUI Supervision;
 
 
 SUPERVGUI::SUPERVGUI(): QObject(),
-    desktop(0),
-    study(0),
-    engine(0),
-    browser(0)
-                       //info(0)
+                       desktop(0),
+                       study(0),
+                       browser(0)
+  //info(0)
 {
     Trace("SUPERVGUI::SUPERVGUI")
     if (factory==0) {
@@ -72,8 +71,9 @@ SUPERVGUI::~SUPERVGUI() {
     Trace("SUPERVGUI::~SUPERVGUI")
     if (factory==1) {
         factory = 0;
+       //if (!engine->_is_nil()) CORBA::release(engine);         
         //info->close();
-        browser->close();
+        if (browser) browser->close();
         MESSAGE("SUPERVGUI Info : factory destroy");
     } else {
         MESSAGE("SUPERVGUI Error : another call to factory destructor");
@@ -125,8 +125,8 @@ void SUPERVGUI::loadEngine(SALOME_NamingService* namingService) {
         return;
     };
 
-    engine  = new SUPERV::SuperG_var;
-    *engine = aSuperVisionComponent;
+    //    engine  = new SUPERV::SuperG_var;
+    engine = aSuperVisionComponent;
 }
 /*
 bool SUPERVGUI::information(SUPERV_CNode node, bool isReadOnly) {
@@ -236,7 +236,7 @@ void SUPERVGUI::importDataflow() {
        return;
     }
 
-    SUPERV_Graph aGraph = (*Supervision.getEngine())->GraphE(f);
+    SUPERV_Graph aGraph = engine->GraphE(f);
     //QFileInfo aFile(f);
     //aGraph->SetName(aFile.baseName());
     if (SUPERV_isNull(aGraph)) {
@@ -274,7 +274,7 @@ void SUPERVGUI::displayDataflow() {
                                 QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
          return;
       }
-      aDataFlow = (*Supervision.getEngine())->getGraph(ior);
+      aDataFlow = engine->getGraph(ior);
       if (SUPERV_isNull(aDataFlow)) {
        QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
        return;
@@ -365,7 +365,7 @@ void SUPERVGUI::modifyDataflow() {
        return;
       }
       
-      SUPERV_Graph aGraph = (*Supervision.getEngine())->Graph(f);
+      SUPERV_Graph aGraph = engine->Graph(f);
       //QFile aFile(f);
       //aGraph->SetName(aFile.name());
       if (SUPERV_isNull(aGraph)) {
@@ -455,20 +455,35 @@ void SUPERVGUI::customPopup(QPopupMenu* popup) {
     SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
     if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
 
-    Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
+    if (Sel->IObjectCount() == 1) {
+      Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
 
-    // insert SUPERV-specific popup items here
+      // insert SUPERV-specific popup items here
 
-    bool isDataflow, ownObj;
-    whatIsSelected(anIObj, ownObj, isDataflow);
-    
-    if (isDataflow) {
-      popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
-      popup->insertItem("Display", this, SLOT(displayDataflow()));
-      popup->insertSeparator();
+      bool isDataflow, ownObj;
+      whatIsSelected(anIObj, ownObj, isDataflow);
+      
+      if (isDataflow) {
+       popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
+       popup->insertItem("Display", this, SLOT(displayDataflow()));
+       popup->insertSeparator();
+      }
+      if (ownObj)
+       popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
+    }
+    if (Sel->IObjectCount() > 1) {
+      int aIObjCount = 0;
+      SALOME_ListIteratorOfListIO It_forCheckOwner(Sel->StoredIObjects());
+      for(;It_forCheckOwner.More();It_forCheckOwner.Next()) {
+       Handle(SALOME_InteractiveObject) anIObj = It_forCheckOwner.Value();
+       bool aIsOwner, aIsDataflow;
+       whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+       
+       if (aIsOwner) aIObjCount++;
+      }
+      if (aIObjCount == Sel->IObjectCount())  //all selected objects belong to Supervision
+       popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
     }
-    if (ownObj)
-      popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
 }
 
  
@@ -499,7 +514,7 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b
          SALOMEDS::GenericAttribute_var anAttr;
          if (obj->FindAttribute(anAttr, "AttributeIOR")) {
            SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-           SUPERV_Graph aDataFlow = (*Supervision.getEngine())->getGraph(anIOR->Value());
+           SUPERV_Graph aDataFlow = engine->getGraph(anIOR->Value());
            if (!SUPERV_isNull(aDataFlow)) 
              theIsDataflow = true;
          }
@@ -516,43 +531,44 @@ void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, b
 void SUPERVGUI::deleteObject() {
   SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
   if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
-  
-  Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
-  bool aIsOwner, aIsDataflow;
-  whatIsSelected(anIObj, aIsOwner, aIsDataflow);
-
-  if (!aIsOwner) return;
-
+   
   if (QMessageBox::warning(QAD_Application::getDesktop(),
                           tr("WARNING"),
                           tr("MSG_ASK_DELETE"),
                           QMessageBox::No,
                           QMessageBox::Yes) == QMessageBox::No)
     return;
-  
-  SALOMEDS::Study_var aStudy = study->getStudyDocument();
-  SALOMEDS::SObject_var  aObj = aStudy->FindObjectID( anIObj->getEntry() );
-  if (!aObj->_is_nil()) {
-    if (aIsDataflow) {
-      SALOMEDS::GenericAttribute_var anAttr;
-      if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
-       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-       QString ior = anIOR->Value();
-       
-       SUPERVGUI_Main* aMain;
-       for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
-         if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
-           aMain->setAsFromStudy(false);
-           break;
+   
+  SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
+  for(;It.More();It.Next()) {
+    Handle(SALOME_InteractiveObject) anIObj = It.Value();
+    bool aIsOwner, aIsDataflow;
+    whatIsSelected(anIObj, aIsOwner, aIsDataflow);
+    
+    SALOMEDS::Study_var aStudy = study->getStudyDocument();
+    SALOMEDS::SObject_var  aObj = aStudy->FindObjectID( anIObj->getEntry() );
+    if (!aObj->_is_nil()) {
+      if (aIsDataflow) {
+       SALOMEDS::GenericAttribute_var anAttr;
+       if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
+         SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
+         QString ior = anIOR->Value();
+           
+         SUPERVGUI_Main* aMain;
+         for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
+           if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
+             aMain->setAsFromStudy(false);
+             break;
+           }
          }
-       }
+        }
       }
+      QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
+      SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
+      op->start();
+      aBuilder->RemoveObjectWithChildren(aObj);
+      op->finish();
     }
-    QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
-    SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
-    op->start();
-    aBuilder->RemoveObjectWithChildren(aObj);
-    op->finish();
   }
   Sel->ClearIObjects() ; 
 }
index a2b9b48a742b40179160cdd1cb263267cc2e20e3..9c89bd7293c16ef4581a00c0502ec62e2154ffa2 100644 (file)
@@ -214,7 +214,16 @@ SUPERVGUI_Cell::SUPERVGUI_Cell(QWidget* parent, SUPERVGUI_Main* m, SUPERV_CNode
   QHBoxLayout* aBox = new QHBoxLayout(this);
   aBox->setMargin(3);
   aBox->setSpacing(3);
-  component = new SUPERVGUI_Label(this, CELL_WIDTH_PART, LABEL_HEIGHT, myNode->Comment(), QLabel::AlignLeft);
+
+  QString aCommentVis;
+  if (getNodeType() == SUPERV::FactoryNode)
+    aCommentVis = QString(myNode->Service()->ServiceName) + QString(tr("COMMENT_FROM"))
+      + QString(getFactoryNode()->GetComponentName());
+  else 
+    //aCommentVis = tr("COMMENT_PYTHON");
+    aCommentVis = tr("COMMENT_CNODE");
+
+  component = new SUPERVGUI_Label(this, CELL_WIDTH_PART, LABEL_HEIGHT, aCommentVis, QLabel::AlignLeft);
   connect(component, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
 
   myTitle = new SUPERVGUI_Label(this, CELL_WIDTH_PART, LABEL_HEIGHT, name(), QLabel::AlignLeft);
@@ -262,7 +271,7 @@ void SUPERVGUI_Cell::sync() {
   Trace("SUPERVGUI_Cell::sync");
   if (myMain == NULL) return;
   myTitle->setText(myNode->Name());
-  component->setText(myNode->Comment());
+  //component->setText(myNode->Comment());
   
   if (guiNode != NULL) {
     guiNode->sync();
index a3e187ad65a3e0bb64d6fabd3ddcac4e2881e825..97580c56fef33d288720787a5b3d115c87f2abcb 100644 (file)
@@ -65,7 +65,7 @@ bool SUPERVGUI_PortField::setNewValue() {
   if ( aTxt.isNull() || aTxt.isEmpty() ) return false;
   
   if ( aTxt.find( "Unknown" ) < 0 ) {
-    return myPort->Input( ( *Supervision.getEngine() )->StringValue( aTxt ) );
+    return myPort->Input( Supervision.getEngine()->StringValue( aTxt ) );
   }
   return false;
 }
index 5fba7792378fc969c9fc2b080100b671643c3271..38fa8285e47767e8b497c142d024f1364349a757 100644 (file)
@@ -28,18 +28,21 @@ SUPERVGUI_ComputeNode::SUPERVGUI_ComputeNode(QWidget* theParent, SUPERVGUI_Main*
   aGridLayout->addMultiCellWidget(myTitle, 0, 0, 0, 1);
 
   QString aComment(theNode->Comment());
+
+  QString aCommentVis = aComment;
+  if (getNodeType() == SUPERV::FactoryNode)
+    aCommentVis = QString(myNode->Service()->ServiceName) + QString(tr("COMMENT_FROM"))
+      + QString(getFactoryNode()->GetComponentName());
+  else 
+    //aCommentVis = tr("COMMENT_PYTHON");
+    aCommentVis = tr("COMMENT_CNODE");
+
   if (aComment.isNull() || aComment.isEmpty()) {
-    if (getNodeType() == SUPERV::FactoryNode)
-      aComment = QString(myNode->Service()->ServiceName) + QString(tr("COMMENT_FROM"))
-       + QString(getFactoryNode()->GetComponentName());
-    else 
-      //aComment = tr("COMMENT_PYTHON");
-      aComment = tr("COMMENT_CNODE");
-    theNode->SetComment(aComment.latin1());
+    theNode->SetComment(aCommentVis.latin1());
   }
-
+    
   myServiceBox = new QVBox(this, "service");
-  myComment = new SUPERVGUI_Label(myServiceBox, LABEL_WIDTH, LABEL_HEIGHT, aComment, QLabel::AlignLeft);
+  myComment = new SUPERVGUI_Label(myServiceBox, LABEL_WIDTH, LABEL_HEIGHT, aCommentVis, QLabel::AlignLeft);
   connect(myComment, SIGNAL(MousePress(QMouseEvent*)), this, SLOT(showPopup(QMouseEvent*)));
   QToolTip::add(myTitle, myTitle->text());
   QToolTip::add(myComment, myComment->text());
@@ -80,8 +83,8 @@ void SUPERVGUI_ComputeNode::sync()
   setName(myNode->Name());
   myTitle->setText(name());
   
-  myComment->setText(myNode->Comment());
-
+  //myComment->setText(myNode->Comment());
+  
   bool editing = myMain->getDataflow()->IsEditing();
   myPopup->setItemEnabled(myKillItem, !editing);
   if (myMain->isEditable()) {
index 2636dbcae7e6994c61eb3f0030c119e15dbcf190..fd5ab5ed4929dea67c7c3a53383f0c18473fe257 100644 (file)
@@ -38,6 +38,7 @@ SUPERVGUI_StartControlNode::SUPERVGUI_StartControlNode(QWidget* theParent, SUPER
 
   myPortsBox->reparent(this, pos());
   aGridLayout->addMultiCellWidget(myPortsBox, 1, 1, 0, 1);
+  //  myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
 
   myStatus->reparent(this, pos());
   myTime->reparent(this, pos());
@@ -212,8 +213,7 @@ SUPERVGUI_EndControlNode::SUPERVGUI_EndControlNode(QWidget* theParent, SUPERVGUI
   myTitle->setPaletteBackgroundColor(TITLECOLOR);
   aGridLayout->addMultiCellWidget(myTitle, 0, 0, 0, 2);
 
-  myPortsBox = new QFrame(this);
-  myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+  myPortsBox->reparent(this, pos());  
   
   myPIcount = 0;
   myPOcount = 0;
@@ -222,13 +222,34 @@ SUPERVGUI_EndControlNode::SUPERVGUI_EndControlNode(QWidget* theParent, SUPERVGUI
 
   for (int i=0; i<n; i++) {
     if (ports[i]->IsInput()) {
-      myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]), 
-                             myPIcount, 0);
-      myPIcount++;
+      if (getComputingNode()->IsEndSwitch()) {
+       if (ports[i]->IsGate())
+         myGatesLayout->addWidget(new SUPERVGUI_PortInESNode(myGatesBox, myMain, ports[i]), 
+                                 0, 0);
+       else {
+         myPortLayout->addWidget(new SUPERVGUI_PortInESNode(myValuesBox, myMain, ports[i]), 
+                                 myPIcount, 0);
+         myPIcount++;
+       }
+      } else {
+       if (ports[i]->IsGate())
+         myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]), 
+                                  0, 0);
+       else {
+         myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]), 
+                                 myPIcount, 0);
+         myPIcount++;
+       }
+      }
     } else {
-      myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]), 
-                             myPOcount, 1, Qt::AlignRight);
-      myPOcount++;
+      if (ports[i]->IsGate())
+       myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]), 
+                                0, 1, Qt::AlignRight);
+      else {
+       myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]), 
+                               myPOcount, 1, Qt::AlignRight);
+       myPOcount++;
+      }
     }
   }
   aGridLayout->addMultiCellWidget(myPortsBox, 1, 1, 1, 2);
index da2e9817186e1543247446063809482ec0b08235..1239c145d7710e7b21f46ea07eccbb4406b1435b 100644 (file)
@@ -172,7 +172,7 @@ NODE_Editing   "",          NODE_RED, NODE_GREEN, NODE_BLUE, true,  false,  true
 #include CORBA_SERVER_HEADER(SALOMEDS)
 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
 
-#define SUPERV_Engine  SUPERV::SuperG_var*
+#define SUPERV_Engine  SUPERV::SuperG_var
 
 #define SUPERV_Graph   SUPERV::Graph_var
 
index c3c6c6c27266ccf5834b236ca1173d0dd256aeee..3a1676f005dc2fdaa9423cd54bd306edd095fea7 100644 (file)
@@ -26,8 +26,18 @@ SUPERVGUI_GraphNode::SUPERVGUI_GraphNode(QWidget* theParent, SUPERVGUI_Main* the
   connect(myTitle, SIGNAL(MouseMove (QMouseEvent*)), this, SLOT(mouseTitleMove(QMouseEvent*)));
   connect(myTitle, SIGNAL(MouseRelease(QMouseEvent*)), this, SLOT(mouseTitleRelease(QMouseEvent*)));
 
-  myPortsBox = new QFrame(0);
-  myPortLayout = new QGridLayout(myPortsBox, 0, 2, 0, 1);
+  myPortsBox = new QVBox(0);  
+  myPortsBox->setSpacing(3);
+  myValuesBox = new QWidget(myPortsBox);
+  myPortLayout = new QGridLayout(myValuesBox, 0, 2, 0, 1);
+
+  myGatesBox = new QFrame(myPortsBox);
+  myGatesBox->setFrameStyle( QFrame::Panel | QFrame::Raised );
+  myGatesBox->setLineWidth(2);
+  //  myGatesBox->setPaletteBackgroundColor(backgroundColor().dark(105));
+  myGatesBox->setPaletteBackgroundColor(green.light(170));
+  myGatesLayout = new QGridLayout(myGatesBox, 0, 2);
+  myGatesLayout->setMargin(3);
   
   myTimer = new QTimer(this);
   connect(myTimer, SIGNAL(timeout()), this, SLOT(movingNode(/*QMouseEvent* e*/)));
@@ -47,13 +57,23 @@ SUPERVGUI_GraphNode::SUPERVGUI_GraphNode(QWidget* theParent, SUPERVGUI_Main* the
 
   for (int i=0; i<n; i++) {
     if (ports[i]->IsInput()) {
-      myPortLayout->addWidget(new SUPERVGUI_PortIn(myPortsBox, myMain, ports[i]), 
-                            myPIcount, 0);
-      myPIcount++;
+      if (ports[i]->IsGate())
+       myGatesLayout->addWidget(new SUPERVGUI_PortIn(myGatesBox, myMain, ports[i]), 
+                                0, 0);
+      else {
+       myPortLayout->addWidget(new SUPERVGUI_PortIn(myValuesBox, myMain, ports[i]), 
+                               myPIcount, 0);
+       myPIcount++;
+      }
     } else {
-      myPortLayout->addWidget(new SUPERVGUI_PortOut(myPortsBox, myMain, ports[i]), 
-                            myPOcount, 1, Qt::AlignRight);
-      myPOcount++;
+      if (ports[i]->IsGate())
+       myGatesLayout->addWidget(new SUPERVGUI_PortOut(myGatesBox, myMain, ports[i]), 
+                                0, 1, Qt::AlignRight);
+      else {
+       myPortLayout->addWidget(new SUPERVGUI_PortOut(myValuesBox, myMain, ports[i]), 
+                               myPOcount, 1, Qt::AlignRight);
+       myPOcount++;
+      }
     }
   }
 }
@@ -254,7 +274,6 @@ void SUPERVGUI_GraphNode::sync() {
   //check: is creation of link is complete
   if (myMain->getGraph()->isAnyLinkCreating()) {
     //not creation complete
-    //cout<<"   --- $$$  1"<<endl;
     myPopup->setItemEnabled(myDeleteItem, false);
   }
   else {
@@ -336,7 +355,7 @@ void SUPERVGUI_GraphNode::addInputPort() {
   if (aPort == NULL) return;
 
   if (getNodeType() == SUPERV::EndSwitchNode) {
-    SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myPortsBox, myMain, aPort);    
+    SUPERVGUI_PortInESNode* aPortPrs = new SUPERVGUI_PortInESNode(myValuesBox, myMain, aPort);    
     myPortLayout->addWidget(aPortPrs, myPIcount, 0);
 
     if (myPortsBox->isVisible()) {
@@ -344,7 +363,7 @@ void SUPERVGUI_GraphNode::addInputPort() {
     }
   }
   else {
-    SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myPortsBox, myMain, aPort);
+    SUPERVGUI_PortIn* aPortPrs = new SUPERVGUI_PortIn(myValuesBox, myMain, aPort);
     myPortLayout->addWidget(aPortPrs, myPIcount, 0);
 
     if (myPortsBox->isVisible()) {
@@ -362,7 +381,7 @@ void SUPERVGUI_GraphNode::addOutputPort() {
   SUPERV_Port aPort = createOutPort();
   if (aPort == NULL) return;
 
-  SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myPortsBox, myMain, aPort);
+  SUPERVGUI_PortOut* aPortPrs = new SUPERVGUI_PortOut(myValuesBox, myMain, aPort);
   myPortLayout->addWidget(aPortPrs, myPOcount, 1, Qt::AlignRight);
   myPOcount++;
   if (myPortsBox->isVisible()) {
@@ -385,16 +404,28 @@ void SUPERVGUI_GraphNode::updatePorts() {
     aPortPrs = (SUPERVGUI_Port*) child(aName, "SUPERVGUI_Port");
     if (aPortPrs == NULL) {
       if (aPorts[i]->IsInput()) {
-       SUPERVGUI_PortIn* aPortIn = new SUPERVGUI_PortIn(myPortsBox, myMain, aPorts[i]);
-       myPortLayout->addWidget(aPortIn, myPIcount, 0);
+       SUPERVGUI_PortIn* aPortIn;
+       if (aPorts[i]->IsGate()) {
+         aPortIn = new SUPERVGUI_PortIn(myGatesBox, myMain, aPorts[i]);
+         myGatesLayout->addWidget(aPortIn, myPIcount, 0);
+       } else {
+         aPortIn = new SUPERVGUI_PortIn(myValuesBox, myMain, aPorts[i]);
+         myPortLayout->addWidget(aPortIn, myPIcount, 0);
+         myPIcount++;
+       }
        if (aIsVisible) aPortIn->show();
-       myPIcount++;
        isAdded = true;
       } else {
-       SUPERVGUI_PortOut* aPortOut = new SUPERVGUI_PortOut(myPortsBox, myMain, aPorts[i]);
-       myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+       SUPERVGUI_PortOut* aPortOut;
+       if (aPorts[i]->IsGate()) {
+         aPortOut = new SUPERVGUI_PortOut(myGatesBox, myMain, aPorts[i]);
+         myGatesLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+       } else {
+         aPortOut = new SUPERVGUI_PortOut(myValuesBox, myMain, aPorts[i]);
+         myPortLayout->addWidget(aPortOut, myPOcount, 1, Qt::AlignRight);
+         myPOcount++;
+       }
        if (aIsVisible) aPortOut->show();
-       myPOcount++;
        isAdded = true;
       }
     }
index ce756bc863ffa3d0a53ef28a8d66ee64b62c574a..fde17f969f6b3be2a7154bc19e0d5e115ad9ec2e 100644 (file)
@@ -58,8 +58,13 @@ class SUPERVGUI_GraphNode: public SUPERVGUI_Node {
  protected:
   SUPERVGUI_Label* myTitle;
 
-  QFrame*          myPortsBox;
+  QVBox*           myPortsBox;
+  QWidget*         myValuesBox;
   QGridLayout*     myPortLayout;
+  
+  QFrame*          myGatesBox;
+  QGridLayout*     myGatesLayout;
+  
   QTimer*          myTimer;  
   int         myPIcount;
   int         myPOcount;
index 765c6bfb2d52901d3483c5908bb9e46562babcbe..1151a7793f61d53da3e6708758631d2380062a7e 100644 (file)
@@ -80,7 +80,7 @@ SUPERVGUI_Information::SUPERVGUI_Information(SUPERV_CNode node, bool isReadOnly)
     contV = new QLineEdit( TopGroup );
     contV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
     contV->setMinimumSize( 200, 0 );
-    contV->setReadOnly( true/*isReadOnly*/ );
+    contV->setReadOnly( false/*isReadOnly*/ );
     contV->setText( SUPERV::FNode::_narrow(node)->GetContainer() );
     
     compnameL = new QLabel( tr( "COMPONENT_NAME_LBL" ), TopGroup ); 
@@ -264,10 +264,10 @@ void SUPERVGUI_Information::okButton() {
   Trace("SUPERVGUI_Information::okButton");
   myNode->SetName( nameV->text().latin1());
   myNode->SetAuthor( authV->text().latin1() );
-  /*if (myNode->IsFactory()) {
+  if (myNode->IsFactory()) {
     SUPERV_FNode aFNode = SUPERV::FNode::_narrow(myNode);
     aFNode->SetContainer( contV->text().latin1() );
-    }*/
+  }
   myNode->SetComment( commV->text().latin1() );
   accept();
 }
index 5184f7cc629905b37f65b36f9c0b34bcc8baf7ad..8f832244e5a18681d0c6fae20dd5656d049dfaaf 100644 (file)
@@ -76,7 +76,7 @@ SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* th
     if (obj->FindAttribute(anAttr, "AttributeIOR")) {
       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
       Standard_CString ior = anIOR->Value();
-      dataflow = (*Supervision.getEngine())->getGraph(ior);
+      dataflow = Supervision.getEngine()->getGraph(ior);
       if (SUPERV_isNull(dataflow)) {
        QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
        close();
@@ -88,7 +88,7 @@ SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* th
       close();
     }
   } else {
-    dataflow = (*Supervision.getEngine())->Graph(MAIN_NEW);
+    dataflow = Supervision.getEngine()->Graph(MAIN_NEW);
     if (SUPERV_isNull(dataflow)) {
       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_CREATE_DF"));
       close();
@@ -112,9 +112,9 @@ SUPERVGUI_Main::SUPERVGUI_Main(SUPERVGraph_ViewFrame* theParent, QAD_Desktop* th
   Trace("SUPERVGUI_Main::SUPERVGUI_Main (file)")
     theParent->setViewWidget(this);  
   if (isModify) {
-    dataflow = (*Supervision.getEngine())->Graph(f);
+    dataflow = Supervision.getEngine()->Graph(f);
   } else {
-    dataflow = (*Supervision.getEngine())->GraphE(f);
+    dataflow = Supervision.getEngine()->GraphE(f);
   }
   if (SUPERV_isNull(dataflow)) {
     QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f));
@@ -184,7 +184,7 @@ void SUPERVGUI_Main::init(QAD_Desktop* theDesktop) {
        aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
        aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );
 
-       builder->DefineComponentInstance(father, *Supervision.getEngine());
+       builder->DefineComponentInstance(father, Supervision.getEngine());
         op->finish();
     };
 
@@ -797,7 +797,7 @@ bool SUPERVGUI_Main::addStudy() {
       anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
       aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
       aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );
-      aBuilder->DefineComponentInstance(aComponent, *Supervision.getEngine());
+      aBuilder->DefineComponentInstance(aComponent, Supervision.getEngine());
       if (aLocked) aStudy->GetProperties()->SetLocked(true);
       anOperation->finish();
     }
@@ -920,7 +920,7 @@ bool SUPERVGUI_Main::putDataStudy(SUPERV_Port p, const char* inout) {
       anAttr = aBuilder->FindOrCreateAttribute(aComponent, "AttributePixMap");
       aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
       aPixmap->SetPixMap( "ICON_OBJBROWSER_Supervision" );
-      aBuilder->DefineComponentInstance(aComponent, *Supervision.getEngine());
+      aBuilder->DefineComponentInstance(aComponent, Supervision.getEngine());
       if (aLocked) aStudy->GetProperties()->SetLocked(true);
       anOperation->finish();
     }
index 3c4515aad4899009162cbd6c16cd24918f3093fa..99b1d9ba31c535d8fbdb3efa6ac98845319716d1 100644 (file)
@@ -174,7 +174,7 @@ void SUPERVGUI_Node::setState(SUPERV::GraphState theState)
     break;
   }
   myTime->setPaletteBackgroundColor(myStatus->paletteBackgroundColor());
-  long sec = 0; //myNode->CpuUsed();
+  long sec = myNode->CpuUsed();
   //    sec++;
   char hms[9];
   long s = sec/3600;
@@ -412,6 +412,10 @@ void SUPERVGUI_Node::setNodeName(QString aName) {
 SUPERV_Port SUPERVGUI_Node::createInPort() {
   SUPERVGUI_PortParamsDlg* aDlg = new SUPERVGUI_PortParamsDlg();
   if (aDlg->exec()) {
+    if (aDlg->getName().isEmpty() || aDlg->getType().isEmpty()) {
+      QMessageBox::warning( QAD_Application::getDesktop(), tr( "ERROR" ), tr( "MSG_CANT_CREATE_PORT" ) );
+      return NULL;
+    }
     SUPERV_INode aNode = getInlineNode();
     if (SUPERV_isNull(aNode)) {
       MESSAGE("SUPERVGUI_Node::createInPort: Node is wrong type");
@@ -503,6 +507,9 @@ void SUPERVGUI_Node::editFunction() {
  * Port parameters dialog definition
  */
 
+static const char* MyTypeStrings[] = 
+  {"string", "boolean", "char", "short", "int", "long", "float", "double", "objref"};
+
 SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg()
   : QDialog(QAD_Application::getDesktop(), 0, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu  )
 {
@@ -522,8 +529,9 @@ SUPERVGUI_PortParamsDlg::SUPERVGUI_PortParamsDlg()
   QLabel* aTypeLbl = new QLabel("Value Type", this );
   aBaseLayout->addWidget(aTypeLbl, 1, 0);
  
-  myTypeTxt = new QLineEdit( this );
+  myTypeTxt = new QComboBox( this );
   aTypeLbl->setBuddy( myTypeTxt );
+  myTypeTxt->insertStrList( MyTypeStrings );
   aBaseLayout->addWidget(myTypeTxt, 1, 1);
  
   QGroupBox* aBtnBox = new QGroupBox( this );
index 08a9587edf1039db46c7ffc77fb92e235ce08ad8..97923f76fa74793dbb214ba2c2f3fa1af71aa021 100644 (file)
@@ -33,6 +33,8 @@ using namespace std;
 #include "SUPERVGUI_Label.h"
 #include <qvbox.h>
 #include "SUPERVGUI_BrowseNodeDlg.h"
+#include <qcombobox.h>
+
 
 class SUPERVGUI_Main;
 
@@ -160,11 +162,11 @@ class SUPERVGUI_PortParamsDlg: public QDialog {
   ~SUPERVGUI_PortParamsDlg() {};
 
   QString getName() { return myNameTxt->text(); }
-  QString getType() { return myTypeTxt->text(); }
+  QString getType() { return myTypeTxt->currentText(); }
 
  private:
   QLineEdit* myNameTxt;
-  QLineEdit* myTypeTxt;
+  QComboBox* myTypeTxt;
 };
 
 
index 842687eaa551826aac48cfed38a9980b01bb43f2..335d05063864f6cd5d7e766bc273024b5be38768 100644 (file)
@@ -200,7 +200,7 @@ void SUPERVGUI_PortIn::sync() {
 
 void SUPERVGUI_PortIn::setValue(const char* d) {
     Trace("SUPERVGUI_PortIn::setValue")
-    if (port->Input((*Supervision.getEngine())->StringValue(d))) {
+    if (port->Input(Supervision.getEngine()->StringValue(d))) {
         sync();
     } else {
         QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SETVAL"));
@@ -237,10 +237,11 @@ void SUPERVGUI_PortIn::browse() {
 QPoint SUPERVGUI_PortIn::getConnectPnt() {
   // Parent widget is internal node frame
   // parent of parent is node it self
-  QWidget* aNode = parentWidget()->parentWidget();
+  QWidget* aNode = parentWidget()->parentWidget()->parentWidget();
   QPoint aPnt(aNode->pos()); // position of the node
 
   if (parentWidget()->isVisible()) {
+    aPnt += parentWidget()->parentWidget()->pos();
     aPnt += parentWidget()->pos();
     return QPoint(aPnt.x() + pos().x(), 
                  aPnt.y() + (pos().y() + height()/2));
@@ -355,9 +356,10 @@ void SUPERVGUI_PortOut::browse() {
 QPoint SUPERVGUI_PortOut::getConnectPnt() {
   // Parent widget is internal node frame
   // parent of parent is node it self
-  QWidget* aNode = parentWidget()->parentWidget();
+  QWidget* aNode = parentWidget()->parentWidget()->parentWidget();
   QPoint aPnt(aNode->pos()); // position of the node
   if (parentWidget()->isVisible()) {
+    aPnt += parentWidget()->parentWidget()->pos();
     aPnt += parentWidget()->pos();
     return QPoint(aPnt.x() + pos().x() + width(), 
                  aPnt.y() + (pos().y() + height()/2));
@@ -436,7 +438,7 @@ void SUPERVGUI_PortInESNode::sync() {
 
 void SUPERVGUI_PortInESNode::setValue(const char* d) {
     Trace("SUPERVGUI_PortIn::setValue")
-    if (port->Input((*Supervision.getEngine())->StringValue(d))) {
+    if (port->Input(Supervision.getEngine()->StringValue(d))) {
         sync();
     } else {
         QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_SETVAL"));
@@ -447,10 +449,11 @@ void SUPERVGUI_PortInESNode::setValue(const char* d) {
  * Returns coordinates of connection point in content coordinates
  */
 QPoint SUPERVGUI_PortInESNode::getConnectPnt() {
-  QWidget* aNode = parentWidget()->parentWidget();
+  QWidget* aNode = parentWidget()->parentWidget()->parentWidget();
   QPoint aPnt(aNode->pos());
 
   if (parentWidget()->isVisible()) {
+    aPnt += parentWidget()->parentWidget()->pos();
     aPnt += parentWidget()->pos();
     return QPoint(aPnt.x() + pos().x(), 
                  aPnt.y() + (pos().y() + height()/2));
index ebcc16bd5cc8e5fc76abda4c07183304a9409b3e..860dd16a33e58d9d57c3b47c329550cfd35955f2 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "Graph_Impl.hxx"
 
@@ -35,7 +35,7 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
 //          << hex << (void *) this << dec )
 //  _thisObj = this ;
 //  _id = _poa->activate_object(_thisObj);
-  MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
+//  MESSAGE( "CNode_Impl::CNode_Impl " << aDataFlowName << " " );
   beginService( "CNode_Impl::CNode_Impl" );
   _Orb = CORBA::ORB::_duplicate(orb);
   _Poa = poa ;
@@ -60,12 +60,13 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
                         const char * FuncName  ,
                         const SUPERV::ListOfStrings & PythonFunction ) :
   Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
-//  beginService( "CNode_Impl::CNode_Impl" );
-  if ( FuncName && NodeName ) {
-    cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
-         << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
-         << " " << strlen( FuncName ) << endl ;
-  }
+  beginService( "CNode_Impl::CNode_Impl" );
+//  cout << "CNode_Impl::CNode_Impl -->" << endl ;
+//  if ( FuncName && NodeName ) {
+//    cout << "CNode_Impl::CNode_Impl " << (void *) NodeName << " " << NodeName
+//         << " " << strlen(NodeName) << " " << (void *) FuncName << " " << FuncName
+//         << " " << strlen( FuncName ) << endl ;
+//  }
   if ( NodeKindOfNode == SUPERV::ComputingNode ) {
     MESSAGE( "CNode_Impl::CNode_Impl " << FuncName << " _poa->activate_object" );
     _thisObj = this ;
@@ -88,7 +89,8 @@ CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
                                             aFuncName ,
                                             aPythonFunction ) ;
   _IsNode = true ;
-//  endService( "CNode_Impl::CNode_Impl" );  
+  endService( "CNode_Impl::CNode_Impl" );  
+//  cout << "<-- CNode_Impl::CNode_Impl" << endl ;
 }
 
 CNode_Impl::CNode_Impl( CORBA::ORB_ptr orb ,
@@ -653,7 +655,7 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
     bool sts = false ;
     GraphBase::InPort * anInPort ;
     if ( _IsNode ) {
-      sts = _DataFlowExecutor->ChangeInputData( _DataFlowEditor->Name() ,
+      sts = _DataFlowExecutor->ChangeInputData( _DataFlowNode->Name() ,
                                                 ToServiceParameterName ,
                                                 *aValue->ToAny() ) ;
       anInPort = _DataFlowNode->GetChangeInPort( ToServiceParameterName ) ;
@@ -698,18 +700,25 @@ SUPERV::Port_ptr CNode_Impl::Input( const char * ToServiceParameterName ,
 SUPERV::ListOfPorts * CNode_Impl::Ports() {
   bool begin = true ;
   SUPERV::ListOfPorts_var RetVal = new SUPERV::ListOfPorts ;
-//  if ( !_DataFlowNode->IsDataFlowNode() ) {
   if ( _IsNode ) {
     int i , j ;
     RetVal->length( _DataFlowNode->GetNodeInPortsSize() +
                     _DataFlowNode->GetNodeOutPortsSize() ) ;
     for ( i = 0 ; i < _DataFlowNode->GetNodeInPortsSize() ; i++ ) {
       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeNodeInPort( i ) ;
-      if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
-        if ( begin ) {
-          beginService( "CNode_Impl::Ports" );
-          begin = false ;
-       }
+      if ( begin ) {
+        beginService( "CNode_Impl::Ports" );
+        begin = false ;
+      }
+      if ( anInPort->IsLoop() || ( anInPort->IsGate() && !anInPort->IsConnected() && 
+                                   ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
+        MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " ignored" ) ;
+        RetVal[ i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
+      }
+      else if ( CORBA::is_nil( anInPort->ObjRef() ) ) {
+        MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() << " IsExecuting "
+                 << _DataFlowEditor->IsExecuting() << " IsGate/IsConnected " << anInPort->IsGate()
+                 << "/" << anInPort->IsConnected() ) ;
         Port_Impl * myPort ;
         if ( _DataFlowNode->HasInput( anInPort->PortName() ) ) {
           const CORBA::Any * anAny = anInPort->GetOutPort()->Value() ;
@@ -739,16 +748,23 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() {
         anInPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
       }
       else {
+        MESSAGE( "InPort " << i << " " << anInPort->PortName() << " of Node " << Name() ) ;
         RetVal[ i ] = SUPERV::Port::_duplicate( anInPort->ObjRef() ) ;
       }
     }
     for ( i = 0 ; i < _DataFlowNode->GetNodeOutPortsSize() ; i++ ) {
       GraphBase::OutPort * anOutPort = _DataFlowNode->GetChangeNodeOutPort( i ) ;
-      if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
-        if ( begin ) {
-          beginService( "CNode_Impl::Ports" );
-          begin = false ;
-       }
+      if ( begin ) {
+        beginService( "CNode_Impl::Ports" );
+        begin = false ;
+      }
+      if ( anOutPort->IsLoop() || ( anOutPort->IsGate() && !anOutPort->IsConnected() &&
+                                    ( _DataFlowEditor->IsExecuting() || _DataFlowEditor->IsReadOnly() ) ) ) {
+        MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() << " ignored" ) ;
+        RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( SUPERV::Port::_narrow( CORBA::Object::_nil() ) ) ;
+      }
+      else if ( CORBA::is_nil( anOutPort->ObjRef() ) ) {
+        MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
         const CORBA::Any * anAny = anOutPort->Value() ;
         Port_Impl * myPort = new Port_Impl( _Orb , _Poa , _ContId ,
                                             instanceName() , interfaceName() ,
@@ -766,9 +782,19 @@ SUPERV::ListOfPorts * CNode_Impl::Ports() {
         anOutPort->ObjRef( SUPERV::Port::_duplicate( iobject ) ) ;
       }
       else {
+        MESSAGE( "OutPort " << i << " " << anOutPort->PortName() << " of Node " << Name() ) ;
         RetVal[ _DataFlowNode->GetNodeInPortsSize() + i ] = SUPERV::Port::_duplicate( anOutPort->ObjRef() ) ;
       }
     }
+    for ( i = 0 ; i < (int ) RetVal->length() ; i++ ) {
+      if ( CORBA::is_nil( RetVal[ i ] ) ) {
+        for ( j = i ; j < (int ) RetVal->length() - 1 ; j++ ) {
+          RetVal[ j ] = RetVal[ j + 1 ] ;
+       }
+        RetVal->length( RetVal->length() - 1 ) ;
+        i-- ;
+      }
+    }
   }
   else {
     if ( _DataFlowEditor->IsValid() ) {
@@ -915,9 +941,10 @@ long CNode_Impl::SubGraph() {
 }
 
 bool CNode_Impl::IsLinked(const char * ServiceParameterName ) {
-//  beginService( "CNode_Impl::IsLinked" );
+  beginService( "CNode_Impl::IsLinked" );
   bool RetVal = _DataFlowNode->IsLinked( ServiceParameterName ) ;
-//  endService( "CNode_Impl::IsLinked" );
+  MESSAGE( Name() << "->IsLinked( '" << ServiceParameterName << "' )" ) ;
+  endService( "CNode_Impl::IsLinked" );
   return RetVal ;
 }
 
@@ -991,7 +1018,7 @@ SUPERV::ControlState CNode_Impl::Control() {
 }
 void CNode_Impl::ControlClear() {
 //  beginService( "CNode_Impl::ControlClear" );
-  SUPERV::ControlState RetVal = SUPERV::VoidState ;
+//  SUPERV::ControlState RetVal = SUPERV::VoidState ;
   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
   if ( _DataFlowExecutor ) {
     if ( _IsNode ) {
@@ -1342,15 +1369,12 @@ long CNode_Impl::CpuUsed() {
   GraphExecutor::DataFlow * _DataFlowExecutor = _DataFlowEditor->Executor() ;
   if ( _DataFlowExecutor ) {
     if ( _IsNode ) {
-//      RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
+      RetVal = _DataFlowExecutor->CpuUsed( Name() ) ;
     }
     else {
-//      RetVal = _DataFlowExecutor->CpuUsed() ;
+      RetVal = _DataFlowExecutor->CpuUsed() ;
     }
   }
-  else {
-    return 0 ;
-  }
   return RetVal ;
 }
 
index 21ae26fc881468cf8d5ee13f55c11da12e21fa49..a642a9fda83670484912745f60bd47b2c65117fa 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _CNODE_IMPL_HXX_
 #define _CNODE_IMPL_HXX_
 
-#include <iostream.h>
+#include <iostream>
 
 #include "CORBA.h"
 
@@ -50,9 +50,9 @@ class CNode_Impl : public POA_SUPERV::CNode ,
                 const char *interfaceName ,
                 GraphEditor::DataFlow * DataFlowEditor ,
                 const SALOME_ModuleCatalog::Service &NodeService ,
-                const char * NodeName = NULL ,
+                const char * NodeName = NULLSTRING ,
                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::ComputingNode ,
-                const char * aFuncName = NULL ,
+                const char * aFuncName = NULLSTRING ,
                 const SUPERV::ListOfStrings & aPythonFunction = SUPERV::ListOfStrings() ) ;
     CNode_Impl( CORBA::ORB_ptr orb ,
                PortableServer::POA_ptr poa ,
@@ -61,7 +61,7 @@ class CNode_Impl : public POA_SUPERV::CNode ,
                 const char *interfaceName ,
                 GraphEditor::DataFlow * DataFlowEditor ,
                 const SALOME_ModuleCatalog::Service &NodeService ,
-                const char * NodeName = NULL ,
+                const char * NodeName = NULLSTRING ,
                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::InLineNode ,
                 const GraphBase::ListOfFuncName & aFuncName = GraphBase::ListOfFuncName() ,
                 const GraphBase::ListOfPythonFunctions & aPythonFunction = GraphBase::ListOfPythonFunctions() ) ;
index 39be6fe37909f6a6753763df7dd45b68be0473e4..d58c3ab1e263ac165b610f05e09f65ecc50bbbdb 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "ELNode_Impl.hxx"
 
index 30b1d8af7cacbd250389f90c816f1812228731c8..db339c69766b87fd3da6bdaa8a7db2027da15e14 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _ELNODE_IMPL_HXX_
 #define _ELNODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index 5b20b25a79c14d78961e6236c68b38edc6e188d0..8e096aa6e8998953765c9c224d9cef500a059a7e 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "ESNode_Impl.hxx"
 
@@ -34,10 +34,10 @@ ESNode_Impl::ESNode_Impl( CORBA::ORB_ptr orb ,
   GNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , FuncName , SUPERV::ListOfStrings() , NodeKindOfNode ) {
 //  MESSAGE( NodeName << " " );
   beginService( "ESNode_Impl::ESNode_Impl" );
-  if ( FuncName ) {
-    cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
-         << " " << strlen( FuncName ) << endl ;
-  }
+//  if ( FuncName ) {
+//    cout << "ESNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
+//         << " " << strlen( FuncName ) << endl ;
+//  }
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);
   _Orb = CORBA::ORB::_duplicate(orb);
index 48d6886b64ec87ba6bcf8edeb9e4c8e3077a1a60..944e3f4c161a59ba5ad06c84e8697a715069e464 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _ESNODE_IMPL_HXX_
 #define _ESNODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index 130ecad41bbb44ebee0596cf1293ea2fe3dc64e6..49e6e5cd84257dedb0315da871425c8cddf08bf0 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "FNode_Impl.hxx"
 
@@ -23,20 +23,21 @@ FNode_Impl::FNode_Impl() {
 }
 
 FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb ,
-                     PortableServer::POA_ptr poa ,
-                     PortableServer::ObjectId * contId , 
-                     const char *instanceName ,
-                      const char *interfaceName ,
-                      GraphEditor::DataFlow * aDataFlowEditor ,
-                      const SALOME_ModuleCatalog::Service &NodeService ,
-                      const char * NodeComponentName ,
-                      const char * NodeInterfaceName ,
-                      const char * NodeName ,
-                      const SUPERV::KindOfNode NodeKindOfNode ) :
+                       PortableServer::POA_ptr poa ,
+                       PortableServer::ObjectId * contId , 
+                       const char * instanceName ,
+                        const char * interfaceName ,
+                        GraphEditor::DataFlow * aDataFlowEditor ,
+                        const SALOME_ModuleCatalog::Service &NodeService ,
+                        const char * NodeComponentName ,
+                        const char * NodeInterfaceName ,
+                        const char * NodeName ,
+                        const SUPERV::KindOfNode NodeKindOfNode ) :
 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
-  CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , NodeService , NodeName , NodeKindOfNode , (char * ) NULL ) {
-  MESSAGE( NodeName << " " );
-//  beginService( "FNode_Impl::FNode_Impl" );
+  CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , NodeService , NodeName , NodeKindOfNode , NULLSTRING ) {
+//  MESSAGE( NodeName << " " );
+  beginService( "FNode_Impl::FNode_Impl" );
+//  cout << "FNode_Impl::FNode_Impl -->" << endl ;
   _thisObj = this ;
   _id = _poa->activate_object(_thisObj);
   _Orb = CORBA::ORB::_duplicate(orb);
@@ -47,16 +48,17 @@ FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb ,
 //                                           NodeKindOfNode ) ) ;
   DataFlowNode()->ComponentName( NodeComponentName ) ;
   DataFlowNode()->InterfaceName( NodeInterfaceName ) ;
-//  endService( "FNode_Impl::FNode_Impl" );  
+  endService( "FNode_Impl::FNode_Impl" );  
+//  cout << "<-- FNode_Impl::FNode_Impl" << endl ;
 }
 
 FNode_Impl::FNode_Impl( CORBA::ORB_ptr orb ,
-                     PortableServer::POA_ptr poa ,
-                     PortableServer::ObjectId * contId , 
-                     const char *instanceName ,
-                      const char *interfaceName ,
-                      GraphEditor::DataFlow * aDataFlowEditor ,
-                      GraphEditor::InNode * aDataFlowNode ) :
+                       PortableServer::POA_ptr poa ,
+                       PortableServer::ObjectId * contId , 
+                       const char * instanceName ,
+                        const char * interfaceName ,
+                        GraphEditor::DataFlow * aDataFlowEditor ,
+                        GraphEditor::InNode * aDataFlowNode ) :
 //  Engines_Component_i(orb, poa, contId, instanceName, interfaceName, false, false) {
   CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , aDataFlowNode ) {
   MESSAGE( DataFlowNode()->Name() << " " );
index 295113a61c4df219b9eabc154a80962c6238a422..0b9105e4312389276ef744887433ed9add41c2ea 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _FNODE_IMPL_HXX_
 #define _FNODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
@@ -40,25 +40,25 @@ class FNode_Impl : public CNode_Impl ,
     FNode_Impl( CORBA::ORB_ptr orb ,
                PortableServer::POA_ptr poa ,
                PortableServer::ObjectId * contId , 
-               const char *instanceName ,
-                const char *interfaceName ,
-                const char *aDataFlowName ) ;
+               const char * instanceName ,
+                const char * interfaceName ,
+                const char * aDataFlowName ) ;
     FNode_Impl( CORBA::ORB_ptr orb ,
                PortableServer::POA_ptr poa ,
                PortableServer::ObjectId * contId , 
-               const char *instanceName ,
-                const char *interfaceName ,
+               const char * instanceName ,
+                const char * interfaceName ,
                 GraphEditor::DataFlow * DataFlowEditor ,
                 const SALOME_ModuleCatalog::Service &NodeService ,
                 const char * NodeComponentName ,
                 const char * NodeInterfaceName ,
-                const char * NodeName = NULL ,
+                const char * NodeName = NULLSTRING ,
                 const SUPERV::KindOfNode NodeKindOfNode = SUPERV::FactoryNode ) ;
     FNode_Impl( CORBA::ORB_ptr orb ,
                PortableServer::POA_ptr poa ,
                PortableServer::ObjectId * contId , 
-               const char *instanceName ,
-                const char *interfaceName ,
+               const char * instanceName ,
+                const char * interfaceName ,
                 GraphEditor::DataFlow * DataFlowEditor ,
                 GraphEditor::InNode * DataFlowNode ) ;
     virtual ~FNode_Impl() ;
index 5d0951c5200493697c10cfc4d8ad74f088ede340..bee265114a3a39f80ccb408d90d74dca91d4a498 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "GNode_Impl.hxx"
 
@@ -36,8 +36,8 @@ GNode_Impl::GNode_Impl( CORBA::ORB_ptr orb ,
 //  MESSAGE( NodeName << " " );
   beginService( "GNode_Impl::GNode_Impl" );
   if ( FuncName ) {
-    cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
-         << " " << strlen( FuncName ) << endl ;
+//    cout << "GNode_Impl::GNode_Impl " << (void *) FuncName << " " << FuncName
+//         << " " << strlen( FuncName ) << endl ;
   }
   if ( NodeKindOfNode == SUPERV::GOTONode ) {
     _thisObj = this ;
index 840ea238951df8b0f6ddaded1638e39bf774e161..ca6cff4da0d9909cb5fb1fcc4ac8f6eff9ea2324 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _GNODE_IMPL_HXX_
 #define _GNODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
@@ -67,7 +67,7 @@ class GNode_Impl : public INode_Impl ,
 
     virtual bool SetCoupled( const char * anInLineNode ) {
             GraphBase::InLineNode * CoupledINode = (GraphBase::InLineNode * ) DataFlowEditor()->GetGraphNode( anInLineNode ) ;
-            cout << Name() << ".SetCoupled " << anInLineNode << endl ;
+//            cout << Name() << ".SetCoupled " << anInLineNode << endl ;
             if ( CoupledINode && ( IsGOTO() &&
                    ( CoupledINode->IsInLineNode() || CoupledINode->IsLoopNode() ||
                      CoupledINode->IsSwitchNode() ) ) ||
@@ -86,15 +86,15 @@ class GNode_Impl : public INode_Impl ,
                 DataFlowEditor()->AddLink( Name() , "OutGate" ,
                                            CoupledINode->Name() , "InGate" ) ;
              }
-              cout << "SetCoupled " << CoupledINode->Name() << endl ;
+//              cout << "SetCoupled " << CoupledINode->Name() << endl ;
               return  true ;
            }
-            cout << Name() << ".SetCoupled ERROR " << anInLineNode << " " << CoupledINode
-                 << " of " << Kind() ;
-            if ( CoupledINode ) {
-              cout << " kinfOkCoupled " << CoupledINode->Kind() ;
-           }
-            cout << endl ;
+//            cout << Name() << ".SetCoupled ERROR " << anInLineNode << " " << CoupledINode
+//                 << " of " << Kind() ;
+//            if ( CoupledINode ) {
+//              cout << " kinfOkCoupled " << CoupledINode->Kind() ;
+//         }
+//            cout << endl ;
             return false ; } ;
     virtual SUPERV::INode_ptr Coupled() ;
 
index bfb13ce8b5c27b5f29c58dee5d30c7d2b449cf96..531b19fddec81dbf7ce643933ac3e6a93386278c 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "Graph_Impl.hxx"
 
@@ -84,16 +84,13 @@ Graph_Impl::Graph_Impl( CORBA::ORB_ptr orb ,
   _DebugFileName = new char[ strlen( dbgfile.c_str() )+1 ] ;
   strcpy( _DebugFileName , dbgfile.c_str() ) ;
 
-  _NamingService = new SALOME_NamingService(orb);
-//  _DataFlowEditor = new SALOME_DataFlowEditor_impl( NS ) ;
-  GraphEditor::DataFlow *  aDataFlowEditor = new GraphEditor::DataFlow(
-                                               _Orb , _NamingService ,
-                                               theDataFlowName ,
-                                               _DebugFileName ) ;
+  _NamingService = new SALOME_NamingService( orb ) ;
+  GraphEditor::DataFlow *  aDataFlowEditor = new GraphEditor::DataFlow( _Orb , _NamingService ,
+                                                                        theDataFlowName ,
+                                                                        _DebugFileName ) ;
   DataFlowEditor( aDataFlowEditor ) ;
   DataFlowEditor()->SetObjImpl( this ) ;
   _DataFlowExecutor = NULL ;
-//  _DataFlowDataNode = DataFlowEditor() ;
   delete [] theDataFlowName ;
   endService( "Graph_Impl::Graph_Impl" );
 }
@@ -257,8 +254,8 @@ SUPERV::CNode_ptr Graph_Impl::CNode(
     CNode_Impl * myNode = new CNode_Impl( _Orb , _Poa , _ContId ,
                                           instanceName() , interfaceName() ,
                                           DataFlowEditor() ,
-                                          NodeService , (char * ) NULL ,
-                                          SUPERV::ComputingNode , (char * ) NULL ) ;
+                                          NodeService , NULLSTRING ,
+                                          SUPERV::ComputingNode , NULLSTRING ) ;
     if ( myNode->DataFlowNode() ) {
       PortableServer::ObjectId * id = myNode->getId() ;
       CORBA::Object_var obj = _poa->id_to_reference(*id);
@@ -274,7 +271,7 @@ SUPERV::FNode_ptr Graph_Impl::FNode(
                         const char * NodeComponentName ,
                          const char * NodeInterfaceName ,
                          const SALOME_ModuleCatalog::Service &NodeService ) {
-  beginService( "Graph_Impl::Node" );
+  beginService( "Graph_Impl::FNode" );
   SUPERV::FNode_var iobject = SUPERV::FNode::_nil() ;
   if ( DataFlowEditor()->IsEditing() && !DataFlowEditor()->IsReadOnly() ) {
     FNode_Impl * myNode = new FNode_Impl( _Orb , _Poa , _ContId ,
@@ -290,7 +287,7 @@ SUPERV::FNode_ptr Graph_Impl::FNode(
       myNode->SetObjRef( SUPERV::FNode::_duplicate( iobject ) ) ;
     }
   }
-  endService( "Graph_Impl::Node" );
+  endService( "Graph_Impl::FNode" );
   return SUPERV::FNode::_duplicate( iobject ) ;
 }
 
@@ -438,17 +435,17 @@ SUPERV::SNode_ptr Graph_Impl::SNode(
       else {
         anEndName += "Switch" ;
       }
-      cout << "Graph_Impl::SNode anEndName " << (void *) FuncName << " " << FuncName
-           << " " << strlen(FuncName) << " " << (void *) anEndName.c_str() << " "
-           << anEndName.c_str() << endl ;
+//      cout << "Graph_Impl::SNode anEndName " << (void *) FuncName << " " << FuncName
+//           << " " << strlen(FuncName) << " " << (void *) anEndName.c_str() << " "
+//           << anEndName.c_str() << endl ;
       ESNode_Impl * myEndNode = new ESNode_Impl( _Orb , _Poa , _ContId ,
                                                instanceName() , interfaceName() ,
                                                DataFlowEditor() ,
                                                anEndName.c_str() ,
                                                SUPERV::EndSwitchNode ) ;
-      cout << "Graph_Impl::SNode returned anEndName " << (void *) FuncName << " "
-           << FuncName << " " << strlen(FuncName) << " " << (void *) anEndName.c_str()
-           << " " << anEndName.c_str() << endl ;
+//      cout << "Graph_Impl::SNode returned anEndName " << (void *) FuncName << " "
+//           << FuncName << " " << strlen(FuncName) << " " << (void *) anEndName.c_str()
+//           << " " << anEndName.c_str() << endl ;
       PortableServer::ObjectId * endid = myEndNode->getId() ;
       CORBA::Object_var endobj = _poa->id_to_reference(*endid);
       iendobject = SUPERV::ESNode::_narrow(endobj) ;
@@ -778,9 +775,16 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode ,
               if ( theNode == NULL ||
                    ( theNode != NULL && theNode->IsEndSwitchNode() &&
                      !strcmp( theNode->Name() , aNode->Name() ) ) ) {
-                if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+                if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+                     ( aNode->IsEndLoopNode() && !strcmp( aNode->CoupledNode()->Name() ,
+                                                          anOutPort->NodeName() ) ) ) {
+                  MESSAGE( "Link " << anOutPort->NodeName() << "("
+                          << anOutPort->PortName() << ") --> " << aNode->Name() << "("
+                          << anInPort->PortName() << ")" << " ignored" ) ;
+               }
+                else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
                   if ( begin ) {
-                    beginService( "Graph_Impl::ListOfLinks" );
+                    beginService( "Graph_Impl::Links" );
                     begin = false ;
                   }
                   GraphEditor::InNode * anOutNode = NULL ;
@@ -825,9 +829,16 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode ,
           if ( theNode || ( toNode->IsEndSwitchNode() && !aNode->IsSwitchNode() ) ) {
             if ( anInputParam == NULL ||
                  !strcmp( anInPort->PortName() , anInputParam ) ) {
-              if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+              if ( anInPort->IsLoop() || anOutPort->IsLoop() ||
+                   ( toNode->IsEndLoopNode() && !strcmp( toNode->CoupledNode()->Name() ,
+                                                         anOutPort->NodeName() ) ) ) {
+                MESSAGE( "Link " << anOutPort->NodeName() << "("
+                        << anOutPort->PortName() << ") --> " << aNode->Name() << "("
+                        << anInPort->PortName() << ")" << " ignored" ) ;
+             }
+              else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
                 if ( begin ) {
-                  beginService( "Graph_Impl::ListOfLinks" );
+                  beginService( "Graph_Impl::Links" );
                   begin = false ;
                 }
                 Link_Impl * myLink = new Link_Impl( _Orb , _Poa , _ContId ,
@@ -857,7 +868,7 @@ SUPERV::ListOfLinks * Graph_Impl::Links( GraphBase::ComputingNode * theNode ,
     }
   }
   if ( !begin ) {
-    endService( "Graph_Impl::ListOfLinks" );
+    endService( "Graph_Impl::Links" );
   }
   return ( RetVal._retn() ) ;
 }
@@ -930,7 +941,7 @@ SUPERV::ListOfNodes * Graph_Impl::LevelNodes(long aLevel ) {
   int i ;
   SUPERV::ListOfStrings_var Nodes = DataFlowEditor()->LevelNodes( aLevel ) ;
 //  RetVal->length( Nodes->length() );
-  for ( i = 0 ; i < Nodes->length() ; i++ ) {
+  for ( i = 0 ; i < (int ) Nodes->length() ; i++ ) {
 //    char * aNode = Nodes[ i ] ;
     GraphBase::ComputingNode * aNode = DataFlowEditor()->GetChangeGraphNode( Nodes[ i ] ) ;
     RetVal = SetNode( RetVal , aNode ) ;
@@ -1136,7 +1147,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
 
     int i ;
     map< string , int > aMapOfNodes ;
-    for ( i = 0 ; i < aGraphNodes->CNodes.length() ; i++ ) {
+    for ( i = 0 ; i < (int ) aGraphNodes->CNodes.length() ; i++ ) {
       SUPERV::CNode_var aNode = (aGraphNodes->CNodes)[ i ] ;
       GraphEditor::InNode * myNode ;
       GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ;
@@ -1144,7 +1155,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
       myNode = DataFlowEditor()->AddNode( *(aNode->Service()) ,
                                           "" ,
                                           "" ,
-                                          NULL ,
+                                          NULLSTRING ,
                                           SUPERV::ComputingNode ,
                                           aFuncName ,
                                           aPythonFunction ,
@@ -1167,7 +1178,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
         break ;
       }
     }
-    for ( i = 0 ; i < aGraphNodes->FNodes.length() ; i++ ) {
+    for ( i = 0 ; i < (int ) aGraphNodes->FNodes.length() ; i++ ) {
       SUPERV::FNode_var aNode = (aGraphNodes->FNodes)[ i ] ;
       GraphEditor::InNode * myNode ;
       GraphBase::ListOfFuncName aFuncName = GraphBase::ListOfFuncName() ;
@@ -1175,7 +1186,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
       myNode = DataFlowEditor()->AddNode( *(aNode->Service()) ,
                                          aNode->GetComponentName() ,
                                          aNode->GetInterfaceName() ,
-                                         NULL ,
+                                         NULLSTRING ,
                                          SUPERV::ComputingNode ,
                                          aFuncName ,
                                          aPythonFunction ,
@@ -1199,7 +1210,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
       }
     }
     if ( RetVal ) {
-      for ( i = 0 ; i < aGraphLinks->length() ; i++ ) {
+      for ( i = 0 ; i < (int ) aGraphLinks->length() ; i++ ) {
         SUPERV::Link_var aLink = (*aGraphLinks)[ i ] ;
         SUPERV::Port_var OutPort = aLink->OutPort() ;
         SUPERV::Port_var InPort = aLink->InPort() ;
@@ -1229,7 +1240,7 @@ bool Graph_Impl::Merge(const SUPERV::Graph_ptr aGraph ) {
        }
       }
       if ( RetVal ) {
-        for ( i = 0 ; i < aGraphPorts->length() ; i++ ) {
+        for ( i = 0 ; i < (int ) aGraphPorts->length() ; i++ ) {
           SUPERV::Port_var aPort = (*aGraphPorts)[ i ] ;
           if ( aPort->HasInput() ) {
             char * aNode = new char[ strlen( aPort->Name() + 1 ) ] ;
index 090df65c38c557717c72bd8efab3309c841ece0b..2560596cf39fee164e684af2bc2fcb45930d79d0 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef _GRAPH_IMPL_HXX_
 #define _GRAPH_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index 29689d1c44e26cb469efc23dc6b91617fc4466d0..dce4335fcb09e40f146bd1b6f755ddf9aba6f9f0 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "LNode_Impl.hxx"
 
@@ -56,8 +56,8 @@ INode_Impl::INode_Impl( CORBA::ORB_ptr orb ,
   CNode_Impl( orb , poa , contId , instanceName , interfaceName , aDataFlowEditor , SALOME_ModuleCatalog::Service() , FuncName , NodeKindOfNode , FuncName , aPythonFunction ) {
   beginService( "INode_Impl::INode_Impl" );
   if ( FuncName ) {
-    cout << "INode_Impl::CNode_Impl " << (void *) FuncName << " " << FuncName
-         << " " << strlen( FuncName ) << endl ;
+//    cout << "INode_Impl::CNode_Impl " << (void *) FuncName << " " << FuncName
+//         << " " << strlen( FuncName ) << endl ;
   }
   if ( NodeKindOfNode == SUPERV::InLineNode ) {
     MESSAGE( "INode_Impl::INode_Impl " << FuncName << " _poa->activate_object" );
@@ -184,6 +184,8 @@ SUPERV::Port_ptr INode_Impl::InPort( const char *aParameterName ,
   SUPERV::Port_ptr InEndobject = SUPERV::Port::_nil() ;
   Port_Impl * myInPort = NULL ;
   bool InPortCreated = false ;
+  MESSAGE( "INode_Impl::InPort " << DataFlowNode()->Name() << "->AddInPort( " << aParameterName << " , "
+           << aParameterType ) ;
   GraphBase::InPort * anInPort = DataFlowNode()->GetChangeInPort( aParameterName ) ;
   if ( anInPort == NULL && DataFlowNode()->IsOneOfInLineNodes() ) {
     anInPort = DataFlowNode()->AddInPort( aParameterName , aParameterType ) ;
@@ -225,6 +227,8 @@ SUPERV::Port_ptr INode_Impl::OutPort( const char *aParameterName ,
                                       const char *aParameterType ) {
   Port_Impl * myOutPort = NULL ;
   SUPERV::Port_ptr Outobject = SUPERV::Port::_nil() ;
+  MESSAGE( "INode_Impl::OutPort " << DataFlowNode()->Name() << "->AddOutPort( " << aParameterName << " , "
+           << aParameterType ) ;
   GraphBase::OutPort * anOutPort = DataFlowNode()->GetChangeOutPort( aParameterName ) ;
   if ( anOutPort == NULL && DataFlowNode()->IsOneOfInLineNodes() ) {
     anOutPort = DataFlowNode()->AddOutPort( aParameterName , aParameterType ) ;
index 4a1fc23835cbaba63bd738d81846fb8595ad21f6..166d6865902337171fac050aea3cb17c90edd431 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _INODE_IMPL_HXX_
 #define _INODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index 9389664737983c9e4c49f676dae3f7a46567693f..2bef195c94b068cb693c89a0d1061f3be80ce8ec 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "LNode_Impl.hxx"
 
index fca090617f22f9aef4095628d9cb0381acc95252..2f6805c548dd1bfbca84df8b7a34c3c1f42bb1c8 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _LNODE_IMPL_HXX_
 #define _LNODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index fe2d3443258726b72f1a07bcb386fda42a8dac59..f20bd13bd2c87e415c792d90931eabea663e7c86 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "Link_Impl.hxx"
 
@@ -151,8 +151,8 @@ SUPERV::Port_ptr Link_Impl::OutPort() {
 
 GraphBase::SLink * Link_Impl::Info() {
 //  beginService( "Link_Impl::Info" );
-  char* FromNodeName ;
-  char* FromServiceParameterName ;
+//  char* FromNodeName ;
+//  char* FromServiceParameterName ;
   GraphBase::SLink * RetVal = _DataFlowEditor->GetLink( _DataFlowNode->ComputingNode() ,
                                                         _InputParameterName ) ;
 //  endService( "Link_Impl::Info" );
index 9413b10aabe7de7c03ae46767ea5dd4dfdaf6b8e..b51245c1790b74bd42db2fcbe739231c5778d74d 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef _LINK_IMPL_HXX_
 #define _LINK_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index 96d13d68bace5abd31cd8c64d0e192c74c48bc9a..3883bd47b6e9cf1192f543209fc48b487b3dbe10 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "Graph_Impl.hxx"
 #include "Port_Impl.hxx"
@@ -236,8 +236,8 @@ SUPERV::Link_ptr Port_Impl::Link() {
     beginService( "Port_Impl::Link" ) ;
     begin = false ;
     SUPERV::ListOfLinks_var Links = new SUPERV::ListOfLinks ;
-    cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
-         << _DataFlowPort->PortName() << endl ;
+//    cout << "Port_Impl::Link " << _DataFlowNode->Name() << " "
+//         << _DataFlowPort->PortName() << endl ;
     Links = _DataFlowEditor->ObjImpl()->Links(
                                         _DataFlowNode->ComputingNode() ,
                                         _DataFlowPort->PortName() ) ;
@@ -261,7 +261,13 @@ SUPERV::Link_ptr Port_Impl::Link() {
       GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
       if ( anInPort->GetOutPort() ) {
         GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
-        if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
+        if ( _DataFlowNode->IsEndLoopNode() && !strcmp( _DataFlowNode->CoupledNode()->Name() ,
+                                                        anOutPort->NodeName() ) ) {
+//          MESSAGE( "Link " << anOutPort->NodeName() << "("
+//                  << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
+//                  << anInPort->PortName() << ")" << " ignored" ) ;
+       }
+        else if ( CORBA::is_nil( anOutPort->InPortObjRef( anInPort ) ) ) {
           if ( begin ) {
             beginService( "Port_Impl::Link" ) ;
             begin = false ;
@@ -294,22 +300,28 @@ SUPERV::Link_ptr Port_Impl::Link() {
 bool Port_Impl::IsInput() {
 //  beginService( "Port_Impl::IsInput" ) ;
   bool RetVal = _InputPort ;
+//  MESSAGE( Name() << "IsInput() " << _InputPort ) ;
 //  endService( "Port_Impl::IsInput" ) ;
   return RetVal ;
 }
 
 bool Port_Impl::IsLinked() {
 //  beginService( "Port_Impl::IsLinked" ) ;
-  bool RetVal = true ;
-#if 0
-  if ( _DataFlowNode->IsEndSwitchNode() && _DataFlowPort->IsBus() ) {
+  bool RetVal = false ;
+  GraphBase::InPort * anInPort = _DataFlowNode->GetChangeInPort( _DataFlowPort->PortName() ) ;
+  GraphBase::OutPort * anOutPort = NULL ;
+  if ( anInPort) {
+    anOutPort = anInPort->GetOutPort() ;
+  }
+  if ( _DataFlowNode->IsEndLoopNode() && anOutPort &&
+       !strcmp( _DataFlowNode->CoupledNode()->Name() , anOutPort->NodeName() ) ) {
+//    MESSAGE( "Link " << anOutPort->NodeName() << "("
+//            << anOutPort->PortName() << ") --> " << _DataFlowNode->Name() << "("
+//            << anInPort->PortName() << ")" << " ignored" ) ;
   }
   else {
-#endif
     RetVal = _DataFlowNode->IsLinked( _DataFlowPort->PortName() ) ;
-#if 0
   }
-#endif
 //  endService( "Port_Impl::IsLinked" ) ;
   return RetVal ;
 }
index 1177c14f07cacce38e9236ca438d19c60c8b3562..51724b056ac6b241f0a7634a0efe4f16fe49919b 100644 (file)
@@ -29,7 +29,8 @@
 #ifndef _PORT_IMPL_HXX_
 #define _PORT_IMPL_HXX_
 
-#include <iostream.h>
+#include <sstream>
+#include <iostream>
 
 #include "CORBA.h"
 
index b6d2dcd557212d5fc8dc0c820ba0a6f033299327..e716e6012df0c319aa937e636513cda6ba5b4abb 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "SNode_Impl.hxx"
 
index 00d59d2752a94cff1d596dbdcb245012399bc913..f62169ae46fe571dfc508029de918f42a6616cf5 100644 (file)
@@ -12,7 +12,7 @@
 #ifndef _SNODE_IMPL_HXX_
 #define _SNODE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
index 09c7cf2aac3df1347342da723141dd9b14f7be97..9e3062d087a58dd2fa9615bfaacde03b98b22821 100644 (file)
@@ -436,7 +436,10 @@ class INode(CNode):
         self.N = aNode
         self.N.Verbose = Verbose
     def Edit( self , FuncName , PyFunc ) :
-        file = '/tmp/' + FuncName + '.py' 
+        import os
+        import random
+        suf = str(random.randrange(1,10000))
+        file = '/tmp/' + FuncName + '_' + suf + '.py' 
         i = 0
         try :
             fd = os.open( file , os.O_CREAT | os.O_WRONLY | os.O_TRUNC )
index 2c13d2eec453261ca7214e869a3c75cbb0f5a430..9f428951c8b14d8eaebaf106e5cbecb45d64498f 100644 (file)
@@ -32,12 +32,12 @@ using namespace std;
 #include <sys/stat.h>
 
 #include <fstream>
-#include <strstream>
+//#include <sstream>
 #include <string>
 
 #include "Python.h"
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "SALOME_Container_i.hxx"
 
@@ -455,6 +455,9 @@ SUPERV::Value_ptr SuperV_Impl::StringValue( const char * aStrIOR ) {
   }
   catch ( CORBA::BAD_PARAM ) {
 
+// JR : objref or string only ==> the eventual convertion to long or double is done in
+//      the SuperVisionEngine with the real type of the argument
+#if 0
     long l;
     double d;
     if ( strchr( aStrIOR , '.' ) != NULL &&
@@ -469,9 +472,12 @@ SUPERV::Value_ptr SuperV_Impl::StringValue( const char * aStrIOR ) {
 //    return(anAny);
     }
     else {
+#endif
       *anAny <<=  aStrIOR ;
 //        MESSAGE( "Value( " << aStrIOR << " ) --> string " << aStrIOR );
+#if 0
     }
+#endif
   }
 
 //  endService( "SuperV_Impl::StringValue" );
index e67a30d81742eb8dfddb4c57035673df1191ac8e..bce58f1de0ee641ce5fd146c34e5b2957160bc28 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef _SUPERV_IMPL_HXX_
 #define _SUPERV_IMPL_HXX_
 
-#include <iostream.h>
+#include <iostream>
 
 #include "CORBA.h"
 
index bd87bcb3841c99a988aff340868661aa155c4de4..1a226c1a288c563f196fcd62a6623ecc09672b16 100644 (file)
 using namespace std;
 #include <stdio.h>
 #include <fstream>
-#include <strstream>
+//#include <strstream>
+//#include <sstream>
 #include <string>
 
-#include "utilities.h"
+//#include "utilities.h"
 
 #include "Value_Impl.hxx"
 
@@ -190,7 +191,7 @@ CORBA::Any * Value_Impl::ToAny() {
 }
 
 char * Value_Impl::ToString() {
-//  beginService( "Value_Impl::ToString" );
+  beginService( "Value_Impl::ToString" );
   CORBA::Any anAny = *ToAny() ;
 //  cout << "Value_Impl::ToString " << _DataFlowNode->Name() << " "
 //       << _ParameterName << " " ;
@@ -235,49 +236,59 @@ char * Value_Impl::ToString() {
       }
     }
   }
-  char* retstr ;
+  ostringstream astr ;
+  const char * retstr ;
+  int startstr = 0 ;
   switch (anAny.type()->kind()) {
     case CORBA::tk_string: {
       anAny >>= retstr;
 //      MESSAGE( "ToString( string ) " << retstr );
       break ;
     }
-    case CORBA::tk_double: {
-      double d;
-      anAny >>= d;
-      retstr = new char[13];
-      snprintf(retstr, 13, "%lf", d);
-//      MESSAGE( "ToString( double ) " << retstr );
-      break ;
-    }
     case CORBA::tk_long: {
       long l;
       anAny >>= l;
-      retstr = new char[13];
-      snprintf(retstr, 13, "%ld", l);
-//      MESSAGE( "ToString( long ) " << retstr );
+      astr << l << ends ;
+      retstr = astr.str().c_str() ;
+//      retstr = new char[13];
+//      snprintf(retstr, 13, "%ld", l);
+//      MESSAGE( "ToString( long ) " << l << " " << retstr );
+      break ;
+    }
+    case CORBA::tk_double: {
+      double d;
+      anAny >>= d;
+      astr << setw(25) << setprecision(18) << d << ends ;
+      retstr = astr.str().c_str() ;
+//      retstr = new char[13];
+//      snprintf(retstr, 13, "%lf", d);
+      int i = 0 ;
+      while ( i < (int ) strlen( retstr ) && retstr[ i++ ] == ' ' ) {
+        startstr = i - 1 ;
+      }
+      MESSAGE( "ToString( double ) '" << d << "' '" << retstr << "' '" << &retstr[ startstr ] << "'");
       break ;
     }
     case CORBA::tk_objref: {
       CORBA::Object_ptr obj ;
       try {
         anAny >>= obj ;
-        retstr = _Orb->object_to_string(obj );
+        retstr = _Orb->object_to_string( obj );
 //        MESSAGE( "ToString( object ) " << retstr );
       }
       catch ( ... ) {
-        retstr = "Unknown CORBA::Any Type" ;
+        retstr = "object_to_string catched " ;
       }
       break ;
     }
     default: {
       retstr = "Unknown CORBA::Any Type" ;
-//      MESSAGE( retstr );
+      MESSAGE( retstr );
       break ;
     }
   }
-//  endService( "Value_Impl::ToString" );
-  return CORBA::string_dup( retstr ) ;
+  endService( "Value_Impl::ToString" );
+  return CORBA::string_dup( &retstr[ startstr ] ) ;
 }
 
 bool Value_Impl::IsIOR() {
index dbe0c65a1a4d2d4cfd17befb92b5a84d4c7d6071..da02747176da3b4ba2ae1e464a15ff89e930b843 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef _VALUE_IMPL_HXX_
 #define _VALUE_IMPL_HXX_
 
-#include <iostream.h>
+//#include <iostream.h>
 
 #include "CORBA.h"
 
@@ -37,6 +37,7 @@
 #include "SALOME_Component_i.hxx"
 #include "SALOME_LifeCycleCORBA.hxx"
 
+#include "DataFlowBase_Base.hxx"
 #include "DataFlowEditor_DataFlow.hxx"
 
 class Value_Impl : public POA_SUPERV::Value ,
index 34f0d8ea381e5455fd1f6e9ae1c8d9db95141006..5d79f84c7305adf67ef6166f5937814182afb384 100644 (file)
@@ -466,6 +466,7 @@ class INode(CNode):
         self.N = aNode
         self.N.Verbose = Verbose
     def Edit( self , FuncName , PyFunc ) :
+        import os
         file = '/tmp/' + FuncName + '.py' 
         i = 0
         fd = os.open( file , os.O_CREAT | os.O_WRONLY | os.O_TRUNC )