]> SALOME platform Git repositories - modules/superv.git/commitdiff
Salome HOME
Debug 10098 : import of a graph (in Python) with MacroNodes
authorrahuel <rahuel@opencascade.com>
Wed, 28 Sep 2005 13:01:08 +0000 (13:01 +0000)
committerrahuel <rahuel@opencascade.com>
Wed, 28 Sep 2005 13:01:08 +0000 (13:01 +0000)
src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx
src/Supervision/CNode_Impl.cxx
src/Supervision/Graph_Impl.cxx

index d79e0e41cd8ec0b22eaf8ae40185a403812a9ae2..4404cc69896229ecb4a310956e4484bbddf09a64 100644 (file)
@@ -45,6 +45,8 @@
 //#include CORBA_SERVER_HEADER(SUPERV)
 #include <SALOME_LifeCycleCORBA.hxx>
 
+class Graph_Impl ;
+
 namespace GraphBase {
   class Graph ;
 }
@@ -195,6 +197,8 @@ namespace GraphExecutor {
       pthread_cond_t    _JoinWait ;
       list< pthread_t > _ThreadList ;
 
+      Graph_Impl * _GraphImpl ;
+
     public :
 
       FiniteStateMachine() ;
@@ -246,6 +250,11 @@ namespace GraphExecutor {
       const GraphExecutor::StateEventAction NextAction( const GraphExecutor::AutomatonState & aState ,
                                                         const GraphExecutor::NodeEvent & anEvent ) const {
             return _ActionTable[ aState ][ anEvent ] ; } ;
+
+    void GraphImpl( Graph_Impl * aGraphImpl ) {// For GraphMNode ...
+         _GraphImpl = aGraphImpl ; } ;
+    Graph_Impl * GraphImpl() {
+                 return _GraphImpl ; } ;
   };
 
 };
index 03bba4427503ebb14332ef822c5788435c131710..3edda9389054415f7179be681b86485b31806b0e 100644 (file)
@@ -1705,6 +1705,9 @@ void CNode_Impl::ping() {
       RetVal = false ;
     }
   }
+  if ( IsGraph() || IsStreamGraph() ) {
+    theAutomaton->GraphImpl( (Graph_Impl * ) this ) ;
+  }
 //  endService( "CNode_Impl::ping" );
   return ;
 }
index 125b0517a8dae46b8331269c38cd144afbfe0cd4..d30f6940cbf02b0c83e1672561a7317f34c91584 100644 (file)
@@ -1019,35 +1019,40 @@ SUPERV::Graph_ptr Graph_Impl::GraphMNode( SUPERV::Graph_ptr myMacroGraph ) {
     aDataFlowNode->SetObjRef( SUPERV::CNode::_duplicate( SUPERV::CNode::_narrow( obj ) ) ) ;
     aDataFlowNode->SetObjImpl( this ) ;
 
+    GraphBase::Graph * aSubGraph = NULL ;
 //    GraphBase::Graph * aGraph = DataFlowEditor()->Automaton()->MapGraph( myMacroGraph->Name() ) ;
-    GraphBase::Graph * aGraph ;
     //DataFlowEditor()->Automaton()->GraphBase( &aGraph ) ;
+//JR 20.09.2005 Debug SAB_data_1609_bugPAL.py from CEA (Anthony)
+//    Graph_Impl * aSubGraphImpl = dynamic_cast<Graph_Impl * >( _Poa->id_to_servant( *myMacroGraph->_Id ) ) ;
+    myMacroGraph->ping() ;
+    Graph_Impl * aSubGraphImpl = theAutomaton->GraphImpl() ;
+    aSubGraph = aSubGraphImpl->DataFlowEditor()->Graph() ;
     myMacroGraph->Coupled() ;
     GraphBase::Graph * aGraphOfMacroGraph = myMacroNode->DataFlowEditor()->Graph() ;
     GraphBase::Graph * aMacroGraph = myMacroNode->DataFlowNode()->GraphMacroNode() ;
     aMacroGraph->Kind( SUPERV::MacroNode ) ;
     aMacroGraph->GraphEditor( DataFlowEditor() ) ;
 // Creation of the Ports of the MacroNode from the ports of the GraphMacroNode
-    aMacroGraph->SetMacroPorts( aGraph ) ;
+    aMacroGraph->SetMacroPorts( aSubGraph ) ;
 // Valid ==> creation of Service and the ports of the current Graph
     DataFlowEditor()->IsValid() ;
 // Set the Input Datas from the GraphMacroNode to the current Graph
-    aMacroGraph->SetMacroDatas( aGraph , aGraphOfMacroGraph ) ;
+    aMacroGraph->SetMacroDatas( aSubGraph , aGraphOfMacroGraph ) ;
 //    aMacroGraphDataFlowEditor->UnValid() ;
-    aGraph->GraphEditor()->UnValid() ;
+    aSubGraph->GraphEditor()->UnValid() ;
 // Set the MacroNode ObjRef in the GraphMacroNode
-    aGraph->CoupledNode( aMacroGraph ) ;
-    aGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
+    aSubGraph->CoupledNode( aMacroGraph ) ;
+    aSubGraph->MacroObject( SUPERV::Graph::_duplicate( macroiobject ) ) ;
 // Set the GraphMacroNode ObjRef in the MacroNode
     aDataFlowNode->GraphMacroNode()->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
-    aMacroGraph->CoupledNode( aGraph ) ;
+    aMacroGraph->CoupledNode( aSubGraph ) ;
     aMacroGraph->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
 //    aDataFlowNode->CoupledNode( aGraph ) ;
 //    aDataFlowNode->ComputingNode()->MacroObject( SUPERV::Graph::_duplicate( iobject ) ) ;
 // Set the MacroLevel of that graph
-    aGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
+    aSubGraph->GraphMacroLevel( aGraphOfMacroGraph->GraphMacroLevel() + 1 ) ;
     aMacroGraph->Coordinates( 0 , 0 ) ;
-    MESSAGE( aGraph->Name() << "->CoupledNode()->GraphEditor() : " << aGraph->CoupledNode()->GraphEditor() ) ;
+    MESSAGE( aSubGraph->Name() << "->CoupledNode()->GraphEditor() : " << aSubGraph->CoupledNode()->GraphEditor() ) ;
     MESSAGE( aMacroGraph->Name() << "->CoupledNode()->GraphEditor() : "
              << aMacroGraph->CoupledNode()->GraphEditor() ) ;
     MESSAGE( "DataFlowNode Graph " << this << " DataFlowEditor " << DataFlowEditor() << " aDataFlowNode "