+void GraphBase::ComputingNode::SetMacroPorts( GraphBase::Graph * aGraph ) {
+ cdebug_in << "GraphBase::ComputingNode::SetMacroPorts fill ports of MacroNode" << endl;
+ int i ;
+ for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
+ const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
+ cdebug << "SetMacroPorts In" << i << " " << anInPort->PortName() << " " << anInPort->PortType()
+ << " " << anInPort->Kind() << endl ;
+ GraphBase::InPort * aNewInPort ;
+ if ( anInPort->IsDataStream() ) {
+ aNewInPort = AddInDataStreamPort( anInPort->PortName() , StringToDataStreamType( anInPort->PortType() ) ,
+ anInPort->Dependency() , anInPort->Kind() ) ;
+ }
+ else if ( anInPort->IsParam() || anInPort->IsInLine() ) {
+ aNewInPort = AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() ) ;
+ }
+ }
+ for ( i = 0 ; i < aGraph->GetNodeOutPortsSize() ; i++ ) {
+ const GraphBase::OutPort * anOutPort = aGraph->GetNodeOutPort( i ) ;
+ cdebug << "SetMacroPorts Out" << i << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+ << " " << anOutPort->Kind() << endl ;
+ if ( anOutPort->IsDataStream() ) {
+ AddOutDataStreamPort( anOutPort->PortName() , StringToDataStreamType( anOutPort->PortType() ) ,
+ anOutPort->Dependency() , anOutPort->Kind() ) ;
+ }
+ else if ( anOutPort->IsParam() || anOutPort->IsInLine() ) {
+ AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() ) ;
+ }
+ }
+ cdebug_out << "GraphBase::ComputingNode::SetMacroPorts" << endl;
+}
+
+void GraphBase::ComputingNode::UpdateMacroPorts( GraphBase::Graph * aGraph ) {
+ cdebug_in << "GraphBase::ComputingNode::UpdateMacroPorts fill ports of MacroNode from "
+ << aGraph->Name() << " InPorts(" << aGraph->GetNodeInPortsSize() << ") OutPorts("
+ << aGraph->GetNodeInPortsSize() << ") to MacroNode " << Name() << " InPorts(" << GetNodeInPortsSize()
+ << ") OutPorts(" << GetNodeInPortsSize() << ")" << endl;
+ cdebug << Name() << " : " << *GetService() << endl ;
+ cdebug << aGraph->Name() << " : " << *aGraph->GetService() << endl ;
+ int i ;
+// Loop over InPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelInPort in the MacroNode
+ for ( i = 0 ; i < GetNodeInPortsSize() ; i++ ) {
+ GraphBase::InPort * anInPort = aGraph->GetChangeInPort( GetNodeInPort( i )->PortName() ) ;
+ if ( anInPort && !anInPort->IsGate() && !GetNodeInPort( i )->IsGate() ) {
+ if ( strcmp( GetNodeInPort( i )->PortType() , anInPort->PortType() ) ) {
+ cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
+ << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
+ cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+ << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
+ GetChangeNodeInPort( i )->PortType( (char * ) anInPort->PortType() ) ;
+ }
+ if ( GetNodeInPort( i )->Kind() != anInPort->Kind() ) {
+ cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
+ << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
+ cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+ << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
+ GetChangeNodeInPort( i )->Kind( anInPort->Kind() ) ;
+ }
+ if ( GetNodeInPort( i )->Dependency() != anInPort->Dependency() ) {
+ cdebug << Name() << " " << GetNodeInPort( i )->PortName() << " " << GetNodeInPort( i )->PortType()
+ << " " << GetNodeInPort( i )->Kind() << " " << GetNodeInPort( i )->Dependency() << endl ;
+ cdebug << " <--> " << aGraph->Name() << " " << anInPort->PortName() << " " << anInPort->PortType()
+ << " " << anInPort->Kind() << " " << anInPort->Dependency() << endl ;
+ GetChangeNodeInPort( i )->Dependency( anInPort->Dependency() ) ;
+ }
+ }
+ else if ( !GetNodeInPort( i )->IsGate() ) {
+ cdebug << "UpdateMacroPorts DelInPort In" << i << " " << GetNodeInPort( i )->PortName() << " "
+ << GetNodeInPort( i )->PortType() << " " << GetNodeInPort( i )->Kind() << endl ;
+ DelInPort( GetNodeInPort( i )->PortName() ) ;
+ }
+ }
+ int index ;
+// Loop over InPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddInPort in the MacroNode
+ for ( index = 0 ; index < aGraph->GetNodeInPortsSize() ; index++ ) {
+ GraphBase::InPort * anInPort = aGraph->GetChangeNodeInPort( index ) ;
+ GraphBase::InPort * aMacroInPort = GetChangeInPort( anInPort->PortName() ) ;
+ if ( !anInPort->IsGate() &&
+ strcmp( GetChangeNodeInPort( index )->PortName() , anInPort->PortName() ) ) {
+ cdebug << "UpdateMacroPorts Add/MoveInPort In" << index << " " << anInPort->PortName() << " "
+ << anInPort->PortType() << " " << anInPort->Kind() << endl ;
+ if ( aMacroInPort ) {
+ MoveInPort( anInPort->PortName() , index ) ;
+ }
+ else {
+ AddInPort( anInPort->PortName() , anInPort->PortType() , anInPort->Kind() , index ) ;
+ }
+ }
+ }
+// Loop over OutPorts of MacroNode ; if it does not exist in the MacroGraph ===> DelOutPort in the MacroNode
+ for ( i = 0 ; i < GetNodeOutPortsSize() ; i++ ) {
+ GraphBase::OutPort * anOutPort = aGraph->GetChangeOutPort( GetNodeOutPort( i )->PortName() ) ;
+ if ( anOutPort && !anOutPort->IsGate() && !GetNodeOutPort( i )->IsGate() ) {
+ if ( strcmp( GetNodeOutPort( i )->PortType() , anOutPort->PortType() ) ) {
+ cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
+ << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
+ cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+ << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
+ GetChangeNodeOutPort( i )->PortType( (char * ) anOutPort->PortType() ) ;
+ }
+ if ( GetNodeOutPort( i )->Kind() != anOutPort->Kind() ) {
+ cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
+ << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
+ cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+ << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
+ GetChangeNodeOutPort( i )->Kind( anOutPort->Kind() ) ;
+ }
+ if ( GetNodeOutPort( i )->Dependency() != anOutPort->Dependency() ) {
+ cdebug << Name() << " " << GetNodeOutPort( i )->PortName() << " " << GetNodeOutPort( i )->PortType()
+ << " " << GetNodeOutPort( i )->Kind() << " " << GetNodeOutPort( i )->Dependency() << endl ;
+ cdebug << " <--> " << aGraph->Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+ << " " << anOutPort->Kind() << " " << anOutPort->Dependency() << endl ;
+ GetChangeNodeOutPort( i )->Dependency( anOutPort->Dependency() ) ;
+ }
+ }
+ else if ( !GetNodeOutPort( i )->IsGate() ) {
+ cdebug << "UpdateMacroPorts DelOutPort Out" << i << " " << GetNodeOutPort( i )->PortName() << " "
+ << GetNodeOutPort( i )->PortType() << " " << GetNodeOutPort( i )->Kind() << endl ;
+ DelOutPort( GetNodeOutPort( i )->PortName() ) ;
+ }
+ }
+// Loop over OutPorts of the MacroGraph : if it does not exist in the MacroNode ==> AddOutPort in the MacroNode
+ for ( index = 0 ; index < aGraph->GetNodeOutPortsSize() ; index++ ) {
+ GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeOutPort( index ) ;
+ GraphBase::OutPort * aMacroOutPort = GetChangeOutPort( anOutPort->PortName() ) ;
+ if ( !anOutPort->IsGate() && strcmp( GetNodeOutPort( index )->PortName() , anOutPort->PortName() ) ) {
+ cdebug << "UpdateMacroPorts Add/MoveOutPort Out" << index << " " << anOutPort->PortName() << " "
+ << anOutPort->PortType() << " " << anOutPort->Kind() << endl ;
+ if ( aMacroOutPort ) {
+ MoveOutPort( anOutPort->PortName() , index ) ;
+ }
+ else {
+ AddOutPort( anOutPort->PortName() , anOutPort->PortType() , anOutPort->Kind() , index ) ;
+ }
+ }
+ }
+ cdebug_out << "GraphBase::ComputingNode::UpdateMacroPorts" << endl;
+}
+
+void GraphBase::ComputingNode::SetMacroDatas( GraphBase::Graph * aGraph ,
+ GraphBase::Graph * aGraphOfMacroGraph ) {
+ cdebug_in << "GraphBase::ComputingNode::SetMacroDatas fill inputs of MacroNode" << endl;
+ int i ;
+ for ( i = 0 ; i < aGraph->GetNodeInPortsSize() ; i++ ) {
+ const GraphBase::InPort * anInPort = aGraph->GetNodeInPort( i ) ;
+ GraphBase::OutPort * anOutPort = aGraph->GetChangeNodeInDataNodePort(i) ;
+ cdebug << " " << Name() << " " << anOutPort->PortName() << " " << anOutPort->PortType()
+ << " " << anOutPort->Kind() << " " << anOutPort->PortStatus() << endl ;
+ if ( anOutPort->IsDataConnected() ) {
+ aGraphOfMacroGraph->AddInputData( Name() , anInPort->PortName() , *(anOutPort->Value()) ) ;
+ anOutPort->PortStatus( ExternConnected ) ;
+ }
+ }
+ cdebug_out << "GraphBase::ComputingNode::SetMacroDatas" << endl;
+}
+