]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphExecutor/DataFlowExecutor_OutNode.cxx
Salome HOME
This commit was generated by cvs2git to track changes on a CVS vendor
[modules/superv.git] / src / GraphExecutor / DataFlowExecutor_OutNode.cxx
1 using namespace std;
2 //=============================================================================
3 // File      : DataFlowBase_OutNode.cxx
4 // Created   : 2002
5 // Author    : Jean Rahuel, CEA
6 // Project   : SALOME
7 // $Header:
8 //=============================================================================
9
10 #include "DataFlowExecutor_OutNode.hxx"
11
12 // Implementation de la classe GraphEditor::GraphControl
13
14 extern GraphExecutor::FiniteStateMachine * theAutomaton ;
15
16 static const char *ComponentName = "SalomeSuperVisionComponent" ;
17
18 GraphExecutor::OutNode::OutNode() :
19                Graph() {
20   _Valid = false ;
21   _Executable = false ;
22   _Done = false ;
23   _Threads = 0 ;
24   _ControlState = SUPERV::VoidState ;
25   _State = SUPERV::UnKnownState ;
26   _PyInitialized = false ;
27   pthread_mutex_init( &_MutexWait , NULL ) ;
28   if ( pthread_cond_init( &_EventWait , NULL ) ) {
29     perror("pthread_cond_init( &_EventWait , NULL )") ;
30     exit( 0 ) ;
31   }
32   if ( pthread_cond_init( &_JoinWait , NULL ) ) {
33     perror("pthread_cond_init( &_JoinWait , NULL )") ;
34     exit( 0 ) ;
35   }
36 }
37
38 GraphExecutor::OutNode::OutNode( CORBA::ORB_ptr ORB, 
39                                  SALOME_NamingService* ptrNamingService ,
40                                  const char *DataFlowName ,
41                                  const char * DebugFileName ) :
42                Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
43   cdebug_in << "GraphEditor::OutNode::OutNode(" << DataFlowName << ")" << endl;
44   _Valid = false ;
45   _Executable = false ;
46   _Done = false ;
47   _Threads = 0 ;
48   _ControlState = SUPERV::VoidState ;
49   _State = SUPERV::UnKnownState ;
50   _PyInitialized = false ;
51   _Orb = CORBA::ORB::_duplicate( ORB ) ;
52   pthread_mutex_init( &_MutexWait , NULL ) ;
53   if ( pthread_cond_init( &_EventWait , NULL ) ) {
54     perror("pthread_cond_init( &_EventWait , NULL )") ;
55     exit( 0 ) ;
56   }
57   if ( pthread_cond_init( &_JoinWait , NULL ) ) {
58     perror("pthread_cond_init( &_JoinWait , NULL )") ;
59     exit( 0 ) ;
60   }
61   cdebug_out << "GraphEditor::OutNode::OutNode" << endl;
62 }
63
64 GraphExecutor::OutNode::OutNode(
65                CORBA::ORB_ptr ORB, 
66                SALOME_NamingService* ptrNamingService ,
67                const SALOME_ModuleCatalog::Service& DataFlowService ,
68                const char *DataFlowComponentName ,
69                const char *DataFlowInterfaceName ,
70                const char *DataFlowName ,
71                const SUPERV::KindOfNode DataFlowkind ,
72                const SUPERV::SDate DataFlowFirstCreation ,
73                const SUPERV::SDate DataFlowLastModification ,
74                const char * DataFlowEditorRelease ,
75                const char * DataFlowAuthor ,
76                const char * DataFlowComputer ,
77                const char * DataFlowComment ,
78                const char * DebugFileName ) :
79                Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
80                       DataFlowInterfaceName , DataFlowName , DataFlowkind ,
81                       DataFlowFirstCreation , DataFlowLastModification  ,
82                       DataFlowEditorRelease , DataFlowAuthor ,
83                       DataFlowComputer , DataFlowComment , DebugFileName ) {
84   _Valid = false ;
85   _Executable = false ;
86   _Done = false ;
87   _Threads = 0 ;
88   _ControlState = SUPERV::VoidState ;
89   _State = SUPERV::UnKnownState ;
90   _PyInitialized = false ;
91   _Orb = CORBA::ORB::_duplicate( ORB ) ;
92   pthread_mutex_init( &_MutexWait , NULL ) ;
93   if ( pthread_cond_init( &_EventWait , NULL ) ) {
94     perror("pthread_cond_init( &_EventWait , NULL )") ;
95     exit( 0 ) ;
96   }
97   if ( pthread_cond_init( &_JoinWait , NULL ) ) {
98     perror("pthread_cond_init( &_JoinWait , NULL )") ;
99     exit( 0 ) ;
100   }
101 }
102
103 GraphExecutor::OutNode::~OutNode() {
104 }
105
106 bool GraphExecutor::OutNode::LoadDataFlow(const GraphBase::SGraph &aDataFlow ) {
107   bool RetVal = false ;
108   RetVal = LoadInfo( aDataFlow.Info ) ;
109   if ( GraphBase::Service::ServiceName() != NULL ) {
110 //    MESSAGE( "GraphExecutor::OutNode::LoadDataFlow" );
111     if ( RetVal ) {
112       RetVal = LoadNodes( aDataFlow.Nodes ) ;
113       if ( RetVal ) {
114         RetVal = LoadLinks( aDataFlow.Links ) ;
115         if ( RetVal ) {
116           IsValid() ;
117           RetVal = LoadDatas( aDataFlow.Datas ) ;
118           IsExecutable() ;
119           if ( !RetVal) {
120             cdebug << "GraphExecutor::OutNode::LoadDataFlow LoadDatas Error."
121                    << endl ;
122           }
123         }
124         else {
125           cdebug << "GraphExecutor::OutNode::LoadDataFlow LoadLinks Error."
126                << endl ;
127         }
128       }
129       else {
130         cdebug << "GraphExecutor::OutNode::LoadDataFlow LoadNodes Error."
131              << endl ;
132       }
133     }
134     else {
135       cdebug << "GraphExecutor::OutNode::LoadDataFlow LoadInfo Error."
136            << endl ;
137     }
138   }
139   else {
140     cdebug << "GraphExecutor::OutNode::LoadDataFlow ServiceName Error." << endl ;
141   }
142   return RetVal ;
143 }
144
145 bool GraphExecutor::OutNode::LoadXml( const char* myFileName ) {
146   bool RetVal = false ;
147   GraphBase::SGraph aDataFlow ;
148   if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) {
149     RetVal = LoadDataFlow( aDataFlow ) ;
150 //    if ( aConstructor && RetVal )
151 //      RetVal = Name( aDataFlow.Info.theName.c_str() ) ;
152   }
153   return RetVal ;
154
155
156 bool GraphExecutor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) {
157   cdebug << "GraphExecutor::OutNode::LoadInfo" << endl ;
158 //  ComponentName( aDataFlowInfo.theComponentName.c_str()  ) ;
159   Name( aDataFlowInfo.theName.c_str()  ) ;
160   Kind( aDataFlowInfo.theKind ) ;
161   DataService( _Orb , aDataFlowInfo.theService , Graph_prof_debug() , Graph_fdebug() ) ;
162   FirstCreation( aDataFlowInfo.theFirstCreation ) ;
163   LastModification( aDataFlowInfo.theLastModification ) ;
164   EditorRelease( aDataFlowInfo.theEditorRelease.c_str()  ) ;
165   Author( aDataFlowInfo.theAuthor.c_str()   ) ;
166 //  Computer( aDataFlowInfo.theContainer.c_str()  ) ;
167   Comment( aDataFlowInfo.theComment.c_str()  ) ;
168 // Not in OutNode/DataFlow but in InNode/DataFlow_in_an_other_DataFlow
169 //  Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ;
170   return true ;
171 }
172
173 bool GraphExecutor::OutNode::LoadNodes(const GraphBase::ListOfNodes &aListOfNodes ) {
174   bool RetVal = true ;
175   GraphExecutor::InNode * anInNode ;
176   cdebug << "GraphExecutor::OutNode::LoadNodes" << endl ;
177   int i ;
178   for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
179     GraphBase::SNode aNode = aListOfNodes[ i ] ;
180     anInNode = AddNode( aNode.theService ,
181                         aNode.theListOfFuncName ,
182                         aNode.theListOfPythonFunctions ,
183                         aNode.theComponentName.c_str() ,
184                         aNode.theInterfaceName.c_str()  , aNode.theName.c_str() ,
185                         aNode.theKind ,
186                         aNode.theFirstCreation , aNode.theLastModification ,
187                         aNode.theEditorRelease.c_str() ,
188                         aNode.theAuthor.c_str()  , aNode.theContainer.c_str() ,
189                         aNode.theComment.c_str() ,
190                         aNode.theCoords.theX , aNode.theCoords.theY ) ;
191     if ( !anInNode ) {
192       RetVal = false ;
193       break ;
194     }
195     if ( anInNode->IsOneOfInLineNodes() ) {
196       anInNode->GraphExecutor::InNode::InLineNode()->DefPortsOfNode(
197                                 _Orb , aNode.theService , anInNode->NamePtr() ,
198                                 anInNode->Kind() , false ,
199                                 anInNode->IsLoopNode() || anInNode->IsEndLoopNode() ,
200                                 true , true , Graph_prof_debug() , Graph_fdebug() ) ;
201 #if 0
202       GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
203       GraphBase::LoopNode * aLNode = NULL ;
204       if ( aINode->IsLoopNode() ) {
205         aLNode = anInNode->LoopNode() ;
206         aLNode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
207                                    *aNode.theListOfPythonFunctions[ 0 ] ) ;
208         aLNode->SetMorePythonFunction( aNode.theListOfFuncName[ 1 ].c_str() ,
209                                        *aNode.theListOfPythonFunctions[ 1 ] ) ;
210         aLNode->SetNextPythonFunction( aNode.theListOfFuncName[ 2 ].c_str() ,
211                                        *aNode.theListOfPythonFunctions[ 2 ] ) ;
212       }
213       else if ( aINode->IsInLineNode() || aINode->IsGOTONode() ||
214                 aINode->IsSwitchNode() || aINode->IsEndSwitchNode() ) {
215         aINode->SetPythonFunction( aNode.theListOfFuncName[ 0 ].c_str() ,
216                                    *aNode.theListOfPythonFunctions[ 0 ] ) ;
217       }
218 #endif
219     }
220 #if 0
221     if ( aNode.theListOfParameters.size() ) { // BusPorts ...
222       int j ;
223       for ( j = 0 ; j < aNode.theListOfParameters.size() ; j++ ) {
224         GraphBase::InPort * InputPort = anInNode->AddInPort(
225                aNode.theListOfParameters[ j ].theInParameter.Parametername ,
226                aNode.theListOfParameters[ j ].theInParameter.Parametertype ) ;
227         GraphBase::OutPort * OutputPort = anInNode->AddOutPort(
228                aNode.theListOfParameters[ j ].theOutParameter.Parametername ,
229                aNode.theListOfParameters[ j ].theOutParameter.Parametertype ) ;
230         anInNode->InOutPort( InputPort , OutputPort ) ;
231       }
232     }
233 #endif
234   }
235   for ( i = 0 ; i < aListOfNodes.size() ; i++ ) {
236     GraphBase::SNode aNode = aListOfNodes[ i ] ;
237     anInNode = (GraphExecutor::InNode * ) GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ;
238     cdebug << "GraphExecutor::OutNode::LoadNodes " << anInNode->Name() << "IsOneOfGOTONodes "
239            << anInNode->IsOneOfGOTONodes() << " " << aNode.theCoupledNode.c_str() << endl ;
240     if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) {
241       GraphBase::GOTONode * aCoupledNode ;
242       aCoupledNode = (GraphBase::GOTONode * ) GetGraphNode( aNode.theName.c_str() ) ;
243       aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ; 
244     }
245   }
246   return RetVal ;
247 }
248
249 bool GraphExecutor::OutNode::LoadLinks(const GraphBase::ListOfLinks &aListOfLinks ) {
250   bool RetVal = true ;
251   cdebug << "GraphExecutor::OutNode::LoadLinks " << aListOfLinks.size()
252          << endl ;
253   int i ;
254   for ( i = 0 ; i < aListOfLinks.size() ; i++ ) {
255     GraphBase::SLink aLink = aListOfLinks[ i ] ;
256     RetVal = AddLink( aLink.FromNodeName.c_str() ,
257                       aLink.FromServiceParameterName.c_str() ,
258                       aLink.ToNodeName.c_str() ,
259                       aLink.ToServiceParameterName.c_str() ,
260                       aLink.aLinkValue ) ;
261 //                      aLink.aLinkValue.Value , aLink.aLinkValue.Kind ) ;
262     if ( !RetVal )
263       break ;
264   }
265   return RetVal ;
266 }
267
268 bool GraphExecutor::OutNode::LoadDatas(const GraphBase::ListOfLinks &aListOfDatas ) {
269   bool RetVal = true ;
270   cdebug << "GraphExecutor::OutNode::LoadDatas " << aListOfDatas.size()
271          << endl ;
272   int i ;
273   for ( i = 0 ; i < aListOfDatas.size() ; i++ ) {
274     GraphBase::SLink aLink = aListOfDatas[ i ] ;
275     if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) )
276       RetVal = GraphBase::Graph::AddInputData( aLink.ToNodeName.c_str() ,
277                                                aLink.ToServiceParameterName.c_str() ,
278                                                aLink.aLinkValue ) ;
279 //                        aLink.aLinkValue.Value , aLink.aLinkValue.Kind ) ;
280     else if ( !strcmp( aLink.ToNodeName.c_str() , Name() ) ) {
281       RetVal = AddOutputData( aLink.FromNodeName.c_str() ,
282                               aLink.FromServiceParameterName.c_str() ,
283                               aLink.aLinkValue ) ;
284 //                              aLink.aLinkValue.Value ,
285 //                              aLink.aLinkValue.Kind ) ;
286       AddLink( aLink.FromNodeName.c_str() , (GraphBase::ComputingNode *) this ) ;
287     }
288     else {
289       cdebug << "GraphExecutor::OutNode::LoadDatas Error " << aLink.FromNodeName
290            << " and " << aLink.ToNodeName << " differents from " << Name()
291            << endl ;
292       RetVal = false ;
293     }
294     if ( !RetVal )
295       break ;
296   }
297   return RetVal ;
298 }
299
300 GraphExecutor::InNode *GraphExecutor::OutNode::AddNode(
301                       const SALOME_ModuleCatalog::Service& NodeService ,
302                       GraphBase::ListOfFuncName aFuncName ,
303                       GraphBase::ListOfPythonFunctions aPythonFunction ,
304                       const char * NodeComponentName ,
305                       const char * NodeInterfaceName ,
306                       const char * NodeName ,
307                       const SUPERV::KindOfNode NodeKindOfNode ,
308                       const SUPERV::SDate NodeFirstCreation ,
309                       const SUPERV::SDate NodeLastModification  ,
310                       const char * NodeEditorRelease ,
311                       const char * NodeAuthor ,
312                       const char * NodeComputer ,
313                       const char * NodeComment ,
314                       const int NodeX ,
315                       const int NodeY ) {
316   cdebug_in << "GraphExecutor::OutNode::AddNode(" << NodeComponentName << " , "
317             << NodeName << ")" << endl;
318   GraphExecutor::InNode *Nd = NULL ;
319   Nd = new GraphExecutor::InNode( _Orb, NamingService() , NodeService ,
320                                   NodeComponentName , NodeInterfaceName ,
321                                   NodeName , NodeKindOfNode ,
322                                   aFuncName , aPythonFunction ,
323                                   NodeFirstCreation , NodeLastModification ,
324                                   NodeEditorRelease , NodeAuthor ,
325                                   NodeComputer , NodeComment , false , NodeX , NodeY ,
326                                   Graph_prof_debug() , Graph_fdebug() ) ;
327   GraphBase::Graph::AddNode( Nd->ComputingNode() ) ;
328   cdebug_out << "GraphExecutor::OutNode::AddNode" << endl;
329   return Nd ;
330 }
331
332
333 bool GraphExecutor::OutNode::AddInputData( const char* ToNodeName1 ,
334                                            const char* ToParameterName1 ,
335                                            const char* ToNodeName2 ,
336                                            const char* ToParameterName2 ) {
337   cdebug_in << "GraphExecutor::OutNode::AddInputData" << endl;
338   bool RetVal = GraphBase::Graph::AddInputData( ToNodeName1 ,
339                                                 ToParameterName1 ,
340                                                 ToNodeName2 ,
341                                                 ToParameterName2 ) ;
342   cdebug_out << "GraphExecutor::OutNode::AddInputData" << endl;
343   _Valid = false ;
344   return RetVal ;
345 }
346
347 bool GraphExecutor::OutNode::Valid() {
348   cdebug_in << "GraphExecutor::OutNode::Valid" << endl;
349
350   if ( _Valid )
351     return true ;
352
353   _Executable = false ;
354
355   CreateService() ;
356
357   if ( !Sort() ) {
358     cdebug << "This DataFlow is not valid." << endl ;
359     return false ;
360   }
361
362 //  CreateService() ;
363
364   InLineServices() ;
365
366   ComputingNodes() ;
367   
368   _Valid = true ;
369
370   cdebug_out << "GraphExecutor::OutNode::Valid" << endl;
371   return _Valid ;
372 }
373
374
375 bool GraphExecutor::OutNode::Executable() {
376
377   cdebug_in << "GraphExecutor::OutNode::Executable" << endl;
378   if ( !IsValid() )
379     return false ;
380
381   if ( DataServerNodes() )
382     _Executable = true ;
383   else {
384     cdebug << "This DataFlow is not executable." << endl ;
385     _Executable = false ;
386   }
387
388   cdebug_out << "GraphExecutor::OutNode::Executable" << endl;
389   return _Executable ;
390 }
391
392 bool GraphExecutor::OutNode::Run( const bool AndSuspend ) {
393   bool RetVal = false ;
394   cdebug_in << "GraphExecutor::OutNode::Run" << endl;
395
396   if ( Executable() ) {
397     _ControlState = SUPERV::VoidState ;
398     _SuspendedThreads = 0 ;
399     ThreadNo( pthread_self() ) ;
400     Done( false ) ;
401     _JustStarted = true ;
402     int i ;
403     for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
404       GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) GraphNodes( i )->GetInNode() ;
405       if ( !PyInitialized() && anInNode->IsOneOfInLineNodes() ) {
406         if ( !Py_IsInitialized() ) {
407           Py_Initialize() ;
408         }
409         anInNode->InitPython() ;
410         PyInitialized( true ) ;
411       }
412       anInNode->InitialState( this ) ;
413     }
414
415     cdebug << "Execution starting GraphExecutor::Action_DataOk_RunService Node "
416            << Name() << endl ;
417
418     PushEvent( NULL , GraphExecutor::ReadyEvent ,
419                SUPERV::DataReadyState ) ; 
420     State( SUPERV::DataReadyState ) ;
421
422     for ( i = 0 ; i < HeadNodesSize() ; i++ ) {
423       GraphExecutor::InNode * anInNode = (GraphExecutor::InNode *) HeadNodes( i )->GetInNode() ;
424       if ( anInNode->State() != SUPERV::DataReadyState ) {
425         cdebug << "GraphExecutor::OutNode::Run inconsistency State of Node "
426              << anInNode->Name() << " : " << anInNode->State() << endl ;
427         return false ;
428       }
429 //      PushEvent( anInNode , GraphExecutor::ReadyEvent ,
430 //                 SUPERV::DataReadyState ) ; 
431       anInNode->CreateNewThread( true ) ;
432       anInNode->DataFromNode( Name() ) ;
433       if ( AndSuspend ) {
434         anInNode->State( SUPERV::DataWaitingState ) ;
435         anInNode->ControlState( SUPERV::ToSuspendStartState ) ;
436         if ( !anInNode->SendEvent( GraphExecutor::SomeDataReadyEvent ) ) {
437           cdebug << "InNode::SendEvent( SomeDataReadyEvent ) Node "
438                  << anInNode->Name() << endl ;
439           return false ;
440         }
441         anInNode->SuspendedWait() ;
442       }
443       else if ( !anInNode->SendEvent( GraphExecutor::ExecuteEvent ) ) {
444         cdebug << "InNode::SendEvent( RunningEvent ) Node "
445                << anInNode->Name() << endl ;
446         return false ;
447       }
448       else {
449         anInNode->RunningWait() ;
450       }
451     }
452
453     if ( AndSuspend ) {
454       PushEvent( NULL , GraphExecutor::SuspendedReadyEvent ,
455                  SUPERV::SuspendedReadyState ) ; 
456     }
457     else {
458       PushEvent( NULL , GraphExecutor::ExecutingEvent ,
459                  SUPERV::ExecutingState ) ; 
460       if (AutomatonState() == SUPERV::DataReadyState) {
461           State( SUPERV::ExecutingState ) ;
462       };
463     }
464
465     RetVal = true ;
466   }
467   else {
468     PushEvent( NULL , GraphExecutor::NoDataReadyEvent ,
469                SUPERV::DataUndefState ) ; 
470   }
471
472   cdebug_out << "GraphExecutor::OutNode::Run" << endl ;
473   return RetVal ;
474 }
475
476 bool GraphExecutor::OutNode::Run( const char * aNodeName ,
477                                   const char * AtNodeName ,
478                                   const bool AndSuspend ) {
479   bool RetVal = false ;
480   cdebug_in << "GraphExecutor::OutNode::Run( " << aNodeName << " , "
481             << AtNodeName << " , " << AndSuspend << ")" << endl;
482   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode() ;
483   if ( anInNode ) {
484     RetVal = anInNode->ReStart( AtNodeName , AndSuspend ) ;
485   }
486   cdebug_out << "GraphExecutor::OutNode::Run" << endl ;
487   return RetVal ;
488 }
489
490 void GraphExecutor::OutNode::CheckAllDone() {
491   int j ;
492   cdebug_in << "GraphExecutor::OutNode::CheckAllDone " << endl;
493   SUPERV::AutomatonState OutNodeState = SUPERV::SuccessedState ;
494   SUPERV::AutomatonState InNodeState ;
495   bool AllDone = true ;
496   if ( !_Done ) {
497     for ( j = 0 ; j < QueueNodesSize() ; j++ ) {
498       InNodeState = ( (GraphExecutor::InNode * ) QueueNodes( j )->GetInNode() )->State() ;
499       cdebug << j << ". "
500              << ( (GraphExecutor::InNode * ) QueueNodes( j )->GetInNode() )->Name()
501              << " " << theAutomaton->StateName( InNodeState ) << endl ;
502       if ( InNodeState != SUPERV::SuccessedState &&
503            InNodeState != SUPERV::ErroredState &&
504            InNodeState != SUPERV::DataWaitingState ) {
505         AllDone = false ;
506       }
507       if ( InNodeState != SUPERV::SuccessedState ) {
508         OutNodeState = InNodeState ;
509       }
510     }
511     if ( AllDone ) {
512       if( _Threads == 0 && _SuspendedThreads == 0 ) {
513         if ( OutNodeState != SUPERV::ErroredState ) {
514           OutNodeState = SUPERV::SuccessedState ;
515         }
516       }
517       else {
518         AllDone = false ;
519       }
520     }
521     if ( AllDone ) {
522       State( OutNodeState ) ;
523       _Done = true ;
524       _JustStarted = false ;
525       for ( j = 0 ; j < GraphNodesSize()  ; j++ ) {
526         GraphExecutor::InNode * aNode ;
527         aNode = (GraphExecutor::InNode * ) GraphNodes( j )->GetInNode() ;
528         SUPERV::GraphState aState = AutomatonGraphState( aNode->State() ) ;
529         cdebug << "GraphExecutor::OutNode::CheckAllDone " << aNode->Name() << " "
530                << theAutomaton->StateName( aNode->State() ) << " :" << endl ;
531         if ( aState == SUPERV::ErrorState ||
532              aState == SUPERV::SuspendErroredState ||
533              aState == SUPERV::KillState ||
534              aState == SUPERV::StopState ) {
535           OutNodeState = aNode->State() ;
536         }
537         aNode->SuspendedAction() ;
538         aNode->DoneAction() ;
539       }
540 // PushEvent AFTER State and _Done ! ...
541       PushEvent( NULL , GraphExecutor::EndExecuteEvent ,
542                  OutNodeState ) ;
543       Py_Finalize() ;
544       PyInitialized( false ) ;
545     }
546   }
547   cdebug_out << "GraphExecutor::OutNode::CheckAllDone " << _Done
548              << " GraphAutomatonState " << theAutomaton->StateName( AutomatonState() )
549              << " State " << State() << " Threads " << _Threads << " SuspendedThreads "
550              << _SuspendedThreads << endl ;
551 }
552
553 void GraphExecutor::OutNode::NewThread() {
554   if ( pthread_mutex_lock( &_MutexWait ) ) {
555     perror("pthread_mutex_lock _NewThread") ;
556     exit( 0 ) ;
557   }
558   _Threads += 1 ;
559   cdebug << "NewThread : " << _Threads << " running threads "
560          << _SuspendedThreads << " suspended threads"
561          << endl ;
562   if ( pthread_mutex_unlock( &_MutexWait ) ) {
563     perror("pthread_mutex_unlock _NewThread") ;
564     exit( 0 ) ;
565   }
566 }
567 void GraphExecutor::OutNode::ExitThread() {
568   if ( pthread_mutex_lock( &_MutexWait ) ) {
569     perror("pthread_mutex_lock _ExitThread") ;
570     exit( 0 ) ;
571   }
572   _Threads -= 1 ;
573   theAutomaton->JoinThread( pthread_self() ) ;
574   if ( pthread_cond_signal( &_JoinWait ) ) {
575     perror("ExitThread pthread_cond_signal ") ;
576   }
577   cdebug << "ExitThread : " << _Threads << " running threads "
578          << _SuspendedThreads << " suspended threads"
579          << endl ;
580   if ( pthread_mutex_unlock( &_MutexWait ) ) {
581     perror("pthread_mutex_unlock _ExitThread") ;
582     exit( 0 ) ;
583   }
584   if ( _Threads == 0 && _SuspendedThreads == 0 ) {
585     CheckAllDone() ;
586   }
587 }
588 void GraphExecutor::OutNode::JoinedWait() {
589   if ( pthread_mutex_lock( &_MutexWait ) ) {
590     perror("pthread_mutex_lock JoinedWait") ;
591     exit( 0 ) ;
592   }
593   while ( _Threads ) {
594     if ( pthread_cond_wait( &_JoinWait , &_MutexWait ) ) {
595       perror("JoinedWait pthread_cond_wait ") ;
596     }
597   }
598   if ( pthread_mutex_unlock( &_MutexWait ) ) {
599     perror("pthread_mutex_unlock JoinedWait") ;
600     exit( 0 ) ;
601   }
602 }
603 void GraphExecutor::OutNode::SuspendThread() {
604   if ( pthread_mutex_lock( &_MutexWait ) ) {
605     perror("pthread_mutex_lock _SuspendThread") ;
606     exit( 0 ) ;
607   }
608   _SuspendedThreads += 1 ;
609   cdebug << "SuspendThread : " << _Threads << " running threads "
610          << _SuspendedThreads << " suspended threads"
611          << endl ;
612   if ( pthread_mutex_unlock( &_MutexWait ) ) {
613     perror("pthread_mutex_unlock _SuspendThread") ;
614     exit( 0 ) ;
615   }
616   if ( IsSuspended() ) {
617     PushEvent( NULL , GraphExecutor::SuspendEvent , SUPERV::SuspendedState ) ;
618   }
619 }
620 void GraphExecutor::OutNode::ResumeThread() {
621   if ( pthread_mutex_lock( &_MutexWait ) ) {
622     perror("pthread_mutex_lock _ResumeThread") ;
623     exit( 0 ) ;
624   }
625   _SuspendedThreads -= 1 ;
626   cdebug << "ResumeThread : " << _Threads << " running threads "
627          << _SuspendedThreads << " suspended threads"
628          << endl ;
629   if ( pthread_mutex_unlock( &_MutexWait ) ) {
630     perror("pthread_mutex_unlock _ResumeThread") ;
631     exit( 0 ) ;
632   }
633 }
634
635 long GraphExecutor::OutNode::Thread( const char * aNodeName ) {
636   long RetVal = 0 ;
637   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( aNodeName )->GetInNode() ;
638   if ( anInNode ) {
639     RetVal = anInNode->ThreadNo() ;
640   }
641   return RetVal ;
642 }
643
644 SUPERV::GraphEvent GraphExecutor::OutNode::AutomatonGraphEvent(GraphExecutor::NodeEvent anEvent ) {
645   SUPERV::GraphEvent aGraphEvent ;
646   switch ( anEvent ) {
647   case GraphExecutor::UndefinedEvent : {
648     aGraphEvent = SUPERV::UndefinedEvent ;
649     break ;
650   }
651   case GraphExecutor::NewThreadEvent : {
652     aGraphEvent = SUPERV::NewThreadEvent ;
653     break ;
654   }
655   case GraphExecutor::SuspendEvent : {
656     aGraphEvent = SUPERV::SuspendEvent ;
657     break ;
658   }
659   case GraphExecutor::ResumeEvent : {
660     aGraphEvent = SUPERV::ResumeEvent ;
661     break ;
662   }
663   case GraphExecutor::KillEvent : {
664     aGraphEvent = SUPERV::KillEvent ;
665     break ;
666   }
667   case GraphExecutor::StopEvent : {
668     aGraphEvent = SUPERV::StopEvent ;
669     break ;
670   }
671   case GraphExecutor::ExecuteEvent : {
672     aGraphEvent = SUPERV::RunningEvent ;
673     break ;
674   }
675   case GraphExecutor::SuccessEvent : {
676     aGraphEvent = SUPERV::DoneEvent ;
677     break ;
678   }
679   case GraphExecutor::ErrorEvent : {
680     aGraphEvent = SUPERV::ErroredEvent ;
681     break ;
682   }
683   case GraphExecutor::ReStartEvent : {
684     aGraphEvent = SUPERV::ReRunEvent ;
685     break ;
686   }
687   case GraphExecutor::ReStartAndSuspendEvent : {
688     aGraphEvent = SUPERV::ReStartEvent ;
689     break ;
690   }
691   case GraphExecutor::NoDataReadyEvent : {
692     aGraphEvent = SUPERV::WaitingEvent ;
693     break ;
694   }
695   case GraphExecutor::SomeDataReadyEvent : {
696     aGraphEvent = SUPERV::WaitingEvent ;
697     break ;
698   }
699   case GraphExecutor::NotAllDataReadyEvent : {
700     aGraphEvent = SUPERV::WaitingEvent ;
701     break ;
702   }
703   case GraphExecutor::AllDataReadyEvent : {
704     aGraphEvent = SUPERV::ReadyEvent ;
705     break ;
706   }
707   case GraphExecutor::ReadyEvent : {
708     aGraphEvent = SUPERV::ReadyEvent ;
709     break ;
710   }
711   case GraphExecutor::SuspendedReadyEvent : {
712     aGraphEvent = SUPERV::SuspendEvent ;
713     break ;
714   }
715   case GraphExecutor::ResumedReadyEvent : {
716     aGraphEvent = SUPERV::ResumeEvent ;
717     break ;
718   }
719   case GraphExecutor::KilledReadyEvent : {
720     aGraphEvent = SUPERV::KillEvent ;
721     break ;
722   }
723   case GraphExecutor::StoppedReadyEvent : {
724     aGraphEvent = SUPERV::StopEvent ;
725     break ;
726   }
727   case GraphExecutor::ExecutingEvent : {
728     aGraphEvent = SUPERV::RunningEvent ;
729     break ;
730   }
731   case GraphExecutor::SuspendedExecutingEvent : {
732     aGraphEvent = SUPERV::SuspendEvent ;
733     break ;
734   }
735   case GraphExecutor::ResumedExecutingEvent : {
736     aGraphEvent = SUPERV::ResumeEvent ;
737     break ;
738   }
739   case GraphExecutor::KilledExecutingEvent : {
740     aGraphEvent = SUPERV::KillEvent ;
741     break ;
742   }
743   case GraphExecutor::StoppedExecutingEvent : {
744     aGraphEvent = SUPERV::StopEvent ;
745     break ;
746   }
747   case GraphExecutor::SuccessedExecutingEvent : {
748     aGraphEvent = SUPERV::DoneEvent ;
749     break ;
750   }
751   case GraphExecutor::ErroredExecutingEvent : {
752     aGraphEvent = SUPERV:: ErroredEvent;
753     break ;
754   }
755   case GraphExecutor::SuspendedSuccessedEvent : {
756     aGraphEvent = SUPERV::SuspendEvent ;
757     break ;
758   }
759   case GraphExecutor::SuspendedErroredEvent : {
760     aGraphEvent = SUPERV::SuspendEvent ;
761     break ;
762   }
763   case GraphExecutor::ResumedSuccessedEvent : {
764     aGraphEvent = SUPERV::ResumeEvent ;
765     break ;
766   }
767   case GraphExecutor::ResumedErroredEvent : {
768     aGraphEvent = SUPERV::ResumeEvent ;
769     break ;
770   }
771   case GraphExecutor::KilledEvent : {
772     aGraphEvent = SUPERV::KillEvent ;
773     break ;
774   }
775   case GraphExecutor::StoppedEvent : {
776     aGraphEvent = SUPERV::StopEvent ;
777     break ;
778   }
779   case GraphExecutor::ReStartedEvent : {
780     aGraphEvent = SUPERV::ReRunEvent ;
781     break ;
782   }
783   case GraphExecutor::ReStartedAndSuspendEvent : {
784     aGraphEvent = SUPERV::ReStartEvent ;
785     break ;
786   }
787   case GraphExecutor::EndExecuteEvent : {
788     aGraphEvent = SUPERV::DoneEvent ;
789     break ;
790   }
791   default : {
792     cdebug << " GraphExecutor::OutNode::AutomatonGraphEvent Error Undefined Event : "
793            << anEvent << endl ;
794     aGraphEvent = SUPERV::UndefinedEvent ;
795   }
796   }
797   return aGraphEvent ;
798 }
799
800 SUPERV::GraphState GraphExecutor::OutNode::AutomatonGraphState(SUPERV::AutomatonState aState ) {
801   SUPERV::GraphState aGraphState ;
802   switch ( aState ) {
803   case SUPERV::UnKnownState : {
804     aGraphState = SUPERV::UndefinedState ;
805     break ;
806   }
807   case SUPERV::DataUndefState : {
808     aGraphState = SUPERV::UndefinedState ;
809     break ;
810   }
811   case SUPERV::DataWaitingState : {
812     aGraphState = SUPERV::WaitingState ;
813     break ;
814   }
815   case SUPERV::DataReadyState : {
816     aGraphState = SUPERV::ReadyState ;
817     break ;
818   }
819   case SUPERV::SuspendedReadyState : {
820     aGraphState = SUPERV::SuspendReadyState ;
821     break ;
822   }
823   case SUPERV::ResumedReadyState : {
824     aGraphState = SUPERV::ReadyState ;
825     break ;
826   }
827   case SUPERV::KilledReadyState : {
828     aGraphState = SUPERV::KillState ;
829     break ;
830   }
831   case SUPERV::StoppedReadyState : {
832     aGraphState = SUPERV::StopState ;
833     break ;
834   }
835   case SUPERV::ExecutingState : {
836     aGraphState = SUPERV::RunningState ;
837     break ;
838   }
839   case SUPERV::SuspendedExecutingState : {
840     aGraphState = SUPERV::SuspendState ;
841     break ;
842   }
843   case SUPERV::ResumedExecutingState : {
844     aGraphState = SUPERV::RunningState ;
845     break ;
846   }
847   case SUPERV::KilledExecutingState : {
848     aGraphState = SUPERV::KillState ;
849     break ;
850   }
851   case SUPERV::StoppedExecutingState : {
852     aGraphState = SUPERV::StopState ;
853     break ;
854   }
855   case SUPERV::SuccessedExecutingState : {
856     aGraphState = SUPERV::DoneState ;
857     break ;
858   }
859   case SUPERV::ErroredExecutingState : {
860     aGraphState = SUPERV::ErrorState ;
861     break ;
862   }
863   case SUPERV::SuspendedSuccessedState : {
864     aGraphState = SUPERV::SuspendDoneState ;
865     break ;
866   }
867   case SUPERV::SuspendedErroredState : {
868     aGraphState = SUPERV::SuspendErroredState ;
869     break ;
870   }
871   case SUPERV::ResumedSuccessedState : {
872     aGraphState = SUPERV::DoneState ;
873     break ;
874   }
875   case SUPERV::ResumedErroredState : {
876     aGraphState = SUPERV::ErrorState ;
877     break ;
878   }
879   case SUPERV::KilledSuccessedState : {
880     aGraphState = SUPERV::KillState ;
881     break ;
882   }
883   case SUPERV::KilledErroredState : {
884     aGraphState = SUPERV::KillState ;
885     break ;
886   }
887   case SUPERV::StoppedSuccessedState : {
888     aGraphState = SUPERV::StopState ;
889     break ;
890   }
891   case SUPERV::StoppedErroredState : {
892     aGraphState = SUPERV::StopState ;
893     break ;
894   }
895   case SUPERV::SuccessedState : {
896     aGraphState = SUPERV::DoneState ;
897     break ;
898   }
899   case SUPERV::ErroredState : {
900     aGraphState = SUPERV::ErrorState ;
901     break ;
902   }
903   case SUPERV::SuspendedState : {
904     aGraphState = SUPERV::SuspendState ;
905     break ;
906   }
907   case SUPERV::KilledState : {
908     aGraphState = SUPERV::KillState ;
909     break ;
910   }
911   case SUPERV::StoppedState : {
912     aGraphState = SUPERV::StopState ;
913     break ;
914   }
915   case SUPERV::ReRunnedState : {
916     aGraphState = SUPERV::ReRunState ;
917     break ;
918   }
919   case SUPERV::ReStartedState : {
920     aGraphState = SUPERV::ReStartState ;
921     break ;
922   }
923   default : {
924     cdebug << " GraphExecutor::OutNode::AutomatonGraphState Error Undefined State : "
925            << aGraphState << endl ;
926     aGraphState = SUPERV::UndefinedState ;
927   }
928   }
929   return aGraphState ;
930 }
931
932 bool GraphExecutor::OutNode::PushEvent( GraphExecutor::InNode * aNode ,
933                                         GraphExecutor::NodeEvent anEvent ,
934                                         SUPERV::AutomatonState aState ) {
935   cdebug_in << "PushEvent Threads " << Threads() << " SuspendedThreads "
936             << SuspendedThreads() << endl ;
937   if ( pthread_mutex_lock( &_MutexWait ) ) {
938     perror("PushEvent pthread_mutex_lock ") ;
939     exit( 0 ) ;
940   }
941   if ( aNode ) {
942     _EventNodes.push_back( aNode->Name() ) ;
943   }
944   else {
945     _EventNodes.push_back( Name() ) ;
946   }
947   _Events.push_back( anEvent ) ;
948   _States.push_back( aState ) ;
949   pthread_cond_broadcast( &_EventWait );
950   if ( aNode ) {
951     cdebug << aNode->ThreadNo() << " PushEvent " << aNode->Name() ;
952     cdebug << " " << aNode->Automaton()->EventName( anEvent )
953            << " " << aNode->Automaton()->StateName( aState )
954            << " ControleState "
955            << aNode->Automaton()->ControlStateName( aNode->ControlState() ) ;
956   }
957   else {
958     cdebug << "PushEvent " << Name() ;
959     cdebug << " " << theAutomaton->EventName( anEvent ) << " "
960            << theAutomaton->StateName( aState ) ;
961   }
962   cdebug_out << "PushEvent Threads " << Threads() << " SuspendedThreads "
963              << SuspendedThreads() << endl ;
964   if ( pthread_mutex_unlock( &_MutexWait ) ) {
965     perror("PushEvent pthread_mutex_unlock ") ;
966     exit( 0 ) ;
967   }
968 }
969
970 bool GraphExecutor::OutNode::StateWait( SUPERV::GraphState aState ) {
971 }
972
973 bool GraphExecutor::OutNode::Event( char ** aNodeName ,
974                                     SUPERV::GraphEvent & anEvent ,
975                                     SUPERV::GraphState & aState ,
976                                     bool WithWait ) {
977   int ThreadsNumber ;
978   int SuspendedThreadsNumber ;
979   if ( pthread_mutex_lock( &_MutexWait ) ) {
980     perror("EventLoop pthread_mutex_lock ") ;
981     exit( 0 ) ;
982   }
983   _JustStarted = false ;
984   ThreadsNumber = Threads() ;
985   SuspendedThreadsNumber = SuspendedThreads() ;
986   bool RetVal = ( ThreadsNumber - SuspendedThreadsNumber) != 0 ||
987                 _EventNodes.size() > 0 ;
988   char * NodeName = "" ;
989   GraphExecutor::NodeEvent theEvent = GraphExecutor::UndefinedEvent ;
990   SUPERV::AutomatonState theState = SUPERV::UnKnownState ;
991   anEvent = SUPERV::UndefinedEvent ;
992   aState = SUPERV::UndefinedState ;
993   if ( ( IsDone() || IsKilled() || IsStopped() ) && _EventNodes.size() == 0 ) {
994     cdebug << "EventLoop IsDone()/IsKilled()/IsStopped() && _EventNodes.size() == 0" << endl ;
995     RetVal = false ;
996   }
997   else if ( !WithWait && _EventNodes.size() == 0 ) {
998     anEvent = SUPERV::NoEvent ;
999     aState = SUPERV::NoState ;
1000     RetVal = true ;
1001   }
1002   else if ( RetVal ) {
1003     while ( !IsSuspended() && _EventNodes.size() == 0 ) {
1004       cdebug << "EventLoop pthread_cond_wait _EventWait" << endl ;
1005       pthread_cond_wait( &_EventWait , &_MutexWait );
1006       cdebug << "EventLoop pthread_cond_waited _EventWait"
1007              << " _EventNodes.size() " << _EventNodes.size() << endl ;
1008     }
1009     if ( _EventNodes.size() ) {
1010       ThreadsNumber = Threads() ;
1011       NodeName = _EventNodes.front() ;
1012       _EventNodes.pop_front() ;
1013       theEvent = _Events.front() ;
1014       anEvent = AutomatonGraphEvent( theEvent ) ;
1015       _Events.pop_front() ;
1016       theState = _States.front() ;
1017       aState = AutomatonGraphState( theState ) ;
1018       _States.pop_front() ;
1019     }
1020   }
1021   *aNodeName = NodeName ;
1022   if ( IsSuspended() && _EventNodes.size() == 0 ) {
1023     RetVal = false ;
1024   }
1025   if ( anEvent != SUPERV::NoEvent ) {
1026     cdebug << pthread_self() << "EventLoop "
1027            << NodeName << " " << theAutomaton->StateName( theState )
1028            << " _EventNodes.size() " << _EventNodes.size()
1029            << " Threads " << Threads() << " SuspendedThreads "
1030            << SuspendedThreads() << " RetVal " << RetVal << endl ;
1031   }
1032   if ( pthread_mutex_unlock( &_MutexWait ) ) {
1033     perror("EventLoop pthread_mutex_lock ") ;
1034     exit( 0 ) ;
1035   }
1036   return RetVal ;
1037 }
1038
1039 bool GraphExecutor::OutNode::EventW( char ** aNodeName ,
1040                                      SUPERV::GraphEvent & anEvent ,
1041                                      SUPERV::GraphState & aState ) {
1042   bool sts = true ;
1043   char * NodeName ;
1044   aState = SUPERV::UndefinedState ;
1045   while ( sts &&
1046           aState != SUPERV::SuspendReadyState &&
1047           aState != SUPERV::RunningState &&
1048           aState != SUPERV::SuspendDoneState &&
1049           aState != SUPERV::SuspendErroredState ) {
1050     NodeName = Name() ;
1051     while ( sts && !strcmp( NodeName , Name() ) ) {
1052       sts = EventWait( aNodeName , anEvent , aState ) ;
1053       NodeName = *aNodeName ;
1054     }
1055   }
1056   return sts ;
1057 }
1058
1059 bool GraphExecutor::OutNode::EventWait( char ** aNodeName ,
1060                                         SUPERV::GraphEvent & anEvent ,
1061                                         SUPERV::GraphState & aState ) {
1062   if ( pthread_mutex_lock( &_MutexWait ) ) {
1063     perror("EventW pthread_mutex_lock ") ;
1064     exit( 0 ) ;
1065   }
1066   int ThreadsNumber ;
1067   int SuspendedThreadsNumber ;
1068   ThreadsNumber = Threads() ;
1069   SuspendedThreadsNumber = SuspendedThreads() ;
1070   bool RetVal = ( ThreadsNumber - SuspendedThreadsNumber) != 0 ||
1071                 _EventNodes.size() > 0 ;
1072   cdebug << "--> EventW RetVal " << RetVal << endl ;
1073   char * NodeName = "" ;
1074   GraphExecutor::NodeEvent theEvent = GraphExecutor::UndefinedEvent ;
1075   SUPERV::AutomatonState theState = SUPERV::UnKnownState ;
1076   anEvent = SUPERV::UndefinedEvent ;
1077   aState = SUPERV::UndefinedState ;
1078   if ( IsDone() && _EventNodes.size() == 0 ) {
1079     cdebug << "EventW IsDone() && _EventNodes.size() == 0" << endl ;
1080     RetVal = 0 ;
1081   }
1082   else if ( RetVal ) {
1083     GraphExecutor::InNode * aNode = NULL ;
1084     while ( aNode == NULL && RetVal ) {
1085       NodeName = _EventNodes.front() ;
1086       theEvent = _Events.front() ;
1087       anEvent = AutomatonGraphEvent( theEvent ) ;
1088       theState = _States.front() ;
1089       aState = AutomatonGraphState( theState ) ;
1090
1091       if ( _JustStarted ) {
1092         _JustStarted = false ;
1093       }
1094       else {
1095         _EventNodes.pop_front() ;
1096         _Events.pop_front() ;
1097         _States.pop_front() ;
1098       }
1099
1100       aNode = ((GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode()) ;
1101       cdebug << "EventW Previous Node " << NodeName << " ThreadsNumber "
1102              << ThreadsNumber
1103              << " _EventNodes.size() " << _EventNodes.size() << " "
1104              << theAutomaton->StateName( theState )
1105              << " Threads " << Threads() << " SuspendedThreads "
1106              << SuspendedThreads() << endl ;
1107       if ( aNode ) {
1108       }
1109       else if ( IsDone() && _EventNodes.size() == 0 ) {
1110         cdebug << "EventW IsDone() && _EventNodes.size() == 0" << endl ;
1111         RetVal = 0 ;
1112       }
1113       else {
1114         cdebug << "EventW Not InNode " << NodeName
1115                << " _EventNodes.size() " << _EventNodes.size() << endl ;
1116         while ( _EventNodes.size() == 0 ) {
1117           pthread_cond_wait( &_EventWait , &_MutexWait );
1118         }
1119         cdebug << "EventW pthread_cond_waited Not InNode " << NodeName
1120                << " _EventNodes.size() " << _EventNodes.size() << endl ;
1121       }
1122     }
1123
1124     if ( aNode ) {
1125       if ( aState == SUPERV::SuspendState ||
1126            aState == SUPERV::SuspendReadyState ||
1127            aState == SUPERV::SuspendDoneState ||
1128            aState == SUPERV::SuspendErroredState ) {
1129         aNode->ControlState( SUPERV::ToSuspendState ) ;
1130         if ( aNode->IsSuspended() ) {
1131           if ( pthread_mutex_unlock( &_MutexWait ) ) {
1132             perror("EventW pthread_mutex_lock ") ;
1133             exit( 0 ) ;
1134           }
1135           cdebug << "EventW " << aNode->Name() << " ResumeAction" << endl ;
1136           aNode->ResumeAction( GraphExecutor::ToResumeEvent ) ;
1137           cdebug << "EventW " << aNode->Name() << " ResumedAction" << endl ;
1138           if ( pthread_mutex_lock( &_MutexWait ) ) {
1139             perror("EventW pthread_mutex_lock ") ;
1140             exit( 0 ) ;
1141           }
1142         }
1143         else {
1144           cdebug << "EventW inconsistent SuspendState" << endl ;
1145           RetVal = false ; 
1146         }
1147       }
1148       else {
1149         if ( aNode->IsDone() ) {
1150           RetVal = true ;
1151         }
1152         else {
1153           cdebug << "EventW NOT SuspendedState _EventNodes.size() "
1154                  << _EventNodes.size() << endl ;
1155           RetVal = true ;
1156         }
1157       }
1158       if ( RetVal ) {
1159         cdebug << "EventW " << aNode->Name() << " pthread_cond_wait" << endl ;
1160         while ( _EventNodes.size() == 0 ) {
1161           pthread_cond_wait( &_EventWait , &_MutexWait );
1162         }
1163         ThreadsNumber = Threads() ;
1164         NodeName = _EventNodes.front() ;
1165         theEvent = _Events.front() ;
1166         anEvent = AutomatonGraphEvent( theEvent ) ;
1167         theState = _States.front() ;
1168         aState = AutomatonGraphState( theState ) ;
1169       }
1170     }
1171   }
1172   *aNodeName = NodeName ;
1173   cdebug << "<-- EventW RetVal " << RetVal << " " << NodeName
1174          << " Threads " << Threads() << " SuspendedThreads "
1175          << SuspendedThreads()
1176          << " _EventNodes.size() " << _EventNodes.size()
1177          << " " << theAutomaton->EventName( theEvent ) << " "
1178          << theAutomaton->StateName( theState ) << endl ;
1179   if ( pthread_mutex_unlock( &_MutexWait ) ) {
1180     perror("EventW pthread_mutex_lock ") ;
1181     exit( 0 ) ;
1182   }
1183   return RetVal ;
1184 }
1185
1186 void GraphExecutor::OutNode::State(SUPERV::AutomatonState aState ) {
1187   _State = aState ;
1188 }
1189
1190 SUPERV::GraphState GraphExecutor::OutNode::State() {
1191 //  cdebug_in << "GraphExecutor::OutNode::State" << endl;
1192 //  cdebug_out << "GraphExecutor::OutNode::State" << endl ;
1193 //  cdebug << "GraphExecutor::OutNode::State GraphState "
1194 //         << theAutomaton->StateName( AutomatonGraphState( _State ) ) << endl ;
1195   return AutomatonGraphState( _State ) ;
1196 }
1197
1198 SUPERV::GraphState GraphExecutor::OutNode::State( const char * NodeName ) {
1199 //  cdebug_in << "GraphExecutor::OutNode::State " << NodeName << endl;
1200   SUPERV::AutomatonState aret = SUPERV::UnKnownState ;
1201   const GraphBase::ComputingNode * aCNode =  GetGraphNode( NodeName ) ;
1202   if ( aCNode ) {
1203     GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *)aCNode->GetInNode() ;
1204     if ( anInNode ) {
1205       aret = anInNode->State() ;
1206       cdebug << "GraphExecutor::OutNode::State( " << NodeName << " ) "
1207              << theAutomaton->StateName( AutomatonGraphState( aret ) ) << endl ;
1208     }
1209   }
1210 //  cdebug_out << "GraphExecutor::OutNode::State" << endl ;
1211   return AutomatonGraphState( aret ) ;
1212 }
1213
1214 SUPERV::GraphState GraphExecutor::OutNode::State(
1215                                     const char * NodeName ,
1216                                     const char * ServiceParameterName )  {
1217 //  cdebug_in << "GraphExecutor::OutNode::State " << NodeName << " "
1218 //            << ServiceParameterName<< endl;
1219   SUPERV::GraphState aret =
1220                     PortState( NodeName , ServiceParameterName ) ;
1221 //  cdebug_out << "GraphExecutor::OutNode::State" << endl ;
1222   return aret ;
1223 }
1224
1225 SUPERV::AutomatonState GraphExecutor::OutNode::AutomatonState() {
1226 //  cdebug_in << "GraphExecutor::OutNode::AutomatonState" << endl;
1227 //  cdebug_out << "GraphExecutor::OutNode::AutomatonState" << endl ;
1228   return _State ;
1229 }
1230
1231 SUPERV::AutomatonState GraphExecutor::OutNode::AutomatonState( const char * NodeName ) {
1232 //  cdebug_in << "GraphExecutor::OutNode::AutomatonState " << NodeName << endl;
1233   SUPERV::AutomatonState aret = SUPERV::UnKnownState ;
1234   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1235   if ( anInNode )
1236     aret = anInNode->State() ;
1237 //  cdebug_out << "GraphExecutor::OutNode::AutomatonState" << endl ;
1238   return aret ;
1239 }
1240
1241 SUPERV::ControlState GraphExecutor::OutNode::ControlState() {
1242 //  cdebug_in << "GraphExecutor::OutNode::ControlState" << endl;
1243 //  cdebug_out << "GraphExecutor::OutNode::ControlState" << endl ;
1244   return _ControlState ;
1245 }
1246
1247 SUPERV::ControlState GraphExecutor::OutNode::ControlState( const char * NodeName ) {
1248 //  cdebug_in << "GraphExecutor::OutNode::ControlState " << NodeName << endl;
1249   SUPERV::ControlState aret = SUPERV::VoidState ;
1250   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1251   if ( anInNode )
1252     aret = anInNode->ControlState() ;
1253 //  cdebug_out << "GraphExecutor::OutNode::ControlState" << endl ;
1254   return aret ;
1255 }
1256
1257 void GraphExecutor::OutNode::ControlClear() {
1258 //  cdebug_in << "GraphExecutor::OutNode::ControlClear" << endl;
1259 //  cdebug_out << "GraphExecutor::OutNode::ControlClear" << endl ;
1260   _ControlState = SUPERV::VoidState;
1261 }
1262
1263 void GraphExecutor::OutNode::ControlClear( const char * NodeName ) {
1264 //  cdebug_in << "GraphExecutor::OutNode::ControlClear " << NodeName << endl;
1265   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1266   if ( anInNode )
1267     anInNode->ControlClear() ;
1268 //  cdebug_out << "GraphExecutor::OutNode::ControlClear" << endl ;
1269 }
1270
1271 bool GraphExecutor::OutNode::IsWaiting() {
1272 //  cdebug_in << "GraphExecutor::OutNode::IsWaiting" << endl;
1273 //  cdebug_out << "GraphExecutor::OutNode::IsWaiting" << endl ;
1274   return !_Done ;
1275 }
1276
1277 bool GraphExecutor::OutNode::IsReady() {
1278 //  cdebug_in << "GraphExecutor::OutNode::IsReady" << endl;
1279 //  cdebug_out << "GraphExecutor::OutNode::IsReady" << endl ;
1280   return !_Done ;
1281 }
1282
1283 bool GraphExecutor::OutNode::IsRunning() {
1284 //  cdebug_in << "GraphExecutor::OutNode::IsRunning" << endl;
1285 //  cdebug_out << "GraphExecutor::OutNode::IsRunning" << endl ;
1286   return !_Done ;
1287 }
1288
1289 bool GraphExecutor::OutNode::IsDone() {
1290 //  cdebug_in << "GraphExecutor::OutNode::IsDone" << endl;
1291 //  cdebug_out << "GraphExecutor::OutNode::IsDone" << endl ;
1292   return ( _Done || IsKilled() || IsStopped() ) ;
1293 }
1294
1295 bool GraphExecutor::OutNode::IsSuspended() {
1296 //  cdebug_in << "GraphExecutor::OutNode::IsSuspended" << endl;
1297   bool aret = false ;
1298   if ( _SuspendedThreads == _Threads ) {
1299     aret = true ;
1300   }
1301 //  cdebug_out << "GraphExecutor::OutNode::IsSuspended" << endl ;
1302   return aret ;
1303 }
1304
1305 bool GraphExecutor::OutNode::IsKilled() {
1306 //  cdebug_in << "GraphExecutor::OutNode::IsKilled" << endl;
1307   bool aret = false ;
1308   if ( AutomatonGraphState( _State ) == SUPERV::KillState ) {
1309     aret = true ;
1310   }
1311 //  cdebug_out << "GraphExecutor::OutNode::IsKilled" << endl ;
1312   return aret ;
1313 }
1314
1315 bool GraphExecutor::OutNode::IsStopped() {
1316 //  cdebug_in << "GraphExecutor::OutNode::IsStopped" << endl;
1317   bool aret = false ;
1318   if ( AutomatonGraphState( _State ) == SUPERV::StopState ) {
1319     aret = true ;
1320   }
1321 //  cdebug_out << "GraphExecutor::OutNode::IsStopped" << endl ;
1322   return aret ;
1323 }
1324
1325 bool GraphExecutor::OutNode::IsWaiting( const char * NodeName ) {
1326   bool aret = false ;
1327 //  cdebug_in << "GraphExecutor::OutNode::IsWaiting " << NodeName << endl;
1328   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1329   if ( anInNode ) {
1330     aret = anInNode->IsWaiting() ;
1331   }
1332 //  cdebug_out << "GraphExecutor::OutNode::IsWaiting" << endl ;
1333   return aret ;
1334 }
1335
1336 bool GraphExecutor::OutNode::IsReady( const char * NodeName ) {
1337   bool aret = false ;
1338 //  cdebug_in << "GraphExecutor::OutNode::IsReady " << NodeName << endl;
1339   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1340   if ( anInNode ) {
1341     aret = anInNode->IsReady() ;
1342   }
1343 //  cdebug_out << "GraphExecutor::OutNode::IsReady" << endl ;
1344   return aret ;
1345 }
1346
1347 bool GraphExecutor::OutNode::IsRunning( const char * NodeName ) {
1348   bool aret = false ;
1349 //  cdebug_in << "GraphExecutor::OutNode::IsRunning " << NodeName << endl;
1350   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1351   if ( anInNode ) {
1352     aret = anInNode->IsRunning() ;
1353   }
1354 //  cdebug_out << "GraphExecutor::OutNode::IsRunning" << endl ;
1355   return aret ;
1356 }
1357
1358 bool GraphExecutor::OutNode::IsDone( const char * NodeName ) {
1359   bool aret = false ;
1360 //  cdebug_in << "GraphExecutor::OutNode::IsDone " << NodeName << endl;
1361   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1362   if ( anInNode ) {
1363     aret = anInNode->IsDone() ;
1364   }
1365 //  cdebug_out << "GraphExecutor::OutNode::IsDone" << endl ;
1366   return aret ;
1367 }
1368
1369 bool GraphExecutor::OutNode::IsSuspended( const char * NodeName ) {
1370   bool aret = false ;
1371 //  cdebug_in << "GraphExecutor::OutNode::IsSuspended " << NodeName << endl;
1372   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1373   if ( anInNode ) {
1374     aret = anInNode->IsSuspended() ;
1375   }
1376 //  cdebug_out << "GraphExecutor::OutNode::IsSuspended" << endl ;
1377   return aret ;
1378 }
1379
1380 bool GraphExecutor::OutNode::IsDone( const char * NodeName ,
1381                                      const char * ServiceParameterName )  {
1382 //  cdebug_in << "GraphExecutor::OutNode::IsDone " << NodeName << " "
1383 //            << ServiceParameterName<< endl;
1384   bool aret = PortDone( NodeName , ServiceParameterName ) ;
1385 //  cdebug_out << "GraphExecutor::OutNode::IsDone" << endl ;
1386   return aret ;
1387 }
1388
1389 bool GraphExecutor::OutNode::ContainerKill() {
1390   bool RetVal = true ;
1391   cdebug_in << "GraphExecutor::OutNode::ContainerKill" << endl;
1392   _ControlState = SUPERV::ToSuspendState ;
1393   int i ;
1394   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1395     GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ;
1396     bool sts = aNode->ContainerKill() ;
1397     if ( sts && aNode->IsKilled() ) {
1398       cdebug << aNode->Name() << " killed" << endl ;
1399     }
1400     else if ( aNode->IsWaiting() || aNode->IsDone() ) {
1401       cdebug << aNode->Name() << " not killed : "
1402              << theAutomaton->StateName( aNode->State() ) << endl ;
1403     }
1404     else {
1405       cdebug << aNode->Name() << " cannot be killed : "
1406              << theAutomaton->StateName( aNode->State() ) << endl ;
1407       RetVal = false ;
1408     }
1409   }
1410   if ( !RetVal || Threads() != 0 ) {
1411     for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1412       GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ;
1413       if ( !aNode->IsKilled() && !aNode->IsWaiting() && !aNode->IsDone() ) {
1414         aNode->KilledAction() ;
1415       }
1416     }
1417     RetVal = true ;
1418   }
1419   State( SUPERV::KilledState ) ;
1420   cdebug_out << "GraphExecutor::OutNode::ContainerKill" << endl ;
1421   return RetVal ;
1422 }
1423
1424 bool GraphExecutor::OutNode::Suspend() {
1425   bool RetVal = false ;
1426   cdebug_in << "GraphExecutor::OutNode::Suspend" << endl;
1427   _ControlState = SUPERV::ToSuspendState ;
1428   int i ;
1429   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1430     GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ;
1431     bool sts = aNode->Suspend() ;
1432     if ( sts && aNode->IsSuspended() ) {
1433       cdebug << aNode->Name() << " Suspend" << endl ;
1434     }
1435     else if ( aNode->IsWaiting() || aNode->IsDone() ) {
1436       cdebug << aNode->Name() << " not Suspended : "
1437              << theAutomaton->StateName( aNode->State() ) << endl ;
1438     }
1439     else {
1440       cdebug << aNode->Name() << " cannot be Suspended : "
1441              << theAutomaton->StateName( aNode->State() ) << endl ;
1442       RetVal = false ;
1443     }
1444   }
1445   State( SUPERV::SuspendedState ) ;
1446   cdebug_out << "GraphExecutor::OutNode::Suspend" << endl ;
1447   return RetVal ;
1448 }
1449 bool GraphExecutor::OutNode::Resume() {
1450   bool RetVal = false ;
1451   cdebug_in << "GraphExecutor::OutNode::Resume" << endl;
1452   cdebug_out << "GraphExecutor::OutNode::Resume" << endl ;
1453   return RetVal ;
1454 }
1455
1456 bool GraphExecutor::OutNode::Kill() {
1457   bool RetVal = true ;
1458   cdebug_in << "GraphExecutor::OutNode::Kill" << endl;
1459   _ControlState = SUPERV::ToSuspendState ;
1460   int i ;
1461   for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1462     GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ;
1463     bool sts = aNode->Kill() ;
1464     if ( sts && aNode->IsKilled() ) {
1465       cdebug << aNode->Name() << " killed" << endl ;
1466     }
1467     else if ( aNode->IsWaiting() || aNode->IsDone() ) {
1468       cdebug << aNode->Name() << " not killed : "
1469              << theAutomaton->StateName( aNode->State() ) << endl ;
1470     }
1471     else {
1472       cdebug << aNode->Name() << " cannot be killed : "
1473              << theAutomaton->StateName( aNode->State() ) << endl ;
1474       RetVal = false ;
1475     }
1476   }
1477   if ( !RetVal || Threads() != 0 ) {
1478     for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1479       GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) GraphNodes( i )->GetInNode() ;
1480       if ( !aNode->IsKilled() && !aNode->IsWaiting() && !aNode->IsDone() ) {
1481         aNode->KilledAction() ;
1482       }
1483     }
1484     RetVal = true ;
1485   }
1486   State( SUPERV::KilledState ) ;
1487   cdebug_out << "GraphExecutor::OutNode::Kill" << endl ;
1488   return RetVal ;
1489 }
1490
1491 bool GraphExecutor::OutNode::Stop() {
1492   bool RetVal = false ;
1493   cdebug_in << "GraphExecutor::OutNode::Stop" << endl;
1494   Kill() ;
1495   cdebug_out << "GraphExecutor::OutNode::Stop" << endl ;
1496   return RetVal ;
1497 }
1498 bool GraphExecutor::OutNode::ReRun() {
1499   bool RetVal = false ;
1500   cdebug_in << "GraphExecutor::OutNode::ReRun" << endl;
1501   if ( IsSuspended() ) {
1502   }
1503   cdebug_out << "GraphExecutor::OutNode::ReRun" << endl ;
1504   return RetVal ;
1505 }
1506 bool GraphExecutor::OutNode::ReStart() {
1507   bool RetVal = false ;
1508   cdebug_in << "GraphExecutor::OutNode::ReStart" << endl;
1509   if ( IsSuspended() ) {
1510   }
1511   cdebug_out << "GraphExecutor::OutNode::ReStart" << endl ;
1512   return RetVal ;
1513 }
1514
1515 bool GraphExecutor::OutNode::ReadyWait() {
1516   cdebug_in << "GraphExecutor::OutNode::ReadyWait" << endl;
1517   bool aret ;
1518   if ( pthread_mutex_lock( &_MutexWait ) ) {
1519     perror("pthread_mutex_lock _ReadyWait") ;
1520     exit( 0 ) ;
1521   }
1522   aret = IsReady() ;
1523   if ( !aret ) {
1524     Suspend() ;
1525     pthread_cond_wait( &_EventWait , &_MutexWait );
1526     aret = IsReady() ;
1527   }
1528   if ( pthread_mutex_unlock( &_MutexWait ) ) {
1529     perror("pthread_mutex_lock _ReadyWait") ;
1530     exit( 0 ) ;
1531   }
1532   cdebug_out << "GraphExecutor::OutNode::ReadyWait" << endl ;
1533   return aret ;
1534 }
1535
1536 bool GraphExecutor::OutNode::RunningWait() {
1537   cdebug_in << "GraphExecutor::OutNode::RunningWait" << endl;
1538   bool aret ;
1539   if ( pthread_mutex_lock( &_MutexWait ) ) {
1540     perror("pthread_mutex_lock _RunningWait") ;
1541     exit( 0 ) ;
1542   }
1543   aret = IsRunning() ;
1544   if ( !aret ) {
1545     cdebug << "RunningWait pthread_cond_wait _EventWait" << endl;
1546     pthread_cond_wait( &_EventWait , &_MutexWait );
1547     aret = IsRunning() ;
1548     cdebug << "RunningWait pthread_cond_waited _EventWait " << aret << endl;
1549   }
1550   if ( pthread_mutex_unlock( &_MutexWait ) ) {
1551     perror("pthread_mutex_lock _RunningWait") ;
1552     exit( 0 ) ;
1553   }
1554   cdebug_out << "GraphExecutor::OutNode::RunningWait " << aret << endl ;
1555   return aret ;
1556 }
1557
1558 bool GraphExecutor::OutNode::DoneWait() {
1559   cdebug_in << "GraphExecutor::OutNode::DoneWait" << endl;
1560   bool aret ;
1561   if ( pthread_mutex_lock( &_MutexWait ) ) {
1562     perror("pthread_mutex_lock _DoneWait") ;
1563     exit( 0 ) ;
1564   }
1565   aret = IsDone() ;
1566   while ( !aret && !IsSuspended() ) {
1567     cdebug << "DoneWait pthread_cond_wait _EventWait" << endl;
1568     pthread_cond_wait( &_EventWait , &_MutexWait );
1569     aret = IsDone() ;
1570     cdebug << "DoneWait pthread_cond_waited _EventWait " << aret << endl;
1571   }
1572   if ( pthread_mutex_unlock( &_MutexWait ) ) {
1573     perror("pthread_mutex_lock _DoneWait") ;
1574     exit( 0 ) ;
1575   }
1576   cdebug_out << "GraphExecutor::OutNode::DoneWait " << aret << endl ;
1577   return aret ;
1578 }
1579
1580 bool GraphExecutor::OutNode::SuspendedWait() {
1581   cdebug_in << "GraphExecutor::OutNode::SuspendedWait" << endl;
1582   bool aret ;
1583   if ( pthread_mutex_lock( &_MutexWait ) ) {
1584     perror("pthread_mutex_lock _SuspendedWait") ;
1585     exit( 0 ) ;
1586   }
1587   aret = IsSuspended() ;
1588   while ( !aret && !_Done ) {
1589     pthread_cond_wait( &_EventWait , &_MutexWait );
1590     aret = IsSuspended() ;
1591   }
1592   if ( pthread_mutex_unlock( &_MutexWait ) ) {
1593     perror("pthread_mutex_lock _SuspendedWait") ;
1594     exit( 0 ) ;
1595   }
1596   cdebug_out << "GraphExecutor::OutNode::SuspendedWait" << endl ;
1597   return aret ;
1598 }
1599
1600 bool GraphExecutor::OutNode::ReadyWait( const char * NodeName ) {
1601   bool aret = false ;
1602   cdebug_in << "GraphExecutor::OutNode::ReadyWait " << NodeName << endl;
1603   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1604   if ( anInNode ) {
1605     aret = anInNode->ReadyWait() ;
1606   }
1607   cdebug_out << "GraphExecutor::OutNode::ReadyWait" << endl ;
1608   return aret ;
1609 }
1610
1611 bool GraphExecutor::OutNode::RunningWait( const char * NodeName ) {
1612   bool aret = false ;
1613   cdebug_in << "GraphExecutor::OutNode::RunningWait " << NodeName << endl;
1614   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1615   if ( anInNode ) {
1616     aret = anInNode->RunningWait() ;
1617   }
1618   cdebug_out << "GraphExecutor::OutNode::RunningWait" << endl ;
1619   return aret ;
1620 }
1621
1622 bool GraphExecutor::OutNode::DoneWait( const char * NodeName ) {
1623   bool aret = false ;
1624   cdebug_in << "GraphExecutor::OutNode::DoneWait " << NodeName << endl;
1625   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1626   if ( anInNode ) {
1627     aret = anInNode->DoneWait() ;
1628   }
1629   cdebug_out << "GraphExecutor::OutNode::DoneWait" << endl ;
1630   return aret ;
1631 }
1632
1633 bool GraphExecutor::OutNode::SuspendedWait( const char * NodeName ) {
1634   bool aret = false ;
1635   cdebug_in << "GraphExecutor::OutNode::SuspendedWait " << NodeName << endl;
1636   GraphExecutor::InNode *anInNode = (GraphExecutor::InNode *) GetGraphNode( NodeName )->GetInNode() ;
1637   if ( anInNode ) {
1638     aret = anInNode->SuspendedWait() ;
1639   }
1640   cdebug_out << "GraphExecutor::OutNode::SuspendedWait" << endl ;
1641   return aret ;
1642 }
1643
1644 long GraphExecutor::OutNode::LastLevelDone() {
1645   int RetVal = -1 ;
1646   int i , j ;
1647   for ( i = 0 ; i <= LevelMax() ; i++ ) {
1648     for ( j = 0 ; j <= NodesNumber( i ) ; j++ ) {
1649       GraphBase::ComputingNode * aNode = SortedNodes( i , j ) ;
1650       if ( !IsDone( aNode->Name() ) ) {
1651         break ;
1652       }
1653     }
1654     if ( j != NodesNumber( i ) + 1 )
1655       break ;
1656     RetVal = i ;
1657   }
1658   return RetVal ;
1659 }
1660
1661
1662 const CORBA::Any *GraphExecutor::OutNode::GetInData(
1663                               const char * NodeName ,
1664                               const char * ServiceParameterName ) {
1665   cdebug_in << "GraphExecutor::OutNode::GetInData " << NodeName << " "
1666             << ServiceParameterName << endl ;
1667   const CORBA::Any * retdata = PortInData( NodeName , ServiceParameterName ) ;
1668   cdebug_out << "GraphExecutor::OutNode::GetInData" << endl ;
1669   return retdata ;
1670 }
1671
1672 const CORBA::Any *GraphExecutor::OutNode::GetOutData(
1673                               const char * NodeName ,
1674                               const char * ServiceParameterName ) {
1675   cdebug_in << "GraphExecutor::OutNode::GetData " << NodeName << " "
1676             << ServiceParameterName << endl ;
1677   const CORBA::Any * retdata = PortOutData( NodeName , ServiceParameterName ) ;
1678   cdebug_out << "GraphExecutor::OutNode::GetOutData" << endl ;
1679   return retdata ;
1680 }
1681