}
-bool GraphBase::ComputingNode::CheckLoop(GraphBase::LoopNode * aLoopNode ,
- GraphBase::EndOfLoopNode * anEndLoopNode ) const {
+bool GraphBase::ComputingNode::CheckLoop( GraphBase::LoopNode * aLoopNode ,
+ GraphBase::EndOfLoopNode * anEndLoopNode ,
+ string & anErrorMessage ) const {
cdebug_in << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name() << " , "
<< anEndLoopNode->Name() << ") LinkedNodesSize "
<< LinkedNodesSize() << endl;
int i ;
if ( LinkedNodesSize() == 0 && !IsDataFlowNode() && !IsDataStreamNode() ) {
+ anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
+ string( " has no linked Nodes. Loop not valid\n" ) ;
cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
<< " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
- << LinkedNodesSize() << " WARNING false" << endl;
+ << LinkedNodesSize() << " ERROR false" << endl;
return false ;
}
// We check that all nodes linked to that node go to the end of LoopNode :
GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
cdebug << i << ". " << Name() << " Linked to " << aNode->Name() << endl ;
if ( !aNode->IsEndLoopNode() || aNode != anEndLoopNode ) {
- if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode ) ) {
+ if ( !aNode->CheckLoop( aLoopNode , anEndLoopNode , anErrorMessage) ) {
cdebug_out << Name() << "->ComputingNode::CheckLoop( " << aLoopNode->Name()
<< " , " << anEndLoopNode->Name() << ") LinkedNodesSize "
- << LinkedNodesSize() << " WARNING false" << endl;
+ << LinkedNodesSize() << " ERROR false" << endl;
return false ;
}
}
}
bool GraphBase::ComputingNode::CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
- GraphBase::EndOfLoopNode * anEndLoopNode ) const {
+ GraphBase::EndOfLoopNode * anEndLoopNode ,
+ string & anErrorMessage ) const {
cdebug_in << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name() << " , "
<< anEndLoopNode->Name() << ") LinkedFromNodesSize "
<< LinkedFromNodesSize() << endl;
int i ;
if ( LinkedFromNodesSize() == 0 ) {
+ anErrorMessage = anErrorMessage + string( "The node " ) + string( Name() ) +
+ string( " has no reversed linked Nodes. Loop not valid\n" ) ;
cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
<< " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
- << LinkedFromNodesSize() << " WARNING false" << endl;
+ << LinkedFromNodesSize() << " ERROR false" << endl;
return false ;
}
// We have to check that all nodes linked from that node go to the beginning of LoopNode :
GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
cdebug << i << ". " << Name() << " Linked from " << aNode->Name() << endl ;
if ( !aNode->IsLoopNode() || aNode != aLoopNode ) {
- if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode ) ) {
+ if ( !aNode->CheckEndLoop( aLoopNode , anEndLoopNode , anErrorMessage ) ) {
cdebug_out << Name() << "->ComputingNode::CheckEndLoop( " << aLoopNode->Name()
<< " , " << anEndLoopNode->Name() << ") LinkedFromNodesSize "
- << LinkedFromNodesSize() << " WARNING false" << endl;
+ << LinkedFromNodesSize() << " ERROR false" << endl;
return false ;
}
}
return true ;
}
-bool GraphBase::ComputingNode::InitBranchOfSwitchDone(bool AllInit ,
- GraphBase::EndOfSwitchNode * anEndSwitchNode ) {
+bool GraphBase::ComputingNode::InitBranchOfSwitchDone( bool AllInit ,
+ GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+ string & anErrorMessage ) {
+ bool RetVal = true ;
bool sts = BranchOfSwitchDone( false ) ;
if ( !sts && !AllInit && anEndSwitchNode != this ) {
// Common Node in branchs :
- cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone WARNING false"
+ anErrorMessage = anErrorMessage + string( "Common Node between some SwitchBranches : " ) +
+ string( Name() ) + string("\n" ) ;
+ cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone ERROR false"
<< endl ;
- return false ;
+ RetVal = false ;
}
int i ;
if ( !IsGOTONode() && anEndSwitchNode != this ) {
for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
GraphBase::ComputingNode * aNode ;
aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
- if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode ) ) {
- return false ;
+ if ( !aNode->InitBranchOfSwitchDone( AllInit , anEndSwitchNode , anErrorMessage ) ) {
+ RetVal = false ;
}
}
}
- return true ;
+ return RetVal ;
}
-bool GraphBase::ComputingNode::CheckSwitch(GraphBase::EndOfSwitchNode * anEndSwitchNode ) {
+bool GraphBase::ComputingNode::CheckSwitch( GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+ string & anErrorMessage ) {
+ bool RetVal = true ;
cdebug_in << Name() << "->ComputingNode::CheckSwitch( "
<< anEndSwitchNode->Name() << " ) " << Kind() << endl;
if ( anEndSwitchNode == this ) {
anOtherEndSwitchNode = (GraphBase::EndOfSwitchNode * ) ((GraphBase::SwitchNode * ) this)->CoupledNode() ;
cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
<< anOtherEndSwitchNode->Name() << endl ;
- if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode ) ) {
+ if ( !anOtherEndSwitchNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
cdebug_out << Name() << "->ComputingNode::CheckSwitch "
- << anOtherEndSwitchNode->Name() << " WARNING false" << endl;
- return false ;
+ << anOtherEndSwitchNode->Name() << " ERROR false" << endl;
+ RetVal = false ;
}
}
else {
<< anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
}
else if ( aNode == anEndSwitchNode ) {
- ((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ) ;
+ if ( !((GraphBase::EndOfSwitchNode * ) aNode)->DecrEndSwitchInPortLinked( anInPort ,
+ anErrorMessage ) ) {
+ RetVal = false ;
+ }
}
else if ( aNode->BranchOfSwitchDone() ) {
cdebug << Name() << "->ComputingNode::CheckSwitch will NOT Check "
else {
cdebug << Name() << "->ComputingNode::CheckSwitch will Check "
<< anInPort->NodeName() << "( " << anInPort->PortName() << " )" << endl ;
- if ( !aNode->CheckSwitch( anEndSwitchNode ) ) {
+ if ( !aNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
cdebug_out << Name() << "->ComputingNode::CheckSwitch "
- << anEndSwitchNode->Name() << " WARNING false" << endl;
- return false ;
+ << anEndSwitchNode->Name() << " ERROR false" << endl;
+ RetVal = false ;
}
// aNode->BranchOfSwitchDone( true ) ;
}
}
}
}
- BranchOfSwitchDone( true ) ;
- cdebug_out << Name() << "->ComputingNode::CheckSwitch BranchOfSwitchDone == true "
- << anEndSwitchNode->Name() << " true" << endl;
- return true ;
+ if ( RetVal ) {
+ BranchOfSwitchDone( true ) ;
+ }
+ cdebug_out << Name() << "->ComputingNode::CheckSwitch "
+ << anEndSwitchNode->Name() << " RetVal " << RetVal << endl;
+ return RetVal ;
}
#include <sys/time.h>
}
return false ; } ;
- bool CheckLoop(GraphBase::LoopNode * aLoopNode ,
- GraphBase::EndOfLoopNode * anEndLoopNode ) const ;
- bool CheckEndLoop(GraphBase::LoopNode * aLoopNode ,
- GraphBase::EndOfLoopNode * anEndLoopNode ) const ;
- bool InitBranchOfSwitchDone( bool AllInit , GraphBase::EndOfSwitchNode * anEndSwitchNode ) ;
- bool CheckSwitch(GraphBase::EndOfSwitchNode * anEndSwitchNode ) ;
+ bool CheckLoop( GraphBase::LoopNode * aLoopNode ,
+ GraphBase::EndOfLoopNode * anEndLoopNode ,
+ string & anErrorMessage ) const ;
+ bool CheckEndLoop( GraphBase::LoopNode * aLoopNode ,
+ GraphBase::EndOfLoopNode * anEndLoopNode ,
+ string & anErrorMessage ) const ;
+ bool InitBranchOfSwitchDone( bool AllInit , GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+ string & anErrorMessage ) ;
+ bool CheckSwitch( GraphBase::EndOfSwitchNode * anEndSwitchNode ,
+ string & anErrorMessage ) ;
// const GraphBase::ListOfParameters * GetListOfParameters() const ;
using namespace std;
#include "DataFlowBase_DataNode.hxx"
+#include "DataFlowBase_Graph.hxx"
GraphBase::DataNode::DataNode() :
GOTONode() {
int i , ierr = 0 ;
for ( i = 0 ; i < _DataFlowDataPorts->GetNodeOutPortsSize() ; i++ ) {
-// Not a BUG : Reversed Service of the graph
+// Not a BUG : Reversed Service of the graph : OutPort of the Graph give input values to nodes
const GraphBase::OutPort * anOutPort = _DataFlowDataPorts->GetNodeOutPort(i) ;
// if ( !anOutPort->IsGate() && !anOutPort->IsDataStream() && !anOutPort->IsDataConnected() ) {
if ( !anOutPort->IsGate() && !anOutPort->IsDataConnected() ) {
if ( anOutPort->IsExternConnected() && GraphMacroLevel() != 0 ) {
- cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
+ cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName() << " "
+ << anOutPort->PortType() << " "
<< anOutPort->PortStatus() << " of DataFlow " << Name()
<< " is ExternConnected. GraphMacroLevel " << GraphMacroLevel() << endl ;
}
else {
- cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
- << anOutPort->PortStatus() << " of DataFlow " << Name() << " has NO Data. GraphMacroLevel "
- << GraphMacroLevel() << endl ;
- ierr++ ;
+ cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName() << " "
+ << anOutPort->PortType() << " " << anOutPort->PortStatus() << " of DataFlow " << Name()
+ << " has NO Data. GraphMacroLevel " << GraphMacroLevel() << " InPortsSize "
+ << anOutPort->InPortsSize() << " corresponding to :"
+ << endl ;
+ int i ;
+ for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) {
+ cdebug << " " << anOutPort->InPorts( i )->NodeName() << "( "
+ << anOutPort->InPorts( i )->PortName() << " ) " << endl ;
+ }
+ if ( anOutPort->InPortsSize() == 1 &&
+ GraphOfNode()->GetGraphNode( anOutPort->InPorts( 0 )->NodeName() )->IsEndSwitchNode() ) {
+ cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName()
+ << " is connected to an EndSwitchNode. Input Data is controlled by ValidSwitchs."
+ << endl ;
+ }
+ else {
+ ostringstream astr ;
+ astr << anOutPort->PortStatus() ;
+ string anErrorMessage = string( "InPort " ) + string( anOutPort->NodeName() ) +
+ string( "( " ) + string( anOutPort->PortName() ) + string( " ) " ) +
+ astr.str() + string( " has NO Input Data.\n" ) ;
+ GraphOfNode()->SetMessages( anErrorMessage ) ;
+ ierr++ ;
+ }
}
}
else {
- cdebug << "InPort " << anOutPort->PortName() << " " << anOutPort->PortType() << " "
- << anOutPort->PortStatus() << " of DataFlow " << Name() << " has Data : "
+ cdebug << "Base::DataNode::CheckDataServerNodes InPort " << anOutPort->PortName() << " "
+ << anOutPort->PortType() << " "
+ << anOutPort->PortStatus() << " of DataFlow " << Name() << " has Data or IsGate"
<< endl ;
}
}
for ( i = 0 ; i < _DataFlowDataPorts->GetNodeInPortsSize() ; i++ ) {
if ( _DataFlowDataPorts->GetNodeInPort(i)->IsPortConnected() ) {
- cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
+ cdebug << "Base::DataNode::CheckDataServerNodes OutPort "
+ << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
<< " of DataFlow " << Name() << " is Connected" << endl ;
}
else {
- cdebug << "OutPort " << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
+ cdebug << "Base::DataNode::CheckDataServerNodes OutPort "
+ << _DataFlowDataPorts->GetNodeInPort(i)->PortName()
<< " of DataFlow " << Name() << " is NOT Connected" << endl ;
}
}
if ( ierr ) {
- cdebug << "In the DataFlow " << Name() << " " << ierr << " Some Input Data is missing" << endl ;
+ GraphOfNode()->SetMessages( "Some Input Data are missing.\n" ) ;
+ cdebug << "Base::DataNode::CheckDataServerNodes In the DataFlow " << Name() << " " << ierr
+ << " Some Input Data are missing" << endl ;
}
cdebug_out << "GraphBase::DataNode::CheckDataServerNodes ierr " << ierr << endl;
// delete [] _Comment;
}
-bool GraphBase::EndOfSwitchNode::DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ) {
+void GraphBase::EndOfSwitchNode::InitEndSwitchInPortLinked() { // without StreamInPorts
+ cdebug << "Base::EndOfSwitchNode::InitEndSwitchInPortLinked of " << Name() << endl ;
+//JR 06.07.2005 : the InGatePort(Default) must also be counted (enhancement) ...
+// _EndSwitchInPortLinkedNumber = GetNodeInPortsSize() - DataStreamInPortsNumber() - 1 ;
+ _EndSwitchInPortLinkedNumber = GetNodeInPortsSize() - DataStreamInPortsNumber() ;
+ _SwitchWithGOTO = false ;
+ int i ;
+//JR 06.07.2005 : the InGatePort must also be counted (enhancement) ...
+// for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) {
+ for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+ GetChangeNodeInPort( i )->BranchOfSwitchLinked( false ) ;
+ }
+}
+
+bool GraphBase::EndOfSwitchNode::DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ,
+ string & anErrorMessage ) {
bool RetVal = true ;
-// if ( !anInPort->BranchOfSwitchLinked() ) {
- RetVal = anInPort->BranchOfSwitchLinked( true ) ;
//JR 16.02.2005 : except for DefaultPort
- if ( !anInPort->IsGate() ) {
- _EndSwitchInPortLinkedNumber -= 1 ;
+//JR 06.07.2005 : the InGatePort must also be counted now (enhancement) ...
+// if ( !anInPort->IsGate() ) {
+ if ( !anInPort->BranchOfSwitchLinked( true ) ) {
+ cdebug << Name() << "->DecrEndSwitchInPortLinked ERROR " << anInPort->NodeName() << "( "
+ << anInPort->PortName() << " ) was already linked in that branch." << endl ;
+ anErrorMessage = anErrorMessage + string( Name() ) + string( " The port " ) +
+ string( anInPort->NodeName() ) + string( "( " ) +
+ string( anInPort->PortName() ) +
+ string( " ) was already linked in that branch.\n" ) ;
+ RetVal = false ;
}
- cdebug << Name()
- << "->EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber "
- << _EndSwitchInPortLinkedNumber << " InPort '" << anInPort->PortName() << "' of "
- << anInPort->NodeName() << " RetVal " << RetVal << endl ;
-// }
-// else {
-// cdebug << "EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber "
-// << _EndSwitchInPortLinkedNumber << " InPort " << anInPort->PortName()
-// << " already done RetVal " << RetVal << endl ;
+ _EndSwitchInPortLinkedNumber -= 1 ;
// }
+ cdebug << Name()
+ << "->EndOfSwitchNode::DecrEndSwitchInPortLinked EndSwitchInPortLinkedNumber "
+ << _EndSwitchInPortLinkedNumber << " InPort '" << anInPort->PortName() << "' of "
+ << anInPort->NodeName() << " RetVal " << RetVal << endl ;
return RetVal ;
}
-bool GraphBase::EndOfSwitchNode::CheckEndSwitchInPortsLinked() {
+bool GraphBase::EndOfSwitchNode::CheckEndSwitchInPortsLinked( string & anErrorMessage ) {
+ bool RetVal = true ;
+ bool DefaultNotLinked = false ;
+// Check that all inports of the EndSwitchNode are reachable in that branch(es)
+ int i ;
+//JR 06.07.2005 : the InGatePort must also be counted now (enhancement) ...
+// for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) {
+ for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+ GraphBase::InPort * anInPort = GetChangeNodeInPort( i ) ;
+ if ( !anInPort->IsDataStream() && !anInPort->BranchOfSwitchLinked() ) {
+ cdebug << Name() << "->EndOfSwitchNode::CheckEndSwitchInPortsLinked "
+ << anInPort->PortName() << " have no link in that branch"
+ << " SwitchWithGOTO() " << SwitchWithGOTO() << endl ;
+ if ( !SwitchWithGOTO() ) {
+ anErrorMessage = anErrorMessage + string( Name() ) + string( "( " ) +
+ string( anInPort->PortName() ) +
+ string( " ) has no link from that branch.\n" ) ;
+ if ( anInPort->IsGate() ) {
+ DefaultNotLinked = true ;
+ }
+ else {
+ RetVal = false ; // that InPort is not linked
+ }
+ }
+ }
+ }
// Check that all inports of the EndSwitchNode will have a value only once
if ( _EndSwitchInPortLinkedNumber != 0 ) {
cdebug << Name()
<< "->EndOfSwitchNode::CheckEndSwitchInPortsLinked EndSwitchInPortLinkedNumber "
- << _EndSwitchInPortLinkedNumber << endl ;
+ << _EndSwitchInPortLinkedNumber << " SwitchWithGOTO() " << SwitchWithGOTO()
+ << " DefaultNotLinked " << DefaultNotLinked << endl ;
if ( !SwitchWithGOTO() ) {
- return false ; // Some InPort is not linked
- }
- }
-// Check that all inports of the EndSwitchNode are reachable in that branch(es)
- int i ;
- for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) {
- if ( !GetChangeNodeInPort( i )->IsDataStream() &&
- !GetChangeNodeInPort( i )->BranchOfSwitchLinked() ) {
- cdebug << Name() << "->EndOfSwitchNode::CheckEndSwitchInPortsLinked "
- << GetNodeInPort( i )->PortName() << " have no link in that branch"
- << endl ;
- if ( !SwitchWithGOTO() ) {
- return false ; // that InPort is not linked
+ if ( RetVal && _EndSwitchInPortLinkedNumber == 1 && DefaultNotLinked ) {
+ }
+ else {
+ if ( _EndSwitchInPortLinkedNumber > 0 ) {
+ anErrorMessage = anErrorMessage + string( Name() ) +
+ string( " has some InPort(s) not linked.\n" ) ;
+ }
+ else {
+ anErrorMessage = anErrorMessage + string( Name() ) +
+ string( " has some InPort(s) multiply linked.\n" ) ;
+ }
+ RetVal = false ; // Some InPort is not linked or multiply linked
}
}
}
- return true ; // Ok : all InPorts are linked
+ return RetVal ;
}
ofstream * Graph_fdebug = NULL ) ;
virtual ~EndOfSwitchNode() ;
- void InitEndSwitchInPortLinked() { // without StreamInPorts and Default
- _EndSwitchInPortLinkedNumber = GetNodeInPortsSize() - DataStreamInPortsNumber() - 1 ;
- _SwitchWithGOTO = false ;
- int i ;
- for ( i = 0 ; i < GetNodeInPortsSize()-1 ; i++ ) {
- GetChangeNodeInPort( i )->BranchOfSwitchLinked( false ) ;
- } } ;
- bool DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ) ;
+ void InitEndSwitchInPortLinked() ;
+ bool DecrEndSwitchInPortLinked( GraphBase::InPort * anInPort ,
+ string & anErrorMessage ) ;
void SetSwitchWithGOTO() {
_SwitchWithGOTO = true ; } ;
bool SwitchWithGOTO() {
return _SwitchWithGOTO ; } ;
- bool CheckEndSwitchInPortsLinked() ;
+ bool CheckEndSwitchInPortsLinked( string & anErrorMessage ) ;
};
DataNode() {
cdebug << "GraphBase::Graph::Graph" << endl ;
_GraphNodesSize = 0 ;
+ GraphOfNode( this ) ;
}
GraphBase::Graph::Graph( CORBA::ORB_ptr ORB ,
Set_prof_debug( Graph_prof_debug , Graph_fdebug ) ;
cdebug << "GraphBase::Graph::Graph( " << DataFlowName << ") GraphNodesSize() " << GraphNodesSize() << endl ;
_GraphNodesSize = 0 ;
+ GraphOfNode( this ) ;
}
GraphBase::Graph::Graph( CORBA::ORB_ptr ORB ,
DataFlowEditorRelease , DataFlowAuthor , DataFlowComment ) {
_Orb = CORBA::ORB::_duplicate( ORB ) ;
_GraphNodesSize = 0 ;
+ GraphOfNode( this ) ;
Set_prof_debug( Graph_prof_debug , Graph_fdebug ) ;
cdebug_in << "GraphBase::Graph::Graph" << endl ;
DataService( ORB , DataFlowService , Graph_prof_debug , Graph_fdebug ) ;
cdebug_in << "GraphBase::Graph::ReNameNode (" << OldNodeName << " , " << NewNodeName << ") "
<< endl;
int i ;
- bool RetVal = false ;
+ bool RetVal = true ;
//#if 0
GraphBase::ComputingNode * anOldNode = GetChangeGraphNode( OldNodeName ) ;
for ( i = 0 ; i < anOldNode->LinkedNodesSize() ; i++ ) {
}
//#endif
if ( !strcmp( OldNodeName , NewNodeName ) ) {
- RetVal = true ;
}
else if ( strcmp( Name() , OldNodeName ) ) {
int index = GetGraphNodeIndex( OldNodeName ) ;
int newindex = GetGraphNodeIndex( NewNodeName ) ;
if ( index >= 0 && index < _GraphNodesSize &&
( newindex < 0 || newindex > _GraphNodesSize ) ) {
+ DelGraphNodeIndex( _GraphNodes[ index ]->Name() ) ;
_GraphNodes[ index ]->Name( NewNodeName ) ;
- _MapOfGraphNodes.erase( OldNodeName ) ;
- SetGraphNodeIndex( NewNodeName , index ) ;
+//JR 29.06.2005 Debug ???
+// SetGraphNodeIndex( NewNodeName , index ) ;
+ SetGraphNodeIndex( _GraphNodes[ index ]->Name() , index ) ;
GraphBase::ComputingNode * aNode = GetChangeGraphNode( index ) ;
// Update 'ToNode's Map from 'aNode'
- cdebug << "Graph::ReNameNode " << aNode->Name() << " LinkedNodesSize : "
+ cdebug << "Graph::ReNameNode " << aNode->Name() << "/" << OldNodeName << " LinkedNodesSize : "
<< aNode->LinkedNodesSize() << endl ;
for ( i = 0 ; i < aNode->LinkedNodesSize() ; i++ ) {
GraphBase::StreamNode * ToNode = aNode->LinkedNodes( i ) ;
ToNode->ReNameLinkedFromNode( OldNodeName , NewNodeName ) ;
}
// Rename in _MapOfLinkedNodes of 'FromNode'
- cdebug << "Graph::ReNameNode " << aNode->Name() << " LinkedFromNodesSize : "
- << aNode->LinkedFromNodesSize() << endl ;
+ cdebug << "Graph::ReNameNode " << aNode->Name() << "/" << OldNodeName
+ << " LinkedFromNodesSize : " << aNode->LinkedFromNodesSize() << endl ;
for ( i = 0 ; i < aNode->LinkedFromNodesSize() ; i++ ) {
GraphBase::StreamNode * FromNode = aNode->LinkedFromNodes( i ) ;
if ( FromNode->GetLinkedNodeIndex( OldNodeName ) >= 0 ) {
GraphBase::InPort * anInPort = aNode->GetChangeNodeInPort( i ) ;
// OutPort 'anOutPort' linked to 'anInPort'
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
- cdebug << i << ". " << aNode->Name() << " " << "GraphBase::Graph::ReNameNode of LinkedNode : from " ;
+ cdebug << i << ". " << aNode->Name() << "/" << OldNodeName
+ << " GraphBase::Graph::ReNameNode of LinkedNode : from " ;
if ( anOutPort ) {
- cdebug << anOutPort->NodeName() ;
+ cdebug << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )" ;
}
else {
cdebug << "without link" ;
}
- cdebug << " to " << i << ". " << anInPort->PortName() << " of " << NewNodeName ;
+ cdebug << " to " << i << ". " << anInPort->PortName() << " of " << NewNodeName
+ << " OldNodeName " << OldNodeName ;
if ( !anInPort->IsNotConnected() ) {
if ( anOutPort->IsDataConnected() ) {
cdebug << " fromDataConnected " << anOutPort->NodeName() << endl ;
FromNode = this ;
}
cdebug << " fromConnected " << anOutPort->NodeName() << endl ;
-#if 0
-//JR 26.01.2005 : a same node may be renamed severeal times. So this is done above
-// Rename in _MapOfLinkedFromNodes of 'FromNode'
- if ( anInPort->IsDataStream() ) {
- FromNode->ReNameStreamLinkedNode( OldNodeName , NewNodeName ) ;
- }
- else {
- FromNode->ReNameLinkedNode( OldNodeName , NewNodeName ) ;
- }
-#endif
}
char* OldNodePortName = new char[ strlen( OldNodeName ) +
strlen( aNode->GetChangeNodeInPort( i )->PortName() ) + 3 ] ;
char* NewNodePortName = new char[ strlen( NewNodeName ) +
strlen( aNode->GetChangeNodeInPort( i )->PortName() ) + 3 ] ;
strcpy( OldNodePortName , OldNodeName ) ;
-// strcat( OldNodePortName , "\\" ) ;
strcat( OldNodePortName , "__" ) ;
strcat( OldNodePortName , aNode->GetChangeNodeInPort( i )->PortName() ) ;
strcpy( NewNodePortName , NewNodeName ) ;
-// strcat( NewNodePortName , "\\" ) ;
strcat( NewNodePortName , "__" ) ;
strcat( NewNodePortName , aNode->GetChangeNodeInPort( i )->PortName() ) ;
RetVal = anOutPort->ReNameInPort( OldNodePortName , NewNodePortName ) ;
}
else {
cdebug << " not connected" << endl ;
- RetVal = true ;
}
}
- RetVal = true ;
// PAL8508
//JR 02.02.2005 DEBUG : ReName in the CoupledNode was missing
if ( aNode->IsLoopNode() || aNode->IsEndLoopNode() ||
}
}
else {
- cdebug << "ERROR Node not found" << endl ;
+ cdebug << "ERROR Node not found or conflicting NodeName" << endl ;
+ RetVal = false ;
}
}
else {
- RetVal = Name( NewNodeName ) ;
+ cdebug << "ReNameNode with same name." << endl ;
+// RetVal = Name( NewNodeName ) ;
}
+#if 1
+ cdebug << "Graph::ReNameNode " << _GraphNodesSize << " known nodes" << endl;
+ for ( i = 0 ; i < _GraphNodesSize ; i++ ) {
+ cdebug << "Node" << i << _GraphNodes[ i ]->Name() << endl ;
+ }
+ map< string , int >::iterator aMapOfGraphNodesIterator ;
+ i = 0 ;
+ for ( aMapOfGraphNodesIterator = _MapOfGraphNodes.begin() ;
+ aMapOfGraphNodesIterator != _MapOfGraphNodes.end() ; aMapOfGraphNodesIterator++ ) {
+ cdebug << "MapOfGraphNodes " << i++ << " " << aMapOfGraphNodesIterator->first << " --> "
+ << aMapOfGraphNodesIterator->second << " - 1" << endl ;
+ }
+#endif
+
cdebug_out << "GraphBase::Graph::ReNameNode RetVal " << RetVal << endl;
return RetVal ;
}
<< fromPort->PortName() << " " << fromPort->PortStatus() << ") " << fromPort->Kind()
<< " ---> " << toNode->Name() << "(" << toPort->PortName() << " " << toPort->PortStatus()
<< ") " << toPort->Kind() << " )" << endl;
+ ostringstream LinkStrError ;
+ LinkStrError << "Creation of link from " << fromNode->Name() << "( "
+ << fromPort->PortName() << " " << fromPort->PortStatus() << " " << fromPort->Kind()
+ << " ) ---> " << toNode->Name() << "( " << toPort->PortName() << " "
+ << toPort->PortStatus() << " " << toPort->Kind() << " ) :\n" ;
if ( fromPort->IsDataConnected() || fromPort->IsExternConnected() ) {
if ( !fromPort->RemoveInPort() ) { // There is only one ===> RemoveOutPort()
- cdebug_out << "GraphBase::Graph::AddLink(" << fromNode->Name() << "("
- << fromPort->PortName() << " " << fromPort->PortStatus() << ") RemoveInPort ERROR " << endl ;
+ cdebug_out << "GraphBase::Graph::AddLink in OutPort ( " << fromNode->Name() << "("
+ << fromPort->PortName() << " " << fromPort->PortStatus()
+ << ") RemoveInPort ERROR InPortsSize " << fromPort->InPortsSize() << endl ;
return false ;
}
}
if ( toPort->IsDataConnected() || toPort->IsExternConnected() ) {
if ( !toPort->GetOutPort()->RemoveInPort() ) { // There is only one ===> RemoveOutPort()
- cdebug_out << "GraphBase::Graph::AddLink(" << toNode->Name() << "("
- << toPort->PortName() << " " << toPort->PortStatus() << ") RemoveInPort ERROR " << endl ;
+ cdebug_out << "GraphBase::Graph::AddLink in InPort connected to the OutPort ( "
+ << toNode->Name() << "(" << toPort->PortName() << " " << toPort->PortStatus()
+ << ") RemoveInPort ERROR InPortsSize " << toPort->GetOutPort()->InPortsSize()
+ << endl ;
return false ;
}
}
if ( !fromNode->IsDataFlowNode() && !fromNode->IsDataStreamNode() &&
!toNode->IsDataFlowNode() && !toNode->IsDataStreamNode() &&
toPort->GetOutPort() ) {
- if ( !strcmp( toPort->GetOutPort()->NodePortName() ,
+//JR Debug 15.06.2005 : the case of multiple links to EndSwitchNode was missing :
+ if ( toNode->IsEndSwitchNode() && fromPort->GetInPort( toPort ) == toPort ) {
+ LinkStrError << "Link already exists.\n" ;
+ SetMessages( LinkStrError.str() ) ;
+ cdebug << "Link already exists" << endl ;
+ cdebug_out << "GraphBase::Graph::AddLink 1" << endl;
+ return true ;
+ }
+ else if ( !strcmp( toPort->GetOutPort()->NodePortName() ,
fromPort->NodePortName() ) ) {
+ LinkStrError << "Link already exists.\n" ;
+ SetMessages( LinkStrError.str() ) ;
cdebug << "Link already exists" << endl ;
cdebug_out << "GraphBase::Graph::AddLink 1" << endl;
return true ;
return false ;
}
}
+//JR 15.06.2005 : disabled : GraphSwitchBranchGates ...
+// else if ( fromNode->IsSwitchNode() && toNode->IsEndSwitchNode() && !toPort->IsGate() ) {
+// cdebug << "fromNode->IsSwitchNode() && toNode->IsEndSwitchNode toPort(NotGate)Error."
+// << endl ;
+// LinkStrError << "Link from SwitchNode to EndSwitchNode is not allowed.\n" ;
+// SetMessages( LinkStrError.str() ) ;
+// cdebug << "Graph::AddLink ERROR Link from SwitchNode to EndSwitchNode is not allowed."
+// << endl ;
+// cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
+// return false ;
+// }
+//JR 15.06.2005 : SwitchNode(Default) may be only linked to EndSwitchNode(Default)
//PAL8511
//JR Debug 15.02.2005 : Not multiple links in that case except if toPort is the DefaultPort
- else if ( fromNode->IsSwitchNode() && toNode->IsEndSwitchNode() && !toPort->IsGate() ) {
- cdebug << "fromNode->IsSwitchNode() && toNode->IsEndSwitchNode toPort(NotGate)Error."
+ else if ( fromNode->IsSwitchNode() && fromPort->IsGate() &&
+ !toNode->IsEndSwitchNode() ) {
+ LinkStrError << "Link from SwitchNode(Default) is allowed only to EndSwitchNode(Default).\n" ;
+ SetMessages( LinkStrError.str() ) ;
+ cdebug << "SwitchNode(Default) may be only linked to EndSwitchNode(Default) AddLink Error."
<< endl ;
- cdebug_out << "GraphBase::Graph::AddLink" << endl;
+ cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
return false ;
}
}
//JR 24.03.2005 : No Link between OutPort of SwitchNode to InPort of EndSwitchNode except if
// they have the same name for a special case :
// Switch with no branch ==> Default is applied always : GraphSyrControl example
+//JR 22.06.2005 : Enhancement of the behaviour :
+// For the DefaultBranch, if we have same PortsNames, Values are automatically
+// transmitted
+// But for the DefaultBranch, if we have NOT same PortsNames, we may create links.
+// Look at GraphSyrControlAve* ...
+#if 0
else if ( fromNode->IsSwitchNode() && !fromPort->IsGate() &&
toNode->IsEndSwitchNode() && !toPort->IsGate() &&
strcmp( fromPort->PortName() , toPort->PortName() ) ) {
- cdebug << "fromNode->IsSwitchNode() && toNode->IsEndSwitchNode with different PortNames Error." << endl ;
+ LinkStrError << "Link from SwitchNode to EndSwitchNode with different PortNames is not allowed.\n" ;
+ SetMessages( LinkStrError.str() ) ;
+ cdebug << "fromNode->IsSwitchNode() && toNode->IsEndSwitchNode with different PortNames Error."
+ << endl ;
cdebug_out << "GraphBase::Graph::AddLink" << endl;
return false ;
}
+#endif
else if ( fromNode->IsGOTONode() && fromPort->InPortsSize() ) {
if ( !RemoveLink( fromNode->Name() , fromPort->PortName() ,
fromPort->ChangeInPorts(0)->NodeName() ,
// JR 12.01.2005 : an OutPort of a SwitchNode connected to a Gate can be connected only to Gate
if ( !toNode->IsDataFlowNode() && !toNode->IsDataStreamNode() &&
fromNode->IsSwitchNode() && fromPort->IsSwitch() && !toPort->IsGate() ) {
+ LinkStrError << "Link from SwitchNode Port linked to a Gate may be connected only to Gates.\n" ;
+ SetMessages( LinkStrError.str() ) ;
cdebug << "toPort->AddLink Error( fromPort->IsSwitch() && !toPort->IsGate())." << endl ;
cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
return false ;
!( ( fromPort->IsGate() && toPort->IsGate() ) ||
( !fromPort->IsGate() ) ) ) {
// ( !fromPort->IsGate() && !toPort->IsGate() ) ) ) {
+ LinkStrError << "Link from SwitchNode to EndSwitchNode : different kinds of ports not allowed.\n" ;
+ SetMessages( LinkStrError.str() ) ;
+ cdebug << "Link ERROR from SwitchNode to EndSwitchNode : different kinds of ports not allowed."
+ << endl ;
+ cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
+ return false ;
+ }
+//JR 15.06.2005 : SwitchNode(Default) may be only linked to EndSwitchNode(Default)
+ else if ( fromNode->IsSwitchNode() && fromPort->IsGate() &&
+ !toNode->IsEndSwitchNode() ) {
+ LinkStrError << "Link from SwitchNode(Default) is allowed only to EndSwitchNode(Default).\n" ;
+ SetMessages( LinkStrError.str() ) ;
cdebug << "SwitchNode(Default) may be only linked to EndSwitchNode(Default) AddLink Error."
<< endl ;
cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
return false ;
}
- else if ( !fromNode->IsSwitchNode() && fromPort->IsParam() && toPort->IsGate() ) {
+ else if ( !fromNode->IsSwitchNode() &&
+ ( fromPort->IsParam() || fromPort->IsInLine() ) && toPort->IsGate() ) {
+ LinkStrError << "Link from OutPort to a Gate is not allowed.\n" ;
+ SetMessages( LinkStrError.str() ) ;
cdebug << "toPort->AddLink Error( fromPort->IsParam() && toPort->IsGate())." << endl ;
cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
return false ;
}
int i ;
+ cdebug << endl << "Graph::AddInputData ListOfInOutPorts of the Graph : " << endl ;
for ( i = 0 ; i < GetNodeOutDataNodePortsSize() ; i++ ) {
cdebug << "Graph::AddInputData In" << i << " " << *GetNodeOutDataNodePort(i) << endl ;
}
cdebug_out << "GraphBase::Graph::SetGraphPorts" << endl;
}
+string GraphBase::Graph::Messages() {
+// cdebug_in << "Graph::Messages" << endl ;
+// cdebug_out << "Graph::Messages" << endl ;
+ return ( CORBA::string_dup( _Messages.c_str() ) ) ;
+}
+
+void GraphBase::Graph::ReSetMessages() {
+ cdebug << "Graph::ReSetMessages" << endl ;
+ _Messages = string( "" ) ;
+}
+
+void GraphBase::Graph::SetMessages( string anErrorMessage ) {
+ cdebug_in << "Graph::SetMessages" << endl ;
+ _Messages = _Messages + anErrorMessage + string( "\n" ) ;
+ cdebug_out << "Graph::SetMessages :" << endl << _Messages << endl ;
+}
+
bool GraphBase::Graph::CreateService() {
cdebug_in << "GraphBase::Graph::CreateService " << Name() << " GraphMacroLevel : " << GraphMacroLevel() << endl;
bool RetVal = true ;
}
//JR PAL8914 : InPorts of EndLoopNodes may not be in the Service of the Graph
// else if ( !anInPort->IsGate() && anInPort->IsNotConnected() ) {
- else if ( !anInPort->IsGate() && anInPort->IsNotConnected() && !aToNode->IsEndLoopNode() ) {
+ else if ( !anInPort->IsGate() &&
+ ( anInPort->IsNotConnected() || anInPort->IsExternConnected() ) &&
+ !aToNode->IsEndLoopNode() ) {
if ( !AddLink( this , GetChangeInDataNodePort( anInPort->NodePortName() ) , aToNode , anInPort ) ) {
cdebug << "CreateService In" << j << " " << anInPort->NodeName() << "(" << anInPort->PortName() << ") "
<< anInPort->PortStatus() << " --> AddInLink ERROR" << endl ;
<< anInPort->PortStatus() << " --> AddInLink" << endl ;
}
}
+ else {
+ cdebug << "CreateService In" << j << " " << anInPort->NodeName() << "(" << anInPort->PortName() << ") "
+ << anInPort->PortStatus() << " --> NO AddInputData/AddInLink" << endl ;
+ }
}
for ( j = 0 ; j < aToNode->GetNodeOutPortsSize() ; j++ ) {
GraphBase::OutPort *anOutPort = aToNode->GetChangeNodeOutPort(j) ;
ListPorts( *_Graph_fdebug , 0 ) ;
#endif
+ if ( !RetVal ) {
+ SetMessages( "Fail to create the Service of the graph.\n" ) ;
+ }
+
cdebug_out << "GraphBase::Graph::CreateService " << RetVal << endl;
return RetVal ;
}
// If no node was found, that FlowGraph is not valid : if we try to execute it, that FlowGraph
// will wait for data(s) from node(s) not executed or not executing for ever
if ( !NewSorted ) {
- cdebug << "Loop detected level " << _LevelsNumber << endl ;
+ SetMessages( "That graph is cyclic.\n" ) ;
+ cdebug << "ERROR Loop detected at level " << _LevelsNumber << endl ;
return false ; // Loop in the Graph
}
// cdebug << "Bilan level " << _LevelsNumber << " : " << endl ;
// cdebug << "No Parallel Execution Nodes detected." << endl ;
}
if ( AllSortedNodes != GraphNodesSize() ) {
- cdebug << "Loop detected level " << _LevelsNumber << endl ;
+ SetMessages( "That graph is cyclic.\n" ) ;
+ cdebug << "ERROR Loop detected at level " << _LevelsNumber << endl ;
return false ; // Loop in the Graph
}
bool GraphBase::Graph::ValidLoops() const {
cdebug_in << "GraphBase::Graph::ValidLoops" << endl;
-
+ bool RetVal = true ;
int i ;
GraphBase::ComputingNode * aNode ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
GraphBase::LoopNode * aLoopNode = (GraphBase::LoopNode * ) aNode ;
GraphBase::EndOfLoopNode * anEndLoopNode ;
anEndLoopNode = (GraphBase::EndOfLoopNode * ) aLoopNode->CoupledNode() ;
- if ( !aLoopNode->CheckLoop( aLoopNode , anEndLoopNode ) ) {
- cdebug_out << "GraphBase::Graph::ValidLoops false aLoopNode " << aLoopNode->Name()
- << endl;
- return false ;
+ string anErrorMessage = string( "CheckLoop " ) + string( aLoopNode->Name() ) +
+ string( " --> " ) + string( anEndLoopNode->Name() ) +
+ string( " :\n" ) ;
+ if ( !aLoopNode->CheckLoop( aLoopNode , anEndLoopNode , anErrorMessage ) ) {
+ ((GraphBase::Graph * ) this)->SetMessages( anErrorMessage ) ;
+ cdebug << "GraphBase::Graph::ValidLoops false aLoopNode " << aLoopNode->Name()
+ << endl;
+ RetVal = false ;
}
- else if ( !anEndLoopNode->CheckEndLoop( aLoopNode , anEndLoopNode ) ) {
- cdebug_out << "GraphBase::Graph::ValidLoops false anEndLoopNode " << anEndLoopNode->Name()
- << endl;
- return false ;
+ anErrorMessage = string( "CheckEndLoop " ) + string( aLoopNode->Name() ) +
+ string( " --> " ) + string( anEndLoopNode->Name() ) + string( " :\n" ) ;
+ if ( !anEndLoopNode->CheckEndLoop( aLoopNode , anEndLoopNode , anErrorMessage ) ) {
+ ((GraphBase::Graph * ) this)->SetMessages( anErrorMessage ) ;
+ cdebug << "GraphBase::Graph::ValidLoops false anEndLoopNode " << anEndLoopNode->Name()
+ << endl;
+ RetVal = false ;
}
}
}
- cdebug_out << "GraphBase::Graph::ValidLoops true" << endl;
- return true ;
+ cdebug_out << "GraphBase::Graph::ValidLoops RetVal " << RetVal << endl;
+ return RetVal ;
}
bool GraphBase::Graph::ValidSwitchs() const {
cdebug_in << "GraphBase::Graph::ValidSwitchs" << endl;
-
+ bool RetVal = true ;
int i ;
GraphBase::ComputingNode * aNode ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
if ( aNode->IsSwitchNode() ) {
GraphBase::SwitchNode * aSwitchNode = (GraphBase::SwitchNode * ) aNode ;
if ( !aSwitchNode->CheckSwitch() ) {
- cdebug_out << "GraphBase::Graph::ValidSwitchs false aSwitchNode " << aSwitchNode->Name()
- << endl;
- return false ;
+ cdebug << "GraphBase::Graph::ValidSwitchs false aSwitchNode " << aSwitchNode->Name()
+ << endl;
+ RetVal = false ;
}
}
}
- cdebug_out << "GraphBase::Graph::ValidSwitchs true" << endl;
- return true ;
+ cdebug_out << "GraphBase::Graph::ValidSwitchs RetVal " << RetVal << endl;
+ return RetVal ;
}
// Controle de la coherence des noeuds de calcul
// cdebug << "Le port d'entree " << iP->PortName()
// << " du noeud de calcul " << aNode->Name() << " du graphe "
// << Name() << " n'est pas connecte "<< endl;
+// string anErrorMessage = string( "That graph have InPort not connected " ) +
+// string( iP->NodeName() ) +
+// string( "( " ) + string( iP->PortName() ) + string( " )\n" ) ;
+// ((GraphBase::Graph * ) this)->SetMessages( anErrorMessage ) ;
RetVal = false ;
};
// cdebug << "Le port de sortie " << iP->PortName()
// << " du noeud de calcul " << aNode->Name() << " du graphe "
// << Name() << " n'est pas connecte "<< endl;
+// string anErrorMessage = string( "That graph have OutPort not connected " ) +
+// string( iP->NodeName() ) +
+// string( "( " ) + string( iP->PortName() ) + string( " )\n" ) ;
+// ((GraphBase::Graph * ) this)->SetMessages( anErrorMessage ) ;
RetVal = false ;
}
};
<< " GraphBase::Graph::StartComponent " << aComputerContainer
<< " " << ComponentName << endl;
bool RetVal = true ;
-
+ objComponent = Engines::Component::_nil() ;
SALOME_LifeCycleCORBA LCC( NamingService() ) ;
- objComponent = LCC.FindOrLoad_Component( aComputerContainer ,
- ComponentName );
+ try {
+ objComponent = LCC.FindOrLoad_Component( aComputerContainer ,
+ ComponentName );
+ }
+ catch (...) {
+ RetVal = 0 ;
+ }
if ( CORBA::is_nil( objComponent ) ) {
cdebug_out << aThread
<< " StartComponent cannot FindOrLoad " << aComputerContainer
<< " " << ComponentName << " ERROR" << endl;
- return 0 ;
+ RetVal = 0 ;
}
/* asv : 24.01.05 : FindContainer() method does not exist any more. FindOrLoad_Component()
starts the container for us. If it fails to start the container, then it
}
}
*/
- cdebug_out << aThread << " GraphBase::Graph::StartComponent " << RetVal << endl;
+ if ( !RetVal ) {
+ string anErrorMessage = string( "Error while FindOrLoad_Component " ) +
+ string( ComponentName ) + string( " in Container " ) +
+ string( aComputerContainer ) ;
+ SetMessages( anErrorMessage ) ;
+ }
+ cdebug_out << aThread << " GraphBase::Graph::StartComponent RetVal " << RetVal << endl;
return RetVal ;
}
// int _SubStreamGraphsSize ;
// vector<vector<ComputingNode *> > _SubStreamGraphs ;
+ string _Messages ;
+
bool AddLink( GraphBase::ComputingNode *fromNode ,
GraphBase::OutPort *fromPort ,
GraphBase::ComputingNode *toNode ,
<< index << " Node " << (void *) _GraphNodes[ index ]
<< " '" << _GraphNodes[ index ]->Name() << "' MapOfGraphNodessize "
<< GetGraphNodeSize() << endl ;
-#if 0
+#if 1
cdebug << "Graph::SetGraphNodeIndex " << _GraphNodesSize << " known nodes" << endl;
int i ;
for ( i = 0 ; i < _GraphNodesSize ; i++ ) {
void SetGraphPorts() ;
+ string Messages() ;
+ void ReSetMessages() ;
+ void SetMessages( string anErrorMessage ) ;
+
bool CreateService() ;
bool InLineServices() ;
const char* NewNodePortName ) {
int index = _MapOfInPorts[ OldNodePortName ] ;
if ( index <= 0 || index > _InPortsSize ) {
- cdebug << "GraphBase::OutPort::ReNameInPort Error " << OldNodePortName
+ cdebug << "GraphBase::OutPort::ReNameInPort Error in Node " << NodeName() << " " << OldNodePortName
<< " --> " << NewNodePortName << " index " << index << endl ;
return false ;
}
<< anEndSwitchNode->Name() << endl;
int i ;
+ string anErrorMessage = string( "SwitchCheck of " ) + string( Name() ) + " --> " +
+ string( anEndSwitchNode->Name() ) + string( " :\n" ) ;
+ bool RetVal = true ;
+
//All nodes between Switch and EndSwitch will have _BranchOfSwitchDone to false
//When we have to execute such a node in a switchbranch, if _BranchOfSwitchDone is true we have
// an error ; else we set _BranchOfSwitchDone to true
GraphBase::ComputingNode * aNode ;
aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
if ( aNode && aNode != anEndSwitchNode ) {
- aNode->InitBranchOfSwitchDone( true , anEndSwitchNode ) ;
+ aNode->InitBranchOfSwitchDone( true , anEndSwitchNode , anErrorMessage ) ;
}
}
}
GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i ) ;
if ( anOutPort->IsSwitch() || anOutPort->IsGate() ) {
// We have a branch of the switch
+ anErrorMessage = anErrorMessage + string( "Branch " ) + string( Name() ) + string( "( " ) +
+ string( anOutPort->PortName() ) + string( " ) :\n" ) ;
cdebug << endl << Name() << "->SwitchNode::CheckSwitch OutPort " << anOutPort->PortName()
<< " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
- << " SWITCHBRANCH" << endl ;
+ << " SWITCHBRANCH" << endl
+ << "===================================================================================="
+ << endl ;
//JR 11.02.2005 : if Default is not connected and if Default is true at execution time, the SwitchNode
// execution will be aborted
if ( anOutPort->IsGate() || EndSwitchNode_Default ) {
if ( anOutPort->InPortsSize() == 0 ) {
// DefaultPort of the SwitchNode is not connected
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() << " "
- << anOutPort->InPortsSize() << " InPortsSize EndSwitch(Default) "
- << anEndSwitchNode->GetNodeInGate()->PortStatus() << "WARNING" << endl;
+ cdebug << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() << " "
+ << anOutPort->InPortsSize() << " InPortsSize EndSwitch(Default) "
+ << anEndSwitchNode->GetNodeInGate()->PortStatus() << "WARNING" << endl;
}
else {
// But the DefaultPort of the EndSwitchNode is connected : so there is a branch going to
// that DefaultPort
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() << " "
- << " " << anOutPort->PortStatus() << " " << anOutPort->InPortsSize() << " InPortsSize "
+ cdebug << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName() << " "
+ << " " << anOutPort->PortStatus() << " " << anOutPort->InPortsSize() << " InPortsSize "
<< endl ;
DefaultConnected = true ;
GraphBase::ComputingNode * aNode ;
aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
if ( aNode != anEndSwitchNode ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " for OutPort " << anOutPort->PortName()
- << " linked to " << aNode->Name() << " WARNING false" << endl;
- return false ;
+ anErrorMessage = anErrorMessage + string( Name() ) + "( " +
+ string( anOutPort->PortName() ) +
+ string( " ) should not be linked to " ) +
+ string( aNode->Name() ) + string( "( " ) +
+ string( anInPort->PortName() ) + string ( " )\n" ) ;
+ cdebug << "1. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " for OutPort " << anOutPort->PortName()
+ << " linked to " << aNode->Name() << " ERROR false" << endl;
+ RetVal = false ;
}
cdebug << endl << Name() << " Check of " << anOutPort->PortName() << " switch port branch"
<< " to EndSwitchNode" << endl ;
int k ;
for ( k = 0 ; k < GetNodeOutPortsSize() ; k++ ) {
GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( k ) ;
+//JR 06.07.2005 : the InGatePort must also be counted now (enhancement) ...
+// But it is done in EndSwitchNode::CheckEndSwitchInPortsLinked
if ( !anOutPort->IsGate() ) {
- GraphBase::InPort * anInPort ;
+ GraphBase::InPort * anInPort = NULL ;
+//JR 22.06.2005 : Enhancement of the behaviour :
+// For the DefaultBranch, if we have same PortsNames, Values are automatically
+// transmitted
+// But for the DefaultBranch, if we have NOT same PortsNames, we may create links.
+// Look at GraphSyrControlAve* ...
+ int kk ;
+//JR 22.06.2005 : At first look at OutPorts linked to InPorts of the EndSwitchNode with
+// different PortsNames :
+ for ( kk = 0 ; kk < anOutPort->InPortsSize() ; kk++ ) {
+ anInPort = anOutPort->ChangeInPorts( kk ) ;
+ if ( GraphOfNode()->GetGraphNode( anInPort->NodeName() ) == anEndSwitchNode ) {
+ if ( !anEndSwitchNode->GetChangeInPort( anOutPort->PortName() ) ) {
+ if ( anInPort && !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ,
+ anErrorMessage ) ) {
+ cdebug << "2. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode : "
+ << anEndSwitchNode->Name() << " to port " << anInPort->PortName()
+ << " from port " << Name() << "( " << anOutPort->PortName()
+ << " ) ERROR false" << endl;
+ RetVal = false ;
+ }
+ }
+ }
+ }
+//Get an InPort of the EndSwitchNode with the same name as that OutPort of the SwitchNode
anInPort = anEndSwitchNode->GetChangeInPort( anOutPort->PortName() ) ;
- if ( anInPort && !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ) ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " for port " << anInPort->PortName()
- << " WARNING false" << endl;
- return false ;
+ if ( anInPort && !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ,
+ anErrorMessage ) ) {
+ cdebug << "3. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " for port " << anInPort->PortName()
+ << " ERROR false" << endl;
+ RetVal = false ;
}
else {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName()
- << " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
- << " not in EndSwitchNode : IGNORED"
- << endl;
+ cdebug << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName()
+ << " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
+ << " not in EndSwitchNode : IGNORED"
+ << endl;
}
+//JR 06.07.2005 : the InGatePort must also be counted now (enhancement) ...
+// But it is done in EndSwitchNode::CheckEndSwitchInPortsLinked
}
else {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName()
- << " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
- << " SwitchPort or Gate : IGNORED"
- << endl;
+ cdebug << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " OutPort " << anOutPort->PortName()
+ << " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
+ << " SwitchPort or Gate : IGNORED"
+ << endl;
}
}
// Check that all InPorts of the EndSwitchNode have a value :
- if ( !anEndSwitchNode->CheckEndSwitchInPortsLinked() ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " " << aNode->Name()
- << " WARNING false" << endl;
- return false ;
+ if ( !anEndSwitchNode->CheckEndSwitchInPortsLinked( anErrorMessage ) ) {
+ cdebug << "4. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " " << aNode->Name()
+ << " ERROR false" << endl;
+ RetVal = false ;
}
}
}
GraphBase::ComputingNode * aNode ;
aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
if ( aNode && aNode != anEndSwitchNode ) {
- if ( !aNode->InitBranchOfSwitchDone( false , anEndSwitchNode ) ) {
- cdebug << Name() << "->ComputingNode::InitBranchOfSwitchDone WARNING false"
+ if ( !aNode->InitBranchOfSwitchDone( false , anEndSwitchNode , anErrorMessage ) ) {
+ anErrorMessage = anErrorMessage + string( Name() ) +
+ string( " Node(s) are common to two or more branchs of switch.\n" ) ;
+ cdebug << "5. " << Name() << "->ComputingNode::InitBranchOfSwitchDone ERROR false"
<< " Node common to two or more branchs of switch" << endl ;
- return false ;
+ RetVal = false ;
}
}
}
// At first all of not SwitchPort should have to be done also :
// Not Switch Branches (Gate not connected to a switch port of a SwitchNode) :
// They are always executed except if we execute the DefaultBranch ...
- cdebug << "1. " << Name() << "->SwitchNode::CheckSwitch at first NOT_SWITCH_BRANCH_OUTPORT FOR "
- << anOutPort->PortName()
- << " " << anOutPort->PortStatus() << " " << anOutPort->Kind() << endl ;
+
+ cdebug << "1. " << Name() << "->SwitchNode::CheckSwitch at first NOTSWITCHBRANCH_OUTPORT FOR "
+ << anOutPort->PortName() << " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
+ << " :" << endl ;
for ( j = 0 ; j < GetNodeOutPortsSize() ; j++ ) {
GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( j ) ;
+ cdebug << Name() << "->SwitchNode::CheckSwitch for OutPort" << j << " "
+ << anOutPort->PortName() << " " << anOutPort->PortStatus() << " " << anOutPort->Kind()
+ << " InPortsSize " << anOutPort->InPortsSize() << endl ;
if ( !anOutPort->IsSwitch() && !anOutPort->IsGate() ) {
- int k ;
- for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) {
- GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
- GraphBase::ComputingNode * aNode ;
- aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
- if ( aNode ) {
- const GraphBase::InPort * anInGatePort = aNode->GetNodeInGate() ;
- cdebug << Name() << "->SwitchNode::CheckSwitch InPort" << k << ". "
- << anInPort->PortName() << " of " << aNode->Name() << " :" << endl ;
+//JR 23.06.2005 : implicit connection with same PortsNames was missing in SwitchNodeBranches :
+ if ( anOutPort->IsExternConnected() ) {
+ GraphBase::InPort * anInPort ;
+ anInPort = anEndSwitchNode->GetChangeInPort( anOutPort->PortName() ) ;
+ if ( anInPort ) {
+ anErrorMessage = anErrorMessage + string( "Implicit NotSwitchBranch " ) +
+ string( Name() ) + string( "( " ) + string( anOutPort->PortName() ) +
+ string( " ) --> " ) + string( anEndSwitchNode->Name() ) +
+ string( "( " ) + string( anInPort->PortName() ) + string( " ).\n" ) ;
+ if ( !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ,
+ anErrorMessage ) ) {
+ cdebug << "6. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " for port " << anInPort->PortName()
+ << " ERROR false" << endl;
+ RetVal = false ;
+ }
+ cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
+ << anOutPort->PortName() << "' " << anOutPort->Kind()
+ << " NOT switch port Branch to EndSwitchNode "
+ << anEndSwitchNode->Name() << " is done" << endl ;
+ }
+ else {
+ cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
+ << anOutPort->PortName() << "' " << anOutPort->Kind()
+ << " NOT switch port does not exist in EndSwitchNode. Ignoed " << endl ;
+ }
+ }
+ else {
+ int k ;
+ for ( k = 0 ; k < anOutPort->InPortsSize() ; k++ ) {
+ GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
+ GraphBase::ComputingNode * aNode ;
+ aNode = GraphOfNode()->GetChangeGraphNode( anInPort->NodeName() ) ;
+ if ( aNode ) {
+ const GraphBase::InPort * anInGatePort = aNode->GetNodeInGate() ;
+ cdebug << Name() << "->SwitchNode::CheckSwitch InPort" << k << ". "
+ << anInPort->PortName() << " of " << aNode->Name() << " :" << endl ;
// Direct Connexion to the EndSwitchNode : always executed (except for DefaultBranch)
- if ( aNode == anEndSwitchNode ) {
- if ( !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ) ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " for port " << anInPort->PortName()
- << " WARNING false" << endl;
- return false ;
- }
- cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
- << anOutPort->PortName() << "' " << anOutPort->Kind()
- << " NOT switch port Branch to EndSwitchNode "
- << aNode->Name() << " is done" << endl ;
- }
+ if ( aNode == anEndSwitchNode ) {
+ anErrorMessage = anErrorMessage + string( "NotSwitchBranch " ) + string( Name() ) +
+ string( "( " ) + string( anOutPort->PortName() ) +
+ string( " ) --> " ) + string( aNode->Name() ) +
+ string( "( " ) + string( anInPort->PortName() ) +
+ string( " ).\n" ) ;
+ if ( !anEndSwitchNode->DecrEndSwitchInPortLinked( anInPort ,
+ anErrorMessage ) ) {
+ cdebug << "7. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " for port " << anInPort->PortName()
+ << " ERROR false" << endl;
+ RetVal = false ;
+ }
+ cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
+ << anOutPort->PortName() << "' " << anOutPort->Kind()
+ << " NOT switch port Branch to EndSwitchNode "
+ << aNode->Name() << " is done" << endl ;
+ }
// Check that InGate is not linked from a SwitchPort or a GatePort of the SwitchNode :
- else if ( !anInGatePort->GetOutPort() ) {
- cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
- << anOutPort->PortName() << "' " << anOutPort->Kind()
- << " NOT switch port Branch to node "
- << aNode->Name() << " will be done" << endl ;
- if ( !aNode->CheckSwitch( anEndSwitchNode ) ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " " << aNode->Name()
- << " WARNING false" << endl;
- return false ;
+ else if ( !anInGatePort->GetOutPort() ) {
+ cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
+ << anOutPort->PortName() << "' " << anOutPort->Kind()
+ << " NOT switch port Branch to node "
+ << aNode->Name() << " will be done" << endl ;
+ anErrorMessage = anErrorMessage + string( "NotSwitchBranch " ) + string( Name() ) +
+ string( "( " ) + string( anOutPort->PortName() ) +
+ string( " ) --> " ) + string( aNode->Name() ) +
+ string( "( " ) + string( anInPort->PortName() ) +
+ string( " ).\n" ) ;
+ if ( !aNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
+ cdebug << "8. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " " << aNode->Name()
+ << " ERROR false" << endl;
+ RetVal = false ;
+ }
+ cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
+ << anOutPort->PortName() << "' " << anOutPort->Kind()
+ << " NOT switch port Branch to node "
+ << aNode->Name() << " is done" << endl ;
}
- cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
- << anOutPort->PortName() << "' " << anOutPort->Kind()
- << " NOT switch port Branch to node "
- << aNode->Name() << " is done" << endl ;
+ else {
+ cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
+ << anOutPort->PortName() << "' " << anOutPort->Kind()
+ << " NOT switch port Branch to node "
+ << aNode->Name() << " has InGate connected IGNORED for that branch"
+ << endl ;
+ }
}
- else {
- cdebug << Name() << "->SwitchNode::CheckSwitch Check of '"
- << anOutPort->PortName() << "' " << anOutPort->Kind()
- << " NOT switch port Branch to node "
- << aNode->Name() << " has InGate connected IGNORED for that branch" << endl ;
- }
}
}
}
cdebug << Name() << " Check of " << anOutPort->PortName()
<< " switch port Branch to node "
<< aNode->Name() << endl ;
- if ( !aNode->CheckSwitch( anEndSwitchNode ) ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " " << aNode->Name() << " WARNING false"
- << endl;
- return false ;
+ if ( !aNode->CheckSwitch( anEndSwitchNode , anErrorMessage ) ) {
+ cdebug << "9. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " " << aNode->Name() << " ERROR false"
+ << endl;
+ RetVal = false ;
}
}
}
// Check that all InPorts of the EndSwitchNode have a value :
- if ( !anEndSwitchNode->CheckEndSwitchInPortsLinked() ) {
- cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " CheckEndSwitchInPortsLinked WARNING false"
- << endl;
- return false ;
+ if ( !anEndSwitchNode->CheckEndSwitchInPortsLinked( anErrorMessage ) ) {
+ cdebug << "10. " << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
+ << anEndSwitchNode->Name() << " CheckEndSwitchInPortsLinked ERROR false"
+ << endl;
+ RetVal = false ;
}
else {
cdebug << Name() << "->SwitchNode::CheckSwitch OutPort " << anOutPort->PortName()
<< " IGNORED" << endl ;
}
}
+
+ if ( !RetVal ) {
+ GraphOfNode()->SetMessages( anErrorMessage ) ;
+ }
+
cdebug_out << Name() << "->SwitchNode::CheckSwitch EndSwitchNode "
- << anEndSwitchNode->Name() << " true" << endl;
- return true ;
+ << anEndSwitchNode->Name() << " RetVal " << RetVal << endl;
+ return RetVal ;
}
if ( fieldvalue[depth] == NULLSTRING )
return returnfalse( this , "depth4-4" , qName ) ;
if ( !strcmp( fieldvalue[depth].c_str() , "?" ) ) {
-// aLink.aLinkValue.Value = fieldvalue[depth].c_str() ;
- aLink.aLinkValue = CORBA::Any() ; // ???
+ aLink.aLinkValue <<= "" ;
}
else {
switch ( aLink.aLinkValue.type()->kind() ) {
fieldvalue[depth] = NULLSTRING ;
#if TRACE
//cout << "InDataStreamParameter.inParameter-dependency " << anInDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
// step[depth]++ ;
// step[depth] = 4 ;
fieldvalue[depth] = NULLSTRING ;
#if TRACE
//cout << "InDataStreamParameter.inParameter-schema " << anInDataStreamParameter.theKindOfSchema << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
// step[depth]++ ;
// step[depth] = 4 ;
fieldvalue[depth] = NULLSTRING ;
#if TRACE
//cout << "InDataStreamParameter.inParameter-interpolation " << anInDataStreamParameter.theKindOfInterpolation << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
// step[depth]++ ;
// step[depth] = 4 ;
step[depth] = 4 ;
#if TRACE
//cout << "InDataStreamParameter.inParameter-extrapolation " << anInDataStreamParameter.theKindOfExtrapolation << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
break ;
}
step[depth] = 7 ;
#if TRACE
//cout << "OutDataStreamParameter.outParameter-type " << anOutDataStreamParameter.theDataStreamParameter.Parametertype << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
}
else
fieldvalue[depth] = NULLSTRING ;
#if TRACE
//cout << "OutDataStreamParameter.outParameter-name " << anOutDataStreamParameter.theDataStreamParameter.Parametername << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
// step[depth]++ ;
// step[depth] = 6 ;
fieldvalue[depth] = NULLSTRING ;
#if TRACE
//cout << "OutDataStreamParameter.outParameter-dependency " << anOutDataStreamParameter.theDataStreamParameter.Parameterdependency << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
// step[depth]++ ;
// step[depth] = 6 ;
step[depth] = 6 ;
#if TRACE
//cout << "OutDataStreamParameter.outParameter-values " << anOutDataStreamParameter.theNumberOfValues << " step[" << depth << "]"
- << step[depth] << endl ;
+ // << step[depth] << endl ;
#endif
}
else
const CORBA::Any GetOutData( const char * FromNodeName ,
const char * FromParameterName ) ;
- bool IsValid(bool kLoopSwitch = true ) ;
+// bool IsValid(bool kLoopSwitch = true ) ;
+ bool IsValid() ;
bool IsExecutable() ;
void Executing() ; // asv : removed a bool parameter, use Editing() to set _Executing = false
_ReadOnly = true ;
}
+//JR 07.07.2005 : old code from the first prototype
+#if 0
inline char * GraphEditor::DataFlow::DataFlowInfo() {
ostringstream s;
IsValid() ;
s << aNodeName << " not found" << ends ;
return CORBA::string_dup( s.str().c_str() );
}
+#endif
inline bool GraphEditor::DataFlow::LoadDataFlow( const GraphBase::SGraph * aDataFlow ) {
if ( _ReadOnly )
//JR Optional parameter kLoopSwitch (default = true) :
//In some cases we do not need to check the validity of loops and switchs
-inline bool GraphEditor::DataFlow::IsValid(bool kLoopSwitch ) {
- return GraphEditor::OutNode::IsValid( kLoopSwitch ) ;
+//inline bool GraphEditor::DataFlow::IsValid(bool kLoopSwitch ) {
+inline bool GraphEditor::DataFlow::IsValid() {
+// return GraphEditor::OutNode::IsValid( kLoopSwitch ) ;
+ return GraphEditor::OutNode::IsValid() ;
}
inline bool GraphEditor::DataFlow::IsExecutable() {
}
inline long GraphEditor::DataFlow::LevelMax() {
- if ( !IsValid( false ) ) {
+// if ( !IsValid( false ) ) {
+ if ( !IsExecutable() ) {
return 0 ;
}
return Graph()->LevelMax() ;
}
inline SUPERV::ListOfStrings * GraphEditor::DataFlow::LevelNodes(long aLevel ) {
- if ( !IsValid( false ) ) {
+// if ( !IsValid( false ) ) {
+ if ( !IsExecutable() ) {
return ((SUPERV::ListOfStrings * ) NULL ) ;
}
return Graph()->LevelNodes( aLevel ) ;
}
inline long GraphEditor::DataFlow::ThreadsMax() {
- if ( !IsValid() ) {
+// if ( !IsValid() ) {
+ if ( !IsExecutable() ) {
return 0 ;
}
return Graph()->ThreadsMax() ;
}
inline long GraphEditor::DataFlow::SubGraphsNumber() {
- if ( !IsValid() ) {
+// if ( !IsValid() ) {
+ if ( !IsExecutable() ) {
return 0 ;
}
return Graph()->SubGraphsNumber() ;
}
inline long GraphEditor::DataFlow::SubStreamGraphsNumber() {
- if ( !IsValid() ) {
+// if ( !IsValid() ) {
+ if ( !IsExecutable() ) {
return 0 ;
}
return StreamGraph()->SubStreamGraphsNumber() ;
RetVal = LoadDatas( aMapOfNodes , (*aDataFlow).Datas ) ;
}
cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize()
- << " RetVal " << RetVal << endl;
+ << " _Valid " << _Valid << " _Executable " << _Executable << " RetVal " << RetVal << endl;
return RetVal ;
}
//JR Optional parameter kLoopSwitch (default = true) :
//In some cases we do not need to check the validity of loops and switchs
-bool GraphEditor::OutNode::Valid(bool kLoopSwitch ) {
- if ( _Valid )
- return true ;
-
+//JR 07.07.2005 PAL9342 : that code is now in Executable() method instead of Valid() method
+//bool GraphEditor::OutNode::Valid(bool kLoopSwitch ) {
+bool GraphEditor::OutNode::Valid() {
+ bool RetVal = true ;
cdebug_in << "GraphEditor::OutNode::Valid" << endl;
+// if ( _Valid )
+// return true ;
+
_Executable = false ;
if ( !Graph()->CreateService() ) {
- cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl;
- return false ;
+ cdebug << "GraphEditor::OutNode::Valid ERROR _Valid " << _Valid << endl;
+ RetVal = false ;
}
if ( Graph()->GraphMacroLevel() != 0 ) {
Graph()->CoupledNode()->GraphEditor()->UnValid() ;
}
+//JR 07.07.2005 PAL9342 : that code is now in Executable() method instead of Valid() method
+#if 0
int SubStreamGraphsNumber = 0 ;
if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
cdebug_out << "This DataFlow is not valid." << endl ;
- return false ;
+ RetVal = false ;
}
if ( Graph()->IsDataStreamNode() ) {
StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
if ( kLoopSwitch ) {
if ( !Graph()->ValidLoops() ) {
cdebug_out << "This DataFlow have not valid Loops." << endl ;
- return false ;
+ RetVal = false ;
}
if ( !Graph()->ValidSwitchs() ) {
cdebug_out << "This DataFlow have not valid Switchs." << endl ;
- return false ;
+ RetVal = false ;
}
}
-// CreateService() ;
-
Graph()->ComputingNodes() ;
+#endif
- if ( kLoopSwitch ) {
+ if ( RetVal ) {
_Valid = true ;
}
- cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << endl;
- return true ;
+ cdebug_out << "GraphEditor::OutNode::Valid " << _Valid << " RetVal " << RetVal << endl;
+ return RetVal ;
}
bool GraphEditor::OutNode::Executable() {
cdebug_in << "GraphEditor::OutNode::Executable" << endl;
+ bool RetVal = true ;
bool NewLink ;
// LinkLoopNodes manage input values of LoopNodes and EndLoopNodes
if ( Graph()->LinkLoopNodes( NewLink ) ) {
if ( NewLink ) {
_Valid = false ;
+ RetVal = false ;
}
}
else {
- cdebug << "This DataFlow is not executable." << endl ;
+ cdebug << "Editor::OutNode::Executable This DataFlow is not executable(LinkLoopNodes)." << endl ;
_Executable = false ;
+ RetVal = false ;
}
if ( !IsValid() ) {
Valid() ;
}
if ( !IsValid() ) {
- return false ;
+ RetVal = false ;
+ }
+
+//JR 07.07.2005 PAL9342 : that code is now in Executable() method instead of Valid() method
+ int SubStreamGraphsNumber = 0 ;
+ if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
+ cdebug << "Editor::OutNode::Executable This DataFlow is not valid(Sort)." << endl ;
+ RetVal = false ;
+ }
+ if ( Graph()->IsDataStreamNode() ) {
+ StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
}
+
+ Graph()->InLineServices() ;
+
+// if ( kLoopSwitch ) {
+ if ( !Graph()->ValidLoops() ) {
+ cdebug << "Editor::OutNode::Executable This DataFlow have not valid Loops(ValidLoops)." << endl ;
+ RetVal = false ;
+ }
+ if ( !Graph()->ValidSwitchs() ) {
+ cdebug << "Editor::OutNode::Executable This DataFlow have not valid Switchs(ValidSwitchs)." << endl ;
+ RetVal = false ;
+ }
+// }
+
+ Graph()->ComputingNodes() ;
+
if ( Graph()->DataServerNodes() )
_Executable = true ;
else {
- cdebug << "This DataFlow is not executable." << endl ;
+ cdebug << "Editor::OutNode::Executable This DataFlow is not executable(DataServerNodes)." << endl ;
_Executable = false ;
+ RetVal = false ;
}
if ( _Executable && Graph()->IsDataStreamNode() ) {
// asv : 13.12.04 : introducing check for compatibility of linked ports' types.
if ( !IsLinksCompatible() ) {
_Executable = false;
+ RetVal = false ;
}
- cdebug_out << "GraphEditor::OutNode::Executable " << _Executable << endl;
- return _Executable ;
+ cdebug_out << "GraphEditor::OutNode::Executable _Executable " << _Executable << " RetVal " << RetVal
+ << endl;
+ return RetVal ;
}
//JR 30.03.2005const CORBA::Any *GraphEditor::OutNode::GetInData(
// f << Tabs << " <value>" << retstr << "</value>" << endl ;
QDomElement value = Graph.createElement( "value" ) ;
//PAL9133 Debug JR : accept void strings
- QDomCDATASection aCDATA = Graph.createCDATASection( retstr ) ;
+ QDomCDATASection aCDATA ;
+ int i ;
+ for ( i = 0 ; i < (int ) strlen( retstr ) ; i++ ) {
+ if ( retstr[ i ] != ' ' ) {
+ break ;
+ }
+ }
+ if ( i == (int ) strlen( retstr ) ) {
+ aCDATA = Graph.createCDATASection( "?" ) ;
+ }
+ else {
+ aCDATA = Graph.createCDATASection( retstr ) ;
+ }
// aField = Graph.createTextNode( retstr ) ;
- aField = Graph.createCDATASection( retstr ) ;
- datavalue.appendChild( aCDATA ) ;
+ datavalue.appendChild( value ) ;
// datavalue.appendChild( value ) ;
- value.appendChild( aField ) ;
+ value.appendChild( aCDATA ) ;
// MESSAGE( "ToString( string ) " << retstr );
break ;
}
* Returns true if all are compatible.
*/
bool GraphEditor::OutNode::IsLinksCompatible() {
+ cdebug_in << "Editor::OutNode::IsLinksCompatible()" << endl ;
+ bool RetVal = true;
+ bool b ;
const GraphBase::ListOfSLinks * Links = Graph()->GetLinks( true ) ;
- bool b = true;
- for ( int i = 0 ; i < (int ) Links->size() && b ; i++ ) {
+ cdebug_in << "Editor::OutNode::IsLinksCompatible() " << Links->size() << " Links" << endl ;
+// for ( int i = 0 ; i < (int ) Links->size() && b ; i++ ) {
+ for ( int i = 0 ; i < (int ) Links->size() ; i++ ) {
GraphBase::SLink aLink = (*Links)[i];
GraphBase::ComputingNode* anOutNode = Graph()->GetChangeGraphNode( aLink.FromNodeName.c_str() );
GraphBase::ComputingNode* anInNode = Graph()->GetChangeGraphNode( aLink.ToNodeName.c_str() );
const GraphBase::OutPort* anOutPort = anOutNode->GetOutPort( aLink.FromServiceParameterName.c_str() );
const GraphBase::InPort* anInPort = anInNode->GetInPort( aLink.ToServiceParameterName.c_str() );
b = IsCompatible( anOutPort->PortType(), anInPort->PortType() );
- cdebug << "GraphEditor::OutNode::IsLinksCompatible: "<<aLink.FromNodeName << "("<<aLink.FromServiceParameterName
- <<") --> "<<aLink.ToNodeName<<"("<<aLink.ToServiceParameterName<<") = " << (b ? "OK" : "Not compatible (ERROR)") << endl;
- if ( !b )
- MESSAGE( "Graph structure ERROR: type of port \""<<aLink.FromServiceParameterName<<"\" of node \""
- <<aLink.FromNodeName<<"\" is not compatible with type of linked port \""
- <<aLink.ToServiceParameterName<<"\" of node \""<<aLink.ToNodeName<<"\"" );
- }
- return b;
+ cdebug << "GraphEditor::OutNode::IsLinksCompatible: " << aLink.FromNodeName << "( "
+ << aLink.FromServiceParameterName << " " << anOutPort->PortType()
+ << " ) --> " << aLink.ToNodeName <<"( " << aLink.ToServiceParameterName << " "
+ << anInPort->PortType() << " ) = " << (b ? "OK" : "Not compatible (ERROR)") << endl;
+ if ( !b ) {
+ RetVal = false ;
+ MESSAGE( "Graph structure ERROR: type of port \"" << aLink.FromServiceParameterName
+ << "\" of node \"" << aLink.FromNodeName
+ << "\" is not compatible with type of linked port \""
+ << aLink.ToServiceParameterName << "\" of node \"" << aLink.ToNodeName<<"\"" ) ;
+ ostringstream aTypeOutPortstr ;
+ aTypeOutPortstr << anOutPort->PortType() ;
+ ostringstream aTypeInPortstr ;
+ aTypeInPortstr << anInPort->PortType() ;
+ string anErrorMessage = string( "PortTypes of " ) + string( aLink.FromNodeName ) +
+ string( "( " ) + aLink.FromServiceParameterName +
+ string( " ) " ) + aTypeOutPortstr.str() + string( " and " ) +
+ string( aLink.ToNodeName ) + string( "( " ) +
+ string( aLink.ToServiceParameterName ) +
+ string( " ) " ) + aTypeInPortstr.str() +
+ string( " are not compatibles.\n" ) ;
+ Graph()->SetMessages( anErrorMessage ) ;
+ }
+ }
+ cdebug_out << "Editor::OutNode::IsLinksCompatible() RetVal " << RetVal << endl ;
+ return RetVal ;
}
static const char* gSimpleTypes[] =
CORBA::ORB_ptr _Orb;
- bool Valid(bool kLoopSwitch = true ) ;
+// bool Valid(bool kLoopSwitch = true ) ;
+ bool Valid() ;
bool Executable() ;
bool LoadNodes( map< string , int > & aMapOfNodes ,
const int index , long &X , long &Y ) ;
- bool IsValid(bool kLoopSwitch = true ) {
+// bool IsValid(bool kLoopSwitch = true ) {
+ bool IsValid( ) {
if ( !_Valid )
- Valid( kLoopSwitch ) ;
+// Valid( kLoopSwitch ) ;
+ Valid() ;
return _Valid ; } ;
bool IsNotValid() const {
return !_Valid ; } ;
bool UnValid() ;
bool IsExecutable() {
+ cdebug_in << "Editor::OutNode::IsExecutable() " << " _Valid " << _Valid
+ << " _Executable " << _Executable << endl;
if ( !_Valid )
Valid() ;
if ( _Valid ) {
}
else
_Executable = false ;
+ cdebug_out << "Editor::OutNode::IsExecutable() " << " _Valid " << _Valid
+ << " _Executable " << _Executable << endl ;
return _Executable ; } ;
bool IsNotExecutable() const {
return !_Executable ; } ;
_ActionName[ Executing_StopAction ] = "Executing_StopAction" ;
_ActionName[ Executing_SuccessAction ] = "Executing_SuccessAction" ;
- _ActionName[ Executing_ErrorAction ] = "Executing_ErrorAction" ;
+// _ActionName[ Executing_ErrorAction ] = "Executing_ErrorAction" ;
+ _ActionName[ Errored_ExecutingAction ] = "Errored_ExecutingAction" ;
_ActionName[ Successed_SuccessAction ] = "Successed_SuccessAction" ;
_ActionName[ Errored_ErrorAction ] = "Errored_ErrorAction" ;
//JR 24.03.2005 : Debug for PAL8176 : abort of GOTONode
// ErrorEvent
_TransitionTable[ SuccessedState ][ ErrorEvent ] = ErroredExecutingState ;
- _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
+// _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
+ _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Errored_ExecutingAction;
// ErrorEvent
_TransitionTable[ ExecutingState ][ ErrorEvent ] = ErroredExecutingState ;
- _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
+// _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
+ _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Errored_ExecutingAction;
// SuspendedExecutingState : NO ResumeEvent 13-03-2003
_TransitionTable[ SuspendedExecutingState ][ ErrorEvent ] = ErroredExecutingState ;
- _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
+// _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Executing_ErrorAction;
+ _ActionTable[ ErroredExecutingState ][ ErrorEvent ] = Errored_ExecutingAction;
// DONE-CONTROL :
// SuccessedExecutingState - SuccessEvent
Executing_KillAction ,
Executing_StopAction ,
Executing_SuccessAction ,
- Executing_ErrorAction ,
+// Executing_ErrorAction ,
+ Errored_ExecutingAction ,
Successed_SuccessAction ,
Errored_ErrorAction ,
Successed_SuspendAction ,
GetChangeNodeOutPort(i)->PortState( SUPERV::ReadyState ) ;
GetChangeNodeOutPort(i)->PortDone( true ) ;
}
- else if ( i != 0 || !IsGOTONode() ) {
+//JR Debug 01.07.2005 :
+// else if ( i != 0 || !IsGOTONode() ) {
+ else {
GetChangeNodeOutPort(i)->PortState( SUPERV::WaitingState ) ;
GetChangeNodeOutPort(i)->PortDone( false ) ;
}
int InPortsCount = GetNodeInPortsSize() ;
for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
- const GraphBase::InPort * anInPort = GetNodeInPort(i) ;
+ GraphBase::InPort * anInPort = GetChangeNodeInPort(i) ;
+ anInPort->PortState( SUPERV::WaitingState ) ;
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
if ( IsHeadNode() && IsLoopNode() && anInPort->IsLoop() ) {
anOutPort->PortStatus( DataConnected );
cdebug_in << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " WithErr " << WithErr
<< " PyFuncRunned() " << PyFuncRunned() << endl;
bool Err = false ;
+ bool OneErr ;
if ( !PyFuncRunned() && IsOneOfInLineNodes() ) {
if ( IsLoopNode() ) {
PyObject * PyRunMethod = InLineNode()->PyRunMethod() ;
PyObject * PyMoreMethod = NULL ;
PyObject * PyNextMethod = NULL ;
if ( PyRunMethod ) {
+ OneErr = false ;
}
else {
PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
InLineNode()->PythonFunction() ,
- Err ) ;
+ OneErr ) ;
InLineNode()->PyRunMethod( PyRunMethod ) ;
}
- if ( !Err ) {
- PyMoreMethod = LoopNode()->PyMoreMethod() ;
- if ( PyMoreMethod ) {
- }
- else {
- PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() ,
- LoopNode()->MorePythonFunction() ,
- Err ) ;
- LoopNode()->PyMoreMethod( PyMoreMethod ) ;
- }
+ Err = Err || OneErr ;
+ if ( OneErr && WithErr ) {
+ string anErrorMessage = string( "Error while declaring the Python function " ) +
+ string( LoopNode()->PyFuncName() ) + string( " in Node " ) +
+ string( Name() ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
}
- if ( !Err ) {
- PyNextMethod = LoopNode()->PyNextMethod() ;
- if ( PyNextMethod ) {
- }
- else {
- PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() ,
- LoopNode()->NextPythonFunction() ,
- Err ) ;
- LoopNode()->PyNextMethod( PyNextMethod ) ;
- }
+ PyMoreMethod = LoopNode()->PyMoreMethod() ;
+ if ( PyMoreMethod ) {
+ OneErr = false ;
+ }
+ else {
+ PyMoreMethod = InitPyDynInvoke( LoopNode()->PyMoreName() ,
+ LoopNode()->MorePythonFunction() ,
+ OneErr ) ;
+ LoopNode()->PyMoreMethod( PyMoreMethod ) ;
+ }
+ Err = Err || OneErr ;
+ if ( OneErr && WithErr ) {
+ string anErrorMessage = string( "Error while declaring the Python function " ) +
+ string( LoopNode()->PyMoreName() ) + string( " in Node " ) +
+ string( Name() ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
+ }
+ PyNextMethod = LoopNode()->PyNextMethod() ;
+ if ( PyNextMethod ) {
+ OneErr = false ;
+ }
+ else {
+ PyNextMethod = InitPyDynInvoke( LoopNode()->PyNextName() ,
+ LoopNode()->NextPythonFunction() ,
+ OneErr ) ;
+ LoopNode()->PyNextMethod( PyNextMethod ) ;
+ }
+ Err = Err || OneErr ;
+ if ( OneErr && WithErr ) {
+ string anErrorMessage = string( "Error while declaring the Python function " ) +
+ string( LoopNode()->PyNextName() ) + string( " in Node " ) +
+ string( Name() ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
}
- cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) " << PyRunMethod
- << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod << endl;
+ cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod(Init) "
+ << PyRunMethod << " PyMoreMethod " << PyMoreMethod << " PyNextMethod " << PyNextMethod
+ << endl;
}
else if ( IsInLineNode() || IsSwitchNode() ) {
PyObject * PyRunMethod = InLineNode()->PyRunMethod() ;
if ( PyRunMethod ) {
+ OneErr = false ;
}
else {
PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
InLineNode()->PythonFunction() ,
- Err ) ;
+ OneErr ) ;
InLineNode()->PyRunMethod( PyRunMethod ) ;
}
+ Err = Err || OneErr ;
+ if ( OneErr && WithErr ) {
+ string anErrorMessage = string( "Error while declaring the Python function " ) +
+ string( InLineNode()->PyFuncName() ) + string( " in Node " ) +
+ string( Name() ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
+ }
cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl;
}
else if ( ( IsEndLoopNode() || IsEndSwitchNode() || IsGOTONode() ) &&
(*InLineNode()->PythonFunction()).length() ) {
PyObject * PyRunMethod = InLineNode()->PyRunMethod() ;
if ( PyRunMethod ) {
+ OneErr = false ;
}
else {
PyRunMethod = InitPyDynInvoke( InLineNode()->PyFuncName() ,
InLineNode()->PythonFunction() ,
- Err ) ;
+ OneErr ) ;
InLineNode()->PyRunMethod( PyRunMethod ) ;
}
+ Err = Err || OneErr ;
+ if ( OneErr && WithErr ) {
+ string anErrorMessage = string( "Error while declaring the Python function " ) +
+ string( InLineNode()->PyFuncName() ) + string( " in Node " ) +
+ string( Name() ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
+ }
cdebug << "GraphExecutor::InNode::InitPythonFunctions " << Name() << " PyRunMethod " << PyRunMethod << endl;
}
}
int Executing_KillAction() ;
int Executing_StopAction() ;
int Executing_SuccessAction() ;
- int Executing_ErrorAction() ;
+// int Executing_ErrorAction() ;
+ int Errored_ExecutingAction() ;
int Successed_SuccessAction() ;
bool SendSomeDataReady( char * FromNodeName ) ;
int Errored_ErrorAction() ;
bool OutParametersSet( bool Err , SUPERV::GraphState PortState ,
int nOutParams ,
ServicesAnyData * OutParametersList ) ;
+ void SetOutPortsOfInportsOfEndSwitch( GraphBase::OutPort * anOutPort ,
+ const char * anEndSwitchNodeName ) ;
void coutbegin() ;
void coutexit() ;
#endif
}
-#define SendEventTrace 1
+#define SendEventTrace 0
int GraphExecutor::InNode::SendEvent( const GraphExecutor::NodeEvent anEvent ) {
_CurrentEvent = (GraphExecutor::NodeEvent ) anEvent ;
<< " _RewindStack " << _RewindStack << endl ;
#endif
- int sts = executeAction() ;
+ int sts = true ;
+ if ( _OutNode->IsNodeAborted() ) {
+#if SendEventTrace
+ cdebug << pthread_self() << "/" << ThreadNo() << " SendedEvent Node " << Name()
+ << " will exit : a node was aborted ..." << endl ;
+#endif
+ }
+ else {
+ sts = executeAction() ;
+ }
#if SendEventTrace
cdebug_out << pthread_self() << "/" << ThreadNo() << " <--- SendEvent Node " << Name()
}
-#define ActionsTrace 1
+#define ActionsTrace 0
// ReadyAction - RunningAction - DoneAction - SuspendedAction :
// for StateWait( ReadyW - RunningW - DoneW - SuspendedW )
void GraphExecutor::InNode::ReadyAction() {
sts = Executing_SuccessAction() ;
break ;
}
- case GraphExecutor::Executing_ErrorAction : {
- sts = Executing_ErrorAction() ;
+ case GraphExecutor::Errored_ExecutingAction : {
+ sts = Errored_ExecutingAction() ;
break ;
}
case GraphExecutor::Successed_SuccessAction : {
return 1;
}
-#define SomeDataReadyActionTrace 1
+#define SomeDataReadyActionTrace 0
int GraphExecutor::InNode::DataWaiting_SomeDataReadyAction() {
#if SomeDataReadyActionTrace
cdebug_in << pthread_self() << "/" << ThreadNo() << " " << Name()
}
}
else {
-//JR 20.04.2005 : SomeDataReady is FROM the SwitchNode
+//JR 20.04.2005 : SomeDataReady is FROM the SwitchNode to that EndSwitchNode
//PAL8518
//JR 16.02.2005 Debug : Change InPorts of EndSwitchNode that have the same name as an OutPort of
// the SwitchNode even if it is the DefaultPort : GraphSwitchCheckDefault1.xml
cdebug << endl ;
#endif
}
+//JR 28.06.2005 : SomeDataReady is from the SwitchNode and the InDefault is not connected :
+// a SwitchBranch should be activated
+ else {
+ DoAllDataReadyIf = false ;
+ }
}
}
GraphBase::InPort * anInPort = GetChangeNodeInPort(k) ;
GraphBase::OutPort * anOutPort ;
if ( SwitchDefault && !anInPort->IsDataStream() ) {
-//Set the field OutPort of that InPort of the EndSwitchNode to the corresponding OutPort
+//Get or Set the field OutPort of that InPort of the EndSwitchNode to the corresponding OutPort
// of the SwitchNode
- anOutPort = CoupledNode()->GetChangeOutPort( anInPort->PortName() ) ;
+ anOutPort = anInPort->GetOutPort() ;
+ if ( anOutPort ) {
#if SomeDataReadyActionTrace
- cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
- << anInPort->PortName() << " change of OutPort from "
- << anInPort->GetOutPort()->NodeName() << "( " << anInPort->GetOutPort()->PortName()
- << " ) to " << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )"
- << endl ;
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ << anInPort->PortName() << " already setted to OutPort " << anOutPort->NodeName()
+ << "( " << anOutPort->PortName() << " )" << endl ;
#endif
- anInPort->ChangeOutPort( anOutPort ) ;
+ }
+ else {
+ anOutPort = CoupledNode()->GetChangeOutPort( anInPort->PortName() ) ;
+ if ( anOutPort ) {
+#if SomeDataReadyActionTrace
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ << anInPort->PortName() << " change of OutPort from "
+ << anInPort->GetOutPort()->NodeName() << "( " << anInPort->GetOutPort()->PortName()
+ << " ) to " << anOutPort->NodeName() << "( " << anOutPort->PortName() << " )"
+ << endl ;
+#endif
+ }
+ else {
+ cdebug << pthread_self() << "/" << ThreadNo() << " " << Name() << " InPort "
+ << anInPort->PortName() << " have NO OutPort ERROR " << endl ;
+ return 0 ;
+ }
+ anInPort->ChangeOutPort( anOutPort ) ;
+ }
}
else {
anOutPort = anInPort->GetOutPort() ;
}
// That InPort get its value from an other node : the node of anOutPort linked to that anInPort is
-// different from the sender of SomeDataReady (DataFromNode)
+// different from the sender of SomeDataReady (DataFromNode) :
else if ( strcmp( DataFromNode() , anOutPort->NodeName() ) ) {
if ( anInPort->PortState() == SUPERV::ReadyState ) {
InReady += 1 ;
}
-#define TraceDataReadyAction 1
+#define TraceDataReadyAction 0
int GraphExecutor::InNode::DataUndef_NotAllDataReadyAction() {
//JR 15.04.2005 Debug PAL8624 RetroConception :
// CreateNewThreadIf( false ) ;
#include <CORBA.h>
-#define TraceDataReady_ExecuteAction 1
+#define TraceDataReady_ExecuteAction 0
int GraphExecutor::InNode::DataReady_ExecuteAction() {
#if TraceDataReady_ExecuteAction
InLineNode()->PyFuncName() ,
&InParametersList[1] , ServiceInParameter().length() ,
&OutParametersList[1] , ServiceOutParameter().length() ) ;
- if ( !StsPyDynInvoke ) {
- RemovePyDynInvoke( InLineNode()->PyFuncName() ) ;
- }
+ if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ InLineNode()->PyFuncName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
+ RemovePyDynInvoke( InLineNode()->PyFuncName() ) ;
+ }
CopyOutIn = true ;
}
else {
&InParametersList[1] , ServiceInParameter().length() ,
&OutParametersList[1] , ServiceOutParameter().length() ) ;
if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ LoopNode()->PyNextName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
RemovePyDynInvoke( LoopNode()->PyNextName() ) ;
}
CopyOutIn = true ;
&InParametersList[1] , ServiceInParameter().length() ,
&OutParametersList[0] , ServiceOutParameter().length()+1 ) ;
if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ LoopNode()->PyMoreName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
RemovePyDynInvoke( LoopNode()->PyMoreName() ) ;
}
}
&InParametersList[0] , ServiceInParameter().length() ,
&OutParametersList[0] , ServiceOutParameter().length() ) ;
if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ InLineNode()->PyFuncName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
RemovePyDynInvoke( InLineNode()->PyFuncName() ) ;
}
}
&InParametersList[0] , ServiceInParameter().length() ,
&OutParametersList[0] , ServiceOutParameter().length() ) ;
if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ InLineNode()->PyFuncName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
RemovePyDynInvoke( GOTONode()->PyFuncName() ) ;
}
}
&InParametersList[0] , ServiceInParameter().length() ,
&OutParametersList[0] , ServiceOutParameter().length() ) ;
if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ InLineNode()->PyFuncName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
RemovePyDynInvoke( InLineNode()->PyFuncName() ) ;
}
}
&InParametersList[0] , ServiceInParameter().length() + 1 ,
&OutParametersList[0] , ServiceOutParameter().length() + 1 ) ;
if ( !StsPyDynInvoke ) {
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " function " +
+ InLineNode()->PyFuncName() + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
RemovePyDynInvoke( InLineNode()->PyFuncName() ) ;
}
}
//JR 24.03.2005 : Debug : void InLine Python function : check of the number of Input Ports
// equals the number of Output Ports was missing
if ( ServiceInParameter().length() != ServiceOutParameter().length() ) {
+ string anErrorMessage = string( "Inconsistent number of In<->Out parameters for the vois Python function of the node " ) +
+ string( Name() ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
StsPyDynInvoke = false ;
}
else {
<< " Value(long) "
<< OutParametersList[argout0 + i ].Name.c_str() << endl ;
break ;
+ case CORBA::tk_float :
+ cdebug << "ArgOut->In" << argin0 + i << " : "
+ << InParametersList[ argin0 + i].Name.c_str()
+ << " Value(float) "
+ << OutParametersList[argout0 + i].Name.c_str() << endl ;
+ break ;
case CORBA::tk_double :
cdebug << "ArgOut->In" << argin0 + i << " : "
<< InParametersList[argin0 + i].Name.c_str()
}
if ( !StsPyDynInvoke ) {
Err = true ;
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " error." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
cdebug << ThreadNo() << " InLineNode " << Name()
<< " Python Dynamic Call Error"
<< endl ;
}
catch( ... ) {
Err = true ;
+ string anErrorMessage = string( "Dynamic Python call for node " ) +
+ string( Name() ) + " catched." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
cdebug << ThreadNo() << " InLineNode " << Name()
<< " Python Dynamic Call Exception catched ERROR"
<< endl ;
_OutNode->Name() , Name() ) ;
}
catch( ... ) {
+ string anErrorMessage = string( "Dynamic CORBA call to Names for node " ) +
+ string( Name() ) + " catched." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
cdebug << "DynInvoke Names catched ERROR" << endl ;
}
// for DataStreamNodes : call of SetProperties ===> environment variables in the component/container
myObjComponent->setProperties( dict ) ;
}
catch( ... ) {
+ string anErrorMessage = string( "Dynamic CORBA call to setProperties for node " ) +
+ string( Name() ) + " catched." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
cdebug << "DynInvoke setProperties catched ERROR" << endl ;
Err = true;
}
}
catch( ... ) {
Err = true ;
+ string anErrorMessage = string( "Dynamic CORBA call for node " ) +
+ string( Name() ) + " catched." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
cdebug << pthread_self() << "/" << ThreadNo() << " !ObjInterface " << Name()
<< " Node(Component) Dynamic Call Exception catched ERROR"
<< endl ;
return 1 ;
}
-int GraphExecutor::InNode::Executing_ErrorAction() {
- cdebug << ThreadNo() << " --> Executing_ErrorAction " << Name() << endl;
+int GraphExecutor::InNode::Errored_ExecutingAction() {
+ cdebug << ThreadNo() << " --> Errored_ExecutingAction " << Name() << endl;
_OutNode->PushEvent( this , GraphExecutor::ErroredExecutingEvent ,
GraphExecutor::ErroredState ) ;
+ _OutNode->NodeAborted( Name() ) ;
+
SUPERV::ControlState aControl = ControlState() ;
switch ( aControl ) {
case SUPERV::VoidState : {
}
default : {
cdebug << ThreadNo()
- << " GraphExecutor::InNodeThreads::Executing_ErrorAction Error Undefined Control : "
+ << " GraphExecutor::InNodeThreads::Errored_ExecutingAction Error Undefined Control : "
<< aControl << endl ;
return 0;
}
}
- cdebug << ThreadNo() << " <-- Executing_ErrorAction " << Name() << endl;
+ cdebug << ThreadNo() << " <-- Errored_ExecutingAction " << Name() << endl;
return 1 ;
}
}
}
-#define SuccessActionTrace 1
+#define SuccessActionTrace 0
//JR Step B
int GraphExecutor::InNode::Successed_SuccessAction() {
#if SuccessActionTrace
cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction " << Name() << " will Loop to HeadNode "
<< aLabelNode->Name() << " from port " << anInPort->PortName() << endl ;
#endif
+ State( GraphExecutor::DataWaitingState ) ;
aLabelNode->SetWaitingStates( this ) ;
// JR 07.01.2005 Debug : Open the Gate of the coupledNode closed by SetWaitingStates
GraphBase::OutPort * anOutPort = aLabelNode->GetChangeNodeInGate()->GetOutPort() ;
cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction "
<< Name() << " SendSomeDataReady to " << aLabelNode->Name() << " ERROR"
<< endl ;
+//JR 30.06.2005 :
+ SendEvent( GraphExecutor::ErrorEvent ) ;
return 0 ;
}
if ( aLabelNode->HasAllDataReady() ) {
}
}
+//Loop of LinkedNodes for SendSomeDataReady :
for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
-//JR 15.04.2005 Debug PAL8624 RetroConception :
-// If this is a LoopNode and if DoLoopPort == false, we go directly to the EndOfLoopNode and
-// we do not activate Nodes within the loop
-// bool IgnoreForEndLoop = false ;
-// If this is a SwitchNode and if DefaultOutPort == true, we do not activate Nodes within Switch
-// We activate directly the EnSwitch
-// BUT the NotSwitchBranch(es) are NOT activated :
-// bool IgnoreForDefaultSwitch = false ;
GraphBase::ComputingNode * aComputingNode ;
aComputingNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
toNode = (GraphExecutor::InNode *) aComputingNode->GetInNode() ;
GateOutPort->PortDone( true ) ;
}
}
+
//JR 15.04.2005 Debug PAL8624 RetroConception :
if ( IsLoopNode() ) {
-// GraphBase::OutPort * fromLoopOutPort = GetChangeNodeOutLoop() ;
-// if ( !fromLoopOutPort->BoolValue() ) { // Ne pas faire la boucle
-// if ( strcmp( toNode->Name() , CoupledNode()->Name() ) ) {
if ( IgnoreForEndLoop && !strcmp( toNode->Name() , CoupledNode()->Name() ) ) {
-// IgnoreForEndLoop = true ;
-// }
-// else { // toNode is the EndLoopNode
GraphBase::InPort * toLoopInPort ;
toLoopInPort = toNode->GetChangeNodeInLoop() ;
if ( toLoopInPort->PortState() != SUPERV::ReadyState ) {
}
}
//JR 15.04.2005 Debug PAL8624 RetroConception :
-// else if ( IsSwitchNode() ) {
-// const GraphBase::OutPort * anOutGatePort = GetNodeOutGate() ;
-// if ( anOutGatePort->BoolValue() && anOutGatePort->InPortsSize() ) { // DefaultPort is activated
-// The DefaultOutPort of that SwitchNode is true and is connected
-// IgnoreForDefaultSwitch = true ;
-// }
-// }
else if ( toNode->IsInLineNode() ) {
int j ;
for ( j = 0 ; j < toNode->GetNodeInPortsSize() ; j++ ) {
activatetoNode = false ;
}
}
+
// If the DefaultPort of that SwitchNode is connected to the DefaultPort of the EndSwitchNode
-// the NotSwitchBranch(es) are NOT activated :
-// If the DefaultPort of that SwitchNode is connected to SwitchBranch(es)
// the NotSwitchBranch(es) are NOT activated :
if ( IgnoreForDefaultSwitch ) {
//We have to activate Default to EndSwitchNode
cdebug << pthread_self() << "/" << ThreadNo() << " Successed_SuccessAction "
<< Name() << " SendSomeDataReady to " << toNode->Name() << " ERROR"
<< endl ;
+//JR 30.06.2005 :
+ toNode->UnLockDataReady() ;
+ SendEvent( GraphExecutor::ErrorEvent ) ;
return 0 ;
}
}
toNode->UnLockDataReady() ;
}
- }
+ } //End of Loop of LinkedNodes for SendSomeDataReady
-//PAL8517
//JR 10.02.2005 : Debug at the end of execution of a SwitchNode :
// Here after we may start execution of only one SwitchBranch or of the Default
// But with activation of only one SwitchBranch we may activate several nodes of that SwitchBranch and
// we may activate several nodes of NotSwitchBranch ( a NotSwitchBranch is a Branch of the Switch
// where GatePorts of Nodes are not connected ; that Branches are always executed for each of SwitchBranch
// BUT are not executed when Default is activated).
-// So the bug is that all input ports of the corresponding EndSwitchNode must have the status NOTDONE !
-// (Only if Default OutPort is closed and Default InPort is closed)
if ( IsSwitchNode() ) {
GraphBase::InLineNode * anEndSwitchNode = GOTONode()->CoupledNode() ;
+//The InPorts of the EndSwitchNode may be connected from that SwitchNode
+//So at first, if we activate a SwitchBranch, we have to establish the correct OutPort in the InPorts
+// of the EndSwitchNode (for the SwitchBranch and the NOTSwitchBranch[es] :
+//PAL8517
+// So the bug is that all input ports of the corresponding EndSwitchNode must have the status NOTDONE !
+// (Only if Default OutPort is closed and Default InPort is closed) :
if ( !GetNodeOutGate()->BoolValue() && anEndSwitchNode->GetNodeInGate()->GetOutPort() &&
!anEndSwitchNode->GetNodeInGate()->GetOutPort()->BoolValue() ) {
#if SuccessActionTrace
}
//JR 15.04.2005 Debug PAL8624 RetroConception :
+//Make the list of nodes to activate :
for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
GraphBase::ComputingNode * aComputingNode ;
aComputingNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
toNode = (GraphExecutor::InNode *) aComputingNode->GetInNode() ;
if ( toNode ) { // Only Not DataFlowNode :
- toNode->LockDataReady() ;
+ toNode->LockDataReady() ; // Only ONE Node may send AllDataReadyEvent to an other node
if ( toNode->HasAllDataReady() ) {
SomeDataNodes.push_back( toNode ) ;
toNode->HasAllDataReady( false ) ;
}
// firsttoNode : node that has the same ThreadNo() as the current node and that have to be activated
-// firstzeroNode : node that has a null ThreadNo() and that have to be activated
//JR 15.04.2005 Debug PAL8624 RetroConception :
+//Activation of nodes that have AllDataReady in a new thread except one :
while ( SomeDataNodes.size() > 1 ) {
GraphExecutor::InNode *aNode = SomeDataNodes.front() ;
SomeDataNodes.pop_front() ;
res = aNode->SendEvent( GraphExecutor::AllDataReadyEvent ); // ==> Ready to execute
}
+//Activation of the last node that have AllDataReady in the same thread :
if ( SomeDataNodes.size() ) {
firsttoNode = SomeDataNodes.front() ;
SomeDataNodes.pop_front() ;
}
-
if ( firsttoNode ) {
#if SuccessActionTrace
cdebug << pthread_self() << "/" << ThreadNo()
<< " " << Automaton()->StateName( firsttoNode->State() ) << endl ;
#endif
//JR 15.04.2005 Debug PAL8624 RetroConception :
-//No creation of thread and with LockDataReady an other node in an other thread cannot be
+//No creation of thread and with LockDataReady, an other node in an other thread cannot be
// waiting for that lock ( if it was the case we could not find AllDataReady for firsttoNode
res = firsttoNode->SendEvent( GraphExecutor::AllDataReadyEvent ); // ==> Ready to execute
}
return 1 ;
}
-#define SendSomeDataReadyTrace 1
+#define SendSomeDataReadyTrace 0
bool GraphExecutor::InNode::SendSomeDataReady( char * FromNodeName ) {
bool RetVal = false ;
if ( IsDataFlowNode() ) {
int GraphExecutor::InNode::Errored_ErrorAction() {
cdebug << ThreadNo() << " Errored_ErrorAction " << Name()
<< " will pthread_exit" << endl;
+
+ _OutNode->NodeAborted( Name() ) ;
+
DoneAction() ;
return 1 ;
}
<< _OutNode->SuspendedThreads() << endl;
_OutNode->PushEvent( this , GraphExecutor::SuspendedErroredEvent ,
GraphExecutor::SuspendedErroredState ) ;
+
+ _OutNode->NodeAborted( Name() ) ;
+
DoneAction() ;
GraphExecutor::InNode * aReStartNode = SuspendAction() ;
cdebug << ThreadNo() << " Errored_SuspendAction Resumed " << Name()
// ResumeAction() ;
_OutNode->PushEvent( this , GraphExecutor::ResumedErroredEvent ,
GraphExecutor::ResumedErroredState ) ;
+
+ _OutNode->NodeAborted( Name() ) ;
+
SendEvent( ResumedErroredEvent ) ;
return 1 ;
}
KillAction() ;
_OutNode->PushEvent( this , GraphExecutor::KilledEvent ,
GraphExecutor::KilledErroredState ) ;
+
+ _OutNode->NodeAborted( Name() ) ;
+
cdebug << ThreadNo() << " Errored_KillAction " << Name() << endl;
return 1 ;
}
StopAction() ;
_OutNode->PushEvent( this , GraphExecutor::StoppedEvent ,
GraphExecutor::StoppedErroredState ) ;
+
+ _OutNode->NodeAborted( Name() ) ;
+
cdebug << ThreadNo() << " Errored_StopAction " << Name() << endl;
return 1 ;
}
return 1 ;
}
-#define InParametersSetTrace 1
+#define InParametersSetTrace 0
void GraphExecutor::InNode::InParametersSet( bool & Err ,
int nInParams ,
ServicesAnyData * InParametersList ) {
}
}
-#define OutParametersSetTrace 1
+#define OutParametersSetTrace 0
bool GraphExecutor::InNode::OutParametersSet( bool Err ,
SUPERV::GraphState PortState ,
int nOutParams ,
#endif
anOutPort->SetValue( OutParametersList[i].Value );
if ( anOutPort->InPortsSize() && anOutPort->ChangeInPorts( 0 )->IsGate() ) {
-//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches :
+//We have a SwitchBranch or the DefaultBranch .
+//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches (SwitchParameters) :
//It controls that there is only one SwitchBranch activated
//If it's final value is false ==> activation of the Default to GOTO to EndSwitchNode
//DefaultSwitch is true if a SwitchPort is linked to the DefaultPort of the EndSwitchNode
if ( OrSwitch && anOutPort->BoolValue() ) {
- cdebug << "GraphExecutor::InNodeThreads::OutParameters more than one switch is true ERROR"
+ string anErrorMessage = string( "More than one SwitchBranch should be activated in SwitchNode " ) +
+ string( Name() ) + string( "( " ) +
+ string( anOutPort->PortName() ) + string( " )" ) ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
+ cdebug << "Executor::InNodeThreads::OutParameters more than one SwitchBranch is true ERROR"
<< endl ;
RetVal = false ;
}
}
#endif
}
- }
- if ( aGateOutPort && IsSwitchNode() ) {
+ } // End of : for ( i = 0 ; i < nOutParams ; i++ ) {
+#if OutParametersSetTrace
+ cdebug << ThreadNo() << "OutParametersSet End of loop with " << nOutParams
+ << " OutParams. aGateOutPort " << (void *) aGateOutPort << " IsSwitchNode "
+ << IsSwitchNode() << " OrSwitch " << OrSwitch << " DefaultSwitch " << DefaultSwitch
+ << endl ;
+#endif
+
+//In SwitchNodes :
+ if ( IsSwitchNode() && aGateOutPort ) {
//JR 09.02.2005 : OrSwitch is the OR of all SwitchBranches :
//It controls that there is only one SwitchBranch activated
-//If it's final value is false ==> activation of the Default to GOTO to EndSwitchNode
+//If it's final value is false ==> activation of the Default in order to GOTO to EndSwitchNode
//DefaultSwitch is true if a SwitchPort (SwitchBranch) is linked to the DefaultPort of the EndSwitchNode
if ( !OrSwitch && !DefaultSwitch ) {
if ( aGateOutPort->InPortsSize() && aGateOutPort->ChangeInPorts( 0 ) ) {
+//Dynamic activation of the Default OutPort :
#if OutParametersSetTrace
cdebug << ThreadNo() << " " << "OutGate " << Name() << " Open of "
<< aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " WITH DefaultPort"
aGateOutPort->SetValue( OutParametersList[0].Value ) ;
}
else {
+//The Default OutPort is not linked ==> error
+ string anErrorMessage = string( "DefaultPort of SwitchNode " ) +
+ string( Name() ) + " is not connected." ;
+ _OutNode->Graph()->SetMessages( anErrorMessage ) ;
#if OutParametersSetTrace
cdebug << ThreadNo() << " " << "OutGate " << Name() << " "
<< aGateOutPort->PortName() << " " << aGateOutPort->Kind() << " NOT CONNECTED ERROR"
}
}
//JR 07.04.2005 Debug : reset only if it is not a default switch (SwitchBranch or
-// SwitchParameter of SwitchNode connected to the InDefaultPort of
+// SwitchParameter of SwitchNode connected to the DefaultInPort of
// EndSwitchNode)
// else {
else if ( !DefaultSwitch ) {
OutParametersList[0].Value <<= l ;
aGateOutPort->SetValue( OutParametersList[0].Value ) ;
}
-// The OutPort field of InPorts of EndSwitchNode may be updated only in branches :
-// for the Default case they should not be changed (if they are changed ==> bug if we activate
-// a branch after a use of the Default)
- if ( !OrSwitch || DefaultSwitch ) { // DefaultPort or DefaultSwitch
+ if ( RetVal ) {
+// The OutPort field of InPorts of EndSwitchNode may be updated from each OutPort of that SwitchNode :
+ GraphBase::EndOfSwitchNode * anEndSwitchNode = (GraphBase::EndOfSwitchNode * ) CoupledNode() ;
int i ;
- for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
- GraphBase::InPort * anInPort ;
- anInPort = CoupledNode()->GetChangeInPort( GetNodeOutPort( i )->PortName() ) ;
//PAL8518
-//JR 16.02.2005 Debug : Change InPorts of EndSwitchNode that have the same name as an OutPort of
+//JR 16.02.2005 Debug : At first Change InPorts of EndSwitchNode that have the same name as an OutPort of
// the SwitchNode even if it is the DefaultPort : GraphSwitchCheckDefault1.xml
-// if ( anInPort && !anInPort->IsGate() ) {
- if ( anInPort && anInPort->GetOutPort() ) {
+//STEP A : InPorts of EndSwitchNode that have the same name as an OutPort of the SwitchNode
+ for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+ GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i );
+ GraphBase::InPort * anInPort = NULL ;
+ anInPort = anEndSwitchNode->GetChangeInPort( anOutPort->PortName() ) ;
+ if ( anInPort ) {
#if OutParametersSetTrace
- cdebug << "OutParametersSet " << Name() << " " << anInPort->NodeName() << "( "
- << anInPort->PortName() << " , " << anInPort->Kind() << " ) linked from "
- << anInPort->GetOutPort()->NodeName()
- << "( " << anInPort->GetOutPort()->PortName() << " ) CHANGED TO linked from "
- << GetChangeNodeOutPort( i )->NodeName() << "( "
- << GetChangeNodeOutPort( i )->PortName() << " )" << endl ;
-#endif
- anInPort->ChangeOutPort( GetChangeNodeOutPort( i ) ) ;
- }
+ cdebug << "OutParametersSet " << Name() << " " << anInPort->NodeName()
+ << "( " << anInPort->PortName() << " , " << anInPort->Kind() << " ) with same name " ;
+ if ( anInPort->GetOutPort() ) {
+ cdebug << "linked from " << anInPort->GetOutPort()->NodeName()
+ << "( " << anInPort->GetOutPort()->PortName() << " ) " ;
+ }
+ else {
+ cdebug << "NOT linked " ;
+ }
+ cdebug << "CHANGED TO linked from " << anOutPort->NodeName() << "( "
+ << anOutPort->PortName() << " )" << endl ;
+#endif
+ anInPort->ChangeOutPort( anOutPort ) ;
+ }
}
+//STEP B : InPorts of EndSwitchNode directly connected from an OutPort of the SwitchNode
+ for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+ GraphBase::OutPort * anOutPort = GetChangeNodeOutPort( i );
+ GraphBase::InPort * anInPort ;
+ int j ;
+ for ( j = 0 ; j < anOutPort->InPortsSize() ; j++ ) {
+ anInPort = anOutPort->ChangeInPorts( j ) ;
+//Update the OutPort field in the Inports directly connected of the EndSwitchNode :
+ if ( !strcmp( anInPort->NodeName() , anEndSwitchNode->Name() ) ) {
+#if OutParametersSetTrace
+ cdebug << "OutParametersSet " << Name() << " " << anInPort->NodeName()
+ << "( " << anInPort->PortName() << " , " << anInPort->Kind()
+ << " ) directly connected " ;
+ if ( anInPort->GetOutPort() ) {
+ cdebug << "linked from " << anInPort->GetOutPort()->NodeName()
+ << "( " << anInPort->GetOutPort()->PortName() << " ) " ;
+ }
+ else {
+ cdebug << "NOT linked " ;
+ }
+ cdebug << "CHANGED TO linked from " << anOutPort->NodeName() << "( "
+ << anOutPort->PortName() << " )" << endl ;
+#endif
+ anInPort->ChangeOutPort( anOutPort ) ;
+ }
+ }
+ }
+//STEP C : If it is not the DefaultBranch, explore the SwitchBranch and all NOTSwitchBranch[es]
+//Change recursively InPorts of EndSwitchNode linked to that Branch (or that SwitchNode)
+ if ( OrSwitch ) {
+ for ( i = 0 ; i < LinkedNodesSize() ; i++ ) {
+ GraphBase::ComputingNode * aNode = (GraphBase::ComputingNode * ) LinkedNodes( i ) ;
+ if ( aNode != anEndSwitchNode && !aNode->IsGOTONode() &&
+ !aNode->IsDataFlowNode() && !aNode->IsDataStreamNode() ) {
+ const GraphBase::InPort * anInGate = aNode->GetNodeInGate() ;
+ GraphExecutor::InNode * anInNode = (GraphExecutor::InNode * ) aNode->GetInNode() ;
+//STEP C1 : SwitchBranch :
+ if ( anInGate->GetOutPort() ) {
+ if ( anInGate->GetOutPort()->BoolValue() ) {
+#if OutParametersSetTrace
+ cdebug << "OutParametersSet " << Name() << " SWITCHBranch " << aNode->Name() << endl ;
+#endif
+ int j ;
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j );
+ anInNode->SetOutPortsOfInportsOfEndSwitch( anOutPort , anEndSwitchNode->Name() ) ;
+ }
+ }
+ }
+//STEP C2 : NOTSwitchBranch :
+ else {
+#if OutParametersSetTrace
+ cdebug << "OutParametersSet " << Name() << " NOTSWITCHBranch " << aNode->Name() << endl ;
+#endif
+ int j ;
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j );
+ anInNode->SetOutPortsOfInportsOfEndSwitch( anOutPort , anEndSwitchNode->Name() ) ;
+ }
+ }
+ }
+ }
+ }
}
}
}
#endif
return RetVal ;
}
+
+
+void GraphExecutor::InNode::SetOutPortsOfInportsOfEndSwitch( GraphBase::OutPort * anOutPort ,
+ const char * anEndSwitchNodeName ) {
+#if OutParametersSetTrace
+ cdebug_in << "SetOutPortsOfInportsOfEndSwitch " << Name() << " " << anOutPort->NodeName() << "( "
+ << anOutPort->PortName() << " ) with " << anOutPort->InPortsSize() << " links." << endl ;
+#endif
+ GraphBase::InPort * anInPort ;
+ int i ;
+ for ( i = 0 ; i < anOutPort->InPortsSize() ; i++ ) {
+ anInPort = anOutPort->ChangeInPorts( i ) ;
+ if ( !anInPort->IsDataStream() ) {
+//Update the OutPort field in the Inports of the EndSwitchNode :
+ if ( !strcmp( anInPort->NodeName() , anEndSwitchNodeName ) ) {
+#if OutParametersSetTrace
+ cdebug << "SetOutPortsOfInportsOfEndSwitch " << Name() << " " << anInPort->NodeName()
+ << "( " << anInPort->PortName() << " , " << anInPort->Kind() << " ) " ;
+ if ( anInPort->GetOutPort() ) {
+ cdebug << "linked from " << anInPort->GetOutPort()->NodeName()
+ << "( " << anInPort->GetOutPort()->PortName() << " ) " ;
+ }
+ else {
+ cdebug << "NOT linked ERROR " ;
+ }
+ cdebug << "CHANGED TO linked from "
+ << anOutPort->NodeName() << "( "
+ << anOutPort->PortName() << " )" << endl ;
+#endif
+ anInPort->ChangeOutPort( anOutPort ) ;
+ }
+ else {
+#if OutParametersSetTrace
+ cdebug << "SetOutPortsOfInportsOfEndSwitch " << Name() << " " << anInPort->NodeName()
+ << "( " << anInPort->PortName() << " , " << anInPort->Kind() << " ) " << endl ;
+#endif
+ GraphBase::ComputingNode * aComputingNode ;
+ aComputingNode = _OutNode->Graph()->GetChangeGraphNode( anInPort->NodeName() ) ;
+ if ( aComputingNode && !aComputingNode->IsGOTONode() &&
+ !( IsEndLoopNode() && GOTONode()->CoupledNode() == aComputingNode ) ) {
+ GraphExecutor::InNode * aNode ;
+ aNode = (GraphExecutor::InNode * ) aComputingNode->GetInNode() ;
+ if ( aNode ) {
+ int j ;
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( j ) ;
+ aNode->SetOutPortsOfInportsOfEndSwitch( anOutPort , anEndSwitchNodeName ) ;
+ }
+ }
+ }
+ }
+ }
+ }
+#if OutParametersSetTrace
+ cdebug_out << "SetOutPortsOfInportsOfEndSwitch " << Name() << " OutPort " << anOutPort->PortName()
+ << endl ;
+#endif
+}
_Valid = false ;
_Executable = false ;
_Done = false ;
+ _NodeAborted = false ;
_Threads = 0 ;
_ControlState = SUPERV::VoidState ;
_State = GraphExecutor::UnKnownState ;
_Valid = false ;
_Executable = false ;
_Done = false ;
+ _NodeAborted = false ;
_Threads = 0 ;
_ControlState = SUPERV::VoidState ;
_State = GraphExecutor::UnKnownState ;
_Valid = false ;
_Executable = false ;
_Done = false ;
+ _NodeAborted = false ;
_Threads = 0 ;
_ControlState = SUPERV::VoidState ;
_State = GraphExecutor::UnKnownState ;
if ( RetVal ) {
IsValid() ;
RetVal = LoadDatas( (*aDataFlow).Datas ) ;
- IsExecutable() ;
+// IsExecutable() ;
if ( !RetVal) {
cdebug << "GraphExecutor::OutNode::LoadDataFlow LoadDatas Error."
<< endl ;
bool GraphExecutor::OutNode::Valid() {
cdebug_in << "GraphExecutor::OutNode::Valid" << endl;
-
+ bool RetVal = true ;
+ Graph()->ReSetMessages() ; // ==> Only one set of errors messages ...
if ( _Valid )
return true ;
if ( !Graph()->CreateService() ) {
cdebug_out << "This DataFlow has invalid type(s)." << endl ;
- return false ;
+ RetVal = false ;
}
int SubStreamGraphsNumber = 0 ;
if ( !Graph()->Sort( SubStreamGraphsNumber ) ) {
cdebug_out << "This DataFlow is not valid." << endl ;
- return false ;
+ RetVal = false ;
}
if ( Graph()->IsDataStreamNode() ) {
StreamGraph()->SubStreamGraphsNumber( SubStreamGraphsNumber ) ;
if ( !Graph()->ValidLoops() ) {
cdebug_out << "This DataFlow have not valid Loops." << endl ;
- return false ;
+ RetVal = false ;
}
if ( !Graph()->ValidSwitchs() ) {
cdebug_out << "This DataFlow have not valid Switchs." << endl ;
- return false ;
+ RetVal = false ;
}
// CreateService() ;
Graph()->ComputingNodes() ;
-
- _Valid = true ;
+ if ( RetVal ) {
+ _Valid = true ;
+ }
- cdebug_out << "GraphExecutor::OutNode::Valid " << _Valid << endl;
- return _Valid ;
+ cdebug_out << "GraphExecutor::OutNode::Valid " << _Valid << " RetVal " << RetVal << endl;
+ return RetVal ;
}
-
bool GraphExecutor::OutNode::Executable() {
-
cdebug_in << "GraphExecutor::OutNode::Executable" << endl;
- if ( !IsValid() )
- return false ;
+ bool RetVal = true ;
+ if ( !IsValid() ) {
+ RetVal = false ;
+ }
- if ( Graph()->DataServerNodes() )
- _Executable = true ;
+ if ( Graph()->DataServerNodes() ) {
+ if ( RetVal ) {
+ _Executable = true ;
+ }
+ }
else {
cdebug << "This DataFlow is not executable." << endl ;
_Executable = false ;
+ RetVal = false ;
}
cdebug_out << "GraphExecutor::OutNode::Executable " << _Executable << endl;
Done( true ) ;
cdebug_out << "GraphExecutor::OutNode::Run InitPythonFunctions ERROR "
<< anInNode->Name() << endl ;
- return false ;
+ RetVal = false ;
}
}
}
//JR 24.03.2005 debug : State and done flags were missing
State( GraphExecutor::ErroredState ) ;
Done( true ) ;
+//JR 17.06.2005 debug call to executed was missing ===>
+// _GraphExecutingNumber field of FiniteStateMachine was not decremented ===>
+// register of python functions was de-activated ==>
+// two graphs execution with two different python functions with the same name
+// give aborted state for the second one
+//Example : GraphLoopSwitchOfSwitchNOTValid, GraphLoopSwitchs and GraphLoopSwitchsBranches
+ if ( IsDone() ) {
+ cdebug << " ==> theAutomaton->Executed() " << endl ;
+ theAutomaton->Executed() ;
+ }
+ else {
+ cdebug << " NO theAutomaton->Executed() " << endl ;
+ }
cdebug_out << "GraphExecutor::OutNode::Run Not Executable ERROR " << endl ;
return false ;
}
if ( InNodeState != GraphExecutor::SuccessedState &&
InNodeState != GraphExecutor::ErroredState &&
InNodeState != GraphExecutor::DataWaitingState ) {
- AllDone = false ;
+ if ( !IsNodeAborted() ) {
+ AllDone = false ;
+ }
}
if ( InNodeState != GraphExecutor::SuccessedState &&
InNodeState != GraphExecutor::DataWaitingState &&
aState == SUPERV::SuspendDoneState ||
aState == SUPERV::SuspendErroredState ||
aState == SUPERV::SuspendState ) {
- alivenodes += 1 ;
+ if ( !IsNodeAborted() ) {
+ alivenodes += 1 ;
+ }
}
aNode->SuspendedAction() ;
aNode->DoneAction() ;
}
if ( _Threads == 0 && _SuspendedThreads == 0 ) {
CheckAllDone() ;
+ cdebug << pthread_self() << " ExitThread( " << ThreadNumber << " ) " << _Threads
+ << " running threads " << _SuspendedThreads << " suspended threads IsDone() "
+ << IsDone() ;
if ( IsDone() ) {
+ cdebug << " ==> theAutomaton->Executed() " << endl ;
theAutomaton->Executed() ;
}
+ else {
+ cdebug << " NO theAutomaton->Executed() " << endl ;
+ }
}
}
void GraphExecutor::OutNode::JoinedWait() {
GraphExecutor::AutomatonState _State ;
SUPERV::ControlState _ControlState ;
bool _Done ;
+ bool _NodeAborted ;
// asv : 20.01.05 : changes involved with switching to old (HEAD) KERNEL
//Engines_Container_i * _SuperVisionContainer ;
bool Kill() ;
bool Stop() ;
+ void NodeAborted( const char * aNodeName ) {
+ string aMsg = string( "The node " ) + string( aNodeName ) + " was aborted." ;
+ Graph()->SetMessages( aMsg.c_str() ) ;
+ _NodeAborted = true ; } ;
+ bool IsNodeAborted() {
+ return _NodeAborted ; } ;
+
bool IsWaiting() ;
bool IsReady() ;
bool IsRunning() ;
bool RetVal = false ;
if ( DataFlowEditor()->IsEditing() ) {
if ( _IsNode ) {
- RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
- aDataFlowName ) ;
+//JR 29.06.2005 debug :
+ char * OldNodeName = my_strdup( DataFlowNode()->Name() ) ;
+// RetVal = DataFlowEditor()->ReNameNode( DataFlowNode()->Name() ,
+ RetVal = DataFlowEditor()->ReNameNode( OldNodeName ,
+ aDataFlowName ) ;
+ delete [] OldNodeName ;
}
else {
// RetVal = DataFlowEditor()->Graph()->Name( aDataFlowName ) ;
return Engines::Component::_duplicate( objComponent ) ;
}
+char * Graph_Impl::Messages() {
+ beginService( "Graph_Impl::Messages" );
+ string Messages ;
+ MESSAGE( "Graph_Impl::Messages IsEditing " << DataFlowEditor()->IsEditing() ) ;
+ Messages = DataFlowEditor()->Graph()->Messages() ;
+ DataFlowEditor()->Graph()->ReSetMessages() ;
+ if ( DataFlowExecutor() ) {
+ Messages += DataFlowExecutor()->Graph()->Messages() ;
+ DataFlowExecutor()->Graph()->ReSetMessages() ;
+ }
+ endService( "Graph_Impl::Messages" );
+ return ( CORBA::string_dup( Messages.c_str() ) ) ;
+}
+
bool Graph_Impl::IsValid() {
// beginService( "Graph_Impl::IsValid" );
bool RetVal = false ;
perror("pthread_mutex_lock _MutexExecutorWait") ;
exit( 0 ) ;
}
+ DataFlowEditor()->Graph()->ReSetMessages() ; // ==> Only one set of errors messages ...
if ( DataFlowExecutor() ) {
MESSAGE( "Graph_Impl::Begin " << DataFlowExecutor()->Threads() << " threads" )
Editing(); // just in case it was not called before by GUI..
virtual Engines::Component_ptr ComponentRef( const char * aComputerContainer ,
const char * aComponentName ) ;
+ virtual char * Messages() ;
+
virtual bool IsValid() ;
virtual bool IsExecutable() ;
bool destroyed = false ;
if ( _DataFlowNode->IsOneOfInLineNodes() ) {
if ( _InputPort ) {
- GraphBase::InPort * anInPort = (GraphBase::InPort * ) _DataFlowPort ;
+// GraphBase::InPort * anInPort = (GraphBase::InPort * ) _DataFlowPort ;
// if ( anInPort->GetOutPort() ) {
// anInPort->GetOutPort()->RemoveInPort( anInPort ) ;
// }
return self.G.Import( anXmlFileName )
def Export( self , anXmlFileName ):
return self.G.Export( anXmlFileName )
+ def Messages( self ) :
+ return self.G.Messages()
def IsReadOnly( self ) :
return self.G.IsReadOnly()
def ComponentRef( self , aFactoryServer , aComponent ) :