// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
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 ) ;
Info->theName = Name() ;
Info->theKind = Kind() ;
if ( IsDataStreamNode() ) {
- long Timeout ;
+ CORBA::Long Timeout ;
SUPERV::KindOfDataStreamTrace DataStreamTrace ;
- double DeltaTime ;
+ CORBA::Double DeltaTime ;
((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
Info->theTimeout = Timeout ;
Info->theDataStreamTrace = DataStreamTrace ;
( igoto == 1 && aCNode->IsGOTONode() ) ) {
if ( aCNode->IsFactoryNode() ) {
GraphBase::FactoryNode * aFNode = (GraphBase::FactoryNode * ) aCNode ;
- (*_list_nodes)[ind].theComponentName = CORBA::string_dup( aFNode->ComponentName());
- (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( aFNode->InterfaceName());
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theComponentName = CORBA::string_dup( aFNode->ComponentName());
+ (*_list_nodes)[ind].theComponentName = string( aFNode->ComponentName());
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( aFNode->InterfaceName());
+ (*_list_nodes)[ind].theInterfaceName = string( aFNode->InterfaceName());
}
else {
- (*_list_nodes)[ind].theComponentName = CORBA::string_dup( "" );
- (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( "" );
+ (*_list_nodes)[ind].theComponentName = string( "" );
+ (*_list_nodes)[ind].theInterfaceName = string( "" );
}
- (*_list_nodes)[ind].theName = CORBA::string_dup( aCNode->Name() );
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theName = CORBA::string_dup( aCNode->Name() );
+ (*_list_nodes)[ind].theName = string( aCNode->Name() );
(*_list_nodes)[ind].theKind = aCNode->Kind();
if ( aCNode->IsInLineNode() || aCNode->IsMacroNode() ) {
GraphBase::InLineNode * aINode = (GraphBase::InLineNode * ) aCNode ;
(*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aINode->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aINode->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aINode->PyFuncName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aINode->PythonFunction() ;
}
if ( aCNode->IsGOTONode() ) {
GraphBase::GOTONode * aGNode = (GraphBase::GOTONode * ) aCNode ;
(*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGNode->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGNode->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aGNode->PyFuncName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aGNode->PythonFunction() ;
}
if ( aCNode->IsLoopNode() ) {
GraphBase::LoopNode * aLNode = (GraphBase::LoopNode * ) aCNode ;
- (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aLNode->CoupledNode()->Name() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aLNode->CoupledNode()->Name() ) ;
+ (*_list_nodes)[ind].theCoupledNode = string( aLNode->CoupledNode()->Name() ) ;
(*_list_nodes)[ind].theListOfFuncName.resize( 3 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aLNode->PyFuncName() ) ;
- (*_list_nodes)[ind].theListOfFuncName[1] = CORBA::string_dup( aLNode->PyMoreName() ) ;
- (*_list_nodes)[ind].theListOfFuncName[2] = CORBA::string_dup( aLNode->PyNextName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aLNode->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aLNode->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[1] = CORBA::string_dup( aLNode->PyMoreName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[1] = string( aLNode->PyMoreName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[2] = CORBA::string_dup( aLNode->PyNextName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[2] = string( aLNode->PyNextName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 3 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aLNode->PythonFunction() ;
(*_list_nodes)[ind].theListOfPythonFunctions[1] = aLNode->MorePythonFunction() ;
}
else if ( aCNode->IsSwitchNode() ) {
GraphBase::SwitchNode * aSNode = (GraphBase::SwitchNode * ) aCNode ;
- (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aSNode->CoupledNode()->Name() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aSNode->CoupledNode()->Name() ) ;
+ (*_list_nodes)[ind].theCoupledNode = string( aSNode->CoupledNode()->Name() ) ;
(*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aSNode->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aSNode->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aSNode->PyFuncName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aSNode->PythonFunction() ;
}
else if ( aCNode->IsEndLoopNode() ) {
GraphBase::EndOfLoopNode * aELNode = (GraphBase::EndOfLoopNode * ) aCNode ;
- (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aELNode->CoupledNode()->Name() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aELNode->CoupledNode()->Name() ) ;
+ (*_list_nodes)[ind].theCoupledNode = string( aELNode->CoupledNode()->Name() ) ;
(*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aELNode->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aELNode->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aELNode->PyFuncName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aELNode->PythonFunction() ;
}
else if ( aCNode->IsEndSwitchNode() ) {
GraphBase::EndOfSwitchNode * aESNode = (GraphBase::EndOfSwitchNode * ) aCNode ;
- (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aESNode->CoupledNode()->Name() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aESNode->CoupledNode()->Name() ) ;
+ (*_list_nodes)[ind].theCoupledNode = string( aESNode->CoupledNode()->Name() ) ;
(*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aESNode->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aESNode->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aESNode->PyFuncName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aESNode->PythonFunction() ;
}
else if ( aCNode->IsMacroNode() ) {
GraphBase::Graph * aGraph = (GraphBase::Graph * ) aCNode ;
- (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aGraph->CoupledNode()->Name() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aGraph->CoupledNode()->Name() ) ;
+ (*_list_nodes)[ind].theCoupledNode = string( aGraph->CoupledNode()->Name() ) ;
(*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
- (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGraph->PyFuncName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGraph->PyFuncName() ) ;
+ (*_list_nodes)[ind].theListOfFuncName[0] = string( aGraph->PyFuncName() ) ;
(*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
(*_list_nodes)[ind].theListOfPythonFunctions[0] = aGraph->PythonFunction() ;
}
else {
- (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( "" ) ;
+ (*_list_nodes)[ind].theCoupledNode = string( "" ) ;
}
// (*_list_nodes)[ind].theDataStreamInArgsNumber = aCNode->DataStreamInPortsNumber() ;
// (*_list_nodes)[ind].theDataStreamOutArgsNumber = aCNode->DataStreamOutPortsNumber() ;
const GraphBase::InPort * anInPort ;
anInPort = aCNode->GetNodeInPort( iostream ) ;
if ( anInPort->IsDataStream() ) {
- cdebug << "GraphBase::Graph::GetNodes In" << iostream << " " << aCNode->Name() << " " << anInPort->NodeName() << " " << anInPort->PortName()
- << endl ;
- (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametertype = StringToDataStreamType( anInPort->PortType() ) ;
+ cdebug << "GraphBase::Graph::GetNodes In" << iostream << " " << aCNode->Name()
+ << " " << anInPort->NodeName() << " " << anInPort->PortName() << endl;
+ (*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ;
(*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ;
(*_list_nodes)[ind].theListOfInDataStreams[streamind].theDataStreamParameter.Parameterdependency = anInPort->Dependency() ;
SUPERV::KindOfSchema aKindOfSchema ;
if ( anOutPort->IsDataStream() ) {
cdebug << "GraphBase::Graph::GetNodes Out" << iostream << " " << aCNode->Name() << " " << anOutPort->NodeName() << " " << anOutPort->PortName() << " "
<< endl ;
- (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametertype = StringToDataStreamType( anOutPort->PortType() ) ;
+ (*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametertype = CORBA::string_dup( anOutPort->PortType() ) ;
(*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parametername = CORBA::string_dup( anOutPort->PortName() ) ;
(*_list_nodes)[ind].theListOfOutDataStreams[streamind].theDataStreamParameter.Parameterdependency = anOutPort->Dependency() ;
long aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
}
(*_list_nodes)[ind].theFirstCreation = aCNode->FirstCreation();
(*_list_nodes)[ind].theLastModification = aCNode->LastModification();
- (*_list_nodes)[ind].theEditorRelease = CORBA::string_dup( aCNode->EditorRelease());
- (*_list_nodes)[ind].theAuthor = CORBA::string_dup( aCNode->Author());
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theEditorRelease = CORBA::string_dup( aCNode->EditorRelease());
+ (*_list_nodes)[ind].theEditorRelease = string( aCNode->EditorRelease());
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theAuthor = CORBA::string_dup( aCNode->Author());
+ (*_list_nodes)[ind].theAuthor = string( aCNode->Author()); // mkr : IPAL10200
if ( aCNode->IsFactoryNode() ) {
GraphBase::FactoryNode * aFNode = (GraphBase::FactoryNode * ) aCNode ;
- (*_list_nodes)[ind].theContainer = CORBA::string_dup( aFNode->Computer());
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theContainer = CORBA::string_dup( aFNode->Computer());
+ (*_list_nodes)[ind].theContainer = string( aFNode->Computer());
}
else {
- (*_list_nodes)[ind].theContainer = CORBA::string_dup( "" );
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theContainer = CORBA::string_dup( "" );
+ (*_list_nodes)[ind].theContainer = string( "" );
}
- (*_list_nodes)[ind].theComment = CORBA::string_dup( aCNode->Comment());
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theComment = CORBA::string_dup( aCNode->Comment());
+ (*_list_nodes)[ind].theComment = string( aCNode->Comment());
(*_list_nodes)[ind].theCoords.theX = aCNode->XCoordinate();
(*_list_nodes)[ind].theCoords.theY = aCNode->YCoordinate();
#if 0
if ( anInPort->IsBus() ) {
nports += 1 ;
(*_list_nodes)[ind].theListOfParameters.resize( nports ) ;
- (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ;
- (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ;
- (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ;
- (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ;
+ (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = string( anInPort->PortType() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ;
+ (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = string( anInPort->PortName() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ;
+ (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = string( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ;
+//JR 24.02.2005 Memory Leak (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ;
+ (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = string( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ;
}
}
#endif
// All the links from _LinksList are taken
// vector< InNode *> Nodes = InNodes() ;
+ cdebug_in << "Graph::GetLinks( " << AllLinks << " ) " << endl ;
int ind = 0 ;
int k ;
for ( k = 0 ; k < GraphNodesSize() ; k++ ) {
GraphBase::ComputingNode * fromNode = GraphNodes( k ) ;
+// cdebug << "GraphBase::Graph::GetLinks k" << k << ". :" << fromNode->Name() << endl ;
int i ;
for ( i = 0 ; i < fromNode->GetNodeOutPortsSize() ; i++ ) {
const GraphBase::OutPort* fromPort = fromNode->GetNodeOutPort( i ) ;
+// cdebug << "GraphBase::Graph::GetLinks k" << k << ". :" << fromNode->Name()
+// << " i" << i << ". : " << fromPort->PortName() << endl ;
int j ;
for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
+// cdebug << "GraphBase::Graph::GetLinks k" << k << ". : fromNode " << fromNode << " = "
+// << fromNode->Name() << " i" << i << ". : fromPort " << fromPort << " = "
+// << fromPort->PortName() << " j" << j << ". : toPort " << toPort << " = "
+// << toPort->NodeName() << "( " << toPort->PortName() << " )" << endl ;
if ( toPort->IsPortConnected() ) {
// Desole pour ce cast mais avec les maps difficile de faire const ...
- const GraphBase::ComputingNode * toNode = ((GraphBase::Graph * ) this)->GetGraphNode( toPort->NodeName() ) ;
+// const GraphBase::ComputingNode * toNode = ((GraphBase::Graph * ) this)->GetGraphNode( toPort->NodeName() ) ;
+// cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " ("
+// << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
+// << " --> toNode " << toNode << " " << toPort->NodeName() << "( "
+// << toPort->PortName() << " ) " << " " << fromPort->InPortsSize() << " ports"
+// << endl ;
if ( !(fromPort->IsLoop() && toPort->IsLoop() ) || AllLinks ) {
- cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " ("
- << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
- << " --> " << toNode->Name() << "( " << toPort->PortName() << " ) "
- << " " << fromPort->InPortsSize() << " ports" << endl ;
+// cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " ("
+// << fromPort->PortName() << " ) IsPortConnected" << fromPort->IsPortConnected()
+// << " --> " << toNode->Name() << "( " << toPort->PortName() << " ) "
+// << " " << fromPort->InPortsSize() << " ports" << endl ;
_list_links->resize( ind+1 );
- (*_list_links)[ind].FromNodeName = CORBA::string_dup( fromNode->Name() );
+//JR 23.02.2005 Memory Leak (*_list_links)[ind].FromNodeName = CORBA::string_dup( fromNode->Name() );
+ (*_list_links)[ind].FromNodeName = string( fromNode->Name() );
(*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
- (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
+//JR 23.02.2005 Memory Leak (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
+ (*_list_links)[ind].ToNodeName = string( toPort->NodeName() );
(*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
- (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
+//JR 30.03.2005 (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
+ (*_list_links)[ind].aLinkValue = fromPort->Value() ;
if ( toPort->IsEndSwitch() ) {
(*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ;
}
}
}
else {
- cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " "
- << fromPort->PortName() << " ) " << fromPort->PortStatus()
- << " --> " << toPort->NodeName() << "( " << toPort->PortName() << " ) "
- << " " << toPort->PortStatus() << " " << fromPort->InPortsSize() << " ports ignored" << endl ;
+// cdebug << "GraphBase::Graph::GetLinks " << fromNode->Name() << " "
+// << fromPort->PortName() << " ) " << fromPort->PortStatus()
+// << " --> " << toPort->NodeName() << "( " << toPort->PortName() << " ) "
+// << " " << toPort->PortStatus() << " " << fromPort->InPortsSize()
+// << " ports ignored" << endl ;
}
}
}
}
+ cdebug_out << "Graph::GetLinks( " << AllLinks << " ) " << endl ;
return _list_links;
}
GraphBase::InPort* toPort ) {
GraphBase::SLink * _link = new GraphBase::SLink ;
GraphBase::OutPort* fromPort = toPort->GetOutPort() ;
- _link->FromNodeName = CORBA::string_dup( fromPort->NodeName() );
+//JR 24.02.2005 Memory Leak _link->FromNodeName = CORBA::string_dup( fromPort->NodeName() );
+ _link->FromNodeName = string( fromPort->NodeName() );
_link->FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
- _link->ToNodeName = CORBA::string_dup( toPort->NodeName() );
+//JR 24.02.2005 Memory Leak _link->ToNodeName = CORBA::string_dup( toPort->NodeName() );
+ _link->ToNodeName = string( toPort->NodeName() );
_link->ToServiceParameterName = toPort->GetServicesParameter().Parametername;
- CORBA::Any aSPValue = *fromPort->Value() ;
+//JR 30.03.2005 CORBA::Any aSPValue = *fromPort->Value() ;
+ CORBA::Any aSPValue = fromPort->Value() ;
_link->aLinkValue = aSPValue;
_link->aListOfCoords = *(toPort->Coords()) ;
return _link;
// input ports. Input(s) of a DataFlow match one or several output-virtual-dataport
for ( j = 0 ; j < fromDataPort->InPortsSize() ; j++ ) {
_list_datalinks->resize( ind+1 );
- (*_list_datalinks)[ind].FromNodeName = CORBA::string_dup( aDataNode->Name() );
+//JR 24.02.2005 Memory Leak (*_list_datalinks)[ind].FromNodeName = CORBA::string_dup( aDataNode->Name() );
+ (*_list_datalinks)[ind].FromNodeName = string( aDataNode->Name() );
(*_list_datalinks)[ind].FromServiceParameterName = fromDataPort->GetServicesParameter().Parametername;
const GraphBase::InPort* toPort = fromDataPort->InPorts( j ) ;
- (*_list_datalinks)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
+//JR 24.02.2005 Memory Leak (*_list_datalinks)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
+ (*_list_datalinks)[ind].ToNodeName = string( toPort->NodeName() );
(*_list_datalinks)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
- CORBA::Any aSPValue = *fromDataPort->Value() ;
+//JR 30.03.2005 CORBA::Any aSPValue = *fromDataPort->Value() ;
+ CORBA::Any aSPValue = fromDataPort->Value() ;
(*_list_datalinks)[ind].aLinkValue = aSPValue;
(*_list_datalinks)[ind++].aListOfCoords = *(toPort->Coords()) ;
}
}
}
-#if 0
-// Output(s) of a DataFlow match only one input-virtual-dataport
- for ( i = 0 ; i < aDataNode->GetNodeOutDataNodePortsSize() ; i++ ) {
- GraphBase::InPort* toDataPort = aDataNode->GetChangeNodeOutDataNodePort( i ) ;
- const GraphBase::OutPort* fromPort = toDataPort->GetLink() ;
- if ( fromPort->IsDataConnected() ) {
- _list_datalinks->length( ind+1 );
- _list_datalinks[ind].FromNodeName = CORBA::string_dup( fromPort->NodeName() );
- _list_datalinks[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
- _list_datalinks[ind].ToNodeName = CORBA::string_dup( aDataNode->Name() );
- _list_datalinks[ind].ToServiceParameterName = toDataPort->GetServicesParameter().Parametername;
-// SALOME_SuperVisionBase::ServicesParameterValue aSPValue;
- CORBA::Any aSPValue = *fromPort->Value() ;
-// aSPValue.Value = CORBA::string_dup( fromPort->Value() );
-// aSPValue.Kind = fromPort->Kind();
- _list_datalinks[ind].aLinkValue = aSPValue;
- _list_datalinks[ind++].aListOfCoords = toDataPort->Coords() ;
- }
- }
-#endif
-
return _list_datalinks ;
}
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 ) ;
}
-// Update 'FomNode's Map to 'aNode'
+// Rename in _MapOfLinkedNodes of 'FromNode'
+ 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 ) {
+ FromNode->ReNameLinkedNode( OldNodeName , NewNodeName ) ;
+ }
+ else {
+ FromNode->ReNameStreamLinkedNode( OldNodeName , NewNodeName ) ;
+ }
+ }
// Inports 'anInPort' of 'aNode'
for ( i = aNode->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
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 ;
else {
FromNode = this ;
}
-// Rename in _MapOfLinkedFromNodes of 'FromNode'
cdebug << " fromConnected " << anOutPort->NodeName() << endl ;
- if ( anInPort->IsDataStream() ) {
- FromNode->ReNameStreamLinkedNode( OldNodeName , NewNodeName ) ;
- }
- else {
- FromNode->ReNameLinkedNode( OldNodeName , NewNodeName ) ;
- }
}
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() ||
+ aNode->IsSwitchNode() || aNode->IsEndSwitchNode() ) {
+ GraphBase::GOTONode * theCoupledNode = NULL ;
+ theCoupledNode = (GraphBase::GOTONode * ) ((GraphBase::GOTONode * ) aNode)->CoupledNode() ;
+ theCoupledNode->CoupledNodeName( aNode->Name() ) ;
+ }
+ else if ( aNode->IsInLineNode() ) {
+ GraphBase::OutPort * anOutPort = aNode->GetNodeInGate()->GetOutPort() ;
+ if ( anOutPort ) {
+ GraphBase::ComputingNode * aLinkedNode ;
+ aLinkedNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
+ if ( aLinkedNode->IsGOTONode() ) {
+ ((GraphBase::GOTONode * ) aLinkedNode)->CoupledNodeName( aNode->Name() ) ;
+ }
+ }
+ }
}
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 ;
int i ;
bool RetVal = false ;
int index = GetGraphNodeIndex( aNodeName ) ;
- GraphBase::ComputingNode * aNode = GetChangeGraphNode( index ) ;
+ GraphBase::ComputingNode * aNode = NULL ;
+ if ( index >= 0 ) {
+ aNode = GetChangeGraphNode( index ) ;
+ }
if ( aNode ) {
cdebug << "Graph::RemoveNode " << aNode->Name() << " : " << aNode->GetNodeInPortsSize()
<< " InPorts " << aNode->GetNodeOutPortsSize() << " OutPorts "
<< aNode->LinkedNodesSize() << " LinkedNodes " << aNode->LinkedFromNodesSize()
- << " LinkedFromNodes IsEndSwitchNode " << aNode->IsEndSwitchNode() << endl ;
+ << " LinkedFromNodes IsEndSwitchNode " << aNode->IsEndSwitchNode()
+ << " ConnectedInPortsNumber " << aNode->ConnectedInPortsNumber() << endl ;
for ( i = 0 ; i < aNode->LinkedNodesSize() ; i++ ) {
cdebug << " LinkedNode" << i << ". " << aNode->LinkedNodes( i ) << " "
<< aNode->LinkedNodes( i )->Name() << endl ;
<< aNode->LinkedFromNodes( i )->Name() << endl ;
}
}
+//PAL8177-PAL8509
+//JR 24.03.2005 : Debug : CoupledNode field of GOTONodes was not erased
+ if ( aNode->IsInLineNode() && aNode->GetNodeInPortsSize() ) { //mkr : IPAL10078
+ GraphBase::OutPort * anOutPort = aNode->GetNodeInGate()->GetOutPort() ;
+ if ( anOutPort ) {
+ GraphBase::ComputingNode * aLinkedNode ;
+ aLinkedNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
+ if ( aLinkedNode->IsGOTONode() ) {
+ cdebug << "Graph::RemoveNode erase CoupledNode " << aLinkedNode->Name() << endl ;
+ ((GraphBase::GOTONode * ) aLinkedNode)->CoupledNode( NULL ) ;
+ ((GraphBase::GOTONode * ) aLinkedNode)->CoupledNodeName( "" ) ;
+ }
+ }
+ }
if ( !aNode->IsEndSwitchNode() ) {
if ( aNode->GetNodeInPortsSize() ) {
for ( i = aNode->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
GraphBase::InPort * anInPort = aNode->GetChangeNodeInPort( i ) ;
- cdebug << "InPort" << i << ". " << aNodeName << "( " << anInPort->PortName() << ") "
- << anInPort->PortStatus() << " <-- " ;
+ cdebug << "Graph::RemoveNode InPort" << i << ". " << aNodeName << "( "
+ << anInPort->PortName() << ") " << anInPort->PortStatus() << " <-- " ;
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
if ( anOutPort && !( aNode->IsEndLoopNode() && anInPort->IsLoop() ) ) {
- cdebug << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") " << anOutPort->PortStatus() ;
+ cdebug << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
+ << anOutPort->PortStatus() ;
}
cdebug << endl ;
if ( !anInPort->IsNotConnected() ) {
+ GraphBase::ComputingNode * FromNode = NULL ;
RetVal = true ;
if ( anOutPort->IsDataConnected() || anOutPort->IsExternConnected() ) {
- cdebug << " Data/Extern" << endl ;
+ cdebug << " Data/Extern ignored" << endl ;
}
else {
- GraphBase::ComputingNode * FromNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
+ FromNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
+ }
+ if ( FromNode ) {
cdebug << "FromNode " << FromNode->Name() << " LinkedNodesSize "
<< FromNode->LinkedNodesSize() << " and " << aNode->Name()
<< " LinkedFromNodesSize " << aNode->LinkedFromNodesSize() << endl ;
RetVal = FromNode->RemoveLinkedNode( aNode ) ;
}
if ( !RetVal ) {
- cdebug << "anOutPort->RemoveLinkedNode Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode anOutPort->RemoveLinkedNode Error RetVal "
+ << RetVal << endl ;
break ;
}
}
}
RetVal = anOutPort->RemoveInPort( anInPort ) ;
if ( !RetVal ) {
- cdebug << "anOutPort->RemoveInPort( anInPort ) Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode anOutPort->RemoveInPort( anInPort ) Error RetVal "
+ << RetVal << endl ;
break ;
}
}
int j ;
for ( j = aLinkedFromNode->GetNodeOutPortsSize() - 1 ; j >= 0 ; j-- ) {
GraphBase::OutPort * anOutPort = aLinkedFromNode->GetChangeNodeOutPort( j ) ;
- cdebug << "OutPort" << j << ". Remove " << anOutPort->InPortsSize()
+ cdebug << "Graph::RemoveNode OutPort" << j << ". Remove " << anOutPort->InPortsSize()
<< " InPortsof OutPort : " << anOutPort->NodeName() << "( "
<< anOutPort->PortName() << ") "
<< anOutPort->PortStatus() << " :" << endl ;
int k ;
for ( k = anOutPort->InPortsSize() - 1 ; k >= 0 ; k-- ) {
GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
- if ( strcmp( anInPort->NodeName() , aNode->Name() ) == 0 ) {
+ if ( !strcmp( anInPort->NodeName() , aNode->Name() ) ) {
// InPort of the EndSwitchNode
cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
<< anInPort->PortName() << ") "
// false ==> No error for aNode->LinkedFromNode()
RetVal = aLinkedFromNode->RemoveLinkedNode( aNode , false ) ;
if ( !RetVal ) {
- cdebug << "aLinkedFromNode->RemoveLinkedNode Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode aLinkedFromNode->RemoveLinkedNode Error RetVal "
+ << RetVal << endl ;
break ;
}
}
-// Remove the InPort of the EndSwitchNode from that OutPort
+// the InPort of the EndSwitchNode from that OutPort was already removed by
+// anInPort->RemoveOutPort done above :
+#if 0
RetVal = anOutPort->RemoveInPort( anInPort ) ;
if ( !RetVal ) {
- cdebug << "anOutPort->RemoveInPort( anInPort ) Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode anOutPort->RemoveInPort( anInPort ) Error RetVal "
+ << RetVal << endl ;
break ;
}
+#endif
}
}
}
}
+ //mkr : fix for bugs IPAL9814 and IPAL9630
+ RetVal = true;
}
if ( RetVal ) {
for ( i = aNode->GetNodeOutPortsSize() - 1 ; i >= 0 ; i-- ) {
GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( i ) ;
- cdebug << "OutPort" << i << ". Remove " << anOutPort->InPortsSize()
- << " InPortsof OutPort : " << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
+ cdebug << "Graph::RemoveNode OutPort" << i << ". Remove " << anOutPort->InPortsSize()
+ << " InPortsof OutPort : " << anOutPort->NodeName() << "( "
+ << anOutPort->PortName() << ") "
<< anOutPort->PortStatus() << " :" << endl ;
int j ;
for ( j = anOutPort->InPortsSize() - 1 ; j >= 0 ; j-- ) {
GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
- cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( " << anInPort->PortName() << ") "
- << anInPort->PortStatus() << endl ;
- if ( !anInPort->IsExternConnected() ) {
- GraphBase::ComputingNode * ToNode = GetChangeGraphNode( anInPort->NodeName() ) ;
+ GraphBase::ComputingNode * ToNode = NULL ;
+ cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
+ << anInPort->PortName() << ") "
+ << anInPort->PortStatus() ;
+ if ( anInPort->IsExternConnected() ) {
+ cdebug << " ExternConnected ignored" << endl ;
+ }
+ else {
+ cdebug << endl ;
+ ToNode = GetChangeGraphNode( anInPort->NodeName() ) ;
+ }
+ if ( ToNode ) {
RetVal = anInPort->RemoveOutPort() ;
+// JR 04.02.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be multiple linked !!!
+// PAL7990
if ( !RetVal ) {
- cdebug << "anOutPort->RemoveOutPort Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode anOutPort->RemoveOutPort Error RetVal " << RetVal
+ << endl ;
break ;
}
if ( ( aNode->IsGOTONode() && ToNode->IsOneOfInLineNodes() ) ||
RetVal = aNode->RemoveLinkedNode( ToNode ) ;
}
if ( !RetVal ) {
- cdebug << "anOutPort->RemoveLinkedNode Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode anOutPort->RemoveLinkedNode Error RetVal " << RetVal
+ << endl ;
break ;
}
+// the InPort of the EndSwitchNode from that OutPort was already removed by
+// anInPort->RemoveOutPort done above :
+#if 0
RetVal = anOutPort->RemoveInPort( anInPort ) ;
if ( !RetVal ) {
- cdebug << "anOutPort->RemoveInPort( anInPort ) Error RetVal " << RetVal << endl ;
+ cdebug << "Graph::RemoveNode anOutPort->RemoveInPort( anInPort ) Error RetVal "
+ << RetVal << endl ;
break ;
}
+#endif
+ if ( ToNode->IsEndSwitchNode() ) {
+ int i ;
+ int done = false ;
+ for ( i = 0 ; i < ToNode->LinkedFromNodesSize() ; i++ ) {
+ GraphBase::StreamNode * fromNode = ToNode->LinkedFromNodes( i ) ;
+// Not the node that we are deleting ... :
+ if ( strcmp( fromNode->Name() , aNode->Name() ) ) {
+ int j ;
+ for ( j = 0 ; j < fromNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * fromOutPort = fromNode->GetChangeNodeOutPort( j ) ;
+ int k ;
+ for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) {
+ if ( strcmp( ToNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) {
+ if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) {
+// Restore an OutPort in the InPort
+ anInPort->ChangeOutPort( fromOutPort ) ;
+ cdebug << "Graph::RemoveNode reestablish " << fromOutPort->NodeName() << "( "
+ << fromOutPort->PortName() << " ) in the InPort of EndSwitch : "
+ << ToNode->Name() << "( " << anInPort->PortName() << " )"
+ << anInPort->Kind() << " " << anInPort->PortStatus() << endl;
+ done = true ;
+ break ;
+ }
+ }
+ }
+ if ( done ) {
+ break ;
+ }
+ }
+ if ( done ) {
+ break ;
+ }
+ }
+ }
+ }
}
}
if ( !RetVal ) {
}
}
}
+ if ( aNode->LinkedNodesSize() || aNode->LinkedFromNodesSize() ) {
+ cdebug << "Graph::RemoveNode ERROR LinkedNodesSize " << aNode->LinkedNodesSize()
+ << " LinkedFromNodesSize " << aNode->LinkedFromNodesSize() << endl ;
+ RetVal = 0 ;
+ }
cdebug << "Graph::RemoveNode " << aNode->Name() << " : " << aNode->GetNodeInPortsSize()
<< " InPorts " << aNode->GetNodeOutPortsSize() << " OutPorts "
<< aNode->LinkedNodesSize() << " LinkedNodes " << aNode->LinkedFromNodesSize()
char * theCoupledNodeName = NULL ;
int CoupledIndex = -1 ;
if ( aNode->IsEndLoopNode() || aNode->IsEndSwitchNode() ) {
- theCoupledNode = ((GraphBase::GOTONode * ) aNode)->CoupledNode() ;
theCoupledNodeName = ((GraphBase::GOTONode * ) aNode)->CoupledNodeName() ;
- CoupledIndex = GetGraphNodeIndex( theCoupledNode->Name() ) ;
+ theCoupledNode = ((GraphBase::GOTONode * ) aNode)->CoupledNode() ;
}
+ cdebug << "Graph::RemoveNode Node" << index << " " << _GraphNodes[ index ]->Name()
+ << " will be deleted" << endl ;
delete aNode ;
_GraphNodesSize -= 1 ;
for ( i = index ; i < _GraphNodesSize ; i++ ) {
}
_GraphNodes.resize( _GraphNodesSize+1 ) ;
_MapOfGraphNodes.erase( aNodeName ) ;
+// PAL8510
// Delete of the LoopNode of that EndLoopNode or of the SwitchNode of that EndSwitchNode :
if ( theCoupledNode ) {
+//JR 02.02.2005 DEBUG : CoupledIndex must be here after the delete of aNode (not before)
+ CoupledIndex = GetGraphNodeIndex( theCoupledNodeName ) ;
+ cdebug << "Graph::RemoveNode CoupledNode" << CoupledIndex << " "
+ << _GraphNodes[ CoupledIndex ]->Name() << " will be deleted" << endl ;
delete theCoupledNode ;
_GraphNodesSize -= 1 ;
for ( i = CoupledIndex ; i < _GraphNodesSize ; i++ ) {
}
}
else {
- cdebug << "Node not found ERROR " << index << endl ;
+ cdebug << "Graph::RemoveNode Node not found ERROR " << index << endl ;
+ }
+
+#if 1
+ cdebug << "Graph::RemoveNode " << _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::RemoveNode " << RetVal << endl;
+ cdebug_out << "Graph::RemoveNode " << RetVal << endl;
return RetVal ;
}
if ( RetVal ) {
if ( fromPort->IsGate() && toPort->IsGate() ) {
CORBA::Any aValue ;
- aValue <<= (long ) 1 ;
- fromPort->Value( aValue ) ;
+//JR 29.09.2005 Debug for CEA : we do not do that for MacroNodes :
+ if ( !fromNode->IsMacroNode() ) {
+ aValue <<= (CORBA::Long ) 1 ;
+ }
+ else {
+ aValue <<= (CORBA::Long ) 0 ;
+ }
+ fromPort->SetValue( aValue ) ;
}
// else {
// const CORBA::Any * aDataValue = new CORBA::Any( aValue ) ;
return false ;
}
- cdebug_in << "GraphBase::Graph::AddLink(" << fromNode->Name() << "("
- << fromPort->PortName() << " " << fromPort->PortStatus() << ") ---> " << toNode->Name() << "("
- << toPort->PortName() << " " << toPort->PortStatus() << ") )" << endl;
+ cdebug_in << "Graph::AddLink( " << fromNode->Name() << "("
+ << 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 ;
}
}
cdebug_out << "RemoveLink(AddLink) toPort->GetOutPort()->NodeName() RemoveLink Error." << endl ;
return false ;
}
+ if ( fromNode->IsGOTONode() && fromPort->IsGate() ) { // mkr : PAL12575
+ ((GraphBase::GOTONode * ) fromNode)->CoupledNode( (GraphBase::InLineNode * ) toNode ) ;
+ }
}
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 ;
}
}
}
- else if ( !toNode->IsEndSwitchNode() ||
- ( toNode->IsEndSwitchNode() && toPort->IsGate() ) ) {
- if ( !RemoveLink( fromNode->Name() , fromPort->PortName() ,
+//PAL8511
+// JR 17.01.2005 : toPort is already linked : RemoveLink
+ else if ( !toNode->IsEndSwitchNode() ) {
+// else if ( !toNode->IsEndSwitchNode() ||
+// ( toNode->IsEndSwitchNode() && toPort->IsGate() ) ) {
+//JR Debug : the fromPort was wrong !
+// if ( !RemoveLink( fromNode->Name() , fromPort->PortName() ,
+ if ( !RemoveLink( toPort->GetOutPort()->NodeName() , toPort->GetOutPort()->PortName() ,
toNode->Name() , toPort->PortName() ) ) {
cdebug << "RemoveLink(AddLink) toNode->IsEndSwitchNode Error." << endl ;
cdebug_out << "GraphBase::Graph::AddLink" << endl;
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() && 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;
+ return false ;
+ }
+ }
+//PAL7990
+//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() ) ) {
+ 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() ,
}
- if ( toNode->IsEndSwitchNode() && !toPort->IsGate() ) {
+// 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 ;
+ }
+//JR 11.02.2005 : SwitchNode(Default) may be only linked to EndSwitchNode(Default)
+// SwitchNode(Param) may be linked to EndSwitchNode(Param)
+// SwitchNode(Param-UserDefault) may be linked to EndSwitchNode(Default)
+ else if ( fromNode->IsSwitchNode() && toNode->IsEndSwitchNode() &&
+ !( ( 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;
+ return false ;
+ }
+ else if ( toNode->IsEndSwitchNode() && !toPort->IsGate() ) {
// if ( !toPort->IsEndSwitch() || !fromPort->AddInPort( toPort ) ) {
if ( !fromPort->AddInPort( toPort ) ) {
cdebug << "toNode->IsEndSwitchNode() : !fromPort->AddInPort( toPort ) AddLink Error."
toPort->Kind( SUPERV::EndSwitchParameter ) ;
}
}
-// JR 12.01.2005 : an OutPort of a SwitchNode connected to a Gate can be connected only to Gate
- else if ( fromNode->IsSwitchNode() && fromPort->IsSwitch() && !toPort->IsGate() ) {
- cdebug << "toPort->AddLink Error( fromPort->IsSwitch() && !toPort->IsGate())." << endl ;
- cdebug_out << "GraphBase::Graph::AddLink 0" << endl;
- return false ;
- }
else if ( !fromPort->AddInPort( toPort ) ) { // --> MapOfInports in the OutPort
cdebug << "!fromPort->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 ;
}
if ( fromNode->IsSwitchNode() ) {
if ( !fromPort->IsDataStream() ) {
- if ( fromPort->IsInLine() && toPort->IsGate() && !toNode->IsEndSwitchNode() ) {
+//JR 08.02.2005 if ( fromPort->IsInLine() && toPort->IsGate() && !toNode->IsEndSwitchNode() ) {
+ if ( fromPort->IsInLine() && toPort->IsGate() ) {
fromPort->Kind( SUPERV::SwitchParameter ) ;
}
else if ( !fromPort->IsGate() && !toPort->IsGate() ){
if ( anInPort && ( anInPort->IsPortConnected() ||
anInPort->IsDataConnected() ||
anInPort->IsExternConnected() ) ) {
-// JR 13.01.2005 : Bug if it is a link to an EndSwitchNode. The OutPort may be an other one !!!
+// JR 13.01.2005 : DeBug : if it is a link to an EndSwitchNode. The OutPort may be an other one !!!
GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ;
GraphBase::OutPort * anOutPort = NULL ;
if ( toNode->IsEndSwitchNode() ) {
}
else {
fromNode->RemoveLinkedNode( toNode ) ;
+ // mkr : PAL12575 -->
+ if ( fromNode->IsGOTONode() ) {
+ GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) fromNode ;
+ if ( aGOTONode->CoupledNode() && strcmp( aGOTONode->CoupledNode()->Name(), toNode->Name() ) == 0 ) {
+ aGOTONode->CoupledNode(NULL);
+ aGOTONode->CoupledNodeName("");
+
+ // set ExternConnected status for output data port of GoTo node
+ for ( int aPortId = 0 ; aPortId < fromNode->GetNodeOutPortsSize() ; aPortId++ ) {
+ GraphBase::OutPort * anOutPort = fromNode->GetChangeNodeOutPort(aPortId) ;
+ if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() )
+ anOutPort->PortStatus( ExternConnected ) ;
+ }
+ }
+ }
+ // mkr : PAL12575 <--
}
}
- if ( fromNode->IsSwitchNode() && !anOutPort->IsGate() && !toNode->IsEndSwitchNode() ) {
- anOutPort->Kind( SUPERV::InLineParameter ) ;
+//JR PAL7990 : a SwitchPort is an OutPort of a SwitchNode connected to a InGate Port
+//Debug : change the kind only if there is no other InGate connected to the OutPort
+ if ( fromNode->IsSwitchNode() && !anOutPort->IsGate() && anOutPort->InPortsSize() == 0 ) {
+ if ( !toNode->IsEndSwitchNode() ) {
+ anOutPort->Kind( SUPERV::InLineParameter ) ;
+ }
+ else if ( !anInPort->IsGate() ) {
+ anOutPort->Kind( SUPERV::InLineParameter ) ;
+ }
}
-// JR 13.01.2005 : Bug if it is a link to an EndSwitchNode. The InPort may be linked !!!
+// JR 13.01.2005 : DeBug : if it is a link to an EndSwitchNode. The InPort may be multiple linked !!!
if ( toNode->IsEndSwitchNode() ) {
int i ;
int done = false ;
int k ;
for ( k = 0 ; k < fromOutPort->InPortsSize() ; k++ ) {
if ( strcmp( toNode->Name() , fromOutPort->InPorts( k )->NodeName() ) == 0 ) {
+ if ( strcmp( anInPort->PortName() , fromOutPort->InPorts( k )->PortName() ) == 0 ) {
// Restore an OutPort in the InPort
- anInPort->ChangeOutPort( fromOutPort ) ;
- cdebug << "Graph::RemoveLink reestablish " << fromOutPort->NodeName() << "( "
- << fromOutPort->PortName() << " ) in the InPort of EndSwitch : "
- << toNode->Name() << "( " << anInPort->PortName() << " )" << endl;
- done = true ;
- break ;
+ anInPort->ChangeOutPort( fromOutPort ) ;
+ cdebug << "Graph::RemoveLink reestablish " << fromOutPort->NodeName() << "( "
+ << fromOutPort->PortName() << " ) in the InPort of EndSwitch : "
+ << toNode->Name() << "( " << anInPort->PortName() << " )"
+ << anInPort->Kind() << " " << anInPort->PortStatus() << endl;
+ done = true ;
+ break ;
+ }
}
}
if ( done ) {
GraphBase::InPort * anInPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
if ( anInPort && !anInPort->IsNotConnected() ) {
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
- *FromNodeName = my_strdup( anOutPort->NodeName() ) ;
- *FromServiceParameterName = my_strdup( anOutPort->PortName() ) ;
+//JR 17.02.2005 Memory Leak *FromNodeName = my_strdup( anOutPort->NodeName() ) ;
+ *FromNodeName = (char * ) anOutPort->NodeName() ;
+//JR 17.02.2005 Memory Leak *FromServiceParameterName = my_strdup( anOutPort->PortName() ) ;
+ *FromServiceParameterName = (char * ) anOutPort->PortName() ;
RetVal = true ;
}
else {
bool RetVal = false ;
cdebug_in << "GraphBase::Graph::AddInputData(" << ToNodeName << ","
<< ToServiceParameterName << " , Any " ;
+ bool isUnknown = false;
switch (aValue.type()->kind()) {
case CORBA::tk_string:
- char * t;
+ const char * t;
aValue >>= t;
cdebug << t << " (string) " ;
+ if ( !strcmp( t, "Unknown CORBA::Any Type" ) )
+ // mkr : IPAL8054 : in this case port has no input value
+ isUnknown = true;
break;
case CORBA::tk_double:
double d;
cdebug << d << " (double) " ;
break;
case CORBA::tk_long:
- long l;
+ CORBA::Long l;
aValue >>= l;
- cdebug << l << " (long) " ;
+ cdebug << l << " (CORBA::Long) " ;
break;
case CORBA::tk_objref:
cdebug << "(object reference) " ;
char *aPortName ;
NodePort( ToNodeName , ToServiceParameterName , &aNodeName , &aPortName ) ;
toNode = GetChangeGraphNode( aNodeName ) ;
- cdebug << "in Graph " << Name() << " aNodeName " << aNodeName << " aPortName " << aPortName << endl;
+ cdebug << "in Graph " << Name() << " aNodeName '" << aNodeName << "' aPortName '" << aPortName
+ << "'" << endl;
if ( toNode ) {
toPort = toNode->GetChangeInPort( aPortName ) ;
- if ( toPort && !toPort->IsDataConnected() ) {
+ if ( toPort && !toPort->IsDataConnected() && toPort->GetOutPort() ) {
toPort->RemoveOutPort() ;
}
}
}
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 ;
}
RetVal = AddLink( (GraphBase::ComputingNode * ) this , fromDataNodePort ,
toNode , toPort ) ;
if ( RetVal ) {
- fromDataNodePort->Value( aValue ) ;
- fromDataNodePort->PortStatus( DataConnected ) ;
+ fromDataNodePort->SetValue( aValue ) ;
+ if ( !isUnknown ) // mkr : IPAL8054 : to avoid setting "strange" value to a port
+ fromDataNodePort->PortStatus( DataConnected ) ;
}
}
else {
cdebug << "ERROR Node and/or Port not found : " << aNodeName << " " << aPortName << endl ;
}
- delete aNodeName ;
- delete aPortName ;
+ delete [] aNodeName ;
+ delete [] aPortName ;
cdebug_out << "GraphBase::Graph::AddInputData " << RetVal << endl;
return RetVal ;
<< ToServiceParameterName << "' , Any " ;
switch (aValue.type()->kind()) {
case CORBA::tk_string:
- char * t;
+ const char * t;
aValue >>= t;
cdebug << t << " (string) " ;
break;
cdebug << d << " (double) " ;
break;
case CORBA::tk_long:
- long l;
+ CORBA::Long l;
aValue >>= l;
- cdebug << l << " (long) " ;
+ cdebug << l << " (CORBA::Long) " ;
break;
case CORBA::tk_objref:
cdebug << "(object reference) " ;
GraphBase::OutPort * fromPort = toPort->GetOutPort();
if ( fromPort ) {
RetVal = true ;
- fromPort->Value( aValue ) ;
+ fromPort->SetValue( aValue ) ;
fromPort->PortStatus( DataConnected ) ;
- toPort->State( SUPERV::ReadyState ) ;
+ toPort->PortState( SUPERV::ReadyState ) ;
}
else {
cdebug << "ERROR ChangeInputData fromPort not found" << endl ;
return RetVal ;
}
+#if 0
// To restore InputData in CreateService
bool GraphBase::Graph::AddInputData( const char* ToNodeName ,
const char* ToServiceParameterName ,
cdebug << t << " (string) " ;
break;
case CORBA::tk_double:
- double d;
+ CORBA::Double d;
theValue >>= d;
cdebug << d << " (double) " ;
break;
case CORBA::tk_long:
- long l;
+ CORBA::Long l;
theValue >>= l;
- cdebug << l << " (long) " ;
+ cdebug << l << " (CORBA::Long) " ;
break;
case CORBA::tk_objref:
cdebug << "(object reference) " ;
cdebug_out << "GraphBase::Graph::AddInputData " << RetVal << endl;
return RetVal ;
}
+#endif
bool GraphBase::Graph::AddOutputData( const char* FromNodeName ,
const char* FromServiceParameterName ,
// toDataNodePort = GraphBase::DataNode::GetChangeOutDataNodePort( fromPort->NodePortName() ) ;
// RetVal = AddLink( fromNode , fromPort ,
// (GraphBase::ComputingNode * ) this , toDataNodePort ) ;
- anOutPort->Value( aValue ) ;
- anOutPort->State( SUPERV::ReadyState ) ;
- anOutPort->Done( true ) ;
+ anOutPort->SetValue( aValue ) ;
+ anOutPort->PortState( SUPERV::ReadyState ) ;
+ anOutPort->PortDone( true ) ;
cdebug << *anOutPort ;
#ifdef _DEBUG_
anOutPort->StringValue( *_fdebug ) ;
return RetVal ;
}
+//JR This is used by StreamGraphs to list "CODES" and after that there is instances
+// for each Code (Nodes).
map< string , GraphBase::Service * > GraphBase::Graph::MapOfServiceNames() {
return _MapOfServiceNames ; }
return true ;
}
-int GraphBase::Graph::GetServiceNameNumber( SALOME_ModuleCatalog::Service aService ) {
- GraphBase::Service * theService = _MapOfServiceNames[ (char * ) aService.ServiceName ] ;
- if ( theService == NULL ) {
- return 1 ;
- }
- return theService->NewInstance() ;
+//PAL7961
+//JR Debug 25.03.2005 : with multiple instances et delete of instances, it was wrong
+//Bug created with the developpement of StreamGraphs
+int GraphBase::Graph::GetNewServiceInstanceNumber( char * aServiceName ) {
+ int InstanceNumber = _MapOfServiceInstanceNumber[ aServiceName ] + 1 ;
+ _MapOfServiceInstanceNumber[ aServiceName ] = InstanceNumber ;
+ return InstanceNumber ;
}
void GraphBase::Graph::SetGraphPorts() {
for ( i = 0 ; i < GetNodeInDataNodePortsSize() ; i++ ) {
GraphBase::OutPort * anOutPort = GetChangeNodeInDataNodePort( i ) ;
cdebug << "SetGraphPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
- << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << " " << anOutPort->State() << endl ;
+ << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << " " << anOutPort->PortState() << endl ;
if ( !anOutPort->IsGate() ) {
anOutPort->PortStatus( ExternConnected ) ;
}
for ( i = 0 ; i < GetNodeOutDataNodePortsSize() ; i++ ) {
GraphBase::InPort * anInPort = GetChangeNodeOutDataNodePort( i ) ;
cdebug << "SetGraphPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType()
- << " " << anInPort->Kind() << " " << anInPort->PortStatus() << " " << anInPort->State() << endl ;
+ << " " << anInPort->Kind() << " " << anInPort->PortStatus() << " " << anInPort->PortState() << endl ;
if ( !anInPort->IsGate() ) {
GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
anOutPort->PortStatus( ExternConnected ) ;
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 ;
// if ( GraphMacroLevel() == 0 ) {
for ( dostore = 0 ; dostore <= 2 ; dostore++ ) {
if ( dostore == 1 ) {
- aService.ServiceName = Name() ;
+//JR 17.02.2005 Memory Leak aService.ServiceName = Name() ;
+ aService.ServiceName = my_strdup( Name() ) ;
aService.ServiceinParameter.length( 0 ) ;
aService.ServiceinParameter.length( innbr ) ;
aService.ServiceoutParameter.length( 0 ) ;
OutNumberOfValues.resize( outnbr ) ;
}
else if ( dostore == 2 ) {
+//JR Creation of the Service (and of the Ports) with GraphBase::DataNode::DataService :
cdebug << "GraphBase::Graph::CreateService ->DataService innbr " << innbr
<< " instreamnbr " << instreamnbr << " outnbr " << outnbr
<< " outstreamnbr " << outstreamnbr << endl ;
}
if ( !anInPort->IsGate() && !anInPort->IsLoop() &&
( !anInPort->IsPortConnected() ||
- ( anInPort->IsPortConnected() && isfromcouplednode ) ) ) {
+// ( anInPort->IsPortConnected() && isfromcouplednode ) ) ) {
+//JR PAL8914 : InPorts of EndLoopNodes may not be in the Service of the Graph
+ ( anInPort->IsPortConnected() && isfromcouplednode ) ) &&
+ !aToNode->IsEndLoopNode() ) {
if ( dostore == 0 ) {
cdebug << "CreateService " << aToNode->Name() << " Input port "
<< anInPort->PortName() << " " << anInPort->Kind() << " " << anInPort->PortStatus() ;
// cdebug << " NULL" << endl ;
// }
if ( !aFromNode->IsGOTONode() ) {
- if ( !anOutPort->IsGate() && ( anOutPort->IsNotConnected() || anOutPort->IsDataConnected() ) ||
- anOutPort->IsExternConnected() ) {
+ if ( !anOutPort->IsGate() && ( anOutPort->IsNotConnected() || anOutPort->IsDataConnected() ||
+//JR PAL8914 : OutPorts of LoopNodes may not be in the Service of the Graph
+// anOutPort->IsExternConnected() ) {
+ anOutPort->IsExternConnected() ) &&
+ !aFromNode->IsLoopNode() ) {
if ( dostore == 0 ) {
// cdebug << "CreateService " << aFromNode->Name() << " Output port "
// << anOutPort->PortName() << " " << anOutPort->PortStatus() << endl ;
}
// }
-#if 0
+#if 1
cdebug << "DataFlowNode ServiceName " << aService.ServiceName << " InPorts " << innbr
<< " OutPorts " << outnbr << endl ;
for ( i = 0 ; i < innbr ; i++ ) {
// DataService( _Orb , aService , InPortsKind , OutPortsKind , Graph_prof_debug() , Graph_fdebug() ) ;
for ( i = 0 ; i < innbr ; i++ ) {
if ( InPortsKind[ i ] == SUPERV::DataStreamParameter ) {
- GraphBase::InDataStreamPort * anInPort = AddInDataStreamPort( aService.ServiceinParameter[ i ].Parametername ,
- StringToDataStreamType( aService.ServiceinParameter[ i ].Parametertype ) ,
+ GraphBase::InDataStreamPort * anInPort = AddInDataStreamPort( aService.ServiceinParameter[ i ].Parametername,
+ aService.ServiceinParameter[ i ].Parametertype,
InDataStreamDependency[ i ] ,
SUPERV::DataStreamParameter ) ;
anInPort->SetParams( InKindOfSchema[ i ] ,
_DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind( InPortsKind[ i ] ) ;
GetChangeNodeInPort( i )->Dependency( InDataStreamDependency[ i ] ) ;
_DataFlowDataPorts->GetChangeNodeOutPort( i )->Dependency( InDataStreamDependency[ i ] ) ;
- cdebug << "InPort " << GetChangeNodeInPort( i )->PortName() << " " << GetChangeNodeInPort( i )->Kind() << endl ;
- cdebug << "ReversedInPort " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind()
+ cdebug << "InPort " << GetChangeNodeInPort( i )->PortName() << " "
+ << GetChangeNodeInPort( i )->Kind() << " " << GetChangeNodeInPort( i )->PortStatus()
+ << endl ;
+ cdebug << "ReversedInPort " << _DataFlowDataPorts->GetChangeNodeOutPort( i )->PortName() << " "
+ << _DataFlowDataPorts->GetChangeNodeOutPort( i )->Kind() << " "
+ << _DataFlowDataPorts->GetChangeNodeOutPort( i )->PortStatus()
<< endl ;
}
}
for ( i = 0 ; i < outnbr ; i++ ) {
if ( OutPortsKind[ i ] == SUPERV::DataStreamParameter ) {
GraphBase::OutDataStreamPort * anOutPort = AddOutDataStreamPort( aService.ServiceoutParameter[ i ].Parametername ,
- StringToDataStreamType( aService.ServiceoutParameter[ i ].Parametertype ) ,
+ aService.ServiceoutParameter[ i ].Parametertype ,
OutDataStreamDependency[ i ] ,
SUPERV::DataStreamParameter ) ;
anOutPort->NumberOfValues( OutNumberOfValues[ i ] ) ;
_DataFlowDataPorts->GetChangeNodeInPort( i )->Dependency( OutDataStreamDependency[ i ] ) ;
GetChangeNodeOutPort( i )->Dependency( OutDataStreamDependency[ i ] ) ;
_DataFlowDataPorts->GetChangeNodeInPort( i )->Dependency( OutDataStreamDependency[ i ] ) ;
- cdebug << "OutPort " << GetChangeNodeOutPort( i )->PortName() << " " << GetChangeNodeOutPort( i )->Kind() << endl ;
- cdebug << "ReversedOutPort " << _DataFlowDataPorts->GetChangeNodeInPort( i )->PortName() << " " << _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind()
+ cdebug << "OutPort " << GetChangeNodeOutPort( i )->PortName() << " "
+ << GetChangeNodeOutPort( i )->Kind() << " " << GetChangeNodeOutPort( i )->PortStatus()
+ << endl ;
+ cdebug << "ReversedOutPort " << _DataFlowDataPorts->GetChangeNodeInPort( i )->PortName()
+ << " " << _DataFlowDataPorts->GetChangeNodeInPort( i )->Kind()
+ << " " << _DataFlowDataPorts->GetChangeNodeInPort( i )->PortStatus()
<< endl ;
}
}
if ( !anInPort->IsGate() && anInPort->IsDataConnected() ) {
if ( !AddInputData( anInPort->NodeName() ,
anInPort->PortName() ,
- anInPort->GetOutPort()->ValuePtr() ) ) {
+//JR 21.02.2005 Debug Memory leak : anInPort->GetOutPort()->ValuePtr() ) ) {
+//JR 30.03.2005 *anInPort->GetOutPort()->Value() ) ) {
+ anInPort->GetOutPort()->Value() ) ) {
cdebug << "CreateService In" << j << " " << anInPort->NodeName() << "(" << anInPort->PortName() << ") "
<< anInPort->PortStatus() << " --> AddInputData ERROR" << endl ;
RetVal = false ;
<< anInPort->PortStatus() << " --> AddInputData" << endl ;
}
}
- else if ( !anInPort->IsGate() && anInPort->IsNotConnected() ) {
+//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() || 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) ;
cdebug << "CreateService Out" << j << " " << anOutPort->NodeName() << "(" << anOutPort->PortName()
<< ") " << anOutPort->PortStatus() << " :" << endl ;
- if ( !anOutPort->IsGate() && anOutPort->IsNotConnected() && !aToNode->IsGOTONode() ) {
+//JR PAL8914 : OutPorts of LoopNodes may not be in the Service of the Graph
+// if ( !anOutPort->IsGate() && anOutPort->IsNotConnected() && !aToNode->IsGOTONode() ) {
+ if ( !anOutPort->IsGate() && !aToNode->IsGOTONode() && !aToNode->IsLoopNode() &&
+//JR Debug : 06.09.2005 : recreate that link if the OutPort is ExternConnected !!!...
+ ( anOutPort->IsNotConnected() || anOutPort->IsExternConnected() ) ) {
GraphBase::InPort *anInPort = GetChangeOutDataNodePort( anOutPort->NodePortName() ) ;
if ( !AddLink( aToNode , anOutPort , this , anInPort ) ) {
cdebug << " --> " << Name() << "(" << anInPort->PortName()
}
}
+#ifdef _DEBUG_
+ 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 ;
}
}
else if ( aINode->GetChangeNodeInPort(j)->IsDataStream() ) {
aService.ServiceinDataStreamParameter.length( InStreamService+1 ) ;
- aService.ServiceinDataStreamParameter[InStreamService].Parametertype = StringToDataStreamType( aINode->GetChangeNodeInPort(j)->PortType() ) ;
+ aService.ServiceinDataStreamParameter[InStreamService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortType() ) ;
aService.ServiceinDataStreamParameter[InStreamService].Parametername = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortName() ) ;
aService.ServiceinDataStreamParameter[InStreamService++].Parameterdependency = aINode->GetChangeNodeInPort(j)->Dependency() ;
aINode->IncrDataStreamInPorts() ;
}
else if ( aINode->GetChangeNodeOutPort(j)->IsDataStream() ) {
aService.ServiceoutDataStreamParameter.length( OutStreamService+1 ) ;
- aService.ServiceoutDataStreamParameter[OutStreamService].Parametertype = StringToDataStreamType( aINode->GetChangeNodeOutPort(j)->PortType() ) ;
+ aService.ServiceoutDataStreamParameter[OutStreamService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortType() ) ;
aService.ServiceoutDataStreamParameter[OutStreamService].Parametername = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortName() ) ;
aService.ServiceoutDataStreamParameter[OutStreamService++].Parameterdependency = aINode->GetChangeNodeOutPort(j)->Dependency() ;
aINode->IncrDataStreamOutPorts() ;
}
bool GraphBase::Graph::Sort( int & SubStreamGraphsNumber ) {
+#ifdef _DEBUG_
+ ListPorts( *_Graph_fdebug , 0 ) ;
+#endif
+
int i ;
int j ;
int NotSortedNumber = GraphNodesSize() ;
// 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
}
+ cdebug << "Graph::Sort " << _NodesNumber[ 0 ] << " HeadNodes :" << endl ;
for ( i= 0 ; i <= _NodesNumber[ 0 ] ; i++ ) {
(_SortedNodes[ 0 ])[ i ]->HeadNode( true ) ;
+ cdebug << " " << i << ". : " << (_SortedNodes[ 0 ])[ i ]->Name() << endl ;
}
// Give a subgraph/substreamgraph number > 0 to HeadNodes (level 0)
return true ;
}
+// mkr : PAL12575
+bool GraphBase::Graph::ValidGOTO() {
+ cdebug_in << "GraphBase::Graph::ValidGOTO" << endl;
+ bool RetVal = true ;
+ int i, j ;
+ GraphBase::ComputingNode * aNode ;
+ for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ aNode = GraphNodes( i ) ;
+ if ( aNode->IsGOTONode() ) {
+ GraphBase::GOTONode * aGoToNode = (GraphBase::GOTONode * ) aNode ;
+ GraphBase::InLineNode * aCoupledNode ;
+ aCoupledNode = (GraphBase::InLineNode * ) aGoToNode->CoupledNode() ;
+ if ( aCoupledNode ) {
+ ostringstream ErrorMessage ;
+ // 1. Check the number of ports (the number of OutPorts of a GOTONode and of InPorts of its linked
+ // InLine node must be the same)
+ if ( aNode->GetNodeOutPortsSize() != aCoupledNode->GetNodeInPortsSize() ) {
+ cdebug << "GraphBase::Graph::ValidGOTO : Different ports number!" << endl ;
+ ReSetMessages() ;
+ ErrorMessage << "Different ports number : the number of OutPorts of a " << aNode->Name()
+ << " node (GoTo node) and of InPorts of its linked " << aCoupledNode->Name()
+ << " node (InLine node) must be the same!\n" ;
+ SetMessages( ErrorMessage.str() ) ;
+ RetVal = false ;
+ }
+ // 2. Check ports names (the names of OutPorts of a GOTONode and of InPorts of its linked
+ // InLine node must be the same)
+ else {
+ for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
+ GraphBase::OutPort * aBusParamOutPort = aNode->GetChangeNodeOutPort( j ) ;
+ if ( !aBusParamOutPort->IsGate() ) {
+ GraphBase::InPort * aBusParamChangeInPort = NULL ;
+ aBusParamChangeInPort = aCoupledNode->GetChangeInPort( aBusParamOutPort->PortName() ) ;
+ if ( !aBusParamChangeInPort ) {
+ cdebug << "GraphBase::Graph::ValidGOTO : Different names of ports!" << endl ;
+ ReSetMessages() ;
+ ErrorMessage << "Different names of ports : there is no input port of " << aCoupledNode->Name()
+ << " node (InLine node) coupled to " << aBusParamOutPort->PortName()
+ << " output port of a " << aNode->Name()
+ << " node (GoTo node)\n" ;
+ SetMessages( ErrorMessage.str() ) ;
+ RetVal = false ;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ cdebug_out << "GraphBase::Graph::ValidGOTO RetVal " << RetVal << endl;
+ return RetVal ;
+}
+
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++ ) {
+ aNode = GraphNodes( i ) ;
+ if ( aNode->IsSwitchNode() ) {
+ GraphBase::SwitchNode * aSwitchNode = (GraphBase::SwitchNode * ) aNode ;
+ if ( !aSwitchNode->CheckSwitch() ) {
+ cdebug << "GraphBase::Graph::ValidSwitchs false aSwitchNode " << aSwitchNode->Name()
+ << endl;
+ RetVal = false ;
+ }
+ }
+ }
+ cdebug_out << "GraphBase::Graph::ValidSwitchs RetVal " << RetVal << endl;
+ return RetVal ;
}
// Controle de la coherence des noeuds de calcul
bool GraphBase::Graph::ComputingNodes() const {
bool RetVal = true ;
- cdebug << "GraphExecutor::GraphControl::ComputingNodes ()" << endl;
+ cdebug << "GraphExecutor::Graph::ComputingNodes ()" << endl;
// list<GraphEditor::Node *> aComputingNodesList = _G->ComputingNodesList() ;
// list<GraphEditor::Node *>::iterator aNode = aComputingNodesList.begin();
GraphBase::ComputingNode * aNode ;
for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
aNode = GraphNodes( i ) ;
+ cdebug << "Graph::ComputingNodes " << i << ". " << aNode->Name() << " Head " << aNode->IsHeadNode()
+ << endl ;
// Tous les ports d'entree de tous les noeuds de calcul sont bien connectes
// Enregistrement eventuel dans la liste des noeuds "tete" de graphe
// if ((*aNode)->GetNodeInPortsSize() == 0)
// 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::LoopNode * aLoopNode = (GraphBase::LoopNode * ) aNode ;
for ( j = 0 ; j < aLoopNode->GetNodeInPortsSize() ; j++ ) {
GraphBase::InPort *anInPort = aLoopNode->GetChangeNodeInPort(j) ;
+ cdebug << "Graph::LinkLoopNodes " << aLoopNode->Name() << "( " << anInPort->PortName()
+ << " ) InPort " << anInPort->PortStatus() << endl ;
if ( !anInPort->IsGate() && anInPort->IsNotConnected() ) {
if ( !AddLink( aLoopNode->CoupledNode() , aLoopNode->CoupledNode()->GetChangeNodeOutPort( j ) ,
aLoopNode , anInPort ) ) {
-// cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->CoupledNode()->Name()
-// << "( " << aLoopNode->CoupledNode()->GetChangeNodeOutPort( j )->PortName() << " ) --> "
-// << aLoopNode->Name() << "( " << anInPort->PortName() << " )" << endl ;
+ cdebug << "Graph::LinkLoopNodes AddLink ERROR "
+ << aLoopNode->CoupledNode()->Name()
+ << "( " << aLoopNode->CoupledNode()->GetChangeNodeOutPort( j )->PortName()
+ << " ) --> " << aLoopNode->Name() << "( " << anInPort->PortName() << " )"
+ << endl ;
RetVal = false ;
}
else {
}
}
for ( j = 0 ; j < aLoopNode->CoupledNode()->GetNodeInPortsSize() ; j++ ) {
- GraphBase::InPort *anInPort = aLoopNode->CoupledNode()->GetChangeNodeInPort( j ) ;
+ GraphBase::EndOfLoopNode * anEndLoopNode ;
+ anEndLoopNode = (GraphBase::EndOfLoopNode * ) aLoopNode->CoupledNode() ;
+ GraphBase::InPort *anInPort = anEndLoopNode->GetChangeNodeInPort( j ) ;
+ cdebug << "Graph::LinkLoopNodes " << anEndLoopNode->Name() << "( " << anInPort->PortName()
+ << " ) InPort " << anInPort->PortStatus() << endl ;
if ( !anInPort->IsGate() && anInPort->IsNotConnected() ) {
if ( !AddLink( aLoopNode , aLoopNode->GetChangeNodeOutPort( j ) ,
- aLoopNode->CoupledNode() , anInPort ) ) {
-// cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aLoopNode->Name() << "( "
-// << aLoopNode->GetChangeNodeOutPort( j )->PortName() << " ) --> "
-// << aLoopNode->CoupledNode()->Name() << "( " << anInPort->PortName() << " )" << endl ;
+ anEndLoopNode , anInPort ) ) {
+ cdebug << "Graph::LinkLoopNodes AddLink ERROR " << aLoopNode->Name() << "( "
+ << aLoopNode->GetChangeNodeOutPort( j )->PortName() << " ) --> "
+ << anEndLoopNode->Name() << "( " << anInPort->PortName() << " )"
+ << endl ;
RetVal = false ;
}
else {
GraphBase::GOTONode * aGOTONode = (GraphBase::GOTONode * ) aNode ;
GraphBase::OutPort *anOutGate = aGOTONode->GetChangeNodeOutGate() ;
if ( anOutGate->IsNotConnected() ) {
- RetVal = aGOTONode->CoupledNode() != NULL;
- if ( RetVal ) {
- RetVal = AddLink( aGOTONode , anOutGate ,
- aGOTONode->CoupledNode() , aGOTONode->CoupledNode()->GetChangeNodeInGate() );
- // cdebug << "GraphBase::Graph::CreateService AddLink ERROR " << aGOTONode->Name() << "( "
- // << anOutGate->PortName() << " ) --> " << aGOTONode->CoupledNode()->Name() << "( "
- // << aGOTONode->CoupledNode()->GetChangeNodeInGate()->PortName() << " )" << endl ;
+ if ( aGOTONode->CoupledNode() ) {
+ cdebug << "Graph::LinkLoopNodes aNode " << aNode << " : " << aNode->Name()
+ << aGOTONode->CoupledNode() << " : " << aGOTONode->CoupledNode()->Name()
+ << endl ;
+ RetVal = AddLink( aGOTONode , anOutGate , aGOTONode->CoupledNode() ,
+ aGOTONode->CoupledNode()->GetChangeNodeInGate() );
+ cdebug << "GraphBase::Graph::LinkLoopNodes AddLink ERROR " << aGOTONode->Name() << "( "
+ << anOutGate->PortName() << " ) --> " << aGOTONode->CoupledNode()->Name() << "( "
+ << aGOTONode->CoupledNode()->GetChangeNodeInGate()->PortName() << " )" << endl ;
if ( !RetVal )
NewLink = true;
}
}
}
}
- cdebug_out << "GraphBase::Graph::LinkLoopNodes() " << RetVal << endl;
+ cdebug_out << "GraphBase::Graph::LinkLoopNodes() NewLink " << NewLink << " returns " << RetVal
+ << endl;
return RetVal ;
}
bool GraphBase::Graph::DataServerNodes() const {
- cdebug << "GraphBase::Graph::DataServerNodes ()" << endl;
+ cdebug_in << "GraphBase::Graph::DataServerNodes ()" << endl;
// const GraphExecutor::InNode *DataFlowDatas = GetDataFlowDatas() ;
int i , j , ierr = 0 ;
}
// For Outputs of the DataFlow :
for ( j = 0 ; j < aNode->GetNodeOutPortsSize() ; j++ ) {
- if ( aNode->GetNodeOutPort(j)->IsNotConnected() ) {
- if ( aNode->GetNodeOutPort(j)->IsDataStream() ) {
+ const GraphBase::OutPort * anOutPort = aNode->GetNodeOutPort(j) ;
+//JR Debug 06.06.2005 : if it is not a Gate !
+// if ( anOutPort->IsNotConnected() ) {
+ if ( anOutPort->IsNotConnected() && !anOutPort->IsGate() && !aNode->IsGOTONode() ) { // mkr : PAL12575
+ cdebug << "Graph::DataServerNodes Add[Stream]LinkedNode for OutPort "
+ << aNode->Name() << "( " << anOutPort->PortName() << " , "
+ << anOutPort->PortStatus() << " )" << endl ;
+ if ( anOutPort->IsDataStream() ) {
aNode->AddStreamLinkedNode( (GraphBase::ComputingNode *) this ) ;
}
else {
// };
// return _dataServerError.size ();
+ cdebug_out << "GraphBase::Graph::DataServerNodes ierr " << ierr << endl;
return ( ierr == 0 ) ;
}
}
}
if ( anOutPort ) {
- aRet = anOutPort->State() ;
+ aRet = anOutPort->PortState() ;
// cdebug << "GraphBase::Graph::PortState --> " << aRet << endl ;
}
}
return aRet ;
}
-const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName ,
- const char* ToServiceParameterName ) {
- const CORBA::Any * aRet = new CORBA::Any() ;
+#define TracePortInOutData 0
+//JR 30.03.2005const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName ,
+const CORBA::Any GraphBase::Graph::PortInData( const char* ToNodeName ,
+ const char* ToServiceParameterName ) {
+//JR 30.03.2005 const CORBA::Any * aRet = new CORBA::Any() ;
+ CORBA::Any aRet = CORBA::Any() ;
char *theNode ;
char *aPort ;
-// cdebug_in << "GraphBase::Graph::PortInData " << ToNodeName << " "
-// << ToServiceParameterName << endl ;
+#if TracePortInOutData
+ cdebug_in << "GraphBase::Graph::PortInData " << ToNodeName << " "
+ << ToServiceParameterName << endl ;
+#endif
NodePort( ToNodeName , ToServiceParameterName , &theNode , &aPort ) ;
GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ;
if ( anInPort ) {
anOutPort = anInPort->GetOutPort() ;
if ( anOutPort ) {
+#if TracePortInOutData
+ cdebug << "-->PortInData " << ToNodeName << " " << ToServiceParameterName << " "
+ << endl ;
+#endif
aRet = anOutPort->Value() ;
+#if TracePortInOutData
+ cdebug << "<--PortInData " << ToNodeName << " " << ToServiceParameterName << " " ;
+ anOutPort->StringValue( *GraphBase::Base::_fdebug ) ;
+ cdebug << endl ;
cdebug << "Graph::PortInData OutPort value " << anOutPort->NodeName() << "("
<< anOutPort->PortName() << ") --> InPort " << anInPort->NodeName()
<< "(" << anInPort->PortName() << ") " << anInPort->PortStatus() << endl ;
+#endif
}
else {
cdebug << "Graph::PortInData GraphBase::Graph::PortInData " << ToNodeName << " "
<< ToServiceParameterName << " ERROR no InPort" << endl ;
}
}
+ else if ( !strcmp( ToNodeName , Name() ) &&
+ !strcmp( ToServiceParameterName , "Gate" ) ) {
+ cdebug << "GraphBase::Graph::PortInData " << ToNodeName << " "
+ << ToServiceParameterName << " InGate ignored" << endl ;
+ }
else {
cdebug << "GraphBase::Graph::PortInData " << ToNodeName << " "
<< ToServiceParameterName << " ERROR no Node" << endl ;
}
- delete theNode ;
- delete aPort ;
-// cdebug_out << "GraphBase::Graph::PortInData " << endl ;
+ delete [] theNode ;
+ delete [] aPort ;
+#if TracePortInOutData
+ cdebug_out << "GraphBase::Graph::PortInData " << endl ;
+#endif
return aRet ;
}
-const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName ,
- const char* FromServiceParameterName ) {
- const CORBA::Any * aRet = new CORBA::Any() ;
+//JR 30.03.2005const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName ,
+const CORBA::Any GraphBase::Graph::PortOutData( const char* FromNodeName ,
+ const char* FromServiceParameterName ) {
+//JR 30.03.2005 const CORBA::Any * aRet = new CORBA::Any() ;
+ CORBA::Any aRet = CORBA::Any() ;
char *theNode ;
char *aPort ;
-// cdebug_in << "GraphBase::Graph::PortOutData " << FromNodeName << " "
-// << FromServiceParameterName << endl ;
+#if TracePortInOutData
+ cdebug_in << "GraphBase::Graph::PortOutData " << FromNodeName << " "
+ << FromServiceParameterName << endl ;
+#endif
NodePort( FromNodeName , FromServiceParameterName , &theNode , &aPort ) ;
GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ;
GraphBase::OutPort *anOutPort ;
anOutPort = aNode->GetChangeOutPort( aPort );
if ( anOutPort ) {
+#if TracePortInOutData
+ cdebug << "-->PortOutData " << FromNodeName << " " << FromServiceParameterName << " "
+ << endl ;
+#endif
aRet = anOutPort->Value() ;
+#if TracePortInOutData
+ cdebug << "<--PortOutData " << FromNodeName << " " << FromServiceParameterName << " " ;
+ anOutPort->StringValue( *GraphBase::Base::_fdebug ) ;
+ cdebug << endl ;
+#endif
}
else {
cdebug << "GraphBase::Graph::PortOutData " << FromNodeName << " "
<< FromServiceParameterName << " ERROR no OutPort" << endl ;
}
}
+ else if ( !strcmp( FromNodeName , Name() ) &&
+ !strcmp( FromServiceParameterName , "Gate" ) ) {
+ cdebug << "GraphBase::Graph::PortOutData " << FromNodeName << " "
+ << FromServiceParameterName << " OutGate ignored" << endl ;
+ }
else {
cdebug << "GraphBase::Graph::PortOutData " << FromNodeName << " "
<< FromServiceParameterName << " ERROR no Node" << endl ;
}
- delete theNode ;
- delete aPort ;
-// cdebug_out << "GraphBase::Graph::PortOutData " << endl ;
+ delete [] theNode ;
+ delete [] aPort ;
+#if TracePortInOutData
+ cdebug_out << "GraphBase::Graph::PortOutData " << endl ;
+#endif
return aRet ;
}
<< " 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 ;
}