From 21f6fb166005ab274a70351b2c3176a514adec29 Mon Sep 17 00:00:00 2001 From: rahuel Date: Wed, 26 Oct 2005 12:53:51 +0000 Subject: [PATCH] MacroNodes --- .../DataFlowExecutor_DataFlow.cxx | 34 +++++++++++++++++-- src/Supervision/CNode_Impl.cxx | 3 ++ src/Supervision/Graph_Impl.cxx | 25 ++++++++------ 3 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx index 2eb3d0d..699a0d8 100644 --- a/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx +++ b/src/GraphExecutor/DataFlowExecutor_DataFlow.cxx @@ -223,6 +223,18 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , RetVal = Graph()->AddOutputData( aNodeName , ToServiceParameterName , aValue ) ; GraphBase::OutPort * anOutPort = aMacroNode->GetChangeOutPort( ToServiceParameterName ) ; int i ; + for ( i = 0 ; i < aMacroNode->GetNodeOutPortsSize() ; i++ ) { + cdebug << "Out" << i << " " << aMacroNode->GetNodeOutPort( i )->PortName() << " " + << aMacroNode->GetChangeNodeOutPort( i )->PortState() << " Done=" + << aMacroNode->GetChangeNodeOutPort( i )->PortDone() << " " ; + if ( GraphBase::Base::_prof_debug ) { + aMacroNode->GetNodeOutPort( i )->StringValue( *GraphBase::Base::_fdebug ) ; + } + if ( aMacroNode->GetChangeNodeOutPort( i )->IsGate() ) { + cdebug << " BoolValue " << aMacroNode->GetChangeNodeOutPort( i )->BoolValue() ; + } + cdebug << endl ; + } // Loop over Inports linked to that OutPort of the MacroNode for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) { const char * ToNodeName = anOutPort->ChangeInPorts( i )->NodeName() ; @@ -239,17 +251,35 @@ bool GraphExecutor::DataFlow::OutputOfAny( const char * aNodeName , // cdebug << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name() // << " IsLockedDataWait --> UnLockDataWait" << endl ; // } + aLinkedNode->LockDataReady() ; sts = aLinkedNode->SendSomeDataReady( (char * ) aNodeName ) ; cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo() << "GraphExecutor::DataFlow::OutputOfAny " << aLinkedNode->Name() << "->SendSomeDataReady( " << aNodeName << " ) sts " << sts << " " << aLinkedNode->State() << endl ; if ( sts ) { - if ( aLinkedNode->State() == GraphExecutor::DataReadyState ) { +// if ( aLinkedNode->State() == GraphExecutor::DataReadyState ) { + if ( aLinkedNode->HasAllDataReady() ) { + cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo() + << "GraphExecutor::DataFlow::OutputOfAny SendEvent(ExecuteEvent) to " + << aLinkedNode->Name() << endl ; //JR 15.04.2005 Debug PAL8624 RetroConception : // aLinkedNode->CreateNewThreadIf( true ) ; // aLinkedNode->UnLockDataWait() ; - aLinkedNode->SendEvent( GraphExecutor::ExecuteEvent ) ; + aLinkedNode->CreateNewThread( true ) ; + aLinkedNode->UnLockDataReady() ; + aLinkedNode->HasAllDataReady( false ) ; +// aLinkedNode->SendEvent( GraphExecutor::ExecuteEvent ) ; + aLinkedNode->SendEvent( GraphExecutor::AllDataReadyEvent ) ; } + else { + aLinkedNode->UnLockDataReady() ; + cdebug << pthread_self() << "/" << aLinkedNode->ThreadNo() + << "GraphExecutor::DataFlow::OutputOfAny NO SendEvent(ExecuteEvent) to " + << aLinkedNode->Name() << endl ; + } + } + else { + aLinkedNode->UnLockDataReady() ; } } else if ( Graph()->GraphMacroLevel() != 0 ) { diff --git a/src/Supervision/CNode_Impl.cxx b/src/Supervision/CNode_Impl.cxx index 65d5ee1..9dd23bb 100644 --- a/src/Supervision/CNode_Impl.cxx +++ b/src/Supervision/CNode_Impl.cxx @@ -1738,6 +1738,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 b6aee77..9be1703 100644 --- a/src/Supervision/Graph_Impl.cxx +++ b/src/Supervision/Graph_Impl.cxx @@ -1035,35 +1035,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->CoupledNode( aSubGraph ) ; // 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