// SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
//
-// Copyright (C) 2003 CEA/DEN, EDF R&D
-//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// 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.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
// File : DataFlowBase_ComputingNode.cxx
// Author : Jean Rahuel, CEA
// Module : SUPERV
-// $Header:
using namespace std;
//#include <sstream>
#include "DataFlowBase_StreamGraph.hxx"
//#include "DataFlowBase_LoopNode.hxx"
+// Screen single quotes
+static string protectQuotes (const string theText)
+{
+ string aRes (theText);
+ unsigned int pos;
+
+ // screen back slash
+ for (pos = 0; pos < aRes.size(); pos++) {
+ pos = aRes.find("\\", pos);
+ if (pos < 0 || pos > aRes.size()) break;
+
+ aRes.insert(pos, "\\");
+ pos++;
+
+ // screen symbol after back slash (except single quote, which will be processed below)
+ if (pos + 1 < aRes.size() && aRes[pos + 1] != '\'') {
+ aRes.insert(pos + 1, "\\");
+ pos += 2;
+ }
+ }
+
+ // screen single quote
+ for (pos = 0; pos < aRes.size(); pos++) {
+ pos = aRes.find("'", pos);
+ if (pos < 0 || pos > aRes.size()) break;
+
+ aRes.insert(pos, "\\");
+ pos++;
+ }
+
+ return aRes;
+}
+
static void InitFields( //SUPERV::KindOfNode &_Kind ,
SUPERV::SDate &_FirstCreation ,
SUPERV::SDate &_LastModification ,
_FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour;
_FirstCreation.Day = _LastModification.Day = Tm->tm_mday;
_FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
- _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
+ _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
_EditorRelease = new char[ strlen( SuperVision_Version ) + 1 ] ;
strcpy( _EditorRelease , SuperVision_Version ) ;
// cout << "GraphBase::ComputingNode::ComputingNode NO SetDebug" << endl ;
// }
DefPortsOfNode( ORB , SALOME_ModuleCatalog::Service() , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
- cdebug << "GraphBase::ComputingNode::ComputingNode " << this
+ cdebug << "GraphBase::ComputingNode::ComputingNode " << this
<< " Name '" << Name() << "' " << _FirstCreation
<< " " << _LastModification << endl ;
}
_FirstCreation.Hour = _LastModification.Hour = Tm->tm_hour;
_FirstCreation.Day = _LastModification.Day = Tm->tm_mday;
_FirstCreation.Month = _LastModification.Month = Tm->tm_mon + 1;
- _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
+ _FirstCreation.Year = _LastModification.Year = Tm->tm_year + 1900;
if ( NodeEditorRelease != NULLSTRING ) {
_EditorRelease = new char[ strlen( NodeEditorRelease ) + 1 ] ;
DefPortsOfNode( ORB , aService , NamePtr() , Kind() , Graph_prof_debug , Graph_fdebug ) ;
- cdebug << "GraphBase::ComputingNode::ComputingNode " << this
+ cdebug << "GraphBase::ComputingNode::ComputingNode " << this
<< " Name '" << Name()
<< "' KindOfNode " << Kind()
<< " ServiceName '" << ServiceName() << "' In(" << ServiceInParameter().length()
}
GraphBase::ComputingNode::~ComputingNode() {
- cdebug << "GraphBase::ComputingNode::~ComputingNode " << this
+ cdebug << "GraphBase::ComputingNode::~ComputingNode " << this
<< " Name() "<< Name() << " _Comment "
<< (void *) _Comment << " " << _Comment << " " << endl ;
}
SUPERV::SDate GraphBase::ComputingNode::FirstCreation () const {
// cdebug << "GraphBase::ComputingNode::FirstCreation "
-// << " Name '" << Name() << "' " << _FirstCreation << " "
+// << " Name '" << Name() << "' " << _FirstCreation << " "
// << _LastModification << endl ;
return _FirstCreation;
}
bool GraphBase::ComputingNode::EditorRelease(const char * c){
if ( _EditorRelease && _EditorRelease != NULLSTRING )
- delete _EditorRelease;
+ delete [] _EditorRelease;
_EditorRelease = my_strdup(c);
return true ;
}
}
}
-bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName ) {
+bool GraphBase::ComputingNode::IsLinked(const char * ToServiceParameterName, bool isInput ) {
bool RetVal = false ;
- const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
- if ( thePort ) {
- RetVal = thePort->IsPortConnected() ;
+ if ( isInput ) { // mkr : PAL8060
+ // we have to know the type of the port, because of input and output ports
+ // belong to one node may have the same names
+ const GraphBase::InPort * thePort = GetInPort( ToServiceParameterName ) ;
+ if ( thePort ) {
+ RetVal = thePort->IsPortConnected() ;
+ }
}
else {
const GraphBase::OutPort * thePort = GetOutPort( ToServiceParameterName ) ;
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 ;
<< " " << anInPort->Kind() << endl ;
GraphBase::InPort * aNewInPort ;
if ( anInPort->IsDataStream() ) {
- aNewInPort = AddInDataStreamPort( anInPort->PortName() , StringToDataStreamType( anInPort->PortType() ) ,
- anInPort->Dependency() , anInPort->Kind() ) ;
+ aNewInPort = AddInDataStreamPort( anInPort->PortName(), anInPort->PortType(),
+ anInPort->Dependency(), anInPort->Kind() ) ;
}
else if ( anInPort->IsParam() || anInPort->IsInLine() ) {
aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ;
cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
<< " " << anOutPort->Kind() << endl ;
if ( anOutPort->IsDataStream() ) {
- AddOutDataStreamPort( anOutPort->PortName() , StringToDataStreamType( anOutPort->PortType() ) ,
- anOutPort->Dependency() , anOutPort->Kind() ) ;
+ AddOutDataStreamPort( anOutPort->PortName(), anOutPort->PortType(),
+ anOutPort->Dependency(), anOutPort->Kind() ) ;
}
else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) {
AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ;
cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " "
<< GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ;
DelInPort( GetNodeInPort( i )->PortName() ) ;
+ i--; // mkr : fix for bug PAL8004
}
}
int index ;
}
void GraphBase::ComputingNode::DelInPort( const char * InputParameterName ) {
+//PAL9122
+//JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated
+// LinkedInPortsNumber and LinkedFromInPortsNumber must be updated
+ cdebug_in << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )"
+ << endl;
+ bool RetVal = true ;
+ if ( !IsEndSwitchNode() ) {
+ GraphBase::InPort * anInPort = GetChangeInPort( InputParameterName ) ;
+ cdebug << "ComputingNode::DelInPort InPort " << Name() << "( "
+ << anInPort->PortName() << " ) " << anInPort->PortStatus() << " <-- " ;
+ GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
+ if ( anOutPort && !( IsEndLoopNode() && anInPort->IsLoop() ) ) {
+ 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 ignored" << endl ;
+ }
+ else {
+ FromNode = GraphOfNode()->GetChangeGraphNode( anOutPort->NodeName() ) ;
+ }
+ if ( FromNode ) {
+ cdebug << "FromNode " << FromNode->Name() << " LinkedNodesSize "
+ << FromNode->LinkedNodesSize() << " and " << Name()
+ << " LinkedFromNodesSize " << LinkedFromNodesSize() << endl ;
+ if ( !FromNode->IsGOTONode() &&
+ !( FromNode->IsEndLoopNode() && anInPort->IsLoop() ) ) {
+ if ( anInPort->IsDataStream() ) {
+ RetVal = FromNode->RemoveStreamLinkedNode( this ) ;
+ }
+ else {
+ RetVal = FromNode->RemoveLinkedNode( this ) ;
+ }
+ if ( !RetVal ) {
+ cdebug << "ComputingNode::DelInPort anOutPort->RemoveLinkedNode Error RetVal "
+ << RetVal << endl ;
+ }
+ }
+ }
+ }
+ }
+//We have an EndSwitchNode :
+ else {
+ int i ;
+ for ( i = LinkedFromNodesSize() - 1 ; i >= 0 ; i-- ) {
+ GraphBase::ComputingNode * aLinkedFromNode = (GraphBase::ComputingNode * ) LinkedFromNodes( i ) ;
+ cdebug << aLinkedFromNode->Name() << " linked to " << Name() << endl ;
+ int j ;
+ for ( j = aLinkedFromNode->GetNodeOutPortsSize() - 1 ; j >= 0 ; j-- ) {
+ GraphBase::OutPort * anOutPort = aLinkedFromNode->GetChangeNodeOutPort( j ) ;
+ cdebug << "ComputingNode::DelInPort OutPort" << j << ". Remove " << anOutPort->InPortsSize()
+ << " InPortsof OutPort : " << anOutPort->NodeName() << "( "
+ << anOutPort->PortName() << ") "
+ << anOutPort->PortStatus() << " :" << endl ;
+ int k ;
+//Process concerned OutPorts of LinkedFromNodes of that EndSwitchNode
+ for ( k = anOutPort->InPortsSize() - 1 ; k >= 0 ; k-- ) {
+ GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( k ) ;
+ if ( !strcmp( anInPort->NodeName() , Name() ) &&
+ !strcmp( anInPort->PortName() , InputParameterName ) ) {
+// InPort of the EndSwitchNode
+ cdebug << " to InPort" << j << ". " << anInPort->NodeName() << "( "
+ << anInPort->PortName() << ") "
+ << anInPort->PortStatus() << endl ;
+ anInPort->RemoveOutPort() ;
+ if ( anOutPort->IsDataStream() ) {
+ aLinkedFromNode->RemoveStreamLinkedNode( this ) ;
+ }
+ else {
+// false ==> No error for aNode->LinkedFromNode()
+ RetVal = aLinkedFromNode->RemoveLinkedNode( this , false ) ;
+ if ( !RetVal ) {
+ cdebug << "ComputingNode::DelInPort aLinkedFromNode->RemoveLinkedNode Error RetVal "
+ << RetVal << endl ;
+ break ;
+ }
+ }
+// Remove the InPort of the EndSwitchNode from that OutPort
+ RetVal = anOutPort->RemoveInPort( anInPort ) ;
+ if ( !RetVal ) {
+ cdebug << "ComputingNode::DelInPort anOutPort->RemoveInPort( anInPort ) Error RetVal "
+ << RetVal << endl ;
+ break ;
+ }
+ }
+ }
+ }
+ }
+ }
+
GraphBase::PortsOfNode::DelInPort( InputParameterName ) ;
+ cdebug_out << "ComputingNode::DelInPort " << Name() << "( " << InputParameterName << " )"
+ << endl;
}
void GraphBase::ComputingNode::DelOutPort( const char * OutputParameterName ) {
+//PAL9122
+//JR 07.06.2005 Debug : LinkedNodes and LinkedFromNode must be updated
+// LinkedInPortsNumber and LinkedFromInPortsNumber must be updated
+ cdebug_in << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )"
+ << endl;
+ bool RetVal = true ;
+ GraphBase::OutPort * anOutPort = GetChangeOutPort( OutputParameterName ) ;
+ cdebug << "ComputingNode::DelOutPort OutPort " << " InPortof OutPort : "
+ << anOutPort->NodeName() << "( " << anOutPort->PortName() << ") "
+ << anOutPort->PortStatus() << " :" << endl ;
+ int j ;
+ for ( j = anOutPort->InPortsSize() - 1 ; j >= 0 ; j-- ) {
+ GraphBase::InPort * anInPort = anOutPort->ChangeInPorts( j ) ;
+ 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 = GraphOfNode()->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 << "ComputingNode::DelOutPort anOutPort->RemoveOutPort Error RetVal " << RetVal
+ << endl ;
+ break ;
+ }
+ if ( ( IsGOTONode() && ToNode->IsOneOfInLineNodes() ) ||
+ ( IsEndLoopNode() && ToNode->IsLoopNode( ) ) ) {
+ }
+ else if ( anOutPort->IsDataStream() ) {
+ RetVal = RemoveStreamLinkedNode( ToNode ) ;
+ }
+ else {
+ RetVal = RemoveLinkedNode( ToNode ) ;
+ }
+ if ( !RetVal ) {
+ cdebug << "ComputingNode::DelOutPort anOutPort->RemoveLinkedNode Error RetVal " << RetVal
+ << endl ;
+ break ;
+ }
+ 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() , 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 << "ComputingNode::DelOutPort 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 ) {
+ cdebug << "Error RetVal " << RetVal << endl ;
+ }
+
GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
+ cdebug_out << "ComputingNode::DelOutPort " << Name() << "( " << OutputParameterName << " )"
+ << endl;
}
GraphBase::InPort * GraphBase::ComputingNode::AddInPort( const char * InputParameterName ,
GraphBase::PortsOfNode::DelOutPort( OutputParameterName ) ;
}
-GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName ,
- const SALOME_ModuleCatalog::DataStreamType InputParameterType ,
+GraphBase::InDataStreamPort * GraphBase::ComputingNode::AddInDataStreamPort( const char * InputParameterName,
+ const char * InputParameterType,
const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
const SUPERV::KindOfPort aKindOfPort ,
int index ) {
aDataStreamPort = (GraphBase::InDataStreamPort * ) GraphBase::PortsOfNode::AddInPort( _ORB , NamePtr() ,
Kind() ,
InputParameterName ,
- DataStreamTypeToString( InputParameterType ).c_str() ,
+ InputParameterType ,
aKindOfPort ,
index ,
_Graph_prof_debug ,
}
return aDataStreamPort ;
}
-GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName ,
- const SALOME_ModuleCatalog::DataStreamType OutputParameterType ,
+GraphBase::OutDataStreamPort * GraphBase::ComputingNode::AddOutDataStreamPort( const char * OutputParameterName,
+ const char * OutputParameterType,
const SALOME_ModuleCatalog::DataStreamDependency aDependency ,
const SUPERV::KindOfPort aKindOfPort ,
int index ) {
// IncrDataStreamOutPorts() ;
GraphBase::OutDataStreamPort * aDataStreamPort ;
- aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr() ,
- Kind() ,
- OutputParameterName ,
- DataStreamTypeToString( OutputParameterType ).c_str() ,
+ aDataStreamPort = (GraphBase::OutDataStreamPort * ) GraphBase::PortsOfNode::AddOutPort( _ORB , NamePtr(),
+ Kind(),
+ OutputParameterName,
+ OutputParameterType,
aKindOfPort ,
index ,
_Graph_prof_debug ,
}
-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 :
+// We have to check that all nodes linked from that node go to the beginning of LoopNode :
for ( i = 0 ; i < LinkedFromNodesSize() ; i++ ) {
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>
kind.appendChild( aField ) ;
if ( IsDataStreamNode() && HasDataStream() != 0 ) {
- long Timeout ;
+ CORBA::Long Timeout ;
SUPERV::KindOfDataStreamTrace DataStreamTrace ;
- double DeltaTime ;
+ CORBA::Double DeltaTime ;
((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
QDomElement timeout = Graph.createElement("streamgraph-timeout") ;
DataStreamlist.appendChild(inParameter) ;
QDomElement inParametertype = Graph.createElement("inParameter-type") ;
QString aType ;
- aType = aType.setNum( StringToDataStreamType( anInPort->PortType() ) ) ;
- cdebug << "SaveXML " << anInPort->PortType() << " --> " << StringToDataStreamType( anInPort->PortType() )
+ aType = aType.setNum( StringToDataStreamType(anInPort->PortType()) ) ;
+ cdebug << "SaveXML " << anInPort->PortType() << " --> " << anInPort->PortType()
<< " " << aType << endl ;
aField = Graph.createTextNode( aType ) ;
inParameter.appendChild(inParametertype) ;
DataStreamlist.appendChild(outParameter) ;
QDomElement outParametertype = Graph.createElement("outParameter-type") ;
QString aType ;
- aType = aType.setNum( StringToDataStreamType( anOutPort->PortType() ) ) ;
- cdebug << "SaveXML " << anOutPort->PortType() << " --> " << StringToDataStreamType( anOutPort->PortType() )
+ aType = aType.setNum( StringToDataStreamType(anOutPort->PortType()) ) ;
+ cdebug << "SaveXML " << anOutPort->PortType() << " --> " << anOutPort->PortType()
<< " " << aType << endl ;
aField = Graph.createTextNode( aType ) ;
outParameter.appendChild(outParametertype) ;
cdebug << "SaveXML NumberOfValues " << ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() << endl ;
}
}
-// f << Tabs << "</Parameter-list>" << endl ;
+// f << Tabs << "</Parameter-list>" << endl ;
// f << Tabs << "<PyFunction-list>" << endl ;
QDomElement PyFunctionlist = Graph.createElement("PyFunction-list") ;
}
else if ( IsDataStreamNode() && HasDataStream() != 0 ) {
f << " " << Name() << " = StreamGraph( '" << Name() << "' )" << endl ;
- long Timeout ;
+ CORBA::Long Timeout ;
SUPERV::KindOfDataStreamTrace DataStreamTrace ;
- double DeltaTime ;
+ CORBA::Double DeltaTime ;
((GraphBase::StreamGraph * ) this)->StreamParams( Timeout , DataStreamTrace , DeltaTime ) ;
f << " " << aGraphName << ".SetStreamParams( " << Timeout << " , SUPERV." << DataStreamTrace
<< " , " << DeltaTime << " )" << endl ;
}
f << " " << Name() << "_ServiceinStreamParameter = []" << endl ;
for ( i = 0 ; i < (int ) ServiceInStreamParameter().length() ; i++ ) {
- f << " " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
- << ServiceInStreamParameter()[i].Parametertype << " , '"
+ f << " " << Name() << "_ServiceinStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( '"
+ << ServiceInStreamParameter()[i].Parametertype << "' , '"
<< ServiceInStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
<< ServiceInStreamParameter()[i].Parameterdependency << " ) )" << endl ;
}
f << " " << Name() << "_ServiceoutStreamParameter = []" << endl ;
for ( i = 0 ; i < (int ) ServiceOutStreamParameter().length() ; i++ ) {
- f << " " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( SALOME_ModuleCatalog."
- << ServiceOutStreamParameter()[i].Parametertype << " , '"
+ f << " " << Name() << "_ServiceoutStreamParameter.append( SALOME_ModuleCatalog.ServicesDataStreamParameter( '"
+ << ServiceOutStreamParameter()[i].Parametertype << "' , '"
<< ServiceOutStreamParameter()[i].Parametername << "' , SALOME_ModuleCatalog."
<< ServiceOutStreamParameter()[i].Parameterdependency << " ) )" << endl ;
}
if ( PythonFunctions.size() ) {
aPyFunc = *PythonFunctions[0] ;
for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
- f << " " << "Py" << Name() << ".append( '" << aPyFunc[i] << "' )" << endl ;
+ f << " " << "Py" << Name() << ".append( '" << protectQuotes(aPyFunc[i].in()) << "' )" << endl;
}
}
if ( IsInLineNode() ) {
SUPERV::ListOfStrings aPyMore = *PythonFunctions[1] ;
SUPERV::ListOfStrings aPyNext = *PythonFunctions[2] ;
f << " " << "PyMore" << Name() << " = []" << endl ;
+
for ( i = 0 ; i < (int ) aPyMore.length() ; i++ ) {
- f << " " << "PyMore" << Name() << ".append( '" << aPyMore[i] << "' )" << endl ;
+ f << " " << "PyMore" << Name() << ".append( '"
+ << protectQuotes(aPyMore[i].in()) << "' )" << endl;
}
f << " " << "PyNext" << Name() << " = []" << endl ;
for ( i = 0 ; i < (int ) aPyNext.length() ; i++ ) {
- f << " " << "PyNext" << Name() << ".append( '" << aPyNext[i] << "' )" << endl ;
+ f << " " << "PyNext" << Name() << ".append( '"
+ << protectQuotes(aPyNext[i].in()) << "' )" << endl ;
}
f << " " << Name() << "," << EndName << " = " << aGraphName << ".LNode( '"
<< FuncNames[0].c_str() << "' , Py" << Name() << " , '"
SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ;
for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
- f << " " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
- << endl ;
+ f << " " << "Py" << aCoupledNode->Name() << ".append( '"
+ << protectQuotes(aPyFunc[i].in()) << "' )" << endl;
}
f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
}
else if ( anInPort->IsDataStream() ) {
f << " " << "I" << Name() << anInPort->PortName() << " = " << Name()
- << ".InStreamPort( '" << anInPort->PortName()
- << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
- << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
+ << ".InStreamPort( '" << anInPort->PortName() << "' , '" << anInPort->PortType()
+ << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
SUPERV::KindOfSchema aKindOfSchema ;
SUPERV::KindOfInterpolation aKindOfInterpolation ;
SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
else if ( anOutPort->IsDataStream() ) {
f << " " << "O" << Name() << anOutPort->PortName() << " = " << Name()
<< ".OutStreamPort( '" << anOutPort->PortName()
- << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
- << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
+ << "' , '" << anOutPort->PortType()
+ << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
long aNumberOfValues ;
aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
f << " " << "O" << Name() << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
<< endl ;
}
+//JR 02.09.2005 : GetOutPort for Gates was missing
+ else if ( anOutPort->IsGate() ) {
+ f << " " << "O" << Name() << anOutPort->PortName() << " = "
+ << Name() << ".GetOutPort( '" << anOutPort->PortName() << "' )" << endl ;
+ }
}
for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
const GraphBase::InPort * anInPort = aCoupledNode->GetNodeInPort(i) ;
else if ( anInPort->IsDataStream() ) {
f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
<< ".InStreamPort( '" << anInPort->PortName()
- << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
- << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
+ << "' , '" << anInPort->PortType()
+ << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
SUPERV::KindOfSchema aKindOfSchema ;
SUPERV::KindOfInterpolation aKindOfInterpolation ;
SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
else if ( anOutPort->IsDataStream() ) {
f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
<< ".OutStreamPort( '" << anOutPort->PortName()
- << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
- << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
+ << "' , '" << anOutPort->PortType()
+ << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
long aNumberOfValues ;
aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
SUPERV::ListOfStrings aPyFunc = *aCoupledNode->PythonFunction() ;
f << " " << "Py" << aCoupledNode->Name() << " = []" << endl ;
for ( i = 0 ; i < (int ) aPyFunc.length() ; i++ ) {
- f << " " << "Py" << aCoupledNode->Name() << ".append( '" << aPyFunc[i] << "' )"
- << endl ;
+ f << " " << "Py" << aCoupledNode->Name() << ".append( '"
+ << protectQuotes(aPyFunc[i].in()) << "' )" << endl;
}
f << " " << EndName << ".SetPyFunction( '" << aCoupledNode->PyFuncName() << "' , Py" << aCoupledNode->Name() << " )" << endl ;
for ( i = 0 ; i < aCoupledNode->GetNodeInPortsSize() ; i++ ) {
else if ( anInPort->IsDataStream() ) {
f << " " << "I" << EndName << anInPort->PortName() << " = " << EndName
<< ".InStreamPort( '" << anInPort->PortName()
- << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anInPort->PortType() )
- << " , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
+ << "' , '" << anInPort->PortType()
+ << "' , SALOME_ModuleCatalog." << anInPort->Dependency() << " )" << endl ;
SUPERV::KindOfSchema aKindOfSchema ;
SUPERV::KindOfInterpolation aKindOfInterpolation ;
SUPERV::KindOfExtrapolation aKindOfExtrapolation ;
else if ( anOutPort->IsDataStream() ) {
f << " " << "O" << EndName << anOutPort->PortName() << " = " << EndName
<< ".OutStreamPort( '" << anOutPort->PortName()
- << "' , SALOME_ModuleCatalog." << StringToDataStreamType( anOutPort->PortType() )
- << " , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
+ << "' , '" << anOutPort->PortType()
+ << "' , SALOME_ModuleCatalog." << anOutPort->Dependency() << " )" << endl ;
long aNumberOfValues ;
aNumberOfValues = ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues() ;
f << " " << "O" << EndName << anOutPort->PortName() << ".SetNumberOfValues( " << aNumberOfValues << " )"
if ( anInPort->IsDataStream() ) {
if ( IsOneOfInLineNodes() ) {
f << " " << "I" << Name() << anInPort->PortName() << " = "
- << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , SALOME_ModuleCatalog."
- << StringToDataStreamType( anInPort->PortType() ) << " , SALOME_ModuleCatalog."
+ << Name() << ".InStreamPort( '" << anInPort->PortName() << "' , '"
+ << anInPort->PortType() << "' , SALOME_ModuleCatalog."
<< anInPort->Dependency() << " )" << endl ;
}
else {
if ( anOutPort->IsDataStream() ) {
if ( IsOneOfInLineNodes() ) {
f << " " << "O" << Name() << anOutPort->PortName() << " = "
- << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , SALOME_ModuleCatalog."
- << StringToDataStreamType( anOutPort->PortType() ) << " , SALOME_ModuleCatalog."
+ << Name() << ".OutStreamPort( '" << anOutPort->PortName() << "' , '"
+ << anOutPort->PortType() << "' , SALOME_ModuleCatalog."
<< anOutPort->Dependency() << " )" << endl ;
}
else {
// cdebug_out << "operator<< GraphEditor::Date" << endl;
return fOut;
}
-