Salome HOME
SMH: 3.0.0 preparation = merged version (POLYWORK + RTVDEBUG01) + adopation for new GUI
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_FiniteStateMachine.cxx
index c563b2550bfcbd0f31951354b35f70ffe292ed38..0ed6762eb25cf89f5e8ad24d0271dc4a64c6258b 100644 (file)
@@ -125,7 +125,7 @@ void * start_function( void *p ) ;
 #define NumberOfEvents            GraphExecutor::NumberOfEvents
 
 GraphExecutor::FiniteStateMachine::FiniteStateMachine() {
-//  cdebug_in << "FiniteStateMachine::FiniteStateMachine" << endl;
+  MESSAGE( "FiniteStateMachine::FiniteStateMachine" ) ;
 
   _ControlStateName[ VoidState ]          = "VoidState" ;
   _ControlStateName[ ToSuspendStartState ]= "ToSuspendStartState" ;
@@ -355,6 +355,10 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() {
 // SuspendedExecutingState : NO ResumeEvent 13-03-2003
   _TransitionTable[ SuspendedExecutingState ][ SuccessEvent ] = SuccessedExecutingState ;
   _ActionTable[ SuccessedExecutingState ][ SuccessEvent ] = Executing_SuccessAction;
+//JR 24.03.2005 : Debug for PAL8176 : abort of GOTONode
+// ErrorEvent
+  _TransitionTable[ SuccessedState ][ ErrorEvent ] = ErroredExecutingState ;
+  _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
 // ErrorEvent
   _TransitionTable[ ExecutingState ][ ErrorEvent ] = ErroredExecutingState ;
   _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
@@ -459,8 +463,7 @@ GraphExecutor::FiniteStateMachine::FiniteStateMachine() {
   _GraphExecutingNumber = 0 ;
   _PyInitModule = false ;
   _DbgFileNumber = 0 ;
-//  cdebug_out << "FiniteStateMachine::FiniteStateMachine _TransitionTable "
-//             << endl;
+  MESSAGE( "FiniteStateMachine::FiniteStateMachine _TransitionTable " ) ;
 }
 
 void * start_function( void *p ) {
@@ -494,17 +497,19 @@ void GraphExecutor::FiniteStateMachine::Executed() {
     for ( aPyFunction = _MapOfPyFunctions.begin() ; aPyFunction != _MapOfPyFunctions.end() ; aPyFunction++ ) {
       if ( !strcmp( aPyFunction->first.c_str() , "PyObjRef" ) ||
            !strcmp( aPyFunction->first.c_str() , "PyObjIor" ) ) {
-       //cout << "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " keeped ..."<< endl ;
+       MESSAGE( "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " keeped ..."
+                 ) ;
       }
       else {
-       //cout << "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " erased ..."<< endl ;
+       MESSAGE( "GraphExecutor::FiniteStateMachine::Executed " << aPyFunction->first << " erased ..."
+               ) ;
        _MapOfPyFunctions.erase( aPyFunction->first ) ;
       }
     }
   }
   else {
-    //cout << "GraphExecutor::FiniteStateMachine::Executed _GraphExecutingNumber " << _GraphExecutingNumber
-    //     << " != 0 ==> no erase" << endl ;
+    MESSAGE( "GraphExecutor::FiniteStateMachine::Executed _GraphExecutingNumber "
+              << _GraphExecutingNumber << " != 0 ==> no erase" ) ;
   }
   PyUnLock() ;
   return ;
@@ -553,28 +558,25 @@ PyObject * GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncNa
   PyObject * PyFunctionMapped = _MapOfPyFunctions[ aPyFuncName ] ;
   if ( _GraphExecutingNumber > 1 && !PyObjRefIor ) {
     RetVal = PyFunctionMapped ;
-    //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ;
+    MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ) ;
     if ( RetVal ) {
-      //cout << RetVal << " ob_refcnt " << RetVal->ob_refcnt ;
+      MESSAGE( RetVal << " ob_refcnt " << RetVal->ob_refcnt ) ;
     }
     else {
-      //cout << " NULL" ;
+      MESSAGE( " NULL" ) ;
     }
-    //cout << endl ;
   }
   else {
     RetVal = PyFunctionMapped ;
-    //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ;
+    MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) --> " ) ;
     if ( RetVal && PyObjRefIor ) {
-      //cout << RetVal << " " << RetVal->ob_refcnt << endl ;
+      MESSAGE( RetVal << " " << RetVal->ob_refcnt ) ;
     }
     else if ( RetVal ) {
-      //cout << RetVal << " " << RetVal->ob_refcnt << endl ;
-//      _MapOfPyFunctions.erase( aPyFuncName ) ;
-//      cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) erased --> NULL" << endl ;
+      MESSAGE( RetVal << " " << RetVal->ob_refcnt ) ;
     }
     else {
-      //cout << " NULL" << endl ;
+      MESSAGE( " NULL" ) ;
     }
   }
   
@@ -585,15 +587,15 @@ bool GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncName , P
   
   bool RetVal = false ;
   if ( _MapOfPyFunctions[ aPyFuncName ] != NULL ) {
-    //PyObject * aPyFunc = _MapOfPyFunctions[ aPyFuncName ] ;
-    //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , " << aPyFunction
-    //     << " ) ob_refcnt " << aPyFunction->ob_refcnt << " already mapped : " << aPyFunc << " ob_refcnt "
-    //     << aPyFunc->ob_refcnt << endl ;
+    PyObject * aPyFunc = _MapOfPyFunctions[ aPyFuncName ] ;
+    MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , aPyFunction "
+             << aPyFunction << " ) ob_refcnt " << aPyFunction->ob_refcnt << " already mapped : "
+             << aPyFunc << " ob_refcnt " << aPyFunc->ob_refcnt ) ;
   }
   else {
     _MapOfPyFunctions[ aPyFuncName ] = aPyFunction ;
-    //cout << "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' , " << aPyFunction
-    //     << " ) ob_refcnt " << aPyFunction->ob_refcnt << " mapped" << endl ;
+    MESSAGE( "GraphExecutor::FiniteStateMachine::PyFunction( '" << aPyFuncName << "' ) " << aPyFunction
+             << " ) ob_refcnt " << aPyFunction->ob_refcnt << " mapped" ) ;
     RetVal = true ;
   }
   
@@ -602,6 +604,7 @@ bool GraphExecutor::FiniteStateMachine::PyFunction( const char * aPyFuncName , P
 
 bool GraphExecutor::FiniteStateMachine::ErasePyFunction( const char * aPyFuncName ) {
   
+  MESSAGE( "GraphExecutor::FiniteStateMachine::ErasePyFunction( '" << aPyFuncName << "' )" ) ;
   if ( _MapOfPyFunctions[ aPyFuncName ] != NULL ) {
     _MapOfPyFunctions.erase( aPyFuncName ) ;
     return true ;
@@ -678,7 +681,7 @@ void GraphExecutor::FiniteStateMachine::JoinThread() {
       exit( 0 ) ;
     }
     else {
-      MESSAGE( pthread_self() << " FiniteStateMachine:JoinThread pthread_joined : " << _Thread );
+//      MESSAGE( pthread_self() << " FiniteStateMachine:JoinThread pthread_joined : " << _Thread );
       _ThreadList.pop_front() ;
     }
   }