From d72b6e6b3504ef90fadf3afb358cb7ec86f8b5bd Mon Sep 17 00:00:00 2001 From: rahuel Date: Wed, 28 Sep 2005 13:01:08 +0000 Subject: [PATCH] Debug 10098 : import of a graph (in Python) with MacroNodes --- .../DataFlowExecutor_FiniteStateMachine.hxx | 9 ++++++++ src/Supervision/CNode_Impl.cxx | 3 +++ src/Supervision/Graph_Impl.cxx | 23 +++++++++++-------- 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx index d79e0e4..4404cc6 100644 --- a/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx +++ b/src/GraphExecutor/DataFlowExecutor_FiniteStateMachine.hxx @@ -45,6 +45,8 @@ //#include CORBA_SERVER_HEADER(SUPERV) #include +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 ; } ; }; }; diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index 03bba44..3edda93 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -1705,6 +1705,9 @@ void CNode_Impl::ping() { RetVal = false ; } } + if ( IsGraph() || IsStreamGraph() ) { + theAutomaton->GraphImpl( (Graph_Impl * ) this ) ; + } // endService( "CNode_Impl::ping" ); return ; } diff --git a/src/Supervision/Graph_Impl.cxx b/src/Supervision/Graph_Impl.cxx index 125b051..d30f694 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -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( _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 " -- 2.39.2