bool LoopFinished = false ;
bool SwitchFinished = false ;
- if ( IsLoopNode() && GetChangeNodeInLoop()->GetOutPort()->BoolValue() ) {
- LoopBeginning = true ; // Beginning of Loop
+ if ( IsLoopNode() ) {
+ GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ;
+ if ( anOutLoopPort && anOutLoopPort->BoolValue() ) {
+ LoopBeginning = true ; // Beginning of Loop
+ }
}
- if ( IsEndLoopNode() && !GetChangeNodeInLoop()->GetOutPort()->BoolValue() ) {
- LoopFinished = true ; // End of Loop
+ if ( IsEndLoopNode() ) {
+ GraphBase::OutPort * anOutLoopPort = GetChangeNodeInLoop()->GetOutPort() ;
+ if ( anOutLoopPort && !anOutLoopPort->BoolValue() ) {
+ LoopFinished = true ; // End of Loop
+ }
}
- if ( IsEndSwitchNode() && !GetChangeNodeInGate()->GetOutPort()->BoolValue() ) {
- SwitchFinished = true ; // End of Switch
+ if ( IsEndSwitchNode() ) {
+ GraphBase::OutPort * anOutGateSwitchPort = GetChangeNodeInGate()->GetOutPort() ;
+ if ( anOutGateSwitchPort && !anOutGateSwitchPort->BoolValue() ) {
+ SwitchFinished = true ; // End of Switch
+ }
}
cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " LoopFinished " << LoopFinished
<< " LoopBeginning " << LoopBeginning << " SwitchFinished " << SwitchFinished << endl ;
<< anOutPort->ChangeInPorts( j )->NodeName() << "( "
<< anOutPort->ChangeInPorts( j )->PortName() << " "
<< anOutPort->ChangeInPorts( j )->PortStatus() << " )" << endl;
- if ( strcmp( anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() , Name() ) ) {
+ GraphBase::ComputingNode * aToNode ;
+ aToNode = _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() ) ;
+// JR 12.01.2005 : the OutPort linked to the InPort of a EndSwitchNode was changed so final
+// values of InPorts of EndSwitchNode may be wrong
+ if ( !aToNode->IsEndSwitchNode() &&
+ strcmp( anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() , Name() ) ) {
// After EndLoopNode or GOTONode the Input Ports of LoopNode or LabelNode have their values from
// EndLoopNode or GOTONode. But if there is several nested loops we should re-establish.
cdebug << ThreadNo()
- << " InNodeThreads::SetWaitingStates OutPort->ChangeInPorts( j )->OutPort()->NodeName "
- << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() << " != "
+ << " InNodeThreads::SetWaitingStates Node " << Name() << " "
+ << anOutPort->ChangeInPorts( j )->GetOutPort()->NodeName() << "( "
+ << anOutPort->ChangeInPorts( j )->GetOutPort()->PortName() << " ) != "
<< Name() << " : Restored to " << anOutPort->NodeName() << "( "
<< anOutPort->PortName() << " )" << endl ;
anOutPort->ChangeInPorts( j )->ChangeOutPort( anOutPort ) ;
}
- GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) _OutNode->Graph()->GetChangeGraphNode( anOutPort->ChangeInPorts( j )->NodeName() )->GetInNode() ;
+ GraphExecutor::InNode * aNode = (GraphExecutor::InNode * ) aToNode->GetInNode() ;
if ( aNode != EndNode ) {
aNode->SetWaitingStates( EndNode ) ;
}