]> SALOME platform Git repositories - modules/superv.git/blobdiff - src/GraphExecutor/DataFlowExecutor_InNode.cxx
Salome HOME
This commit was generated by cvs2git to create branch 'Tag-First-
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_InNode.cxx
diff --git a/src/GraphExecutor/DataFlowExecutor_InNode.cxx b/src/GraphExecutor/DataFlowExecutor_InNode.cxx
deleted file mode 100644 (file)
index 76ff07f..0000000
+++ /dev/null
@@ -1,1369 +0,0 @@
-//  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;
-
-#include <stdlib.h>
-#include <iostream>
-#include <unistd.h>
-#include <stdio.h>
-
-#include "OpUtil.hxx"
-
-#include <SALOMEconfig.h>
-#include CORBA_CLIENT_HEADER(SALOME_Component)
-//#include "SALOME_NamingService.hxx"
-#include "SALOME_LifeCycleCORBA.hxx"
-
-#include "DataFlowBase_FactoryNode.hxx"
-#include "DataFlowBase_GOTONode.hxx"
-#include "DataFlowBase_LoopNode.hxx"
-#include "DataFlowBase_EndOfLoopNode.hxx"
-#include "DataFlowBase_SwitchNode.hxx"
-#include "DataFlowBase_EndOfSwitchNode.hxx"
-
-#include "DataFlowExecutor_OutNode.hxx"
-
-static void InitInNode( int &_RewindStack ,
-                        SUPERV::ControlState &_ControlState ,
-                        SUPERV::AutomatonState &_currentState ,
-                        GraphExecutor::InNode ** _aReStartNode ,
-                        bool & _PyFuncRunned ,
-                        PyObject ** _MyPyRunMethod ,
-                        pthread_mutex_t &_MutexDataWait ,
-                        bool &_DataWait ,
-                        pthread_mutex_t &_MutexWait ,
-                        pthread_cond_t &_ReadyWait ,
-                        pthread_cond_t &_RunningWait ,
-                        pthread_cond_t &_DoneWait ,
-                        pthread_cond_t &_SuspendedWait ,
-                        pthread_cond_t &_SuspendWait ,
-                        bool &_SuspendSync ,
-                        pthread_cond_t &_ResumeWait ,
-                        bool &_ResumeSync ,
-                        pthread_cond_t &_KillWait ,
-                        bool &_KillSync ,
-                        pthread_cond_t &_ThreadStartedWait ,
-                        bool &_ThreadStartedSync ,
-                        pthread_cond_t &_StopWait ,
-                        GraphExecutor::FiniteStateMachine ** _Automaton ,
-                        GraphExecutor::FiniteStateMachine * theAutomaton ,
-                        CORBA::ORB_ptr * _Orb ,
-                        CORBA::ORB_ptr ORB ) {
-  _RewindStack = 0 ;
-  _ControlState = SUPERV::VoidState ;
-  _currentState = SUPERV::UnKnownState ;
-  *_aReStartNode = NULL ;
-  _PyFuncRunned = false ;
-  *_MyPyRunMethod = NULL ;
-  pthread_mutex_init( &_MutexDataWait , NULL ) ;
-  _DataWait = false ;
-  pthread_mutex_init( &_MutexWait , NULL ) ;
-  if ( pthread_cond_init( &_ReadyWait , NULL ) ) {
-    perror("pthread_cond_init( &_ReadyWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  if ( pthread_cond_init( &_RunningWait , NULL ) ) {
-    perror("pthread_cond_init( &_RunningWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  if ( pthread_cond_init( &_DoneWait , NULL ) ) {
-    perror("pthread_cond_init( &_DoneWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  if ( pthread_cond_init( &_SuspendedWait , NULL ) ) {
-    perror("pthread_cond_init( &_SuspendedWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  if ( pthread_cond_init( &_SuspendWait , NULL ) ) {
-    perror("pthread_cond_init( &_SuspendWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  _SuspendSync = false ;
-  if ( pthread_cond_init( &_ResumeWait , NULL ) ) {
-    perror("pthread_cond_init( &_ResumeWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  _ResumeSync = false ;
-  if ( pthread_cond_init( &_KillWait , NULL ) ) {
-    perror("pthread_cond_init( &_KillWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  _KillSync = false ;
-  if ( pthread_cond_init( &_ThreadStartedWait , NULL ) ) {
-    perror("pthread_cond_init( &_ThreadStartedWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  _ThreadStartedSync = false ;
-  if ( pthread_cond_init( &_StopWait , NULL ) ) {
-    perror("pthread_cond_init( &_StopWait , NULL )") ;
-    exit( 0 ) ;
-  }
-  *_Automaton = theAutomaton ;
-  *_Orb = CORBA::ORB::_nil();
-}
-
-GraphExecutor::FiniteStateMachine * theAutomaton = new GraphExecutor::FiniteStateMachine() ;
-
-//GraphExecutor::InNode::InNode() :
-//     GraphBase::FactoryNode() {
-GraphExecutor::InNode::InNode() {
-  InitInNode( _RewindStack ,
-              _ControlState ,
-              _currentState ,
-              &_aReStartNode ,
-              _PyFuncRunned ,
-              &_MyPyRunMethod ,
-              _MutexDataWait ,
-              _DataWait ,
-              _MutexWait ,
-              _ReadyWait ,
-              _RunningWait ,
-              _DoneWait ,
-              _SuspendedWait ,
-              _SuspendWait ,
-              _SuspendSync ,
-              _ResumeWait ,
-              _ResumeSync ,
-              _KillWait ,
-              _KillSync ,
-              _ThreadStartedWait ,
-              _ThreadStartedSync ,
-              _StopWait ,
-              &_Automaton ,
-              theAutomaton ,
-              &_Orb ,
-              CORBA::ORB::_nil() ) ;
-}
-
-GraphExecutor::InNode::InNode( CORBA::ORB_ptr ORB,
-                               SALOME_NamingService* ptrNamingService ,
-                               const SALOME_ModuleCatalog::Service& aService ,
-                               const char * ComponentName ,
-                               const char * NodeInterfaceName ,
-                               const char * NodeName ,
-                               const SUPERV::KindOfNode akind ,
-                               GraphBase::ListOfFuncName aFuncName ,
-                               GraphBase::ListOfPythonFunctions aPythonFunction ,
-                               const SUPERV::SDate NodeFirstCreation ,
-                               const SUPERV::SDate NodeLastModification  ,
-                               const char * NodeEditorRelease ,
-                               const char * NodeAuthor ,
-                               const char * NodeComputer ,
-                               const char * NodeComment ,
-                               const bool   GeneratedName ,
-                               const int NodeX ,
-                               const int NodeY ,
-                               int * Graph_prof_debug,
-                               ofstream * Graph_fdebug) {
-//               ostream * Graph_fdebug = NULL ) :
-//             GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
-//                                     ComponentName , NodeInterfaceName ,
-//                                     NodeName , akind ,
-//                                     NodeFirstCreation , NodeLastModification  ,
-//                                     NodeEditorRelease , NodeAuthor ,
-//                                     NodeComputer , NodeComment , GeneratedName ,
-//                                     0 , 0 ,
-//                                     Graph_prof_debug , Graph_fdebug ) {
-  InitInNode( _RewindStack ,
-              _ControlState ,
-              _currentState ,
-              &_aReStartNode ,
-              _PyFuncRunned ,
-              &_MyPyRunMethod ,
-              _MutexDataWait ,
-              _DataWait ,
-              _MutexWait ,
-              _ReadyWait ,
-              _RunningWait ,
-              _DoneWait ,
-              _SuspendedWait ,
-              _SuspendWait ,
-              _SuspendSync ,
-              _ResumeWait ,
-              _ResumeSync ,
-              _KillWait ,
-              _KillSync ,
-              _ThreadStartedWait ,
-              _ThreadStartedSync ,
-              _StopWait ,
-              &_Automaton ,
-              theAutomaton ,
-              &_Orb ,
-              ORB ) ;
-  SetDebug( ORB , Graph_prof_debug , Graph_fdebug ) ;
-
-  _ComputingNode = NULL ;
-  _FactoryNode = NULL ;
-  _InLineNode = NULL ;
-  _GOTONode = NULL ;
-  _LoopNode = NULL ;
-  _EndOfLoopNode = NULL ;
-  _SwitchNode = NULL ;
-  _EndOfSwitchNode = NULL ;
-  switch ( akind ) {
-  case SUPERV::ComputingNode : {
-    cdebug << "GraphExecutor::InNode::InNode SUPERV::ComputingNode : " << NodeName ;
-    _ComputingNode = new GraphBase::ComputingNode( ORB , ptrNamingService ,
-                                                   aService ,
-                                                   NodeName , akind ,
-                                                   NodeFirstCreation ,
-                                                   NodeLastModification  ,
-                                                   NodeEditorRelease , NodeAuthor ,
-                                                   NodeComment , GeneratedName ,
-                                                   NodeX , NodeY ,
-                                                   Graph_prof_debug , Graph_fdebug ) ;
-    break ;
-  }
-  case SUPERV::FactoryNode : {
-    cdebug << "GraphExecutor::InNode::InNode SUPERV::FactoryNode : " << NodeName ;
-    _FactoryNode = new GraphBase::FactoryNode( ORB , ptrNamingService , aService ,
-                                               ComponentName , NodeInterfaceName ,
-                                               NodeName , akind ,
-                                               NodeFirstCreation ,
-                                               NodeLastModification  ,
-                                               NodeEditorRelease , NodeAuthor ,
-                                               NodeComputer , NodeComment ,
-                                               GeneratedName , NodeX , NodeY ,
-                                               Graph_prof_debug , Graph_fdebug ) ;
-    _ComputingNode = (GraphBase::ComputingNode *) _FactoryNode ;
-    break ;
-  }
-  case SUPERV::InLineNode : {
-    cdebug << "GraphExecutor::InNode::InNode SUPERV::InLineNode : " << NodeName ;
-    _InLineNode = new GraphBase::InLineNode( ORB , ptrNamingService ,
-                                             aFuncName[0].c_str() , *aPythonFunction[0] ,
-                                             NodeName , akind ,
-                                             NodeFirstCreation , NodeLastModification  ,
-                                             NodeEditorRelease , NodeAuthor ,
-                                             NodeComment , GeneratedName ,
-                                             NodeX , NodeY ,
-                                             Graph_prof_debug , Graph_fdebug ) ;
-    _ComputingNode = (GraphBase::ComputingNode *) _InLineNode ;
-    break ;
-  }
-  case SUPERV::GOTONode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::GOTONode : " << NodeName ;
-    _GOTONode = new GraphBase::GOTONode( ORB , ptrNamingService ,
-                                         aFuncName[0].c_str() , *aPythonFunction[0] ,
-                                         NodeName , akind ,
-                                         NodeFirstCreation , NodeLastModification  ,
-                                         NodeEditorRelease , NodeAuthor ,
-                                         NodeComment , GeneratedName ,
-                                         NodeX , NodeY ,
-                                         Graph_prof_debug , Graph_fdebug ) ;
-    _ComputingNode = (GraphBase::ComputingNode *) _GOTONode ;
-    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
-    break ;
-  }
-  case SUPERV::LoopNode : {
-    cdebug << "GraphExecutor::InNode::InNode SUPERV::LoopNode : " << NodeName ;
-    _LoopNode = new GraphBase::LoopNode( ORB , ptrNamingService ,
-                                         aFuncName[0].c_str() , *aPythonFunction[0] ,
-                                         aFuncName[1].c_str() , *aPythonFunction[1] ,
-                                         aFuncName[2].c_str() , *aPythonFunction[2] ,
-                                         NodeName , akind ,
-                                         NodeFirstCreation , NodeLastModification  ,
-                                         NodeEditorRelease , NodeAuthor ,
-                                         NodeComment , GeneratedName ,
-                                         NodeX , NodeY ,
-                                         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 ;
-    _EndOfLoopNode = new GraphBase::EndOfLoopNode(
-                                         ORB , ptrNamingService ,
-                                         aFuncName[0].c_str() , *aPythonFunction[0] ,
-                                         NodeName , akind ,
-                                         NodeFirstCreation , NodeLastModification  ,
-                                         NodeEditorRelease , NodeAuthor ,
-                                         NodeComment , GeneratedName ,
-                                         NodeX , NodeY ,
-                                         Graph_prof_debug , Graph_fdebug ) ;
-    _ComputingNode = (GraphBase::ComputingNode *) _EndOfLoopNode ;
-    _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
-    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
-    break ;
-  }
-  case SUPERV::SwitchNode : {
-    cdebug << "GraphExecutor::InNode::InNode SUPERV::SwitchNode : " << NodeName ;
-    _SwitchNode = new GraphBase::SwitchNode( ORB , ptrNamingService ,
-                                             aFuncName[0].c_str() , *aPythonFunction[0] ,
-                                             NodeName , akind ,
-                                             NodeFirstCreation , NodeLastModification  ,
-                                             NodeEditorRelease , NodeAuthor ,
-                                             NodeComment , GeneratedName ,
-                                             NodeX , NodeY ,
-                                             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 ;
-    _EndOfSwitchNode = new GraphBase::EndOfSwitchNode(
-                                             ORB , ptrNamingService ,
-                                             aFuncName[0].c_str() , *aPythonFunction[0] ,
-                                             NodeName , akind ,
-                                             NodeFirstCreation , NodeLastModification  ,
-                                             NodeEditorRelease , NodeAuthor ,
-                                             NodeComment , GeneratedName ,
-                                             NodeX , NodeY ,
-                                             Graph_prof_debug , Graph_fdebug ) ;
-    _ComputingNode = (GraphBase::ComputingNode *) _EndOfSwitchNode ;
-    _GOTONode = (GraphBase::GOTONode *) _ComputingNode ;
-    _InLineNode = (GraphBase::InLineNode *) _ComputingNode ;
-    break ;
-  }
-  case SUPERV::DataFlowGraph : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::DataFlowGraph ERROR : " << NodeName ;
-  }
-  case SUPERV::DataStreamGraph : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::DataStreamGraph ERROR : " << NodeName ;
-  }
-  case SUPERV::UnknownNode : {
-    cdebug << "GraphEditor::InNode::InNode SUPERV::UnknownNode ERROR : " << NodeName ;
-  }
-  }
-  cdebug << "GraphExecutor::InNode::InNode "  << (void *) this
-         << " _ComputingNode " << (void *) _ComputingNode  ;
-  _ComputingNode->InNode( this ) ;
-}
-
-GraphExecutor::InNode::~InNode() {
-}
-
-void GraphExecutor::InNode::LockDataWait() {
-  if ( pthread_mutex_lock( &_MutexDataWait ) ) {
-    perror("Ready pthread_mutex_lock ") ;
-    exit( 0 ) ;
-  }
-  _DataWait = true ;
-}
-void GraphExecutor::InNode::UnLockDataWait() {
-  _DataWait = false ;
-  if ( pthread_mutex_unlock( &_MutexDataWait ) ) {
-    perror("Ready pthread_mutex_unlock ") ;
-    exit( 0 ) ;
-  }
-}
-
-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 ;
-  if ( IsFactoryNode() ) {
-    RetVal = !CORBA::is_nil( _FactoryNode->Component() ) ;
-    if ( RetVal ) {
-      if ( State() != SUPERV::SuspendedExecutingState ) {
-        try {
-          _FactoryNode->Component()->ping() ;
-       }
-        catch( ... ) {
-          cdebug << "InNode::Ping() catched" << endl ;
-          State( SUPERV::ErroredState ) ;
-          _OutNode->State( SUPERV::ErroredState ) ;
-          RetVal = false ;
-       }
-      }
-      else {
-        RetVal = false ;
-      }
-    }
-  }
-//  cdebug_out << "GraphExecutor::InNode::Ping" << endl ;
-  return RetVal ;
-}
-
-void GraphExecutor::InNode::NewThread( pthread_t aThread ) {
-  ThreadNo ( aThread ) ; 
-  if ( aThread )
-    _OutNode->NewThread() ;
-}
-void GraphExecutor::InNode::ExitThread() {
-  ThreadNo( 0 ) ;
-  _OutNode->ExitThread() ;
-} 
-
-bool GraphExecutor::InNode::Suspend() {
-  cdebug_in << "GraphExecutor::InNode::Suspend " << Name() << " " << ThreadNo()
-            << endl;
-  bool RetVal ;
-  if ( IsDone() ) {
-    ControlState( SUPERV::VoidState ) ;
-    if ( _OutNode->IsDone() ) {
-      ControlState( SUPERV::VoidState ) ;
-    }
-    RetVal = false ;
-  }
-  else if ( IsWaiting() || IsReady() ) {
-    ControlState( SUPERV::ToSuspendState ) ;
-    RetVal = true ;
-  }
-  else  if ( IsRunning() ) {
-    ControlState( SUPERV::ToSuspendState ) ;
-    if ( IsFactoryNode() || IsComputingNode() ) {
-      if ( !CORBA::is_nil( Component() ) ) {
-        try {
-          RetVal = Component()->Suspend_impl() ;
-       }
-        catch( ... ) {
-          cdebug << "InNode::Suspend() catched" << endl ;
-          State( SUPERV::ErroredState ) ;
-          _OutNode->State( SUPERV::ErroredState ) ;
-          RetVal = false ;
-       }
-        if ( RetVal ) {
-          if ( IsRunning() ) {
-            cdebug << pthread_self() << "GraphExecutor::InNode::Suspend_impl " << Name()
-                   << " --> thread" << ThreadNo() << " SuspendEvent " << endl;
-            SendEvent( GraphExecutor::SuspendEvent ) ;
-            cdebug << pthread_self() << "GraphExecutor::InNode::Suspended_impl in Container"
-                   << Name() << " --> thread" << ThreadNo() << endl;
-          }
-          else if ( IsDone() ) {
-            ControlState( SUPERV::VoidState ) ;
-            RetVal = false ; // Too late ...
-          }
-          else {
-            cdebug << "component Suspended and !IsDone and !IsRunning !"
-                   << endl ;
-         }
-        }
-      }
-      else {
-        cdebug << "Suspend cannot Suspend component !" << endl ;
-        RetVal = false ;
-      }
-    }
-    else {
-      cdebug << "Suspend with nilComponent while RunningState !" << endl ;
-      RetVal = false ;
-    }
-  }
-  else {
-    cdebug << "Suspend and !IsDone and !IsRunning and !IsWaiting ?"
-           << endl ;
-    RetVal = false ;
-  }
-  cdebug_out << "GraphExecutor::InNode::Suspend " << RetVal << " "
-             << Automaton()->StateName( State() ) << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::ContainerKill() {
-  cdebug_in << "GraphExecutor::InNode::ContainerKill " << Name() << " "
-            << ThreadNo() << endl;
-  bool RetVal ;
-  if ( IsFactoryNode() ) {
-    Kill() ;
-    RetVal = Container()->Kill_impl() ;
-  }
-  cdebug_out << "GraphExecutor::InNode::ContainerKill" << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::Kill() {
-  cdebug_in << "GraphExecutor::InNode::Kill " << Name() << " " << ThreadNo() << " " 
-            << Automaton()->StateName( State() ) << endl;
-  bool RetVal ;
-  if ( IsDone() ) {
-    ControlState( SUPERV::ToKillState ) ; // if loop
-    if ( _OutNode->IsDone() ) {
-      ControlState( SUPERV::VoidState ) ;
-    }
-    RetVal = false ;
-  }
-  else {
-    ControlState( SUPERV::ToKillState ) ;
-    if ( IsDone() ) {
-      if ( _OutNode->IsDone() ) {
-        ControlState( SUPERV::VoidState ) ;
-      }
-      RetVal = false ;
-    }
-    else {
-      if ( IsRunning() ) {
-        if ( IsFactoryNode() || IsComputingNode() ) {
-          if ( !CORBA::is_nil( Component() ) ) {
-            try {
-              RetVal = Component()->Kill_impl() ;
-           }
-            catch( ... ) {
-              cdebug << "InNode::Suspend() catched" << endl ;
-              State( SUPERV::ErroredState ) ;
-              _OutNode->State( SUPERV::ErroredState ) ;
-              RetVal = false ;
-           }
-            cdebug << "Component()->Kill_impl() returns status " << RetVal << endl ;
-            RetVal = true ;
-            if ( IsRunning() ) {
-              cdebug << pthread_self() << "GraphExecutor::InNode::Kill_impl " << Name()
-                     << " --> thread" << ThreadNo() << " SuspendEvent " << endl;
-              SendEvent( GraphExecutor::KillEvent ) ;
-              cdebug << pthread_self() << "GraphExecutor::InNode::Killed_impl in Container"
-                     << Name() << " --> thread" << ThreadNo() << endl;
-           }
-            else if ( IsDone() ) {
-              ControlState( SUPERV::VoidState ) ;
-              RetVal = false ; // Too late ...
-           }
-            else {
-              cdebug << "component Killed and !IsDone and !IsRunning !"
-                     << endl ;
-           }
-         }
-          else {
-            cdebug << "Kill with nilComponent cannot Kill component !" << endl ;
-            RetVal = false ;
-         }
-       }
-      }
-      else if ( IsSuspended() ) {
-        cdebug << pthread_self() << "GraphExecutor::InNode::Kill " << Name()
-               << " --> thread" << ThreadNo() << " Resume()" << endl;
-        Resume() ;
-        RetVal = true ;
-      }
-      else if ( IsWaiting() ) {
-        RetVal = true ;
-      }
-      else {
-        cdebug << "Kill and !IsDone and !IsRunning and !IsWaiting ?"
-               << endl ;
-        RetVal = false ;
-      }
-    }
-  }
-  cdebug_out << "GraphExecutor::InNode::Kill" << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::KillDone() {
-  cdebug_in << "GraphExecutor::InNode::KillDone " << Name() << " " << ThreadNo()
-            << endl;
-  bool RetVal ;
-  if ( ControlState() == SUPERV::ToKillDoneState || IsDone() ) {
-    RetVal = false ;
-  }
-  else {
-    ControlState( SUPERV::ToKillDoneState ) ;
-    if ( IsDone() ) {
-      if ( _OutNode->IsDone() ) {
-        ControlState( SUPERV::VoidState ) ;
-      }
-      RetVal = false ;
-    }
-    else {
-      if ( IsRunning() ) {
-        RetVal = true ;
-      }
-      else if ( IsWaiting() ) {
-        RetVal = true ;
-      }
-      else {
-        cdebug << "KillDone and !IsDone and !IsRunning and !IsWaiting ?"
-               << endl ;
-        RetVal = false ;
-      }
-    }
-  }
-  cdebug_out << "GraphExecutor::InNode::KillDone" << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::Stop() {
-  cdebug_in << "GraphExecutor::InNode::Stop " << Name() << " " << ThreadNo()
-            << endl;
-  bool RetVal ;
-  if ( ControlState() == SUPERV::ToStopState || IsDone() ) {
-    RetVal = false ;
-  }
-  else {
-    ControlState( SUPERV::ToStopState ) ;
-    if ( IsDone() ) {
-      if ( _OutNode->IsDone() ) {
-        ControlState( SUPERV::VoidState ) ;
-      }
-      RetVal = false ;
-    }
-    else {
-      if ( IsRunning() ) {
-        if ( IsFactoryNode() || IsComputingNode() ) {
-          if ( !CORBA::is_nil( Component() ) ) {
-            try {
-              RetVal = Component()->Stop_impl() ;
-           }
-            catch( ... ) {
-              cdebug << "InNode::Stop() catched" << endl ;
-              State( SUPERV::ErroredState ) ;
-              _OutNode->State( SUPERV::ErroredState ) ;
-              RetVal = false ;
-           }
-            if ( RetVal ) {
-              if ( IsRunning() ) {
-                SendEvent( GraphExecutor::StopEvent ) ;
-             }
-              else if ( IsDone() ) {
-                ControlState( SUPERV::VoidState ) ;
-                RetVal = false ; // Too late ...
-             }
-              else {
-                cdebug << "component Suspended and !IsDone and !IsRunning !"
-                       << endl ;
-             }
-           }
-         }
-          else {
-            cdebug << "Suspend cannot Suspend component !" << endl ;
-            RetVal = false ;
-         }
-       }
-        else {
-          cdebug << "Suspend with nilComponent while RunningState !" << endl ;
-          RetVal = false ;
-        }
-      }
-      else if ( IsWaiting() ) {
-        RetVal = true ;
-      }
-      else {
-        cdebug << "Suspend and !IsDone and !IsRunning and !IsWaiting ?"
-               << endl ;
-        RetVal = false ;
-      }
-    }
-  }
-  cdebug_out << "GraphExecutor::InNode::Stop" << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::SuspendDone() {
-  cdebug_in << "GraphExecutor::InNode::SuspendDone " << Name() << " "
-            << ThreadNo() << endl;
-  bool RetVal ;
-  if ( ControlState() == SUPERV::ToSuspendDoneState || IsDone() ) {
-    RetVal = false ;
-  }
-  else {
-    ControlState( SUPERV::ToSuspendDoneState ) ;
-    if ( IsDone() ) {
-      if ( _OutNode->IsDone() ) {
-        ControlState( SUPERV::VoidState ) ;
-      }
-      RetVal = false ;
-    }
-    else {
-      RetVal = true ;
-    }
-  }
-  cdebug_out << "GraphExecutor::InNode::SuspendDone" << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::Resume() {
-  cdebug_in << pthread_self() << "/" << ThreadNo()
-            << " GraphExecutor::InNode::Resume " << Name() << " "
-            << Automaton()->StateName( State() ) << endl;
-  bool RetVal = false ;
-  if ( IsSuspended() ) {
-    if ( State() == SUPERV::SuspendedReadyState ) {
-      ResumeAction( GraphExecutor::ToResumeEvent ) ;
-      RetVal = true ;
-    }
-    else if ( State() == SUPERV::SuspendedExecutingState ) {
-      if ( IsFactoryNode() || IsComputingNode() ) {
-        try {
-          RetVal = Component()->Resume_impl() ;
-       }
-        catch( ... ) {
-          cdebug << "InNode::Resume() catched" << endl ;
-          State( SUPERV::ErroredState ) ;
-          _OutNode->State( SUPERV::ErroredState ) ;
-          RetVal = false ;
-       }
-      }
-    }
-    else if ( State() == SUPERV::SuspendedSuccessedState ) {
-      ResumeAction( GraphExecutor::ResumeEvent ) ;
-      RetVal = true ;
-    }
-    else if ( State() == SUPERV::SuspendedErroredState ) {
-      ResumeAction( GraphExecutor::ResumeEvent ) ;
-      RetVal = true ;
-    }
-    else {
-      cdebug << "GraphExecutor::InNode::Resume Not SuspendedReady/Executing/Successed/ErroredState "
-             << Automaton()->StateName( State() ) << endl ;
-      RetVal = false ;
-    }
-  }
-  else {
-    cdebug << "GraphExecutor::InNode::Resume Not Suspended State "
-           << Automaton()->StateName( State() ) << endl ;
-    RetVal = false ;
-  }
-  if ( ControlState() == SUPERV::ToSuspendStartState ) {
-    ControlState( SUPERV::VoidState ) ;
-  }
-
-#if 0
-  if ( ControlState() == SUPERV::ToSuspendRunState ||
-       ( ControlState() == SUPERV::ToSuspendState &&
-         State() == SUPERV::SuspendedReadyState) ) {
-    if ( IsSuspended() ) {
-      if ( State() == SUPERV::SuspendedReadyState ) {
-        ResumeAction() ;
-        RetVal = true ;
-      }
-      else if ( State() == SUPERV::SuspendedExecutingState ) {
-        ResumeAction() ;
-        RetVal = Component()->Resume_impl() ;
-      }
-      else {
-        cdebug << "GraphExecutor::InNode::Resume State "
-               << Automaton()->StateName( State() ) << endl ;
-        RetVal = false ;
-      }
-      if ( ControlState() != SUPERV::ToSuspendState ) {
-        ControlState( SUPERV::VoidState ) ;
-      }
-    }
-    else if ( IsRunning() ) {
-      RetVal = true ;
-    }
-    else if ( IsWaiting() ) {
-      ControlState( SUPERV::VoidState ) ;
-      RetVal = true ;
-    }
-    else if ( IsDone() ) {
-      RetVal = true ;
-    }
-  }
-  else if ( ControlState() == SUPERV::ToSuspendDoneState ||
-            ( ControlState() == SUPERV::ToSuspendState &&
-              State() == SUPERV::SuspendedSuccessedState) ) {
-    if ( IsSuspended() ) {
-      if ( State() == SUPERV::SuspendedSuccessedState ) {
-        ResumeAction() ;
-        RetVal = true ;
-      }
-      else if ( State() == SUPERV::SuspendedErroredState ) {
-        ResumeAction() ;
-        RetVal = true ;
-      }
-      else {
-        cdebug << "GraphExecutor::InNode::Resume State " << State() << endl ;
-        RetVal = false ;
-      }
-      if ( ControlState() != SUPERV::ToSuspendState ) {
-        ControlState( SUPERV::VoidState ) ;
-      }
-    }
-    else if ( IsRunning() ) {
-      ControlState( SUPERV::VoidState ) ;
-      RetVal = true ;
-    }
-    else if ( IsWaiting() ) {
-      ControlState( SUPERV::VoidState ) ;
-      RetVal = true ;
-    }
-    else if ( IsDone() ) {
-      ControlState( SUPERV::VoidState ) ;
-      RetVal = true ;
-    }
-  }
-#endif
-  cdebug_out << "GraphExecutor::InNode::Resume " << RetVal << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::ReStart( const char * AtNodeName ,
-                                     const bool AndSuspend ) {
-  bool RetVal = false ;
-  GraphExecutor::InNode * aRestartNode = (GraphExecutor::InNode *) _OutNode->Graph()->GetGraphNode( AtNodeName )->GetInNode() ;
-  cdebug_in << pthread_self() << "/" << ThreadNo()
-            << " --> GraphExecutor::InNode::ReStartAt( "
-            << AtNodeName << " , " << AndSuspend << ") " << endl
-            << "thread " << aRestartNode->ThreadNo() << " "
-            << Automaton()->StateName( aRestartNode->State() )
-            << " from " << Name() << " " << Automaton()->StateName( State() )
-            << endl ;
-  if ( IsWaiting() && aRestartNode->IsSuspended() ) {
-    RetVal = aRestartNode->Resume() ;
-  }
-  else if ( IsSuspended() ) {
-    if ( strcmp( AtNodeName , Name() ) ) {
-      aRestartNode->State( SUPERV::SuspendedSuccessedState ) ;
-    }
-    if ( AndSuspend ) {
-      ReStartAction( aRestartNode , GraphExecutor::ReStartAndSuspendEvent ) ;
-    }
-    else {
-      ReStartAction( aRestartNode , GraphExecutor::ReStartEvent ) ;
-    }
-    RetVal = true ;
-  }
-  cdebug_out << "<-- GraphExecutor::InNode::ReStartAt" << endl ;
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::IsWaiting() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsWaiting " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::DataUndefState ||
-       aState == SUPERV::DataWaitingState ||
-       aState == SUPERV::SuspendedReadyState )
-//       aState == SUPERV::SuspendedExecutingState ||
-//       aState == SUPERV::SuspendedSuccessedState ||
-//       aState == SUPERV::SuspendedErroredState ||
-//       aState == SUPERV::SuspendedState
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsWaiting" << endl ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::IsReady() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsReady " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::DataUndefState ||
-       aState == SUPERV::DataWaitingState ||
-       aState == SUPERV::DataReadyState ||
-       aState == SUPERV::ResumedReadyState )
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsReady" << endl ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::IsRunning() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsRunning " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::ExecutingState ||
-       aState == SUPERV::ResumedExecutingState )
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsRunning" << endl ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::IsDone() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsDone " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::KilledReadyState ||
-       aState == SUPERV::StoppedReadyState ||
-       aState == SUPERV::KilledExecutingState ||
-       aState == SUPERV::StoppedExecutingState ||
-       aState == SUPERV::SuspendedSuccessedState ||
-       aState == SUPERV::SuspendedErroredState ||
-//       aState == SUPERV::SuccessedExecutingState ||
-//       aState == SUPERV::ErroredExecutingState ||
-       aState == SUPERV::SuccessedState ||
-       aState == SUPERV::ErroredState ||
-       aState == SUPERV::ResumedSuccessedState ||
-       aState == SUPERV::ResumedErroredState ||
-       aState == SUPERV::KilledSuccessedState ||
-       aState == SUPERV::StoppedSuccessedState )
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsDone" << endl ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::IsSuspended() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsSuspended " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::SuspendedReadyState ||
-       aState == SUPERV::SuspendedExecutingState ||
-       aState == SUPERV::SuspendedSuccessedState ||
-       aState == SUPERV::SuspendedErroredState )
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsSuspended" << endl ;
-  return aret ;
-}
-bool GraphExecutor::InNode::IsKilled() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsKilled " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::KilledReadyState ||
-       aState == SUPERV::KilledExecutingState ||
-       aState == SUPERV::KilledSuccessedState ||
-       aState == SUPERV::KilledErroredState ||
-       aState == SUPERV::KilledState )
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsKilled" << endl ;
-  return aret ;
-}
-bool GraphExecutor::InNode::IsStopped() {
-  bool aret = false ;
-//  cdebug_in << "GraphExecutor::InNode::IsStopped " << Name() << endl;
-  SUPERV::AutomatonState aState = State() ;
-  if ( aState == SUPERV::StoppedReadyState ||
-       aState == SUPERV::StoppedExecutingState ||
-       aState == SUPERV::StoppedSuccessedState ||
-       aState == SUPERV::StoppedErroredState ||
-       aState == SUPERV::StoppedState )
-    aret = true ;
-//  cdebug_out << "GraphExecutor::InNode::IsStopped" << endl ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::StateWait( SUPERV::GraphState aState ) {
-  bool RetVal = false ;
-  if ( pthread_mutex_lock( &_MutexWait ) ) {
-    perror("pthread_mutex_lock _Wait") ;
-    exit( 0 ) ;
-  }
-  switch ( aState ) {
-  case SUPERV::ReadyState : {
-    RetVal = IsReady() ;
-    cdebug_in << pthread_self() << " StateWait( Ready ) " << RetVal
-              << " " << Automaton()->StateName( _currentState )
-              << " pthread_cond_wait _ReadyWait " << Name() << endl ;
-    while ( !RetVal && !IsDone() ) {
-      cdebug << pthread_self() << " pthread_cond_wait ReadyWait" << endl ;
-      pthread_cond_wait( &_ReadyWait , &_MutexWait );
-      RetVal = IsReady() ;
-      cdebug << pthread_self() << " pthread_cond_waited ReadyWait "
-             << Automaton()->StateName( _currentState ) << " " << RetVal
-             << endl ;
-    }
-    cdebug_out << pthread_self() << " StateWait( Ready ) " << RetVal
-               << " " << Automaton()->StateName( _currentState )
-               << " pthread_cond_wait _ReadyWait " << Name() << endl ;
-    break ;
-  }
-  case SUPERV::RunningState : {
-    RetVal = IsRunning() ;
-    cdebug_in << pthread_self() << " StateWait( Running ) " << RetVal
-              << " " << Automaton()->StateName( _currentState )
-              << " pthread_cond_wait _RunningWait " << Name() << endl ;
-    while ( !RetVal && !IsDone() ) {
-      cdebug << pthread_self() << " pthread_cond_wait RunningWait" << endl ;
-      pthread_cond_wait( &_RunningWait , &_MutexWait );
-      RetVal = IsRunning() ;
-      cdebug << pthread_self() << " pthread_cond_waited RunningWait "
-             << Automaton()->StateName( _currentState ) << " " << RetVal
-             << endl ;
-    }
-    cdebug_out << pthread_self() << " StateWait( Running ) " << RetVal
-               << " " << Automaton()->StateName( _currentState )
-               << " pthread_cond_wait _RunningWait " << Name() << endl ;
-    break ;
-  }
-  case SUPERV::DoneState : {
-    RetVal = IsDone() ;
-    cdebug_in << pthread_self() << " StateWait( Done ) " << RetVal
-              << " " << Automaton()->StateName( _currentState )
-              << " pthread_cond_wait _DoneWait " << Name() << endl ;
-    while ( !RetVal ) {
-      cdebug << pthread_self() << " pthread_cond_wait DoneWait" << endl ;
-      pthread_cond_wait( &_DoneWait , &_MutexWait );
-      RetVal = IsDone() ;
-      cdebug << pthread_self() << " pthread_cond_waited DoneWait "
-             << Automaton()->StateName( _currentState ) << " " << RetVal
-             << endl ;
-    }
-    cdebug_out << pthread_self() << " StateWait( Done ) " << RetVal
-               << " " << Automaton()->StateName( _currentState )
-               << " pthread_cond_wait _DoneWait " << Name() << endl ;
-    break ;
-  }
-  case SUPERV::SuspendState : {
-    RetVal = IsSuspended() ;
-    cdebug_in << pthread_self() << " StateWait( Suspend ) " << RetVal
-              << " " << Automaton()->StateName( _currentState )
-              << " pthread_cond_wait _SuspendedWait " << Name() << endl ;
-    while ( !RetVal && !IsDone() ) {
-      cdebug << pthread_self() << " pthread_cond_wait SuspendedWait" << endl ;
-      pthread_cond_wait( &_SuspendedWait , &_MutexWait );
-      RetVal = IsSuspended() ;
-      cdebug << pthread_self() << " pthread_cond_waited SuspendedWait "
-             << Automaton()->StateName( _currentState ) << " " << RetVal
-             << endl ;
-    }
-    cdebug_out << pthread_self() << " StateWait( Suspend ) " << RetVal
-               << " " << Automaton()->StateName( _currentState )
-               << " pthread_cond_wait _SuspendedWait " << Name() << endl ;
-    break ;
-  }
-  default : {
-    cdebug << " GraphExecutor::OutNode::StateWait Error Undefined State : "
-           << aState << endl ;
-  }
-  }
-  if ( pthread_mutex_unlock( &_MutexWait ) ) {
-    perror("pthread_mutex_lock _Wait") ;
-    exit( 0 ) ;
-  }
-  return RetVal ;
-}
-
-bool GraphExecutor::InNode::ReadyWait() {
-//  cdebug_in << "GraphExecutor::InNode::ReadyWait " << Name() << endl;
-  bool aret ;
-  aret = StateWait( SUPERV::ReadyState ) ;
-//  cdebug_out << "GraphExecutor::InNode::ReadyWait" << endl ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::RunningWait() {
-//  cdebug_in << "GraphExecutor::InNode::RunningWait " << Name() << endl;
-  bool aret ;
-  aret = StateWait( SUPERV::RunningState ) ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::DoneWait() {
-//  cdebug_in << "GraphExecutor::InNode::DoneWait " << Name() << endl;
-  bool aret ;
-  aret = StateWait( SUPERV::DoneState ) ;
-  return aret ;
-}
-
-bool GraphExecutor::InNode::SuspendedWait() {
-//  cdebug_in << "GraphExecutor::InNode::SuspendedWait " << Name() << endl;
-  bool aret ;
-  aret = StateWait( SUPERV::SuspendState ) ;
-  return aret ;
-}
-
-void GraphExecutor::InNode::InitialState( GraphExecutor::OutNode * theOutNode )
-{
-  cdebug_in << "GraphExecutor::InNode::InitialState Node " << Name() << endl;
-
-  _OutNode = theOutNode ;
-
-  int i;
-  _ControlState = SUPERV::VoidState ;
-  CreateNewThread( false ) ;
-  CreateNewThreadIf( false ) ;
-  _SuspendSync = false ;
-  _ResumeSync = false ;
-//  ThreadNo( pthread_self() ) ;
-  ThreadNo( 0 ) ;
-
-  for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
-    if ( GetNodeOutPort(i)->IsDataStream() ) {
-      GetChangeNodeOutPort(i)->State(  SUPERV::ReadyState ) ;
-      GetChangeNodeOutPort(i)->Done( true ) ;
-    }
-    else if ( i != 0 || !IsGOTONode() ) {
-      GetChangeNodeOutPort(i)->State(  SUPERV::WaitingState ) ;
-      GetChangeNodeOutPort(i)->Done( false ) ;
-    }
-  }
-
-  int Pc = GetNodeInPortsSize() ;
-  for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
-    const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
-    GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
-    if ( IsHeadNode() && IsLoopNode() && anInPort->IsLoop() ) {
-      anOutPort->PortStatus( DataConnected );
-      anOutPort->State( SUPERV::ReadyState ) ;
-      anOutPort->Done( true ) ;
-      CORBA::Any * anAny = new CORBA::Any() ;
-      *anAny <<= (long ) 1 ;
-      anOutPort->Value( anAny ) ;
-    }
-    else if ( anInPort->IsGate() && anOutPort ) {
-      if ( IsComputingNode() || IsFactoryNode() ) {
-        anOutPort->State( SUPERV::WaitingState ) ;
-        anOutPort->Done( false ) ;
-      }
-      else if ( IsOneOfInLineNodes() ) {
-        anOutPort->PortStatus( DataConnected );
-        anOutPort->State( SUPERV::ReadyState ) ;
-        anOutPort->Done( true ) ;
-      }
-    }
-//    if ( ( anInPort->IsGate() || anInPort->IsBus() ) && anOutPort == NULL ) {
-    if ( anInPort->IsGate() && anOutPort == NULL ) {
-      Pc-- ;
-    }
-    else if ( anOutPort ) {
-      if ( anOutPort->IsDataConnected() || anOutPort->IsDataStream() ) {
-        Pc-- ;
-      }
-      if ( anOutPort->IsDataConnected() || anOutPort->IsDataStream() ) {
-        anOutPort->State( SUPERV::ReadyState ) ;
-        anOutPort->Done( true ) ;
-      }
-      else if ( anOutPort->IsPortConnected() ) {
-        anOutPort->State( SUPERV::WaitingState ) ;
-        anOutPort->Done( false ) ;
-      }
-    }
-    if ( anOutPort ) {
-      if ( !anOutPort->IsDataStream() || anInPort->IsDataStream() ) {
-        cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort "
-               << anOutPort->PortName() << " from Node " << anOutPort->NodeName()
-               << " with state " << theAutomaton->StateName( anOutPort->State() ) << endl ;
-        GetChangeNodeInPort(i)->State( anOutPort->State() ) ;
-      }
-      else {
-        cdebug << "InPort" << i << " state change : " << anInPort->PortName() << " from OutPort "
-               << anOutPort->PortName() << " from Node " << anOutPort->NodeName()
-               << " with state ReadyState" << endl ;
-        GetChangeNodeInPort(i)->State( SUPERV::ReadyState ) ;
-      }
-    }
-    if ( anOutPort ) {
-      cdebug << "InPort" << i << " : " << anInPort->PortName() << " from OutPort "
-             << anOutPort->PortName() << " from Node " << anOutPort->NodeName()
-             << " with state " ;
-      if ( anOutPort->State() == SUPERV::WaitingState ) {
-        cdebug << "WaitingState" ;
-      }
-      else if ( anOutPort->State() == SUPERV::ReadyState ) {
-        cdebug << "ReadyState" ;
-      }
-      else {
-        cdebug << "???" ;
-      }
-      cdebug << " PortConnected("
-             << anOutPort->IsPortConnected() << ") DataConnected("
-             << anOutPort->IsDataConnected() << ")" << endl ;
-    }
-  }
-
-  _currentState = Pc > 0 ? SUPERV::DataWaitingState 
-                         : SUPERV::DataReadyState ;
-  if ( Pc == GetNodeInPortsSize() ) {
-    _OutNode->PushEvent( this , GraphExecutor::NoDataReadyEvent ,
-                         _currentState ) ; 
-  }
-  else if ( Pc != 0 ) {
-    _OutNode->PushEvent( this , GraphExecutor::SomeDataReadyEvent ,
-                         _currentState ) ; 
-  }
-  else {
-    _OutNode->PushEvent( this , GraphExecutor::AllDataReadyEvent ,
-                         _currentState ) ; 
-  }
-
-  for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
-    cdebug << "OutPort" << i << " : " << GetNodeOutPort(i)->PortName() << " "
-           << theAutomaton->StateName( GetChangeNodeOutPort(i)->State() )
-           << " " << GetNodeOutPort(i)->Kind() << endl ;
-  }
-
-  cdebug << "CurrentState = " << theAutomaton->StateName( _currentState )
-         << endl;
-
-  cdebug_out << "GraphExecutor::InNode::InitialState" << endl;
-}
-
-bool GraphExecutor::InNode::InitPythonFunctions(bool WithErr ) {
-  cdebug_in << "GraphExecutor::InNode::InitPythonFunctions " << Name() << endl;
-  bool Err = false ;
-  if ( !PyFuncRunned() && IsOneOfInLineNodes() ) {
-    if ( IsLoopNode() ) {
-      PyObject * PyRunMethod = InLineNode()->PyRunMethod() ;
-      PyObject * PyMoreMethod = NULL ;
-      PyObject * PyNextMethod = NULL ;
-      if ( PyRunMethod ) {
-      }
-      else {
-        PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
-                                       InLineNode()->PythonFunction() ,
-                                       Err ) ;
-        InLineNode()->PyRunMethod( PyRunMethod ) ;
-      }
-      if ( !Err ) {
-        PyMoreMethod = LoopNode()->PyMoreMethod() ;
-        if ( PyMoreMethod ) {
-        }
-        else {
-          PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() ,
-                                          LoopNode()->MorePythonFunction() ,
-                                          Err ) ;
-          LoopNode()->PyMoreMethod( PyMoreMethod ) ;
-        }
-      }
-      if ( !Err ) {
-        PyNextMethod = LoopNode()->PyNextMethod() ;
-        if ( PyNextMethod ) {
-        }
-        else {
-          PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() ,
-                                          LoopNode()->NextPythonFunction() ,
-                                          Err ) ;
-          LoopNode()->PyNextMethod( PyNextMethod ) ;
-        }
-      }
-      cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) " << PyRunMethod
-             << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod << endl;
-    }
-    else if ( IsInLineNode() || IsSwitchNode() ) {
-      PyObject * PyRunMethod = InLineNode()->PyRunMethod() ;
-      if ( PyRunMethod ) {
-      }
-      else {
-       PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
-                                       InLineNode()->PythonFunction() ,
-                                       Err ) ;
-        InLineNode()->PyRunMethod( PyRunMethod ) ;
-      }
-      cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl;
-    }
-    else if ( ( IsEndLoopNode() || IsEndSwitchNode() || IsGOTONode() ) &&
-              (*InLineNode()->PythonFunction()).length() ) {
-      PyObject * PyRunMethod = InLineNode()->PyRunMethod() ;
-      if ( PyRunMethod ) {
-      }
-      else {
-        PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
-                                       InLineNode()->PythonFunction() ,
-                                       Err ) ;
-        InLineNode()->PyRunMethod( PyRunMethod ) ;
-      }
-      cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl;
-    }
-  }
-  Err = WithErr && Err ;
-  cdebug_out << "GraphExecutor::InNode::InitPythonFunctions " << Name() ;
-  if ( Err ) {
-    cdebug << " Error " << Err ;
-  }
-  cdebug << endl;
-  return !Err ;
-}
-
-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 ;
-        State( SUPERV::ErroredState ) ;
-        _OutNode->State( SUPERV::ErroredState ) ;
-        cpu = 0 ;
-      }
-    }
-  }
-//  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 {
-      cpu = 0 ;
-    }
-  }
-  else {
-    cpu = _PyTotCpuUsed ;
-  }
-//  cdebug << pthread_self() << "GraphExecutor::InNode::PyCpuUsed(" << tot << ") " << Name() << "_PyTotCpuUsed"
-//         <<  _PyTotCpuUsed << " CpuUsed : " << cpu << endl ;
-  return cpu ;
-}
-
-void GraphExecutor::InNode::SetPyCpuUsed() {
-  _PyTotCpuUsed = -1 ;
-  _PyCpuUsed = 0 ;
-  _Pythread = pthread_self() ;
-  _PyCpuUsed = PyCpu() ;
-//  cdebug << pthread_self() << "GraphExecutor::InNode::SetPyCpuUsed " << Name() << " _PyCpuUsed : "
-//         << _PyCpuUsed << endl ;
-}
-