2 //=============================================================================
3 // File : DataFlowBase_Graph.cxx
5 // Author : Jean Rahuel, CEA
8 //=============================================================================
10 #include "DataFlowBase_Graph.hxx"
12 #include "SALOME_LifeCycleCORBA.hxx"
14 GraphBase::Graph::Graph() :
16 cdebug << "GraphBase::Graph::Graph" << endl ;
20 GraphBase::Graph::Graph( CORBA::ORB_ptr ORB ,
21 SALOME_NamingService* ptrNamingService ,
22 const char *DataFlowName ,
23 const char * DebugFileName ) :
24 DataNode( ORB ,ptrNamingService , DataFlowName ) {
25 cdebug << "GraphBase::Graph::Graph" << endl ;
26 _Orb = CORBA::ORB::_duplicate( ORB ) ;
28 Set_prof_debug( ORB , DebugFileName ) ;
31 GraphBase::Graph::Graph( CORBA::ORB_ptr ORB ,
32 SALOME_NamingService* ptrNamingService ,
33 const SALOME_ModuleCatalog::Service& DataFlowService ,
34 const char *DataFlowComponentName ,
35 const char *DataFlowInterfaceName ,
36 const char *DataFlowName ,
37 const SUPERV::KindOfNode DataFlowkind ,
38 const SUPERV::SDate DataFlowFirstCreation ,
39 const SUPERV::SDate DataFlowLastModification ,
40 const char * DataFlowEditorRelease ,
41 const char * DataFlowAuthor ,
42 const char * DataFlowComputer ,
43 const char * DataFlowComment ,
44 const char * DebugFileName ) :
45 DataNode( ORB , ptrNamingService , DataFlowService ,
46 DataFlowName , DataFlowkind ,
47 DataFlowFirstCreation , DataFlowLastModification ,
48 DataFlowEditorRelease , DataFlowAuthor , DataFlowComment ) {
49 _Orb = CORBA::ORB::_duplicate( ORB ) ;
51 Set_prof_debug( ORB , DebugFileName ) ;
52 cdebug_in << "GraphBase::Graph::Graph" << endl ;
53 DataService( ORB , DataFlowService , Graph_prof_debug() , Graph_fdebug() ) ;
54 cdebug_out << "GraphBase::Graph::Graph" << endl ;
57 GraphBase::Graph::~Graph() {
58 cdebug << "GraphBase::Graph::~Graph" << endl ;
61 void GraphBase::Graph::Set_prof_debug( CORBA::ORB_ptr ORB ,
62 const char * DebugFileName ) {
63 _Graph_prof_debug = 0 ;
64 if ( DebugFileName ) {
65 _Graph_fdebug = new ofstream( DebugFileName );
66 MESSAGE( endl << "Trace redirected to file " << DebugFileName << endl)
69 _Graph_fdebug = &(std::cerr);
70 SetDebug( ORB , &_Graph_prof_debug , _Graph_fdebug ) ;
73 GraphBase::SNode * GraphBase::Graph::GetInfo() const {
74 GraphBase::SNode * Info = new GraphBase::SNode ;
75 Info->theComponentName = "" ;
76 Info->theInterfaceName = "" ;
77 Info->theName = Name() ;
78 Info->theKind = Kind() ;
79 Info->theService = *GetService() ;
80 Info->theFirstCreation = FirstCreation() ;
81 Info->theLastModification = LastModification() ;
82 Info->theEditorRelease = EditorRelease() ;
83 Info->theAuthor = Author() ;
84 Info->theContainer = "" ;
85 Info->theComment = Comment() ;
86 Info->theCoords.theX = GraphBase::ComputingNode::XCoordinate() ;
87 Info->theCoords.theY = GraphBase::ComputingNode::YCoordinate() ;
91 //----------------------------------------------------------------------
92 // Function : GetNodes
93 // Purpose : get a nodes list
94 //----------------------------------------------------------------------
95 GraphBase::ListOfNodes * GraphBase::Graph::GetNodes() const {
96 GraphBase::ListOfNodes * _list_nodes =
97 new GraphBase::ListOfNodes;
99 // All the nodes from _InNodes are taken
100 // vector< InNode *> Nodes = InNodes() ;
102 _list_nodes->resize( GraphNodesSize() );
106 GraphBase::ComputingNode * aCNode = NULL ;
107 for ( igoto = 0 ; igoto < 2 ; igoto++ ) {
108 for ( ind = 0 ; ind < GraphNodesSize() ; ind++ ) {
109 aCNode = GraphNodes( ind ) ;
110 if ( ( igoto == 0 && !aCNode->IsGOTONode() ) ||
111 ( igoto == 1 && aCNode->IsGOTONode() ) ) {
112 if ( aCNode->IsFactoryNode() ) {
113 GraphBase::FactoryNode * aFNode = (GraphBase::FactoryNode * ) aCNode ;
114 (*_list_nodes)[ind].theComponentName = CORBA::string_dup( aFNode->ComponentName());
115 (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( aFNode->InterfaceName());
118 (*_list_nodes)[ind].theComponentName = CORBA::string_dup( "" );
119 (*_list_nodes)[ind].theInterfaceName = CORBA::string_dup( "" );
121 (*_list_nodes)[ind].theName = CORBA::string_dup( aCNode->Name() );
122 (*_list_nodes)[ind].theKind = aCNode->Kind();
123 if ( aCNode->IsInLineNode() ) {
124 GraphBase::InLineNode * aINode = (GraphBase::InLineNode * ) aCNode ;
125 (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
126 (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aINode->PyFuncName() ) ;
127 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
128 (*_list_nodes)[ind].theListOfPythonFunctions[0] = aINode->PythonFunction() ;
130 if ( aCNode->IsGOTONode() ) {
131 GraphBase::GOTONode * aGNode = (GraphBase::GOTONode * ) aCNode ;
132 (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
133 (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aGNode->PyFuncName() ) ;
134 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
135 (*_list_nodes)[ind].theListOfPythonFunctions[0] = aGNode->PythonFunction() ;
137 if ( aCNode->IsLoopNode() ) {
138 GraphBase::LoopNode * aLNode = (GraphBase::LoopNode * ) aCNode ;
139 (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aLNode->CoupledNode()->Name() ) ;
140 (*_list_nodes)[ind].theListOfFuncName.resize( 3 ) ;
141 (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aLNode->PyFuncName() ) ;
142 (*_list_nodes)[ind].theListOfFuncName[1] = CORBA::string_dup( aLNode->PyMoreName() ) ;
143 (*_list_nodes)[ind].theListOfFuncName[2] = CORBA::string_dup( aLNode->PyNextName() ) ;
144 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 3 ) ;
145 (*_list_nodes)[ind].theListOfPythonFunctions[0] = aLNode->PythonFunction() ;
146 (*_list_nodes)[ind].theListOfPythonFunctions[1] = aLNode->MorePythonFunction() ;
147 (*_list_nodes)[ind].theListOfPythonFunctions[2] = aLNode->NextPythonFunction() ;
149 else if ( aCNode->IsSwitchNode() ) {
150 GraphBase::SwitchNode * aSNode = (GraphBase::SwitchNode * ) aCNode ;
151 (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aSNode->CoupledNode()->Name() ) ;
152 (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
153 (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aSNode->PyFuncName() ) ;
154 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
155 (*_list_nodes)[ind].theListOfPythonFunctions[0] = aSNode->PythonFunction() ;
157 else if ( aCNode->IsEndLoopNode() ) {
158 GraphBase::EndOfLoopNode * aELNode = (GraphBase::EndOfLoopNode * ) aCNode ;
159 (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aELNode->CoupledNode()->Name() ) ;
160 (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
161 (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aELNode->PyFuncName() ) ;
162 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
163 (*_list_nodes)[ind].theListOfPythonFunctions[0] = aELNode->PythonFunction() ;
165 else if ( aCNode->IsEndSwitchNode() ) {
166 GraphBase::EndOfSwitchNode * aESNode = (GraphBase::EndOfSwitchNode * ) aCNode ;
167 (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( aESNode->CoupledNode()->Name() ) ;
168 (*_list_nodes)[ind].theListOfFuncName.resize( 1 ) ;
169 (*_list_nodes)[ind].theListOfFuncName[0] = CORBA::string_dup( aESNode->PyFuncName() ) ;
170 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
171 (*_list_nodes)[ind].theListOfPythonFunctions[0] = aESNode->PythonFunction() ;
174 (*_list_nodes)[ind].theCoupledNode = CORBA::string_dup( "" ) ;
176 (*_list_nodes)[ind].theService = *aCNode->GetService();
177 // (*_list_nodes)[ind].theListOfParameters = *aCNode->GetListOfParameters() ;
178 if ( aCNode->IsOneOfInLineNodes() ) {
179 GraphBase::InLineNode * aINode = (GraphBase::InLineNode * ) aCNode ;
180 GraphBase::LoopNode * aLNode = NULL ;
181 if ( aCNode->IsLoopNode() ) {
182 aLNode = (GraphBase::LoopNode * ) aCNode ;
183 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 3 ) ;
184 (*_list_nodes)[ind].theListOfPythonFunctions[ 0 ] = aINode->PythonFunction() ;
185 (*_list_nodes)[ind].theListOfPythonFunctions[ 1 ] = aLNode->MorePythonFunction() ;
186 (*_list_nodes)[ind].theListOfPythonFunctions[ 2 ] = aLNode->NextPythonFunction() ;
188 else if ( aCNode->IsInLineNode() || aCNode->IsGOTONode() ||
189 aCNode->IsSwitchNode() || aCNode->IsEndSwitchNode() ) {
190 (*_list_nodes)[ind].theListOfPythonFunctions.resize( 1 ) ;
191 (*_list_nodes)[ind].theListOfPythonFunctions[ 0 ] = aINode->PythonFunction() ;
194 (*_list_nodes)[ind].theFirstCreation = aCNode->FirstCreation();
195 (*_list_nodes)[ind].theLastModification = aCNode->LastModification();
196 (*_list_nodes)[ind].theEditorRelease = CORBA::string_dup( aCNode->EditorRelease());
197 (*_list_nodes)[ind].theAuthor = CORBA::string_dup( aCNode->Author());
198 if ( aCNode->IsFactoryNode() ) {
199 GraphBase::FactoryNode * aFNode = (GraphBase::FactoryNode * ) aCNode ;
200 (*_list_nodes)[ind].theContainer = CORBA::string_dup( aFNode->Computer());
203 (*_list_nodes)[ind].theContainer = CORBA::string_dup( "" );
205 (*_list_nodes)[ind].theComment = CORBA::string_dup( aCNode->Comment());
206 (*_list_nodes)[ind].theCoords.theX = aCNode->XCoordinate();
207 (*_list_nodes)[ind].theCoords.theY = aCNode->YCoordinate();
211 for ( i = 0 ; i < aCNode->GetNodeInPortsSize() ; i++ ) {
212 const GraphBase::InPort * anInPort = aCNode->GetNodeInPort( i ) ;
213 if ( anInPort->IsBus() ) {
215 (*_list_nodes)[ind].theListOfParameters.resize( nports ) ;
216 (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametertype = CORBA::string_dup( anInPort->PortType() ) ;
217 (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theInParameter.Parametername = CORBA::string_dup( anInPort->PortName() ) ;
218 (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametertype = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortType() ) ;
219 (*_list_nodes)[ind].theListOfParameters[ nports-1 ].theOutParameter.Parametername = CORBA::string_dup( aCNode->GetNodeOutPort( anInPort->PortIndex() )->PortName() ) ;
230 //----------------------------------------------------------------------
231 // Function : GetLinks
232 // Purpose : get a links list
233 //----------------------------------------------------------------------
234 GraphBase::ListOfLinks * GraphBase::Graph::GetLinks() const {
235 GraphBase::ListOfLinks * _list_links =
236 new GraphBase::ListOfLinks;
238 // All the links from _LinksList are taken
239 // vector< InNode *> Nodes = InNodes() ;
243 for ( k = 0 ; k < GraphNodesSize() ; k++ ) {
244 GraphBase::ComputingNode * aNode = GraphNodes( k ) ;
246 for ( i = 0 ; i < aNode->GetNodeOutPortsSize() ; i++ ) {
247 const GraphBase::OutPort* fromPort = aNode->GetNodeOutPort( i ) ;
248 // cout << "GraphBase::Graph::GetLinks " << aNode->Name() << " "
249 // << fromPort->PortName() << " " << fromPort->IsPortConnected()
250 // << " " << fromPort->InPortsSize() << endl ;
251 if ( fromPort->IsPortConnected() ) {
253 for ( j = 0 ; j < fromPort->InPortsSize() ; j++ ) {
254 _list_links->resize( ind+1 );
255 (*_list_links)[ind].FromNodeName = CORBA::string_dup( aNode->Name() );
256 (*_list_links)[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
257 const GraphBase::InPort* toPort = fromPort->InPorts( j ) ;
258 (*_list_links)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
259 (*_list_links)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
260 (*_list_links)[ind].aLinkValue = *fromPort->Value() ;
261 if ( toPort->IsEndSwitch() ) {
262 (*_list_links)[ind++].aListOfCoords = *(fromPort->Coords()) ;
265 (*_list_links)[ind++].aListOfCoords = *(toPort->Coords()) ;
275 GraphBase::ListOfGraphs * GraphBase::Graph::GetGraphs() const {
276 GraphBase::ListOfGraphs * _list_graphs =
277 new GraphBase::ListOfGraphs;
282 GraphBase::SLink * GraphBase::Graph::GetLink( GraphBase::ComputingNode * aNode ,
283 GraphBase::InPort* toPort ) {
284 GraphBase::SLink * _link = new GraphBase::SLink ;
285 GraphBase::OutPort* fromPort = toPort->GetOutPort() ;
286 _link->FromNodeName = CORBA::string_dup( fromPort->NodeName() );
287 _link->FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
288 _link->ToNodeName = CORBA::string_dup( toPort->NodeName() );
289 _link->ToServiceParameterName = toPort->GetServicesParameter().Parametername;
290 CORBA::Any aSPValue = *fromPort->Value() ;
291 _link->aLinkValue = aSPValue;
292 _link->aListOfCoords = *(toPort->Coords()) ;
295 //----------------------------------------------------------------------
296 // Function : GetDatas
297 // Purpose : get the datas list
298 //----------------------------------------------------------------------
299 GraphBase::ListOfLinks * GraphBase::Graph::GetDatas() const {
300 GraphBase::ListOfLinks * _list_datalinks =
301 new GraphBase::ListOfLinks;
304 const GraphBase::DataNode * aDataNode = this ;
306 for ( i = 0 ; i < aDataNode->GetNodeInDataNodePortsSize() ; i++ ) {
307 const GraphBase::OutPort* fromDataPort = aDataNode->GetNodeInDataNodePort( i ) ;
308 if ( fromDataPort->IsDataConnected() ) {
310 //We may have SharedData as input of a DataFlow : same input for one or several
311 // input ports. Input(s) of a DataFlow match one or several output-virtual-dataport
312 for ( j = 0 ; j < fromDataPort->InPortsSize() ; j++ ) {
313 _list_datalinks->resize( ind+1 );
314 (*_list_datalinks)[ind].FromNodeName = CORBA::string_dup( aDataNode->Name() );
315 (*_list_datalinks)[ind].FromServiceParameterName = fromDataPort->GetServicesParameter().Parametername;
316 const GraphBase::InPort* toPort = fromDataPort->InPorts( j ) ;
317 (*_list_datalinks)[ind].ToNodeName = CORBA::string_dup( toPort->NodeName() );
318 (*_list_datalinks)[ind].ToServiceParameterName = toPort->GetServicesParameter().Parametername;
319 CORBA::Any aSPValue = *fromDataPort->Value() ;
320 (*_list_datalinks)[ind].aLinkValue = aSPValue;
321 (*_list_datalinks)[ind++].aListOfCoords = *(toPort->Coords()) ;
327 // Output(s) of a DataFlow match only one input-virtual-dataport
328 for ( i = 0 ; i < aDataNode->GetNodeOutDataNodePortsSize() ; i++ ) {
329 GraphBase::InPort* toDataPort = aDataNode->GetChangeNodeOutDataNodePort( i ) ;
330 const GraphBase::OutPort* fromPort = toDataPort->GetLink() ;
331 if ( fromPort->IsDataConnected() ) {
332 _list_datalinks->length( ind+1 );
333 _list_datalinks[ind].FromNodeName = CORBA::string_dup( fromPort->NodeName() );
334 _list_datalinks[ind].FromServiceParameterName = fromPort->GetServicesParameter().Parametername;
335 _list_datalinks[ind].ToNodeName = CORBA::string_dup( aDataNode->Name() );
336 _list_datalinks[ind].ToServiceParameterName = toDataPort->GetServicesParameter().Parametername;
337 // SALOME_SuperVisionBase::ServicesParameterValue aSPValue;
338 CORBA::Any aSPValue = *fromPort->Value() ;
339 // aSPValue.Value = CORBA::string_dup( fromPort->Value() );
340 // aSPValue.Kind = fromPort->Kind();
341 _list_datalinks[ind].aLinkValue = aSPValue;
342 _list_datalinks[ind++].aListOfCoords = toDataPort->Coords() ;
347 return _list_datalinks ;
350 bool GraphBase::Graph::AddNode( GraphBase::ComputingNode * aNode ) {
351 cdebug_in << "GraphBase::Graph::AddNode " << (void *) aNode << " "
352 << aNode->Name() << " " << aNode->ServiceName() << endl;
353 bool RetVal = false ;
354 int index = GetGraphNodeIndex( aNode->Name() ) ;
356 _GraphNodes.resize( _GraphNodesSize+1 ) ;
357 _GraphNodes[ _GraphNodesSize ] = aNode ;
358 SetGraphNodeIndex( aNode->Name() , _GraphNodesSize ) ;
359 _GraphNodesSize += 1 ;
362 // cout << "GraphBase::Graph::AddNode(" << aNode->ComponentName() << " , "
363 // << aNode->Name() << ")" << endl;
365 cdebug << "GraphBase::Graph::AddNode Known nodes :" << endl ;
366 for ( i = 0 ; i < _GraphNodesSize ; i++ ) {
367 cdebug << i << ". " << GetGraphNode( i )->Name() << " "
368 << _MapOfGraphNodes[ GetGraphNode( i )->Name() ] - 1 << endl ;
370 cdebug_out << "GraphBase::Graph::AddNode " << _GraphNodesSize << " Nodes. "
371 << aNode->ServiceName() << endl;
375 bool GraphBase::Graph::ReNameNode( const char* OldNodeName ,
376 const char* NewNodeName ) {
377 cdebug_in << "GraphBase::Graph::ReNameNode (" << OldNodeName << " , "
378 << NewNodeName << ")" << endl;
380 bool RetVal = false ;
381 if ( !strcmp( OldNodeName , NewNodeName ) ) {
384 else if ( strcmp( Name() , OldNodeName ) ) {
385 int index = GetGraphNodeIndex( OldNodeName ) ;
386 int newindex = GetGraphNodeIndex( NewNodeName ) ;
387 if ( index >= 0 && index < _GraphNodesSize &&
388 ( newindex < 0 || newindex > _GraphNodesSize ) ) {
389 _GraphNodes[ index ]->Name( NewNodeName ) ;
390 _MapOfGraphNodes.erase( OldNodeName ) ;
391 SetGraphNodeIndex( NewNodeName , index ) ;
393 GraphBase::ComputingNode * aNode = GetChangeGraphNode( index ) ;
394 for ( i = aNode->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
395 cdebug << i << ". GraphBase::Graph::ReNameNode of LinkedNode : from " ;
396 GraphBase::InPort * anInPort = aNode->GetChangeNodeInPort( i ) ;
397 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
399 cdebug << anOutPort->NodeName() ;
402 cdebug << "without link" ;
404 cdebug << " to " << i << ". " << anInPort->PortName()
405 << " of " << NewNodeName ;
406 if ( anInPort->IsConnected() ) {
407 if ( anOutPort->IsDataConnected() ) {
408 cdebug << " fromDataConnected "
409 << anOutPort->NodeName()
413 GraphBase::ComputingNode * FromNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
414 cdebug << " fromConnected " << FromNode->Name() << endl ;
415 FromNode->ReNameLink( OldNodeName , NewNodeName ) ;
417 char* OldNodePortName = new char[ strlen( OldNodeName ) +
418 strlen( aNode->GetChangeNodeInPort( i )->PortName() ) + 2 ] ;
419 char* NewNodePortName = new char[ strlen( NewNodeName ) +
420 strlen( aNode->GetChangeNodeInPort( i )->PortName() ) + 2 ] ;
421 strcpy( OldNodePortName , OldNodeName ) ;
422 strcat( OldNodePortName , "\\" ) ;
423 strcat( OldNodePortName , aNode->GetChangeNodeInPort( i )->PortName() ) ;
424 strcpy( NewNodePortName , NewNodeName ) ;
425 strcat( NewNodePortName , "\\" ) ;
426 strcat( NewNodePortName , aNode->GetChangeNodeInPort( i )->PortName() ) ;
427 RetVal = anOutPort->ReNameInPort( OldNodePortName , NewNodePortName ) ;
428 delete [] OldNodePortName ;
429 delete [] NewNodePortName ;
434 cdebug << " not connected" << endl ;
441 cdebug << "Node not found" << endl ;
445 RetVal = Name( NewNodeName ) ;
448 cdebug_out << "GraphBase::Graph::ReNameNode" << endl;
452 bool GraphBase::Graph::RemoveNode( const char* aNodeName ) {
453 cdebug_in << "GraphBase::Graph::RemoveNode (" << aNodeName << ")" << endl;
455 bool RetVal = false ;
456 int index = GetGraphNodeIndex( aNodeName ) ;
457 GraphBase::ComputingNode * aNode = GetChangeGraphNode( index ) ;
459 if ( aNode->GetNodeInPortsSize() ) {
460 for ( i = aNode->GetNodeInPortsSize()-1 ; i >= 0 ; i-- ) {
461 cdebug << i << ". GraphBase::Graph::RemoveNode of LinkedNode : from " ;
462 GraphBase::InPort * anInPort = aNode->GetChangeNodeInPort( i ) ;
463 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
465 cdebug << anOutPort->NodeName() ;
468 cdebug << "without link" ;
470 cdebug << " to " << i << ". " << anInPort->PortName()
471 << " of " << aNodeName ;
472 if ( anInPort->IsConnected() ) {
473 if ( anOutPort->IsDataConnected() ) {
474 cdebug << " fromDataConnected " << anOutPort->NodeName() << endl ;
477 GraphBase::ComputingNode * FromNode = GetChangeGraphNode( anOutPort->NodeName() ) ;
478 cdebug << " fromConnected " << FromNode->Name() << endl ;
479 FromNode->RemoveLink( aNode ) ;
481 RetVal = anOutPort->RemoveInPort( anInPort ) ;
486 cdebug << " not connected" << endl ;
495 for ( i = aNode->GetNodeOutPortsSize() - 1 ; i >= 0 ; i-- ) {
496 GraphBase::OutPort * anOutPort = aNode->GetChangeNodeOutPort( i ) ;
497 cdebug << "GraphBase::Graph::Remove " <<anOutPort->InPortsSize()
498 << " Links of OutPort : " << i << ". "
499 << *aNode->GetChangeNodeOutPort( i ) ;
501 for ( j = anOutPort->InPortsSize() - 1 ; j >= 0 ; j-- ) {
502 cdebug << " to " << j << ". " << *anOutPort->InPorts( j )
504 RetVal = anOutPort->ChangeInPorts( j )->RemoveOutPort() ;
507 GraphBase::ComputingNode * ToNode = GetChangeGraphNode( anOutPort->InPorts( j )->NodeName() ) ;
508 aNode->RemoveLink( ToNode ) ;
509 RetVal = anOutPort->RemoveInPort( anOutPort->ChangeInPorts( j ) ) ;
513 // RetVal = aNode->GetChangeNodeOutPort( j )->RemoveLinks() ;
518 // RetVal = aNode->RemoveLinks() ; // In PortsOfNode
521 _GraphNodesSize -= 1 ;
522 for ( i = index ; i < _GraphNodesSize ; i++ ) {
523 SetGraphNodeIndex( _GraphNodes[ i+1 ]->Name() , i ) ;
524 _GraphNodes[ i ] = _GraphNodes[ i+1 ] ;
526 _GraphNodes.resize( _GraphNodesSize+1 ) ;
527 _MapOfGraphNodes.erase( aNodeName ) ;
532 cdebug << "Node not found" << endl ;
534 cdebug_out << "GraphBase::Graph::RemoveNode" << endl;
538 bool GraphBase::Graph::AddLink(
539 const char* FromNodeName ,
540 const char* FromServiceParameterName ,
541 const char* ToNodeName ,
542 const char* ToServiceParameterName ,
543 const CORBA::Any aValue ) {
546 cdebug_in << "GraphBase::Graph::AddLink(" << FromNodeName << "("
547 << FromServiceParameterName << ") ---> " << ToNodeName << "("
548 << ToServiceParameterName << ") )" << endl;
550 GraphBase::ComputingNode *fromNode = GetChangeGraphNode( FromNodeName ) ;
551 GraphBase::ComputingNode *toNode = GetChangeGraphNode( ToNodeName ) ;
553 GraphBase::OutPort *fromPort = NULL ;
554 GraphBase::InPort *toPort = NULL ;
557 fromPort = fromNode->GetChangeOutPort( FromServiceParameterName ) ;
559 cdebug << "AddLink fromPort " << FromServiceParameterName << " FromNode("
560 << FromNodeName << ") not found." << endl ;
564 cdebug << "AddLink FromNode " << FromNodeName << " not found." << endl ;
567 toPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
569 cdebug << "AddLink toPort " << ToServiceParameterName << " ToNode("
570 << ToNodeName << ") not found." << endl ;
574 cdebug << "AddLink toNode " << ToNodeName << " not found." << endl ;
577 RetVal = AddLink( fromNode , fromPort , toNode , toPort ) ;
580 if ( fromPort->IsGate() && toPort->IsGate() ) {
582 aValue <<= (long ) 1 ;
583 fromPort->Value( aValue ) ;
586 const CORBA::Any * aDataValue = new CORBA::Any( aValue ) ;
587 fromPort->Value( aDataValue ) ;
591 cdebug_out << "GraphBase::Graph::AddLink" << endl;
595 bool GraphBase::Graph::AddLink(
596 GraphBase::ComputingNode *fromNode ,
597 GraphBase::OutPort *fromPort ,
598 GraphBase::ComputingNode *toNode ,
599 GraphBase::InPort *toPort ) {
603 cdebug << "AddLink fromNode not found." << endl ;
607 cdebug << "AddLink fromPort not found." << endl ;
612 cdebug << "AddLink toNode not found." << endl ;
616 cdebug << "AddLink toPort not found." << endl ;
620 cdebug_in << "GraphBase::Graph::AddLink(" << fromNode->Name() << "("
621 << fromPort->PortName() << ") ---> " << toNode->Name() << "("
622 << toPort->PortName() << ") )" << endl;
623 if ( !fromNode->IsDataFlowNode() && !toNode->IsDataFlowNode() &&
624 toPort->GetOutPort() ) {
625 if ( !strcmp( toPort->GetOutPort()->NodePortName() ,
626 fromPort->NodePortName() ) ) {
627 cdebug << "Link already exists" << endl ;
628 cdebug_out << "GraphBase::Graph::AddLink" << endl;
631 else if ( toPort->IsDataConnected() ) {
632 toPort->RemoveOutPort() ;
634 else if ( fromNode->IsGOTONode() ) {
635 if ( !RemoveLink( toPort->GetOutPort()->NodeName() ,
636 toPort->GetOutPort()->PortName() ,
637 toNode->Name() , toPort->PortName() ) ) {
638 cdebug << "RemoveLink(AddLink) toPort->GetOutPort()->NodeName() Error."
640 cdebug_out << "GraphBase::Graph::AddLink" << endl;
643 if ( fromPort->InPortsSize() ) {
644 if ( !RemoveLink( fromNode->Name() , fromPort->PortName() ,
645 fromPort->ChangeInPorts(0)->NodeName() ,
646 fromPort->ChangeInPorts(0)->PortName() ) ) {
647 cdebug << "RemoveLink(AddLink) fromNode->IsGOTONode Error." << endl ;
648 cdebug_out << "GraphBase::Graph::AddLink" << endl;
653 else if ( !toNode->IsEndSwitchNode() ) {
654 if ( !RemoveLink( fromNode->Name() , fromPort->PortName() ,
655 toNode->Name() , toPort->PortName() ) ) {
656 cdebug << "RemoveLink(AddLink) toNode->IsEndSwitchNode Error." << endl ;
657 cdebug_out << "GraphBase::Graph::AddLink" << endl;
662 else if ( fromNode->IsGOTONode() && fromPort->InPortsSize() ) {
663 if ( !RemoveLink( fromNode->Name() , fromPort->PortName() ,
664 fromPort->ChangeInPorts(0)->NodeName() ,
665 fromPort->ChangeInPorts(0)->PortName() ) ) {
666 cdebug << "RemoveLink(AddLink) fromNode->IsGOTONode Error." << endl ;
667 cdebug_out << "GraphBase::Graph::AddLink" << endl;
672 if ( toNode->IsEndSwitchNode() && !toPort->IsGate() ) {
673 // if ( !toPort->IsEndSwitch() || !fromPort->AddInPort( toPort ) ) {
674 if ( !fromPort->AddInPort( toPort ) ) {
675 cdebug << "toNode->IsEndSwitchNode() : !fromPort->AddInPort( toPort ) AddLink Error."
677 cdebug_out << "GraphBase::Graph::AddLink" << endl;
680 toPort->Kind( SUPERV::EndSwitchParameter ) ;
682 else if ( !fromPort->AddInPort( toPort ) ) { // --> MapOfInports in the OutPort
683 cdebug << "!fromPort->AddLink Error." << endl ;
684 cdebug_out << "GraphBase::Graph::AddLink" << endl;
688 if ( fromNode->IsDataFlowNode() && toPort->IsDataConnected() ) {
689 toPort->RemoveOutPort() ;
692 if ( fromNode->IsGOTONode() && ( !fromPort->IsGate() || !toPort->IsGate() ||
693 toNode->IsEndLoopNode() || toNode->IsEndSwitchNode() ) ) {
694 cdebug << "toPort->AddLink Error( fromNode->IsGOTONode() && toNode->IsEndInLineNode() )." << endl ;
695 cdebug_out << "GraphBase::Graph::AddLink" << endl;
698 else if ( !fromNode->IsSwitchNode() && fromPort->IsParam() && toPort->IsGate() ) {
699 cdebug << "toPort->AddLink Error( fromPort->IsParam() && toPort->IsGate())." << endl ;
700 cdebug_out << "GraphBase::Graph::AddLink" << endl;
703 else if ( !toNode->IsEndSwitchNode() && !toNode->IsEndLoopNode() ) {
704 if ( !toPort->AddOutPort( fromPort ) ) { // --> Unique OutPort of the InPort
705 cdebug << "toPort->AddLink Error." << endl ;
706 cdebug_out << "GraphBase::Graph::AddLink" << endl;
711 toPort->AddOutPort( fromPort ) ;
714 if ( ( fromNode->IsGOTONode() && toNode->IsOneOfInLineNodes() ) ||
715 ( fromNode->IsEndLoopNode() && toNode->IsLoopNode() ) ) {
716 cdebug << "AddLink fromPort->PortStatus( PortConnected ) "
717 << "GOTONode/EndLoopNode-->InLineNode/LoopNode/SwitchNode "
718 << fromNode->Name() << " " << fromPort->PortName()
719 << " InLineNode/LoopNode_ConnectedInPortsNumber "
720 << toNode->ConnectedInPortsNumber() << endl;
721 if ( fromNode->IsGOTONode() ) {
722 fromPort->Kind( SUPERV::GOTOParameter ) ;
724 fromPort->PortStatus( PortConnected ); // GOTO - Loop
726 else if ( fromNode->IsDataFlowNode() || toNode->IsDataFlowNode() ) {
727 cdebug << "AddLink IsDataFlowNode fromPort->PortStatus( DataConnected ) "
728 << fromNode->Name() << " " << fromPort->PortName() << endl ;
729 fromPort->PortStatus( DataConnected );
732 cdebug << "AddLink fromPort->PortStatus( PortConnected ) & fromNode->toNode "
733 << fromNode->Name() << " " << fromPort->PortName() << endl;
734 fromPort->PortStatus( PortConnected );
735 fromNode->AddLink( toNode ) ;
737 if ( fromNode->IsSwitchNode() ) {
738 if ( fromPort->IsInLine() && toPort->IsGate() ) {
739 fromPort->Kind( SUPERV::SwitchParameter ) ;
741 else if ( !fromPort->IsGate() && !toPort->IsGate() ){
742 fromPort->Kind( SUPERV::InLineParameter ) ;
744 if ( fromPort->IsGate() && !toNode->IsEndSwitchNode() ) {
745 GraphBase::InLineNode * anEndSwitchNode ;
746 anEndSwitchNode = ((GraphBase::SwitchNode * ) fromNode)->CoupledNode() ;
747 GraphBase::InPort * anInPort = anEndSwitchNode->GetChangeNodeInPort(0) ;
748 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
749 if ( anOutPort && !strcmp( fromNode->Name() , anOutPort->NodeName() ) &&
750 !strcmp( fromPort->PortName() , anOutPort->PortName() ) &&
751 anOutPort->IsGate() ) {
752 if ( !RemoveLink( fromNode->Name() , anOutPort->PortName() ,
753 anEndSwitchNode->Name() ,
754 anEndSwitchNode->GetChangeNodeInPort(0)->PortName() ) ) {
755 cdebug << "AddLink Error Removelink ( Switch , Default , EndSwitch , Default )"
757 cdebug_out << "GraphBase::Graph::AddLink" << endl;
763 // cdebug << fromNode->ServiceName() << " " << toNode->ServiceName() << endl ;
764 cdebug_out << "GraphBase::Graph::AddLink" << endl;
768 bool GraphBase::Graph::RemoveLink( const char* FromNodeName ,
769 const char* FromServiceParameterName ,
770 const char* ToNodeName ,
771 const char* ToServiceParameterName ) {
772 cdebug_in << "GraphBase::Graph::RemoveLink to " << ToNodeName << "("
773 << ToServiceParameterName << ")" << endl;
774 bool RetVal = false ;
775 GraphBase::ComputingNode * toNode = GetChangeGraphNode( ToNodeName ) ;
777 GraphBase::InPort * anInPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
778 if ( anInPort && ( anInPort->IsConnected() ||
779 anInPort->IsDataConnected() ) ) {
780 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
781 RetVal = anOutPort->RemoveInPort( anInPort ) ;
782 anInPort->RemoveOutPort() ;
783 const char * FromNodeName = anOutPort->NodeName() ;
784 GraphBase::ComputingNode * fromNode = GetChangeGraphNode( FromNodeName ) ;
786 fromNode->RemoveLink( toNode ) ;
788 if ( fromNode->IsSwitchNode() ) {
789 anOutPort->Kind( SUPERV::InLineParameter ) ;
793 cdebug_out << "GraphBase::Graph::RemoveLink " << RetVal << endl;
797 bool GraphBase::Graph::GetLink(const char* ToNodeName ,
798 const char* ToServiceParameterName ,
799 char** FromNodeName ,
800 char** FromServiceParameterName ) {
801 cdebug_in << "GraphBase::Graph::GetLink " << ToNodeName << "("
802 << ToServiceParameterName << ")" << endl;
803 bool RetVal = false ;
804 GraphBase::ComputingNode * toNode = GetChangeGraphNode( ToNodeName ) ;
806 GraphBase::InPort * anInPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
807 if ( anInPort && anInPort->IsConnected() ) {
808 GraphBase::OutPort * anOutPort = anInPort->GetOutPort() ;
809 *FromNodeName = my_strdup( anOutPort->NodeName() ) ;
810 *FromServiceParameterName = my_strdup( anOutPort->PortName() ) ;
814 cdebug_out << "GraphEditor::OutNode::GetLink " << RetVal << endl;
818 bool GraphBase::Graph::AddInputData( const char* ToNodeName ,
819 const char* ToServiceParameterName ,
820 const CORBA::Any aValue ) {
821 bool RetVal = false ;
822 cdebug_in << "GraphBase::Graph::AddInputData(" << ToNodeName << ","
823 << ToServiceParameterName << " , Any " ;
824 switch (aValue.type()->kind()) {
825 case CORBA::tk_string:
828 cdebug << t << " (string) " ;
830 case CORBA::tk_double:
833 cdebug << d << " (double) " ;
838 cdebug << l << " (long) " ;
840 case CORBA::tk_objref:
841 cdebug << "(object reference) " ;
844 cdebug << "(other(tk_string,tk_double,tk_long,tk_objref)) ERROR";
847 cdebug << ")" << endl;
849 GraphBase::OutPort *fromDataNodePort = NULL ;
851 GraphBase::ComputingNode *toNode ;
852 GraphBase::InPort *toPort ;
855 NodePort( ToNodeName , ToServiceParameterName , &aNode , &aPort ) ;
856 toNode = GetChangeGraphNode( aNode ) ;
858 toPort = toNode->GetChangeInPort( aPort ) ;
859 if ( toPort && !toPort->IsDataConnected() ) {
860 toPort->RemoveOutPort() ;
871 for ( i = 0 ; i < GetNodeOutDataNodePortsSize() ; i++ ) {
872 cdebug "GraphBase::Graph::AddInputData " << GetNodeOutDataNodePort(i) << endl ;
874 for ( i = 0 ; i < GetNodeInDataNodePortsSize() ; i++ ) {
875 cdebug "GraphBase::Graph::AddInputData " << GetNodeInDataNodePort(i) << endl ;
879 if ( toNode && toPort ) {
880 fromDataNodePort = GraphBase::DataNode::GetChangeInDataNodePort( toPort->NodePortName() ) ;
881 if ( fromDataNodePort && fromDataNodePort->GetInPort( toPort ) ) {
882 fromDataNodePort->RemoveInPort( toPort ) ;
884 cdebug << "Try AddLink " << toPort->NodePortName() << " : " << Name() << "( "
885 << fromDataNodePort->PortName() << " ) -->" << toNode->Name() << "( "
886 << toPort->PortName() << " )" << endl ;
887 RetVal = AddLink( (GraphBase::ComputingNode * ) this , fromDataNodePort ,
890 fromDataNodePort->Value( aValue ) ;
894 cdebug << "Node not found" << endl ;
897 cdebug_out << "GraphBase::Graph::AddInputData " << RetVal << endl;
901 bool GraphBase::Graph::ChangeInputData( const char* ToNodeName ,
902 const char* ToServiceParameterName ,
903 const CORBA::Any aValue ) {
904 bool RetVal = false ;
905 cdebug_in << "GraphBase::Graph::ChangeInputData(" << ToNodeName << ","
906 << ToServiceParameterName << " Any " ;
907 switch (aValue.type()->kind()) {
908 case CORBA::tk_string:
911 cdebug << t << " (string) " ;
913 case CORBA::tk_double:
916 cdebug << d << " (double) " ;
921 cdebug << l << " (long) " ;
923 case CORBA::tk_objref:
924 cdebug << "(object reference) " ;
927 cdebug << "(other(tk_string,tk_double,tk_long,tk_objref)) ERROR";
930 cdebug << ")" << endl;
932 GraphBase::ComputingNode *toNode = GetChangeGraphNode( ToNodeName ) ;
934 GraphBase::OutPort *fromPort = NULL ;
935 GraphBase::InPort *toPort = NULL ;
938 toPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
940 fromPort = toPort->GetOutPort();
943 fromPort->Value( aValue ) ;
944 toPort->State( SUPERV::ReadyState ) ;
947 cdebug << "ChangeInputData fromPort not found" << endl ;
951 cdebug << "ChangeInputData toPort not found" << endl ;
955 cdebug << "ChangeInputData Node not found" << endl ;
958 cdebug_out << "GraphBase::Graph::ChangeInputData" << endl;
962 bool GraphBase::Graph::AddInputData(
963 const char* ToNodeName1 ,
964 const char* ToServiceParameterName1 ,
965 const char* ToNodeName2 ,
966 const char* ToServiceParameterName2 ) {
967 bool RetVal = false ;
968 cdebug_in << "GraphBase::Graph::AddInputSharedData(" << ToNodeName1 << ","
969 << ToServiceParameterName1 << ", " << ToNodeName2 << ","
970 << ToServiceParameterName2 << " )" << endl;
972 GraphBase::ComputingNode *toNode1 = GetChangeGraphNode( ToNodeName1 ) ;
973 GraphBase::ComputingNode *toNode2 = GetChangeGraphNode( ToNodeName2 ) ;
975 GraphBase::OutPort *fromDataNodePort1 = NULL ;
976 GraphBase::OutPort *fromDataNodePort2 = NULL ;
977 GraphBase::InPort *toPort1 = NULL ;
978 GraphBase::InPort *toPort2 = NULL ;
980 if ( toNode1 && toNode2 ) {
981 toPort1 = toNode1->GetChangeInPort( ToServiceParameterName1 ) ;
982 toPort2 = toNode2->GetChangeInPort( ToServiceParameterName2 ) ;
983 fromDataNodePort1 = GraphBase::DataNode::GetChangeInDataNodePort( toPort1->NodePortName() ) ;
984 // const char* aDataValue = fromDataNodePort->Value() ;
985 const CORBA::Any ** aDataValue1 = fromDataNodePort1->ValuePtr() ;
986 fromDataNodePort2 = GraphBase::DataNode::GetChangeInDataNodePort( toPort2->NodePortName() ) ;
987 RetVal = AddLink( (GraphBase::ComputingNode * ) this , fromDataNodePort1 ,
988 toNode2 , toPort2 ) ;
990 fromDataNodePort2->Value( aDataValue1 ) ;
993 cdebug << "Node not found" << endl ;
996 cdebug_out << "GraphBase::Graph::AddInputSharedData" << endl;
1000 bool GraphBase::Graph::AddInputData( const char* ToNodeName ,
1001 const char* ToServiceParameterName ,
1002 const CORBA::Any ** aValue ) {
1003 bool RetVal = false ;
1004 cdebug_in << "GraphBase::Graph::AddInputData(" << ToNodeName << ","
1005 << ToServiceParameterName << " **Any " ;
1006 const CORBA::Any theValue = **aValue ;
1007 switch (theValue.type()->kind()) {
1008 case CORBA::tk_string:
1011 cdebug << t << " (string) " ;
1013 case CORBA::tk_double:
1016 cdebug << d << " (double) " ;
1018 case CORBA::tk_long:
1021 cdebug << l << " (long) " ;
1023 case CORBA::tk_objref:
1024 cdebug << "(object reference) " ;
1027 cdebug << "(other(tk_string,tk_double,tk_long,tk_objref)) ERROR";
1030 cdebug << ")" << endl;
1032 GraphBase::ComputingNode *toNode = GetChangeGraphNode( ToNodeName ) ;
1034 GraphBase::OutPort *fromDataNodePort = NULL ;
1035 GraphBase::InPort *toPort = NULL ;
1038 toPort = toNode->GetChangeInPort( ToServiceParameterName ) ;
1039 fromDataNodePort = GraphBase::DataNode::GetChangeInDataNodePort( toPort->NodePortName() ) ;
1040 cdebug << "Try AddLink " << Name() << "( " << fromDataNodePort << " ) -->"
1041 << toNode->Name() << "( " << toPort->PortName() << " )" << endl ;
1042 RetVal = AddLink( (GraphBase::ComputingNode * ) this , fromDataNodePort ,
1045 fromDataNodePort->Value( aValue ) ;
1049 cdebug << "Node not found" << endl ;
1052 cdebug_out << "GraphBase::Graph::AddInputData" << endl;
1056 bool GraphBase::Graph::AddOutputData(
1057 const char* FromNodeName ,
1058 const char* FromServiceParameterName ,
1059 const CORBA::Any aValue ) {
1060 // const char* DataValue ,
1061 // const SUPERV::KindOfPortValue aKindOfPortValue ) {
1062 bool RetVal = false ;
1063 cdebug_in << "GraphBase::Graph::AddOutputData(" << FromNodeName << ","
1064 << FromServiceParameterName
1065 // << FromServiceParameterName << ", " << DataValue << ","
1066 // << aKindOfPortValue
1069 GraphBase::ComputingNode *fromNode = GetChangeGraphNode( FromNodeName ) ;
1071 GraphBase::OutPort *fromPort = NULL ;
1072 GraphBase::InPort *toDataNodePort = NULL ;
1075 fromPort = fromNode->GetChangeOutPort( FromServiceParameterName ) ;
1076 toDataNodePort = GraphBase::DataNode::GetChangeOutDataNodePort( fromPort->NodePortName() ) ;
1077 RetVal = AddLink( fromNode , fromPort ,
1078 (GraphBase::ComputingNode * ) this , toDataNodePort ,
1080 // DataValue , aKindOfPortValue ) ;
1083 cdebug << "Node not found" << endl ;
1086 cdebug_out << "GraphBase::Graph::AddOutputData" << endl;
1090 bool GraphBase::Graph::CreateService() {
1091 cdebug_in << "GraphBase::Graph::CreateService" << endl;
1093 SALOME_ModuleCatalog::Service aService ;
1095 GraphBase::ComputingNode * iN ;
1099 for ( dostore = 0 ; dostore <= 1 ; dostore++ ) {
1100 if ( dostore == 1 ) {
1101 aService.ServiceName = Name() ;
1102 aService.ServiceinParameter.length( 0 ) ;
1103 aService.ServiceinParameter.length( innbr ) ;
1104 aService.ServiceoutParameter.length( 0 ) ;
1105 aService.ServiceoutParameter.length( outnbr ) ;
1109 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1110 iN = GraphNodes( i ) ;
1111 for ( j = 0 ; j < iN->GetNodeInPortsSize() ; j++ ) {
1112 GraphBase::InPort *anInPort = iN->GetChangeNodeInPort(j) ;
1113 if ( !anInPort->IsConnected() && !anInPort->IsGate() ) {
1114 // !anInPort->IsLoop() ) {
1115 // if ( !anInPort->IsGate() && !anInPort->IsConnected() &&
1116 // !( iN->IsLoopNode() && anInPort->IsBus() && anInPort->IsParam() )) {
1117 if ( dostore == 0 ) {
1118 cdebug << "CreateService " << iN->Name() << " Input port "
1119 << anInPort->PortName() << " is NOT connected " ;
1120 if ( anInPort->GetOutPort() ) {
1121 cdebug << *(anInPort->GetOutPort()) ;
1127 aService.ServiceinParameter[innbr].Parametertype = CORBA::string_dup( anInPort->PortType() ) ;
1128 aService.ServiceinParameter[innbr++].Parametername = CORBA::string_dup( anInPort->NodePortName() ) ;
1132 if ( !iN->IsGOTONode() ) {
1133 for ( j = 0 ; j < iN->GetNodeOutPortsSize() ; j++ ) {
1134 GraphBase::OutPort *anOutPort = iN->GetChangeNodeOutPort(j) ;
1135 if ( !anOutPort->IsGate() &&
1136 //!anOutPort->IsLoop() &&
1137 // !( iN->IsEndLoopNode() && anOutPort->IsBus() ) &&
1138 ( anOutPort->IsNotConnected() || anOutPort->IsDataConnected() ) ) {
1139 if ( dostore == 0 ) {
1143 aService.ServiceoutParameter[outnbr].Parametertype = CORBA::string_dup( anOutPort->PortType() ) ;
1144 aService.ServiceoutParameter[outnbr++].Parametername = CORBA::string_dup( anOutPort->NodePortName() ) ;
1152 // MESSAGE( "DataFlowNode ServiceName " << aService.ServiceName );
1153 // for ( i = 0 ; i < innbr ; i++ ) {
1154 // cout << "aService.ServiceinParameter[" << i << "].Parametertype "
1155 // << aService.ServiceinParameter[i].Parametertype << endl ;
1156 // cout << "aService.ServiceinParameter[" << i << "].Parametername "
1157 // << aService.ServiceinParameter[i].Parametername << endl ;
1159 // for ( i = 0 ; i < outnbr ; i++ ) {
1160 // cout << "aService.ServiceoutParameter[" << i << "].Parametertype "
1161 // << aService.ServiceoutParameter[i].Parametertype << endl ;
1162 // cout << "aService.ServiceoutParameter[" << i << "].Parametername "
1163 // << aService.ServiceoutParameter[i].Parametername << endl ;
1166 DataService( _Orb , aService , Graph_prof_debug() , Graph_fdebug() ) ;
1168 // Restore input datas :
1169 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1170 // iN = (GraphEditor::InNode * ) GraphNodes( i ) ;
1171 iN = GraphNodes( i ) ;
1172 for ( j = 1 ; j < iN->GetNodeInPortsSize() ; j++ ) {
1173 GraphBase::InPort *anInPort = iN->GetChangeNodeInPort(j) ;
1174 if ( anInPort->IsDataConnected() ) {
1175 // GraphBase::Graph::AddInputData( anInPort->NodeName() ,
1176 AddInputData( anInPort->NodeName() ,
1177 anInPort->PortName() ,
1178 anInPort->GetOutPort()->ValuePtr() ) ;
1183 cdebug_out << "GraphBase::Graph::CreateService" << endl;
1187 bool GraphBase::Graph::InLineServices() {
1188 cdebug_in << "GraphBase::Graph::InLineServices" << endl;
1191 GraphBase::InLineNode * aINode ;
1192 SALOME_ModuleCatalog::Service aService ;
1193 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1194 aINode = (GraphBase::InLineNode * ) GraphNodes( i ) ;
1195 if ( aINode->IsOneOfInLineNodes() ) {
1196 cdebug << "GraphBase::Graph::InLineServices " << aINode->Name() << endl;
1197 aService.ServiceName = aINode->ServiceName() ;
1198 aService.ServiceinParameter.length( 0 ) ;
1199 aService.ServiceoutParameter.length( 0 ) ;
1201 for ( j = 0 ; j < aINode->GetNodeInPortsSize() ; j++ ) {
1202 if ( aINode->GetChangeNodeInPort(j)->IsGate() ||
1203 aINode->GetChangeNodeInPort(j)->IsLoop() ) {
1204 cdebug << "GraphBase::Graph::InLineServices In" << j << " "
1205 << aINode->GetChangeNodeInPort(j)->Kind() << " "
1206 << aINode->GetChangeNodeInPort(j)->PortType() << " "
1207 << aINode->GetChangeNodeInPort(j)->PortName() << " ignored "
1208 << aINode->GetChangeNodeInPort(j)->IsGate() << " "
1209 << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
1212 aService.ServiceinParameter.length( InService+1 ) ;
1213 aService.ServiceinParameter[InService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortType() ) ;
1214 aService.ServiceinParameter[InService++].Parametername = CORBA::string_dup( aINode->GetChangeNodeInPort(j)->PortName() ) ;
1215 cdebug << "GraphBase::Graph::InLineServices In" << j << " "
1216 << aINode->GetChangeNodeInPort(j)->Kind() << " "
1217 << aINode->GetChangeNodeInPort(j)->PortType() << " "
1218 << aINode->GetChangeNodeInPort(j)->PortName() << " "
1219 << aINode->GetChangeNodeInPort(j)->IsGate() << " "
1220 << aINode->GetChangeNodeInPort(j)->IsLoop() << endl;
1223 int OutService = 0 ;
1224 for ( j = 0 ; j < aINode->GetNodeOutPortsSize() ; j++ ) {
1225 if ( aINode->GetChangeNodeOutPort(j)->IsGate() ||
1226 aINode->GetChangeNodeOutPort(j)->IsLoop() ) {
1227 cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
1228 << aINode->GetChangeNodeOutPort(j)->Kind() << " "
1229 << aINode->GetChangeNodeOutPort(j)->PortType() << " "
1230 << aINode->GetChangeNodeOutPort(j)->PortName() << " ignored "
1231 << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
1232 << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
1235 aService.ServiceoutParameter.length( OutService+1 ) ;
1236 aService.ServiceoutParameter[OutService].Parametertype = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortType() ) ;
1237 aService.ServiceoutParameter[OutService++].Parametername = CORBA::string_dup( aINode->GetChangeNodeOutPort(j)->PortName() ) ;
1238 cdebug << "GraphBase::Graph::InLineServices Out" << j << " "
1239 << aINode->GetChangeNodeOutPort(j)->Kind() << " "
1240 << aINode->GetChangeNodeOutPort(j)->PortType() << " "
1241 << aINode->GetChangeNodeOutPort(j)->PortName() << " "
1242 << aINode->GetChangeNodeOutPort(j)->IsGate() << " "
1243 << aINode->GetChangeNodeOutPort(j)->IsLoop() << endl;
1246 aINode->SetService( aService ) ;
1247 cdebug << "GraphBase::Graph::InLineServices" << *aINode->GetService() << endl;
1251 cdebug_out << "GraphBase::Graph::InLineServices" << endl;
1255 bool GraphBase::Graph::Sort() {
1258 int NotSortedNumber = GraphNodesSize() ;
1260 if ( NotSortedNumber ) {
1262 _ParallelExecutionNodes = false ;
1263 _Sorted.resize( GraphNodesSize() ) ;
1264 _CnxInPortsNumber.resize( GraphNodesSize() ) ;
1265 _DecrInPortsNumber.resize( GraphNodesSize() ) ;
1266 if ( _NodesNumber.size() )
1267 _NodesNumber.resize( 0 ) ;
1268 _SortedNodes.resize( 0 ) ;
1269 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1270 _Sorted[ i ] = false ;
1271 _CnxInPortsNumber[ i ] = GraphNodes( i )->ConnectedInPortsNumber() ;
1272 _DecrInPortsNumber[ i ] = 0 ;
1274 while ( NotSortedNumber ) {
1276 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1277 cdebug << "Sort level " << _LevelsNumber << ". [" << i << "] "
1278 << GraphNodes( i )->Name() << " count "
1279 << _CnxInPortsNumber[ i ] << endl ;
1280 if ( !_Sorted[ i ] && _CnxInPortsNumber[ i ] == 0 ) {
1281 // All inputs of GraphNodes( i ) are available
1282 if ( _NodesNumber.size() != _LevelsNumber+1 ) {
1283 _NodesNumber.resize( _LevelsNumber+1 ) ;
1284 _SortedNodes.resize( _LevelsNumber+1 ) ;
1285 _NodesNumber[ _LevelsNumber ] = -1 ;
1287 _NodesNumber[ _LevelsNumber ]++ ;
1288 (_SortedNodes[ _LevelsNumber ]).resize( _NodesNumber[ _LevelsNumber ]+1 ) ;
1289 (_SortedNodes[ _LevelsNumber ])[ _NodesNumber[ _LevelsNumber ] ] = GraphNodes( i ) ;
1290 _Sorted[ i ] = true ;
1292 cdebug << GraphNodes( i )->Name() << " belongs to level "
1293 << _LevelsNumber << "." << endl ;
1294 for ( j = 0 ; j < GraphNodes( i )->LinkedNodesSize() ; j++ ) {
1295 // Outputs of GraphNodes( i ) will satisfy
1296 // GraphNodes( i )->LinkedInPortsNumber( j ) InPorts of
1297 // GraphNodes( i )->LinkedNodes( j )
1298 GraphBase::ComputingNode * aLinkedNode = GraphNodes( i )->LinkedNodes( j ) ;
1299 int aLinkedInPortsNumber = GraphNodes( i )->LinkedInPortsNumber( j ) ;
1300 cdebug << j << ". LinkedNode " << aLinkedNode->Name() ;
1301 if ( !aLinkedNode->IsDataFlowNode() ) {
1302 cdebug << " _DecrInPortsNumber[ "
1303 << GetGraphNodeIndex( aLinkedNode->Name() )
1305 << _DecrInPortsNumber[ GetGraphNodeIndex( aLinkedNode->Name() ) ]
1306 << " += " << aLinkedInPortsNumber ;
1307 _DecrInPortsNumber[ GetGraphNodeIndex( aLinkedNode->Name() ) ] += aLinkedInPortsNumber ;
1310 // GraphNodes( i )->LinkedNodes( j )->IncrDecrConnectedInPortsNumber( GraphNodes( i )->LinkedInPortsNumber( j ) ) ;
1315 cdebug << "Loop detected level " << _LevelsNumber << endl ;
1316 return false ; // Loop in the Graph
1318 cdebug << "Bilan level " << _LevelsNumber << " : " << endl ;
1319 bool ChangeCount = false ;
1320 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1321 // if ( GraphNodes( i )->DecrIncrDecrConnectedInPortsNumber() ) {
1322 if ( _DecrInPortsNumber[ i ] ) {
1323 int prevcount = _CnxInPortsNumber[ i ] ;
1324 _CnxInPortsNumber[ i ] -= _DecrInPortsNumber[ i ] ;
1325 _DecrInPortsNumber[ i ] = 0 ;
1326 ChangeCount = true ;
1327 cdebug << " " << GraphNodes( i )->Name() << " count " << prevcount
1328 << " --> new count " << _CnxInPortsNumber[ i ] << endl ;
1333 _LevelsNumber += 1 ;
1336 int AllSortedNodes = 0 ;
1337 _HeadNodes = _SortedNodes[ 0 ] ;
1338 _HeadNodesSize = _SortedNodes[ 0 ].size() ;
1339 _QueueNodes = _SortedNodes[ _LevelsNumber ] ;
1340 _QueueNodesSize = _SortedNodes[ _LevelsNumber ].size() ;
1341 for ( i = 0 ; i < _QueueNodesSize ; i++ ) {
1342 if ( !_QueueNodes[ i ]->IsGOTONode() ) {
1346 if ( i == _QueueNodesSize && _LevelsNumber ) {
1347 _QueueNodes = _SortedNodes[ _LevelsNumber - 1 ] ;
1348 _QueueNodesSize = _SortedNodes[ _LevelsNumber - 1 ].size() ;
1350 for ( i = 0 ; i <= _LevelsNumber ; i++ ) {
1351 AllSortedNodes += _NodesNumber[ i ]+1 ;
1352 if ( _NodesNumber[ i ] + 1 > _ThreadsMax )
1353 _ThreadsMax = _NodesNumber[ i ] + 1 ;
1354 cdebug << _NodesNumber[ i ]+1 << " Nodes of level " << i << " : "
1355 << (_SortedNodes[ i ])[ 0 ]->Name() << endl ;
1356 for ( j = 1 ; j <= _NodesNumber[ i ] ; j++ ) {
1357 _ParallelExecutionNodes = true ;
1358 cdebug << " " << (_SortedNodes[ i ])[ j ]->Name()
1362 if ( _ParallelExecutionNodes ) {
1363 cdebug << "Parallel Execution Nodes detected." << endl ;
1366 cdebug << "No Parallel Execution Nodes detected." << endl ;
1368 if ( AllSortedNodes != GraphNodesSize() ) {
1369 cdebug << "Loop detected level " << _LevelsNumber << endl ;
1370 return false ; // Loop in the Graph
1373 for ( i= 0 ; i <= _NodesNumber[ 0 ] ; i++ ) {
1374 (_SortedNodes[ 0 ])[ i ]->HeadNode( true ) ;
1377 for ( i = 0 ; i <= _NodesNumber[ 0 ] ; i++ ) {
1378 (_SortedNodes[ 0 ])[ i ]->Level( 0 ) ;
1379 (_SortedNodes[ 0 ])[ i ]->SubGraph( i + 1 ) ;
1381 for ( i = 1 ; i <= _LevelsNumber ; i++ ) {
1382 for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
1383 (_SortedNodes[ i ])[ j ]->Level( i ) ;
1384 (_SortedNodes[ i ])[ j ]->SubGraph( 0 ) ;
1387 bool Graphs = true ;
1389 for ( i = 0 ; i <= _LevelsNumber ; i++ ) {
1390 for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
1391 GraphBase::ComputingNode * aNode = (_SortedNodes[ i ])[ j ] ;
1392 cdebug << "Graph " << aNode->SubGraph() << " " << aNode->Name()
1395 for ( k = 0 ; k < aNode->LinkedNodesSize() ; k++ ) {
1396 if ( aNode->LinkedNodes( k )->SubGraph() ) {
1397 if ( aNode->LinkedNodes( k )->SubGraph() != aNode->SubGraph() &&
1398 aNode->LinkedNodes( k )->Level() == aNode->Level()+1 ) {
1399 aNode->SubGraph( aNode->LinkedNodes( k )->SubGraph() ) ;
1400 cdebug << " Linked " << aNode->LinkedNodes( k )->Name()
1401 << " Graph(" << aNode->LinkedNodes( k )->SubGraph()
1402 << ") ==>" << endl ;
1403 cdebug << " Graph " << aNode->SubGraph() << " for "
1404 << aNode->Name() << " ==> again" << endl ;
1406 for ( l = 0 ; l < aNode->LinkedNodesSize() ; l++ ) {
1407 aNode->LinkedNodes( l )->SubGraph( aNode->SubGraph() ) ;
1413 cdebug << " Linked " << aNode->LinkedNodes( k )->Name()
1414 << " Graph(" << aNode->LinkedNodes( k )->SubGraph()
1415 << ") distance > 1 ignored" << endl ;
1419 cdebug << " Linked " << aNode->LinkedNodes( k )->Name()
1420 << " GraphInit to " << aNode->SubGraph() << " from "
1421 << aNode->Name() << endl ;
1422 aNode->LinkedNodes( k )->SubGraph( aNode->SubGraph() ) ;
1430 cdebug << endl << "Graphs result : " << endl ;
1433 cdebug << endl << "One more time" << endl ;
1437 int CurrGraphsNumber = 0;
1439 for ( k = 0 ; k <= _NodesNumber[ 0 ] ; k++ ) {
1440 if ( (_SortedNodes[ 0 ])[ k ]->SubGraph() > CurrGraphsNumber ) {
1441 CurrGraphsNumber = (_SortedNodes[ 0 ])[ k ]->SubGraph() ;
1442 _GraphsNumber += 1 ;
1443 for ( i = 0 ; i <= _LevelsNumber ; i++ ) {
1444 for ( j = 0 ; j <= _NodesNumber[ i ] ; j++ ) {
1445 if ( (_SortedNodes[ i ])[ j ]->SubGraph() == CurrGraphsNumber ) {
1446 (_SortedNodes[ i ])[ j ]->SubGraph( _GraphsNumber ) ;
1447 cdebug << "GraphsNumber " << _GraphsNumber << " " << " Level "
1448 << i << " : " << (_SortedNodes[ i ])[ j ]->Name()
1460 // Controle de la coherence des noeuds de calcul
1461 // Enregistrement dans la liste des noeuds "tete" de graphe
1463 bool GraphBase::Graph::ComputingNodes() const {
1464 bool RetVal = true ;
1465 cdebug << "GraphExecutor::GraphControl::ComputingNodes ()" << endl;
1467 // list<GraphEditor::Node *> aComputingNodesList = _G->ComputingNodesList() ;
1468 // list<GraphEditor::Node *>::iterator iN = aComputingNodesList.begin();
1469 // GraphEditor::Port * iP;
1471 // for (iN = _G->ComputingNodesList().begin(); iN !=_G->ComputingNodesList().end(); iN++) {
1472 // while ( iN != aComputingNodesList.end() ) {
1474 GraphBase::ComputingNode * iN ;
1475 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1476 iN = GraphNodes( i ) ;
1477 // Tous les ports d'entree de tous les noeuds de calcul sont bien connectes
1478 // Enregistrement eventuel dans la liste des noeuds "tete" de graphe
1479 // if ((*iN)->GetNodeInPortsSize() == 0)
1480 // _headNodes.push_front(*iN);
1482 for ( j = 1; j < iN->GetNodeInPortsSize() ; j++ ) {
1483 const GraphBase::InPort *iP = iN->GetNodeInPort(j);
1484 if ( !iP->IsConnected() ){
1485 cdebug << "Le port d'entree " << iP->PortName()
1486 << " du noeud de calcul " << iN->Name() << " du graphe "
1487 << Name() << " n'est pas connecte "<< endl;
1493 // Tous les noeuds de calcul ont au moins un port de sortie connecte
1494 bool oneOutPortConnected = false;
1495 for ( j = 1; j < iN->GetNodeOutPortsSize() ; j++) {
1496 const GraphBase::OutPort *iP = iN->GetNodeOutPort(j);
1497 if ( iP->IsPortConnected() || iP->IsDataConnected() ){
1498 oneOutPortConnected = true ;
1502 cdebug << "Le port de sortie " << iP->PortName()
1503 << " du noeud de calcul " << iN->Name() << " du graphe "
1504 << Name() << " n'est pas connecte "<< endl;
1508 if (!oneOutPortConnected) {
1509 cdebug << "Le noeud de calcul " << iN->Name() << " du graphe "
1510 << Name() << " n'a aucun port de sortie connecte "<< endl;
1511 // _computingError.push_front(2);
1514 // return _computingError.size () ;
1518 // Controle de la coherence des noeuds de calcul
1519 // Enregistrement dans la liste des noeuds "tete" de graphe
1521 bool GraphBase::Graph::DataServerNodes() const {
1523 cdebug << "GraphBase::Graph::DataServerNodes ()" << endl;
1525 // const GraphExecutor::InNode *DataFlowDatas = GetDataFlowDatas() ;
1526 int i , j , ierr = 0 ;
1528 // if ( DataFlowDatas == NULL ) {
1529 // MESSAGE( "No input data available in the DataFlow " << _G->Name() );
1533 // const GraphExecutor::InNode *DataFlowNode = _G->GetDataFlowNode() ;
1534 // MESSAGE( "DataServerNodes DataFlowNode : " << *DataFlowNode );
1536 // MESSAGE( "DataServerNodes DataFlowDatas : " << *DataFlowDatas );
1538 // cout are inversed because DataFlowDatas is a mirror node of the DataFlow
1540 ierr = CheckDataServerNodes() ;
1542 // list<GraphExecutor::InNode *> aComputingNodesList = _G->ComputingNodesList() ;
1543 // list<GraphExecutor::InNode *>::iterator iN = aComputingNodesList.begin();
1544 if ( GraphNodesSize() == 0 ) {
1548 GraphBase::ComputingNode * iN ;
1549 for ( i = 0 ; i < GraphNodesSize() ; i++ ) {
1550 iN = GraphNodes( i ) ;
1551 // while ( iN != aComputingNodesList.end() ) {
1552 if ( iN->IsFactoryNode() ) {
1553 GraphBase::FactoryNode * FiN = (GraphBase::FactoryNode * ) iN ;
1554 if ( !strlen( FiN->Computer() ) ) {
1555 cdebug << "ComputerName missing for node " << FiN->Name() ;
1556 if ( !strlen( FiN->Computer() ) ) {
1561 cdebug << ". " << FiN->Computer() << " will be used." << endl ;
1565 // For Outputs of the DataFlow :
1566 for ( j = 0 ; j < iN->GetNodeOutPortsSize() ; j++ ) {
1567 if ( !iN->GetNodeOutPort(j)->IsConnected() ) {
1568 iN->AddLink( (GraphBase::ComputingNode *) this ) ;
1574 // Chaque noeud dataserver ne possede qu'un seul port entree ou sortie et il est bien connecte
1576 // list<GraphExecutor::InNode *> aDataServerNodesList = _G->DataServerNodesList() ;
1577 // list<GraphExecutor::InNode *>::iterator it = aDataServerNodesList.begin() ;
1579 // for (it = _G->DataServerNodesList().begin(); it !=_G->DataServerNodesList().end(); it++){
1580 // while ( it != aDataServerNodesList.end() ) {
1581 // if ( (*it)->GetNodeOutPortsSize() && (*it)->GetNodeInPortsSize() ) {
1582 // cerr << "Erreur dans le noeud serveur de donnees "
1583 // << (*it)->Name() << " du graphe " << _G->Name() << endl;
1584 // cerr << "A la fois importation et exportation de donnees" << endl;
1585 // _dataServerError.push_front(1);
1588 // if ((*it)->GetNodeOutPortsSize()) {
1589 // if ((*it)->GetNodeOutPortsSize()==1){
1590 // if ( (*it)->GetNodeOutPort(0)->IsPortConnected() ){
1591 // _headNodes.push_front(*it);
1594 // cerr << "Le port de sortie du noeud serveur de donnees "
1595 // << (*it)->Name() << " du graphe " << _G->Name()
1596 // << " n'est pas connecte "<< endl;
1597 // _dataServerError.push_front(4);
1601 // cerr << "Plus d'une donnee importee du noeud serveur de donnees "
1602 // << (*it)->Name() << " du graphe " << _G->Name() << endl;
1603 // _dataServerError.push_front(2);
1607 // if ((*it)->GetNodeInPortsSize()) {
1608 // if ((*it)->GetNodeInPortsSize() > 1){
1609 // cerr << "Plus d'une donnee exportee vers le noeud serveur de donnees "
1610 // << (*it)->Name() << " du graphe " << _G->Name() << endl;
1611 // _dataServerError.push_front(3);
1614 // if ( !(*it)->GetNodeInPort(0)->IsPortConnected() ){
1615 // cerr << "Le port d'entree du noeud serveur de donnees "
1616 // << (*it)->Name() << " du graphe " << _G->Name()
1617 // << " n'est pas connecte "<< endl;
1618 // _dataServerError.push_front(5);
1624 // return _dataServerError.size ();
1625 return ( ierr == 0 ) ;
1628 SUPERV::GraphState GraphBase::Graph::PortState(
1629 const char* NodeName ,
1630 const char* ServiceParameterName ) {
1631 SUPERV::GraphState aRet = SUPERV::UndefinedState ;
1632 // cdebug << "GraphBase::Graph::PortState( " << NodeName << " , "
1633 // << ServiceParameterName << " )" << endl ;
1637 NodePort( NodeName , ServiceParameterName , &theNode , &aPort ) ;
1639 GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ;
1641 GraphBase::OutPort *anOutPort ;
1642 anOutPort = aNode->GetChangeOutPort( aPort );
1643 if ( anOutPort == NULL ) {
1644 GraphBase::InPort *anInPort = aNode->GetChangeInPort( aPort );
1646 anOutPort = anInPort->GetOutPort() ;
1648 cdebug << "GraphBase::Graph::PortState OutPort/InPort not found --> "
1653 aRet = anOutPort->State() ;
1654 // cdebug << "GraphBase::Graph::PortState --> " << aRet << endl ;
1658 cdebug << "GraphBase::Graph::PortState Node not found --> " << aRet
1666 const CORBA::Any * GraphBase::Graph::PortInData( const char* ToNodeName ,
1667 const char* ToServiceParameterName ) {
1668 const CORBA::Any * aRet = new CORBA::Any() ;
1671 cdebug_in << "GraphBase::Graph::PortData " << ToNodeName << " "
1672 << ToServiceParameterName << endl ;
1673 NodePort( ToNodeName , ToServiceParameterName , &theNode , &aPort ) ;
1675 GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ;
1678 GraphBase::OutPort *anOutPort = NULL ;
1679 GraphBase::InPort *anInPort = aNode->GetChangeInPort( aPort );
1681 anOutPort = anInPort->GetOutPort() ;
1683 aRet = anOutPort->Value() ;
1684 cdebug << "OutPort value " << anOutPort->NodeName() << "("
1685 << anOutPort->PortName() << ") --> InPort " << anInPort->NodeName()
1686 << "(" << anInPort->PortName() << ")" << endl ;
1692 cdebug_out << "GraphBase::Graph::PortData " << endl ;
1696 const CORBA::Any * GraphBase::Graph::PortOutData( const char* FromNodeName ,
1697 const char* FromServiceParameterName ) {
1698 const CORBA::Any * aRet = new CORBA::Any() ;
1701 cdebug_in << "GraphBase::Graph::PortOutData " << FromNodeName << " "
1702 << FromServiceParameterName << endl ;
1703 NodePort( FromNodeName , FromServiceParameterName , &theNode , &aPort ) ;
1705 GraphBase::ComputingNode * aNode = GetChangeGraphNode( theNode ) ;
1708 GraphBase::OutPort *anOutPort ;
1709 anOutPort = aNode->GetChangeOutPort( aPort );
1711 aRet = anOutPort->Value() ;
1715 cdebug_out << "GraphBase::Graph::PortOutData " << endl ;
1719 SUPERV::ListOfStrings * GraphBase::Graph::LevelNodes(long aLevel ) {
1720 SUPERV::ListOfStrings_var RetVal = new SUPERV::ListOfStrings;
1721 if ( aLevel >= 0 && aLevel <= _LevelsNumber ) {
1723 RetVal->length( _NodesNumber[ aLevel ] + 1 );
1724 for ( i= 0 ; i <= _NodesNumber[ aLevel ] ; i++ ) {
1725 RetVal[i] = CORBA::string_dup( (_SortedNodes[ aLevel ])[ i ]->Name() ) ;
1728 return ( RetVal._retn() ) ;
1731 bool GraphBase::Graph::StartComponent(const int aThread ,
1732 const char * aComputerContainer ,
1733 const char * ComponentName ,
1734 Engines::Container_var & myContainer ,
1735 Engines::Component_var & objComponent ) {
1736 cdebug_in << aThread
1737 << " GraphBase::Graph::StartComponent " << aComputerContainer
1738 << " " << ComponentName << endl;
1739 bool RetVal = true ;
1741 SALOME_LifeCycleCORBA LCC( NamingService() ) ;
1742 objComponent = LCC.FindOrLoad_Component( aComputerContainer ,
1744 if ( CORBA::is_nil( objComponent ) ) {
1745 cdebug_out << aThread
1746 << " StartComponent cannot FindOrLoad " << aComputerContainer
1747 << " " << ComponentName << endl;
1751 myContainer = LCC.FindContainer( aComputerContainer );
1752 if ( CORBA::is_nil( myContainer ) ) {
1753 cdebug_out << aThread
1754 << " GraphBase::Graph::StartComponent myContainer = LCC.FindContainer( '"
1755 << aComputerContainer << "' ) Container does not exist"
1760 cdebug_out << aThread << " GraphBase::Graph::StartComponent" << endl;