]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Porting from omniORB3 to omniORB4
authorrahuel <rahuel@opencascade.com>
Fri, 14 Oct 2005 11:43:02 +0000 (11:43 +0000)
committerrahuel <rahuel@opencascade.com>
Fri, 14 Oct 2005 11:43:02 +0000 (11:43 +0000)
Debug of MacroNodes : developpement of missing code for Gate management of MacroNodes

src/GraphExecutor/DataFlowExecutor_InNodeThreads.cxx

index 46a721c07369892774f57fcf5df0e3e197008daa..19f2821f76ddbc5da5f9f1ea88a0ef9b8b4ebbef 100644 (file)
@@ -925,7 +925,7 @@ int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
         cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " "
                << anInPort->PortName() << " Gate is Opened from Node "
                << anOutPort->NodeName() << "( " << anOutPort->PortName()
-               << ") " ;
+               << " , Done=" << anOutPort->Done() << " ) " ;
 #ifdef _DEBUG_
         if ( GraphBase::Base::_prof_debug ) {
           anOutPort->StringValue( *GraphBase::Base::_fdebug ) ;
@@ -1158,10 +1158,19 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
 //      cdebug << ThreadNo() << "No Component : NO StartComponent & No Ping" << endl ;
       if ( IsComputingNode() ) {
         ObjInterface( true ) ;
+//JR 05.08.2005 DEBUG : that code runs with SALOME_3 (OMNIOrb4) ...
+#if OMNIORB_VERSION >= 4
+        CORBA::Object * obj ;
+        InParametersList[0].Value >>= obj ;
+        myObjComponent = Engines::Component::_narrow( obj ) ;
+//JR 05.08.2005 DEBUG : the folowing code runs with OMNIOrb3 but gives
+//                      unpredictable results with SALOME_3 (OMNIOrb4) ...
+#else
         CORBA::Object_ptr obj ;
         InParametersList[0].Value >>= obj ;
         CORBA::Object_var objvar = CORBA::Object_var( obj ) ;
         myObjComponent = Engines::Component::_narrow( objvar ) ;
+#endif
       }
       else {
       }
@@ -1333,7 +1342,11 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
                       CORBA::Object_ptr obj ;
                       char * retstr ;
                       try {
+#if OMNIORB_VERSION >= 4
+                        InParametersList[i].Value >>= (CORBA::Any::to_object ) obj ;
+#else
                         InParametersList[i].Value >>= obj ;
+#endif
                         retstr = ObjectToString( obj );
                         cdebug << "ArgOut->In" << i << " : "
                                << InParametersList[i].Name.c_str()
@@ -1637,11 +1650,45 @@ int GraphExecutor::InNode::DataReady_ExecuteAction() {
   }
   else {
     GraphExecutor::DataFlow * aMacroGraph = GraphMacroNode()->CoupledNode()->GraphEditor()->Executor() ;
+    int i ;
+    for ( i = 0 ; i < GraphMacroNode()->GetNodeOutPortsSize() ; i++ ) {
+      cdebug << "Out" << i << " " << GraphMacroNode()->GetNodeOutPort( i )->PortName() << " "
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->State() << " Done="
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->Done() << " " ;
+      if ( GraphBase::Base::_prof_debug ) {
+        GraphMacroNode()->GetNodeOutPort( i )->StringValue( *GraphBase::Base::_fdebug ) ;
+      }
+      if ( GraphMacroNode()->GetChangeNodeOutPort( i )->IsGate() ) {
+        cdebug << " BoolValue " << GraphMacroNode()->GetChangeNodeOutPort( i )->BoolValue() ;
+      }
+      cdebug << endl ;
+    }
     cdebug << ThreadNo() << " DataReady_ExecuteAction " << aMacroGraph << " "
            << aMacroGraph->Graph()->Name() << " ->DoneWait()"
            << " State " << aMacroGraph->State() << endl;
     aMacroGraph->DoneWait() ;
-    cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " State " << aMacroGraph->State() << endl;
+    cdebug << ThreadNo() << " DataReady_ExecuteAction " << Name() << " State "
+           << aMacroGraph->State() << endl;
+
+//JR 29.09.2005 Debug for CEA (examples/GraphMacroNodes1) :
+// Set of value of the OutGate of the corresponding MacroNode was missing
+    CORBA::Any anAny = CORBA::Any() ;
+    anAny <<= (long ) 1 ;
+    GraphMacroNode()->GraphEditor()->Executor()->OutputOfAny( Name() , "Gate" , anAny ) ;
+    cdebug << "DataReady_ExecuteAction OutputOfAny( " << Name() << " , Gate , 1 )" << endl ;
+
+    for ( i = 0 ; i < GraphMacroNode()->GetNodeOutPortsSize() ; i++ ) {
+      cdebug << "Out" << i << " " << GraphMacroNode()->GetNodeOutPort( i )->PortName() << " "
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->State() << " Done="
+             << GraphMacroNode()->GetChangeNodeOutPort( i )->Done() << " " ;
+      if ( GraphBase::Base::_prof_debug ) {
+        GraphMacroNode()->GetNodeOutPort( i )->StringValue( *GraphBase::Base::_fdebug ) ;
+      }
+      if ( GraphMacroNode()->GetChangeNodeOutPort( i )->IsGate() ) {
+        cdebug << " BoolValue " << GraphMacroNode()->GetChangeNodeOutPort( i )->BoolValue() ;
+      }
+      cdebug << endl ;
+    }
     if ( aMacroGraph->State() == SUPERV::DoneState ) {
       PortState = SUPERV::ReadyState ;
       NewState = GraphExecutor::DataReadyState ;
@@ -1909,8 +1956,8 @@ int GraphExecutor::InNode::Successed_SuccessAction() {
   DoneAction() ;
 
   if ( IsMacroNode() ) {
-      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " LinkedNodes->SomeDataReady already done"
-             << endl ;
+      cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name()
+             << " LinkedNodes->SomeDataReady already done for that MacroNode" << endl ;
     return 1;
   }
 
@@ -2641,7 +2688,11 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
           CORBA::Object_ptr ObjRef ;
           char * retstr ;
           try {
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) ObjRef ;
+#else
             D.Value >>= ObjRef ;
+#endif
             retstr = ObjectToString( ObjRef ) ;
             D.Value <<= retstr ;
 //            theOutPort->Value( D.Value ) ;
@@ -2688,7 +2739,11 @@ void GraphExecutor::InNode::InParametersSet( bool & Err ,
           CORBA::Object_ptr obj ;
           char * retstr ;
           try {
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) obj ;
+#else
             D.Value >>= obj ;
+#endif
             retstr = ObjectToString( obj ) ;
             cdebug << retstr << endl ;
           }
@@ -2803,7 +2858,11 @@ void GraphExecutor::InNode::InOutParametersSet( int nOutParams ,
       try {
         CORBA::Object_ptr obj ;
         char * retstr ;
+#if OMNIORB_VERSION >= 4
+        D.Value >>= (CORBA::Any::to_object ) obj ;
+#else
         D.Value >>= obj ;
+#endif
         retstr = ObjectToString( obj ) ;
         cdebug << ThreadNo() << retstr << endl ;
       }
@@ -2897,7 +2956,11 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           try {
             CORBA::Object_ptr obj ;
             char * retstr ;
+#if OMNIORB_VERSION >= 4
+            D.Value >>= (CORBA::Any::to_object ) obj ;
+#else
             D.Value >>= obj ;
+#endif
             retstr = ObjectToString( obj ) ;
             cdebug << ThreadNo() << retstr << endl ;
           }
@@ -2952,14 +3015,18 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
         for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
           bool fromGOTO = false ;
           const char * ToNodeName = anOutPort->ChangeInPorts( j )->NodeName() ;
-          if ( !strcmp( ToNodeName , _OutNode->Graph()->Name() ) && _OutNode->Graph()->GraphMacroLevel() != 0 ) {
+          if ( !strcmp( ToNodeName , _OutNode->Graph()->Name() ) &&
+               _OutNode->Graph()->GraphMacroLevel() != 0 ) {
             cdebug << "OutParametersSet ToNodeName " << _OutNode->Graph()->Name() << " CoupledNode "
                    << _OutNode->Graph()->CoupledNodeName() << _OutNode->Graph()->CoupledNode()
                    << endl ;
-            cdebug << " GraphExecutor " << _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor() << endl ;
+            cdebug << "OutParametersSet GraphExecutor " << _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor() << endl ;
             _OutNode->Graph()->CoupledNode()->GraphEditor()->Executor()->OutputOfAny( _OutNode->Graph()->CoupledNodeName() ,
                                                                             anOutPort->ChangeInPorts( j )->PortName() ,
                                                                             *anOutPort->Value() ) ;
+            cdebug << "OutParametersSet OutputOfAny( "
+                   << _OutNode->Graph()->CoupledNodeName() << " , "
+                   << anOutPort->ChangeInPorts( j )->PortName() << " , value )" << endl ;
          }
           else {
            GraphBase::ComputingNode * ToNode = _OutNode->Graph()->GetChangeGraphNode( ToNodeName ) ;
@@ -3035,7 +3102,11 @@ bool GraphExecutor::InNode::OutParametersSet( bool Err ,
           CORBA::Object_ptr obj ;
           char * retstr ;
           try {
+#if OMNIORB_VERSION >= 4
+            (*anOutPort->Value()) >>= (CORBA::Any::to_object ) obj ;
+#else
             (*anOutPort->Value()) >>= obj ;
+#endif
             retstr = ObjectToString( obj );
             cdebug << ThreadNo() << " Out" << i << " : " << "ToString( object ) "
                    << retstr << endl ;