// Implementation de la classe GraphEditor::Graph
-GraphEditor::OutNode::OutNode() :
- Graph() {
+GraphEditor::OutNode::OutNode() {
+// Graph() {
cdebug_in << "GraphEditor::OutNode::OutNode()" << endl;
_Imported = false ;
GraphEditor::OutNode::OutNode( CORBA::ORB_ptr ORB ,
SALOME_NamingService * ptrNamingService ,
const char * DataFlowName ,
- const char * DebugFileName ) :
- Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
+ const char * DebugFileName ,
+ const SUPERV::KindOfNode aKindOfNode ) {
+// Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) {
+ Set_prof_debug( ORB , DebugFileName ) ;
cdebug_in << "GraphEditor::OutNode::OutNode(" ;
if ( DataFlowName ) {
cdebug << DataFlowName ;
}
cdebug << ")" << endl;
+ if ( aKindOfNode == SUPERV::DataFlowGraph ) {
+ _StreamGraph = NULL ;
+// _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;
+ _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowName ,
+ _prof_debug , _fdebug ) ;
+ }
+ else if ( aKindOfNode == SUPERV::DataStreamGraph ) {
+// _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName , DebugFileName ) ;;
+ _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowName ,
+ _prof_debug , _fdebug ) ;
+ _Graph = _StreamGraph ;
+ }
_Orb = CORBA::ORB::_duplicate( ORB ) ;
_Imported = false ;
_Valid = false ;
const char * DataFlowAuthor ,
const char * DataFlowComputer ,
const char * DataFlowComment ,
- const char * DebugFileName ) :
- Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
- DataFlowInterfaceName , DataFlowName , DataFlowkind ,
- DataFlowFirstCreation , DataFlowLastModification ,
- DataFlowEditorRelease , DataFlowAuthor ,
- DataFlowComputer , DataFlowComment , DebugFileName ) {
-
+ const char * DebugFileName ) {
+// Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
+// DataFlowInterfaceName , DataFlowName , DataFlowkind ,
+// DataFlowFirstCreation , DataFlowLastModification ,
+// DataFlowEditorRelease , DataFlowAuthor ,
+// DataFlowComputer , DataFlowComment , DebugFileName ) {
+ Set_prof_debug( ORB , DebugFileName ) ;
+
+ if ( DataFlowkind == SUPERV::DataFlowGraph ) {
+ _StreamGraph = NULL ;
+ _Graph = new GraphBase::Graph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
+ DataFlowInterfaceName , DataFlowName , DataFlowkind ,
+ DataFlowFirstCreation , DataFlowLastModification ,
+ DataFlowEditorRelease , DataFlowAuthor ,
+ DataFlowComputer , DataFlowComment ,
+ _prof_debug , _fdebug ) ;
+// DataFlowComputer , DataFlowComment , DebugFileName ) ;
+ }
+ else if ( DataFlowkind == SUPERV::DataStreamGraph ) {
+ _StreamGraph = new GraphBase::StreamGraph( ORB , ptrNamingService , DataFlowService , DataFlowComponentName ,
+ DataFlowInterfaceName , DataFlowName , DataFlowkind ,
+ DataFlowFirstCreation , DataFlowLastModification ,
+ DataFlowEditorRelease , DataFlowAuthor ,
+ DataFlowComputer , DataFlowComment ,
+ _prof_debug , _fdebug ) ;
+// DataFlowComputer , DataFlowComment , DebugFileName ) ;
+ _Graph = _StreamGraph ;
+ }
_Orb = CORBA::ORB::_duplicate( ORB ) ;
_Imported = false ;
_Valid = false ;
// delete _GT ;
}
+void GraphEditor::OutNode::Set_prof_debug( CORBA::ORB_ptr ORB ,
+ const char * DebugFileName ) {
+ _Graph_prof_debug = 0 ;
+ _prof_debug = 0 ;
+ if ( DebugFileName ) {
+ _fdebug = new ofstream( DebugFileName );
+ SetDebug( ORB , &_Graph_prof_debug , _fdebug ) ;
+ MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl)
+ }
+}
+
bool GraphEditor::OutNode::LoadDataFlow( const GraphBase::SGraph *aDataFlow ) {
bool RetVal = false ;
cdebug_in << "GraphEditor::OutNode::LoadDataFlow() " << aDataFlow->Info.theName.c_str()
- << endl;
+ << " GraphNodesSize " << Graph()->GraphNodesSize() << endl;
if ( !_Imported ) {
RetVal = LoadInfo( aDataFlow->Info ) ;
_Imported = true ;
}
- else {
+ else if ( aDataFlow->Info.theKind == Graph()->Kind() ) {
RetVal = true ;
}
+ cdebug << "GraphEditor::OutNode::LoadDataFlow() _Imported " << _Imported << " RetVal " << RetVal << endl;
map< string , int > aMapOfNodes ;
- if ( RetVal )
+ if ( RetVal ) {
+ cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadNodes GraphNodesSize " << Graph()->GraphNodesSize() << endl;
RetVal = LoadNodes( aMapOfNodes , aDataFlow->Nodes ) ;
- if ( RetVal )
+ }
+ if ( RetVal ) {
+ cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadLinks GraphNodesSize " << Graph()->GraphNodesSize() << endl;
RetVal = LoadLinks( aMapOfNodes , aDataFlow->Links ) ;
+ }
if ( RetVal ) {
Valid() ;
+ cdebug << "GraphEditor::OutNode::LoadDataFlow() LoadDatas GraphNodesSize " << Graph()->GraphNodesSize() << endl;
RetVal = LoadDatas( aMapOfNodes , aDataFlow->Datas ) ;
}
- cdebug_out << "GraphEditor::OutNode::LoadDataFlow" << endl;
+ cdebug_out << "GraphEditor::OutNode::LoadDataFlow done GraphNodesSize " << Graph()->GraphNodesSize() << endl;
return RetVal ;
}
_Imported = true ;
RetVal = true ;
}
- else if ( GraphBase::Graph::LoadXml( _Orb , myFileName , aDataFlow ) ) {
+ else if ( Graph()->LoadXml( _Orb , myFileName , aDataFlow ) ) {
cdebug_in << "GraphEditor::OutNode::LoadXml() " << endl;
RetVal = LoadDataFlow( &aDataFlow ) ;
cdebug_out << "GraphEditor::OutNode::LoadXml " << RetVal << endl;
}
bool GraphEditor::OutNode::LoadInfo(const GraphBase::SNode &aDataFlowInfo ) {
+ bool RetVal = false ;
cdebug_in << "GraphEditor::OutNode::LoadInfo " << aDataFlowInfo.theName.c_str()
<< endl ;
// MESSAGE( "GraphEditor::OutNode::LoadDataFlow" );
// ComponentName( aDataFlowInfo.theComponentName.c_str() ) ;
// InterfaceName( aDataFlowInfo.theInterfaceName.c_str() ) ;
- Name( aDataFlowInfo.theName.c_str() ) ;
- Kind( aDataFlowInfo.theKind ) ;
- Service( aDataFlowInfo.theService ) ;
- FirstCreation( aDataFlowInfo.theFirstCreation ) ;
- LastModification( aDataFlowInfo.theLastModification ) ;
- EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ;
- Author( aDataFlowInfo.theAuthor.c_str() ) ;
-// Computer( aDataFlowInfo.theContainer.c_str() ) ;
- Comment( aDataFlowInfo.theComment.c_str() ) ;
+ if ( Graph()->IsDataStreamNode() || aDataFlowInfo.theKind == SUPERV::DataFlowGraph ) {
+ Graph()->Name( aDataFlowInfo.theName.c_str() ) ;
+// Graph()->Kind( aDataFlowInfo.theKind ) ;
+ cdebug << "GraphEditor::OutNode::LoadInfo aDataFlowInfo.Kind " << aDataFlowInfo.theKind
+ << " Kind() " << Graph()->Kind() << endl ;
+ if ( Graph()->IsDataStreamNode() ) {
+ Graph()->Kind( SUPERV::DataStreamGraph ) ;
+ StreamGraph()->SetStreamParams( aDataFlowInfo.theTimeout , aDataFlowInfo.theDataStreamTrace , aDataFlowInfo.theDeltaTime ) ;
+ }
+ else {
+ Graph()->Kind( SUPERV::DataFlowGraph ) ;
+ }
+ Graph()->SetService( aDataFlowInfo.theService ) ;
+ Graph()->FirstCreation( aDataFlowInfo.theFirstCreation ) ;
+ Graph()->LastModification( aDataFlowInfo.theLastModification ) ;
+ Graph()->EditorRelease( aDataFlowInfo.theEditorRelease.c_str() ) ;
+ Graph()->Author( aDataFlowInfo.theAuthor.c_str() ) ;
+// Graph()->Computer( aDataFlowInfo.theContainer.c_str() ) ;
+ Graph()->Comment( aDataFlowInfo.theComment.c_str() ) ;
// Not in OutNode/DataFlow but in InNode/DataFlow_in_an_other_DataFlow
-// Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ;
- cdebug_out << "GraphEditor::OutNode::LoadInfo" << endl ;
- return true ;
+// Graph()->Coordinates( aDataFlowInfo.theX , aDataFlowInfo.theY ) ;
+ RetVal = true ;
+ }
+ else {
+ Graph()->Kind( aDataFlowInfo.theKind ) ;
+ cdebug << "GraphEditor::OutNode::LoadInfo aDataFlowInfo.Kind " << aDataFlowInfo.theKind
+ << " != IsDataStreamNode() " << Graph()->IsDataStreamNode() << endl ;
+ }
+ cdebug_out << "GraphEditor::OutNode::LoadInfo " << RetVal << endl ;
+ return RetVal ;
}
bool GraphEditor::OutNode::LoadNodes(map< string , int > & aMapOfNodes ,
const GraphBase::ListOfNodes &aListOfNodes ) {
GraphEditor::InNode * anInNode ;
- cdebug_in << "GraphEditor::OutNode::LoadNodes" << endl ;
+ cdebug_in << "GraphEditor::OutNode::LoadNodes " << endl ;
int i ;
for ( i = 0 ; i < (int ) aListOfNodes.size() ; i++ ) {
GraphBase::SNode aNode = aListOfNodes[ i ] ;
const char * aNodeName = aNode.theName.c_str() ;
+ cout << "GraphEditor::OutNode::LoadNodes " << aNodeName << " "
+ << aNode.theListOfInDataStreams.size() << " InDataStreams "
+ << aNode.theListOfOutDataStreams.size() << " OutDataStreams "
+ << " _prof_debug " << _prof_debug << endl ;
+ cdebug << "GraphEditor::OutNode::LoadNodes " << aNodeName << " "
+ << aNode.theListOfInDataStreams.size() << " InDataStreams "
+ << aNode.theListOfOutDataStreams.size() << " OutDataStreams "
+ << endl ;
if ( aNode.theListOfFuncName.size() == 0 ) {
aNode.theListOfFuncName.resize( 1 ) ;
aNode.theListOfFuncName[ 0 ] = "" ;
aNode.theListOfPythonFunctions.resize( 1 ) ;
aNode.theListOfPythonFunctions[ 0 ] = new SUPERV::ListOfStrings() ;
}
- if ( GetGraphNode( aNode.theName.c_str() ) ) {
+ if ( Graph()->GetGraphNode( aNode.theName.c_str() ) ) {
aNodeName = NULL ;
}
anInNode = AddNode( aNode.theService ,
aNode.theComment.c_str() ,
aNode.theCoords.theX , aNode.theCoords.theY ) ;
string * aNodetheName = new string( aNode.theName ) ;
- aMapOfNodes[ *aNodetheName ] = GetGraphNodeIndex( anInNode->Name() ) ;
+ aMapOfNodes[ *aNodetheName ] = Graph()->GetGraphNodeIndex( anInNode->Name() ) ;
if ( anInNode->IsOneOfInLineNodes() ) {
anInNode->GraphEditor::InNode::InLineNode()->DefPortsOfNode(
_Orb , aNode.theService , anInNode->NamePtr() ,
anInNode->Kind() ,
- Graph_prof_debug() , Graph_fdebug() ) ;
+ _prof_debug , _fdebug ) ;
GraphBase::InLineNode * aINode = anInNode->InLineNode() ;
GraphBase::LoopNode * aLNode = NULL ;
if ( aINode->IsLoopNode() ) {
unsigned int j ;
for ( j = 0 ; j < aNode.theListOfInDataStreams.size() ; j++ ) {
GraphBase::InPort * anInPort ;
- anInPort = anInNode->AddInPort( aNode.theListOfInDataStreams[ j ].Parametername ,
- aNode.theListOfInDataStreams[ j ].Parametertype ) ;
- anInPort->Kind( SUPERV::DataStreamParameter ) ;
- anInNode->IncrDataStreamInPorts() ;
+ anInPort = anInNode->ComputingNode()->AddInDataStreamPort( aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametername ,
+ aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parametertype ,
+ aNode.theListOfInDataStreams[ j ].theDataStreamParameter.Parameterdependency ,
+ SUPERV::DataStreamParameter ) ;
+ ((GraphBase::InDataStreamPort * ) anInPort)->SetParams( aNode.theListOfInDataStreams[ j ].theKindOfSchema ,
+ aNode.theListOfInDataStreams[ j ].theKindOfInterpolation ,
+ aNode.theListOfInDataStreams[ j ].theKindOfExtrapolation ) ;
}
for ( j = 0 ; j < aNode.theListOfOutDataStreams.size() ; j++ ) {
GraphBase::OutPort * anOutPort ;
- anOutPort = anInNode->AddOutPort( aNode.theListOfOutDataStreams[ j ].Parametername ,
- aNode.theListOfOutDataStreams[ j ].Parametertype ) ;
- anOutPort->Kind( SUPERV::DataStreamParameter ) ;
- anInNode->IncrDataStreamOutPorts() ;
+ anOutPort = anInNode->ComputingNode()->AddOutDataStreamPort( aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametername ,
+ aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parametertype ,
+ aNode.theListOfOutDataStreams[ j ].theDataStreamParameter.Parameterdependency ,
+ SUPERV::DataStreamParameter ) ;
+ ((GraphBase::OutDataStreamPort * ) anOutPort)->NumberOfValues( aNode.theListOfOutDataStreams[ j ].theNumberOfValues ) ;
}
delete aNodetheName ;
if ( !anInNode ) {
GraphBase::SNode aNode = aListOfNodes[ i ] ;
cdebug << "GraphEditor::OutNode::LoadNodes " << aNode.theName.c_str() << " Coupled to "
<< aNode.theCoupledNode.c_str() << endl ;
- anInNode = (GraphEditor::InNode * ) GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ;
+ anInNode = (GraphEditor::InNode * ) Graph()->GetChangeGraphNode( aNode.theName.c_str() )->GetInNode() ;
if ( anInNode->IsOneOfGOTONodes() && strlen( aNode.theCoupledNode.c_str() ) ) {
GraphBase::GOTONode * aCoupledNode ;
- aCoupledNode = (GraphBase::GOTONode * ) GetGraphNode( aNode.theName.c_str() ) ;
- aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ;
+ aCoupledNode = (GraphBase::GOTONode * ) Graph()->GetGraphNode( aNode.theName.c_str() ) ;
+ aCoupledNode->CoupledNode( (GraphBase::GOTONode * ) Graph()->GetChangeGraphNode( aNode.theCoupledNode.c_str() ) ) ;
}
}
cdebug_out << "GraphEditor::OutNode::LoadNodes" << endl ;
<< aLink.FromServiceParameterName.c_str() << " ) --> "
<< aLinkToNodeName->c_str() << "( "
<< aLink.ToServiceParameterName.c_str() << " )" << endl ;
- if ( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) &&
- GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) {
- RetVal = AddLink( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
- aLink.FromServiceParameterName.c_str() ,
- GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
- aLink.ToServiceParameterName.c_str() ,
- *((GraphBase::ComputingNode *) GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ))->GetOutPort( aLink.FromServiceParameterName.c_str() )->Value() ) ;
+ if ( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) &&
+ Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] ) ) {
+ GraphBase::ComputingNode * aFromNode = (GraphBase::ComputingNode * ) Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] ) ;
+ const GraphBase::OutPort * anOutPort = aFromNode->GetOutPort( aLink.FromServiceParameterName.c_str() ) ;
+ RetVal = AddLink( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
+ aLink.FromServiceParameterName.c_str() ,
+ Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
+ aLink.ToServiceParameterName.c_str() ,
+ *anOutPort->Value() ) ;
}
else {
RetVal = false ;
break ;
else {
for ( j = 0 ; j < (int ) aLink.aListOfCoords.size() ; j++ ) {
- RetVal = AddLinkCoord( GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
- aLink.FromServiceParameterName.c_str() ,
- GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() ,
- aLink.ToServiceParameterName.c_str() ,
- j + 1 ,
- aLink.aListOfCoords[j].theX ,
- aLink.aListOfCoords[j].theY ) ;
+ RetVal = AddLinkCoord( Graph()->GetGraphNode( aMapOfNodes[ aLinkFromNodeName->c_str() ] )->Name() ,
+ aLink.FromServiceParameterName.c_str() ,
+ Graph()->GetGraphNode( aMapOfNodes[ aLink.ToNodeName.c_str() ] )->Name() ,
+ aLink.ToServiceParameterName.c_str() ,
+ j + 1 ,
+ aLink.aListOfCoords[j].theX ,
+ aLink.aListOfCoords[j].theY ) ;
if ( !RetVal )
break ;
}
int i ;
for ( i = 0 ; i < (int ) aListOfDatas.size() ; i++ ) {
GraphBase::SLink aLink = aListOfDatas[ i ] ;
- if ( !strcmp( aLink.FromNodeName.c_str() , Name() ) ) {
+ if ( !strcmp( aLink.FromNodeName.c_str() , Graph()->Name() ) ) {
cdebug << "GraphEditor::OutNode::LoadDatas Warning "
<< aLink.FromNodeName.c_str()
- << " and " << aLink.ToNodeName.c_str() << " differents from " << Name()
+ << " and " << aLink.ToNodeName.c_str() << " differents from " << Graph()->Name()
<< endl ;
}
string * aLinkFromNodeName = new string( aLink.FromNodeName.c_str() ) ;
// << aMapOfNodes[ aLinkFromNodeName->c_str() ] << endl ;
// cout << " " << aLink.ToNodeName.c_str() << " "
// << aMapOfNodes[ aLinkToNodeName->c_str() ] << endl ;
- RetVal = GraphBase::Graph::AddInputData( GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
- aLink.ToServiceParameterName.c_str() ,
- aLink.aLinkValue ) ;
+ RetVal = Graph()->AddInputData( Graph()->GetGraphNode( aMapOfNodes[ aLinkToNodeName->c_str() ] )->Name() ,
+ aLink.ToServiceParameterName.c_str() ,
+ aLink.aLinkValue ) ;
delete aLinkFromNodeName ;
delete aLinkToNodeName ;
if ( !RetVal )
GraphBase::SGraph * GraphEditor::OutNode::GetDataFlow() {
GraphBase::SGraph * aDataFlow = new GraphBase::SGraph;
- aDataFlow->Info = *GetInfo() ;
- aDataFlow->Nodes = *GetNodes() ;
- aDataFlow->Links = *GetLinks( true ) ;
- aDataFlow->Datas = *GetDatas() ;
+ if ( Graph()->IsDataFlowNode() ) {
+ aDataFlow->Info = *Graph()->GetInfo() ;
+ aDataFlow->Nodes = *Graph()->GetNodes() ;
+ aDataFlow->Links = *Graph()->GetLinks( true ) ;
+ aDataFlow->Datas = *Graph()->GetDatas() ;
+ }
+ else {
+ aDataFlow->Info = *StreamGraph()->GetInfo() ;
+ aDataFlow->Nodes = *StreamGraph()->GetNodes() ;
+ aDataFlow->Links = *StreamGraph()->GetLinks( true ) ;
+ aDataFlow->Datas = *StreamGraph()->GetDatas() ;
+ }
return aDataFlow ;
}
aLastModificationDate.Day = Tm->tm_mday;
aLastModificationDate.Month = Tm->tm_mon + 1;
aLastModificationDate.Year = Tm->tm_year + 1900;
- LastModification( aLastModificationDate ) ;
+ Graph()->LastModification( aLastModificationDate ) ;
}
void GraphEditor::OutNode::Coordinates( const char* NodeName ,
const int X ,
const int Y ) {
- ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->Coordinates( X , Y ) ;
+ ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->Coordinates( X , Y ) ;
}
const int GraphEditor::OutNode::XCoordinate( const char* NodeName ) {
- return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->XCoordinate() ;
+ return ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->XCoordinate() ;
}
const int GraphEditor::OutNode::YCoordinate( const char* NodeName ) {
- return ((GraphEditor::InNode * ) GetChangeGraphNode( NodeName ))->YCoordinate() ;
+ return ((GraphEditor::InNode * ) Graph()->GetChangeGraphNode( NodeName ))->YCoordinate() ;
}
GraphEditor::InNode * GraphEditor::OutNode::AddNode(
const int NodeY ) {
cdebug_in << "GraphEditor::OutNode::AddNode( " ;
if ( NodeComponentName != NULLSTRING && strlen( NodeComponentName ) ) {
- cdebug << NodeComponentName << " , " ;
+ cdebug << "Component('" << NodeComponentName << "') , Node('" ;
}
else {
cdebug << "NodeComponentName[NULL] )" << endl;
}
if ( theNodeName != NULLSTRING && strlen( theNodeName ) ) {
- cdebug << theNodeName << " )" << endl;
+ cdebug << theNodeName << "' )" ;
}
else {
- cdebug << "NodeName[NULL] )" << endl;
+ cdebug << "NodeName[NULL]' )" ;
}
+ cdebug << " " << NodeKindOfNode << endl ;
char * RetVal = NULLSTRING ;
GraphEditor::InNode *Nd = NULL ;
char * aNodeName = NULL ;
if ( theNodeName == NULLSTRING || strlen( theNodeName ) == 0 ) {
aNodeName = new char[ strlen( NodeService.ServiceName )+1 ] ;
strcpy( aNodeName , NodeService.ServiceName ) ;
- if ( GetGraphNode( NodeService.ServiceName ) ) {
+ if ( Graph()->GetGraphNode( NodeService.ServiceName ) ) {
GeneratedName = true ;
- while ( GetGraphNode( aNodeName ) ) {
+ while ( Graph()->GetGraphNode( aNodeName ) ) {
if ( aNodeName ) {
delete [] aNodeName ;
}
- int num = GetServiceNameNumber( NodeService.ServiceName ) ;
+ int num = Graph()->GetServiceNameNumber( NodeService.ServiceName ) ;
ostringstream astr ;
astr << num << ends ;
const char * n_instance = astr.str().c_str() ;
}
}
else {
- if ( GetGraphNode( theNodeName ) == NULL ) {
+ if ( Graph()->GetGraphNode( theNodeName ) == NULL ) {
aNodeName = new char[ strlen( theNodeName )+1 ] ;
strcpy( aNodeName , theNodeName ) ;
}
}
if ( aNodeName != NULLSTRING ) {
- Nd = new GraphEditor::InNode( _Orb , NamingService() ,
+ Nd = new GraphEditor::InNode( _Orb , Graph()->NamingService() ,
aFuncName , aPythonFunction , NodeService ,
NodeComponentName , NodeInterfaceName ,
aNodeName , NodeKindOfNode ,
NodeEditorRelease , NodeAuthor ,
NodeComputer , NodeComment , GeneratedName ,
NodeX , NodeY ,
- Graph_prof_debug() , Graph_fdebug() ) ;
+ _prof_debug , _fdebug ) ;
// MESSAGE( "GraphEditor::OutNode::AddNode " << hex << (void *) Nd << dec );
// if ( GraphBase::Graph::AddNode( Nd ) ) {
- if ( GraphBase::Graph::AddNode( Nd->ComputingNode() ) ) {
+ if ( Graph()->AddNode( Nd->ComputingNode() ) ) {
DateModification() ;
RetVal = Nd->Name() ;
}
}
}
else {
- cdebug << "NodeName is NULL or already exists." << endl ;
+ cdebug << "ERROR NodeName is NULL or already exists." << endl ;
}
// delete [] aNodeName ;
cdebug_out << "GraphEditor::OutNode::AddNode" << endl;
const int nXY ,
const int* X ,
const int* Y ) {
- GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName ,
- ToServiceParameterName ) ;
+ GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
+ ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::AddLinkCoord " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::AddLinkCoord " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( nXY , X , Y ) ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( nXY , X , Y ) ;
}
else {
return anInPort->AddCoord( nXY , X , Y ) ;
const int index ,
const int X ,
const int Y ) {
- GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName ,
- ToServiceParameterName ) ;
+ GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
+ ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::AddLinkCoord " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::AddLinkCoord " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( index , X , Y ) ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->AddCoord( index , X , Y ) ;
}
else {
return anInPort->AddCoord( index , X , Y ) ;
const int index ,
const int X ,
const int Y ) {
- GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName ,
- ToServiceParameterName ) ;
+ GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
+ ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::ChangeLinkCoord " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::ChangeLinkCoord " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->ChangeCoord( index , X , Y ) ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->ChangeCoord( index , X , Y ) ;
}
else {
return anInPort->ChangeCoord( index , X , Y ) ;
const char* ToNodeName ,
const char* ToServiceParameterName ,
const int index ) {
- GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName ,
- ToServiceParameterName ) ;
+ GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
+ ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::RemoveLinkCoord " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::RemoveLinkCoord " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->RemoveCoord( index ) ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->RemoveCoord( index ) ;
}
else {
return anInPort->RemoveCoord( index ) ;
const char* FromServiceParameterName ,
const char* ToNodeName ,
const char* ToServiceParameterName ) {
- const GraphBase::InPort * anInPort = GraphBase::Graph::GetInPort( ToNodeName , ToServiceParameterName ) ;
+ const GraphBase::InPort * anInPort = Graph()->GetInPort( ToNodeName , ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::GetLinkCoordSize " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::GetLinkCoordSize " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord() ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord() ;
}
else {
return anInPort->GetCoord() ;
const char* ToNodeName ,
const char* ToServiceParameterName ,
int *X , int *Y ) {
- const GraphBase::InPort * anInPort = GraphBase::Graph::GetInPort( ToNodeName , ToServiceParameterName ) ;
+ const GraphBase::InPort * anInPort = Graph()->GetInPort( ToNodeName , ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::GetLinkCoord " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::GetLinkCoord " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( X , Y ) ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( X , Y ) ;
}
else {
return anInPort->GetCoord( X , Y ) ;
const char* ToNodeName ,
const char* ToServiceParameterName ,
const int index , long &X , long &Y ) {
- GraphBase::InPort * anInPort = GraphBase::Graph::GetChangeInPort( ToNodeName ,
- ToServiceParameterName ) ;
+ GraphBase::InPort * anInPort = Graph()->GetChangeInPort( ToNodeName ,
+ ToServiceParameterName ) ;
// cdebug << "GraphEditor::OutNode::GetLinkCoord " << ToNodeName << "( " << ToServiceParameterName
// << " ) " << anInPort << " IsEndSwitch " << anInPort->IsEndSwitch() << endl ;
if ( anInPort ) {
if ( anInPort->IsEndSwitch() ) {
// cdebug << "GraphEditor::OutNode::GetLinkCoord " << FromNodeName << "( " << FromServiceParameterName
// << " )" << endl ;
- return GraphBase::Graph::GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( index , X , Y ) ;
+ return Graph()->GetChangeOutPort( FromNodeName , FromServiceParameterName )->GetCoord( index , X , Y ) ;
}
else {
return anInPort->GetCoord( index , X , Y ) ;
const char* ToNodeName2 ,
const char* ToParameterName2 ) {
cdebug_in << "GraphEditor::OutNode::AddInputData" << endl;
- bool RetVal = GraphBase::Graph::AddInputData( ToNodeName1 ,
+ bool RetVal = Graph()->AddInputData( ToNodeName1 ,
ToParameterName1 ,
ToNodeName2 ,
ToParameterName2 ) ;
cdebug_in << "GraphEditor::OutNode::Valid" << endl;
_Executable = false ;
- CreateService() ;
+ Graph()->CreateService() ;
- if ( !Sort() ) {
+ if ( !Graph()->Sort() ) {
cdebug << "This DataFlow is not valid." << endl ;
return false ;
}
// CreateService() ;
- InLineServices() ;
+ Graph()->InLineServices() ;
- ComputingNodes() ;
+ Graph()->ComputingNodes() ;
_Valid = true ;
bool GraphEditor::OutNode::Executable() {
cdebug_in << "GraphEditor::OutNode::Executable" << endl;
bool NewLink ;
- if ( LinkLoopNodes( NewLink ) ) {
+ if ( Graph()->LinkLoopNodes( NewLink ) ) {
if ( NewLink ) {
_Valid = false ;
}
if ( !IsValid() ) {
return false ;
}
- if ( DataServerNodes() )
+ if ( Graph()->DataServerNodes() )
_Executable = true ;
else {
cdebug << "This DataFlow is not executable." << endl ;
const char * ToParameterName ) {
// cdebug_in << "GraphEditor::OutNode::GetInData " << ToNodeName
// << " " << ToParameterName << endl ;
- const CORBA::Any * retdata = PortInData( ToNodeName , ToParameterName ) ;
+ const CORBA::Any * retdata = Graph()->PortInData( ToNodeName , ToParameterName ) ;
// cdebug_out << "GraphEditor::OutNode::GetInData" << endl ;
return retdata ;
}
const char * FromParameterName ) {
// cdebug_in << "GraphEditor::OutNode::GetOutData " << FromNodeName
// << " " << FromParameterName << endl ;
- const CORBA::Any * retdata = PortOutData( FromNodeName , FromParameterName ) ;
+ const CORBA::Any * retdata = Graph()->PortOutData( FromNodeName , FromParameterName ) ;
// cdebug_out << "GraphEditor::OutNode::GetOutData" << endl ;
return retdata ;
}
bool GraphEditor::OutNode::LinkSavePY( ostream &f , const char * aGraphName ,
GraphBase::SLink aLink ,
- bool intervar , bool wdata ) const {
+ bool fromparam , bool toparam ,
+ bool wdata ) const {
if ( !wdata ) {
- if ( intervar ) {
- f << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
- << " = "
- << aLink.FromNodeName.c_str() << ".Port( '"
- << aLink.FromServiceParameterName.c_str()
- << "' )" << endl ;
- }
- f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
- << " = " << aGraphName << ".Link( " << aLink.FromNodeName.c_str()
- << aLink.FromServiceParameterName.c_str() << " , "
- << aLink.ToNodeName.c_str() << ".Port( '"
- << aLink.ToServiceParameterName.c_str() << "' ) )" << endl ;
+// if ( intervar ) {
+// f << "O" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
+// << " = "
+// << aLink.FromNodeName.c_str() << ".GetOutPort( '"
+// << aLink.FromServiceParameterName.c_str()
+// << "' )" << endl ;
+// }
+ f << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
+ << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
+ << " = " << aGraphName << ".Link( " ;
+// if ( !fromparam ) {
+ f << "O" ;
+// }
+ f << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str() << " , " ;
+// if ( !toparam ) {
+ f << "I" ;
+// }
+ f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << " )" << endl ;
}
else {
- f << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
- << " = " << aLink.ToNodeName.c_str() << ".Input( '"
- << aLink.ToServiceParameterName.c_str() << "' , " ;
+ f << "I"<< aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str()
+// << " = " << aLink.ToNodeName.c_str() << ".Input( '"
+// << aLink.ToServiceParameterName.c_str() << "' , " ;
+ << ".Input( " ;
switch (aLink.aLinkValue.type()->kind()) {
case CORBA::tk_string: {
char* retstr ;
break ;
}
}
- f << ")" << endl ;
+ f << " )" << endl ;
}
int i ;
for ( i = 0 ; i < (int ) aLink.aListOfCoords.size() ; i++ ) {
- f << aLink.ToNodeName.c_str()
- << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , "
+ f << "L" << aLink.FromNodeName.c_str() << aLink.FromServiceParameterName.c_str()
+ << aLink.ToNodeName.c_str() << aLink.ToServiceParameterName.c_str() << ".AddCoord( " << i+1 << " , "
<< aLink.aListOfCoords[ i ].theX << " , "
<< aLink.aListOfCoords[ i ].theY << " )" << endl ;
}
}
//bool GraphEditor::OutNode::SaveXML(ostream & f ) {
-bool GraphEditor::OutNode::SaveXML(QDomDocument & Graph ) {
+bool GraphEditor::OutNode::SaveXML(QDomDocument & GraphQDom ) {
int i ;
// f << "<?xml version='1.0' encoding='us-ascii' ?>" << endl << endl ;
// f << "<!-- XML Dataflow -->" << endl << endl ;
// f << "<!-- Dataflow information -->" << endl ;
QString Dataflow("Dataflow") ;
- Graph = QDomDocument(Dataflow) ;
+ GraphQDom = QDomDocument(Dataflow) ;
// f << "<dataflow>" << endl ;
- QDomElement dataflow = Graph.createElement( "dataflow" ) ;
- Graph.appendChild( dataflow ) ;
+ QDomElement dataflow = GraphQDom.createElement( "dataflow" ) ;
+ GraphQDom.appendChild( dataflow ) ;
// f << " <info-list>" << endl ;
- QDomElement info = Graph.createElement( "info-list" ) ;
+ QDomElement info = GraphQDom.createElement( "info-list" ) ;
dataflow.appendChild( info ) ;
// f << " <node>" << endl ;
// GraphBase::DataNode::SaveXML( f , " " , 0 , 0 ) ;
- GraphBase::DataNode::SaveXML( Graph , info , 0 , 0 ) ;
+ Graph()->SaveXML( GraphQDom , info , 0 , 0 ) ;
// f << " </node>" << endl ;
// f << " </info-list>" << endl << endl ;
// f << " <node-list>" << endl ;
- QDomElement nodelist = Graph.createElement( "node-list" ) ;
+ QDomElement nodelist = GraphQDom.createElement( "node-list" ) ;
dataflow.appendChild( nodelist ) ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
// f << " <node>" << endl ;
- if ( GraphNodes( i )->IsComputingNode() ) {
+ if ( Graph()->GraphNodes( i )->IsComputingNode() ) {
// ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::ComputingNode *)GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::ComputingNode *) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsFactoryNode() ) {
+ else if ( Graph()->GraphNodes( i )->IsFactoryNode() ) {
// ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::FactoryNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsInLineNode() ) {
+ else if ( Graph()->GraphNodes( i )->IsInLineNode() ) {
// ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::InLineNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsGOTONode() ) {
+ else if ( Graph()->GraphNodes( i )->IsGOTONode() ) {
// ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::GOTONode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsLoopNode() ) {
+ else if ( Graph()->GraphNodes( i )->IsLoopNode() ) {
// ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::LoopNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsEndLoopNode() ) {
+ else if ( Graph()->GraphNodes( i )->IsEndLoopNode() ) {
// ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::EndOfLoopNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::EndOfLoopNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsSwitchNode() ) {
+ else if ( Graph()->GraphNodes( i )->IsSwitchNode() ) {
// ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::SwitchNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
- else if ( GraphNodes( i )->IsEndSwitchNode() ) {
+ else if ( Graph()->GraphNodes( i )->IsEndSwitchNode() ) {
// ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( f ,
// " " ,
- ((GraphBase::EndOfSwitchNode * ) GraphNodes( i ))->SaveXML( Graph , nodelist ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::EndOfSwitchNode * ) Graph()->GraphNodes( i ))->SaveXML( GraphQDom , nodelist ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
// f << " </node>" << endl ;
// }
// f << " </node-list>" << endl << endl ;
// f << " <link-list>" << endl ;
- QDomElement linklist = Graph.createElement( "link-list" ) ;
+ QDomElement linklist = GraphQDom.createElement( "link-list" ) ;
dataflow.appendChild( linklist ) ;
- const GraphBase::ListOfLinks * Links = GetLinks( true ) ;
+ const GraphBase::ListOfLinks * Links = Graph()->GetLinks( true ) ;
for ( i = 0 ; i < (int ) Links->size() ; i++ ) {
// f << " <link>" << endl ;
- QDomElement link = Graph.createElement( "link" ) ;
+ QDomElement link = GraphQDom.createElement( "link" ) ;
linklist.appendChild( link ) ;
// LinkSaveXML( f , " " , (*Links)[ i ] , false ) ;
- LinkSaveXML( Graph , link , (*Links)[ i ] , false ) ;
+ LinkSaveXML( GraphQDom , link , (*Links)[ i ] , false ) ;
// f << " </link>" << endl ;
}
// f << " </link-list>" << endl << endl ;
// f << " <data-list>" << endl ;
- QDomElement datalist = Graph.createElement( "data-list" ) ;
+ QDomElement datalist = GraphQDom.createElement( "data-list" ) ;
dataflow.appendChild( datalist ) ;
- const GraphBase::ListOfLinks * Datas = GetDatas() ;
+ const GraphBase::ListOfLinks * Datas = Graph()->GetDatas() ;
for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
// f << " <data>" << endl ;
- QDomElement data = Graph.createElement( "data" ) ;
+ QDomElement data = GraphQDom.createElement( "data" ) ;
datalist.appendChild( data ) ;
// LinkSaveXML( f , " " , (*Datas)[ i ] , true ) ;
- LinkSaveXML( Graph , data , (*Datas)[ i ] , true ) ;
+ LinkSaveXML( GraphQDom , data , (*Datas)[ i ] , true ) ;
// f << " </data>" << endl ;
}
//#if 0
bool GraphEditor::OutNode::SavePY( ostream & f ) {
int i ;
int j ;
- f << endl << "# Generated python file of Graph " << Name() << endl << endl ;
+ f << endl << "# Generated python file of Graph " << Graph()->Name() << endl << endl ;
f << "from SuperV import *" << endl ;
f << "# Graph creation " << endl ;
- GraphBase::DataNode::SavePY( f , Name() , 0 , 0 ) ;
+ Graph()->SavePY( f , Graph()->Name() , 0 , 0 ) ;
f << endl << "# Creation of Factory Nodes" << endl ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsFactoryNode() ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
+ if ( Graph()->GraphNodes( i )->IsFactoryNode() ) {
f << endl ;
- ((GraphBase::FactoryNode * ) GraphNodes( i ))->SavePY( f , Name() ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::FactoryNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
}
bool first = true ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsComputingNode() ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
+ if ( Graph()->GraphNodes( i )->IsComputingNode() ) {
if ( first ) {
f << endl << "# Creation of Computing Nodes" << endl ;
first = false ;
else {
f << endl ;
}
- ((GraphBase::ComputingNode * ) GraphNodes( i ))->SavePY( f , Name() ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::ComputingNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
}
first = true ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsInLineNode() ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
+ if ( Graph()->GraphNodes( i )->IsInLineNode() ) {
if ( first ) {
f << endl << "# Creation of InLine Nodes" << endl ;
first = false ;
else {
f << endl ;
}
- ((GraphBase::InLineNode * ) GraphNodes( i ))->SavePY( f , Name() ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::InLineNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
}
first = true ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsLoopNode() ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
+ if ( Graph()->GraphNodes( i )->IsLoopNode() ) {
if ( first ) {
f << endl << "# Creation of Loop Nodes" << endl ;
first = false ;
else {
f << endl ;
}
- ((GraphBase::LoopNode * ) GraphNodes( i ))->SavePY( f , Name() ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::LoopNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
}
first = true ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsSwitchNode() ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
+ if ( Graph()->GraphNodes( i )->IsSwitchNode() ) {
if ( first ) {
f << endl << "# Creation of Switch Nodes" << endl ;
first = false ;
else {
f << endl ;
}
- ((GraphBase::SwitchNode * ) GraphNodes( i ))->SavePY( f , Name() ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::SwitchNode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
}
first = true ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
- if ( GraphNodes( i )->IsGOTONode() ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
+ if ( Graph()->GraphNodes( i )->IsGOTONode() ) {
if ( first ) {
f << endl << "# Creation of GOTO Nodes" << endl ;
first = false ;
else {
f << endl ;
}
- ((GraphBase::GOTONode * ) GraphNodes( i ))->SavePY( f , Name() ,
- GraphNodes( i )->XCoordinate() ,
- GraphNodes( i )->YCoordinate() ) ;
+ ((GraphBase::GOTONode * ) Graph()->GraphNodes( i ))->SavePY( f , Graph()->Name() ,
+ Graph()->GraphNodes( i )->XCoordinate() ,
+ Graph()->GraphNodes( i )->YCoordinate() ) ;
}
}
- const GraphBase::ListOfLinks * Links = GetLinks() ;
- bool intervar ;
- map< string , int > aMapOfOutPorts ;
+ const GraphBase::ListOfLinks * Links = Graph()->GetLinks() ;
+// bool intervar ;
+// map< string , int > aMapOfOutPorts ;
first = true ;
- for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
+ for ( i = 0 ; i < Graph()->GraphNodesSize() ; i++ ) {
for ( j = 0 ; j < (int ) Links->size() ; j++ ) {
- if ( !strcmp( GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) {
+ if ( !strcmp( Graph()->GraphNodes( i )->Name() , (*Links)[ j ].FromNodeName.c_str() ) ) {
if ( first ) {
f << endl
<< "# Creation of Links"
else {
f << endl ;
}
- char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) +
- strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ;
- strcpy( NodePort , (*Links)[ j ].FromNodeName.c_str() ) ;
- strcat( NodePort , (*Links)[ j ].FromServiceParameterName.c_str() ) ;
- if ( aMapOfOutPorts[ NodePort ] == 0 ) {
- aMapOfOutPorts[ NodePort ] = j + 1 ;
- intervar = true ;
- }
- else {
- intervar = false ;
- }
- LinkSavePY( f , Name() , (*Links)[ j ] , intervar , false ) ;
- delete [] NodePort ;
- }
- }
- }
-
-#if 0
- first = true ;
- for ( i = 0 ; i < Links->size() ; i++ ) {
- if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsSwitchNode() ||
- GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsSwitchNode() ||
- GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsEndSwitchNode() ||
- GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsEndSwitchNode() ) {
- if ( first ) {
- f << endl
- << "# Creation of Switch Links"
- << endl ;
- first = false ;
- }
- char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) +
- strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ;
- strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ;
- strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ;
- if ( aMapOfOutPorts[ NodePort ] == 0 ) {
- aMapOfOutPorts[ NodePort ] = i + 1 ;
- intervar = true ;
- }
- else {
- intervar = false ;
- }
- LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ;
- delete [] NodePort ;
- }
- }
-
- first = true ;
- for ( i = 0 ; i < Links->size() ; i++ ) {
- if ( GetGraphNode( (*Links)[ i ].FromNodeName.c_str() )->IsGOTONode() &&
- GetGraphNode( (*Links)[ i ].ToNodeName.c_str() )->IsInLineNode() ) {
- if ( first ) {
- f << endl
- << "# Creation of intermediate Output variables and of Loop Links"
- << endl ;
- first = false ;
- }
- char * NodePort = new char [ strlen( (*Links)[ i ].FromNodeName.c_str() ) +
- strlen( (*Links)[ i ].FromServiceParameterName.c_str() ) + 1 ] ;
- strcpy( NodePort , (*Links)[ i ].FromNodeName.c_str() ) ;
- strcat( NodePort , (*Links)[ i ].FromServiceParameterName.c_str() ) ;
- if ( aMapOfOutPorts[ NodePort ] == 0 ) {
- aMapOfOutPorts[ NodePort ] = i + 1 ;
- intervar = true ;
- }
- else {
- intervar = false ;
+// char * NodePort = new char [ strlen( (*Links)[ j ].FromNodeName.c_str() ) +
+// strlen( (*Links)[ j ].FromServiceParameterName.c_str() ) + 1 ] ;
+// strcpy( NodePort , (*Links)[ j ].FromNodeName.c_str() ) ;
+// strcat( NodePort , (*Links)[ j ].FromServiceParameterName.c_str() ) ;
+// if ( aMapOfOutPorts[ NodePort ] == 0 ) {
+// aMapOfOutPorts[ NodePort ] = j + 1 ;
+// intervar = true ;
+// }
+// else {
+// intervar = false ;
+// }
+ bool fromparam = false ;
+ if ( Graph()->GraphNodes( i )->GetOutPort( (*Links)[ j ].FromServiceParameterName.c_str() )->IsParam() ) {
+ fromparam = true ;
+ }
+ bool toparam = false ;
+ if ( Graph()->GetChangeGraphNode( (*Links)[ j ].ToNodeName.c_str() )->GetInPort( (*Links)[ j ].ToServiceParameterName.c_str() )->IsParam() ) {
+ toparam = true ;
+ }
+ LinkSavePY( f , Graph()->Name() , (*Links)[ j ] , fromparam , toparam , false ) ;
+// delete [] NodePort ;
}
- LinkSavePY( f , Name() , (*Links)[ i ] , intervar , false ) ;
- delete [] NodePort ;
}
}
-#endif
- const GraphBase::ListOfLinks * Datas = GetDatas() ;
+ const GraphBase::ListOfLinks * Datas = Graph()->GetDatas() ;
first = true ;
for ( i = 0 ; i < (int ) Datas->size() ; i++ ) {
if ( first ) {
- f << endl << "# Creation of Input datas" << endl ;
+ f << endl << "# Input datas" << endl ;
first = false ;
}
- LinkSavePY( f , Name() , (*Datas)[ i ] , false , true ) ;
+ bool fromparam = true ;
+ bool toparam = true ;
+ LinkSavePY( f , Graph()->Name() , (*Datas)[ i ] , fromparam , toparam , true ) ;
}
first = true ;
- const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = ServiceInParameter() ;
+ const SALOME_ModuleCatalog::ListOfServicesParameter ListOfInParam = Graph()->ServiceInParameter() ;
for ( i = 0 ; i < (int ) ListOfInParam.length() ; i++ ) {
string _aParam = CORBA::string_dup(ListOfInParam[ i ].Parametername) ;
const char * aParam = _aParam.c_str() ;
break ;
}
}
- if ( !GetChangeGraphNode( aNodeName )->GetInPort( aPortName )->IsDataConnected() ) {
+ const GraphBase::InPort * anInPort = Graph()->GetChangeGraphNode( aNodeName )->GetInPort( aPortName ) ;
+ if ( !anInPort->IsDataConnected() ) {
if ( first ) {
- f << endl << "# Missing Input datas" << endl ;
+ f << endl << "# Input Ports of the graph" << endl ;
first = false ;
}
- f << aNodeName << aPortName << " = " << aNodeName << ".Port( '"
+ f << "#I" << aNodeName << aPortName << " = " << aNodeName << ".GetInPort( '"
<< aPortName << "' )" << endl ;
}
delete [] aNodeName ;
delete [] aPortName ;
}
- f << endl << "# Creation of Output variables" << endl ;
- const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = ServiceOutParameter() ;
+ f << endl << "# Output Ports of the graph" << endl ;
+ const SALOME_ModuleCatalog::ListOfServicesParameter ListOfOutParam = Graph()->ServiceOutParameter() ;
for ( i = 0 ; i < (int ) ListOfOutParam.length() ; i++ ) {
string _aParam = CORBA::string_dup(ListOfOutParam[ i ].Parametername) ;
const char * aParam = _aParam.c_str() ;
break ;
}
}
- f << aNodeName << aPortName << " = " << aNodeName << ".Port( '"
+ f << "#O" << aNodeName << aPortName << " = " << aNodeName << ".GetOutPort( '"
<< aPortName << "' )" << endl ;
delete [] aNodeName ;
delete [] aPortName ;
ostream & operator<< (ostream & f,const GraphEditor::OutNode & G) {
- f << (GraphBase::ComputingNode ) G ;
+ f << (GraphBase::ComputingNode ) *(G.Graph()) ;
f << endl ;
- f << " Nodes : " << G.GraphNodesSize() << " node"
- << (G.GraphNodesSize() > 1 ? "s" : "") << endl;
+ f << " Nodes : " << (G.Graph())->GraphNodesSize() << " node"
+ << ((G.Graph())->GraphNodesSize() > 1 ? "s" : "") << endl;
int i ;
- for ( i = 0 ; i < G.GraphNodesSize() ; i++ ) {
+ for ( i = 0 ; i < (G.Graph())->GraphNodesSize() ; i++ ) {
f
-// << hex << (void *) G.GraphNodes( i ) << dec << " "
- << *G.GraphNodes( i ) << endl;
+// << hex << (void *) G.Graph().GraphNodes( i ) << dec << " "
+ << (G.Graph())->GraphNodes( i ) << endl;
}
f << " Links : " << endl ;
- for ( i = 0 ; i < G.GraphNodesSize() ; i++ ) {
- G.GraphNodes( i )->ListLinks( f ) ;
+ for ( i = 0 ; i < (G.Graph())->GraphNodesSize() ; i++ ) {
+ (G.Graph())->GraphNodes( i )->ListLinks( f ) ;
}
f << " Datas : " << endl ;
- G.ListDatas( f ) ;
+ (G.Graph())->ListDatas( f ) ;
- f << "DataFlow " << G.Name() << " is " ;
+ f << "DataFlow " << (G.Graph())->Name() << " is " ;
if ( G.IsNotValid() )
f << "not " ;
f << "valid and is " ;