Salome HOME
There was an error in the update of OutPort of Loop/EndLoopNodes (not used in the...
[modules/superv.git] / src / GraphBase / DataFlowBase_LoopNode.cxx
1 //  SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
2 //
3 //  Copyright (C) 2003  CEA/DEN, EDF R&D
4 //
5 //
6 //
7 //  File   : DataFlowBase_LoopNode.cxx
8 //  Author : Jean Rahuel, CEA
9 //  Module : SUPERV
10 //  $Header:
11
12 using namespace std;
13 //#include <sstream>
14 //#include <iostream>
15
16 #include "DataFlowBase_LoopNode.hxx"
17
18 GraphBase::LoopNode::LoopNode() :
19   GraphBase::GOTONode::GOTONode() {
20
21   cdebug << "GraphBase::LoopNode::LoopNode "  << this 
22          << " _Name " << (void *) Name() << " " << Name() << " _Comment "
23          << (void *) Comment() << " "  << Comment() << " "  << endl ;
24
25 }
26
27 GraphBase::LoopNode::LoopNode( CORBA::ORB_ptr ORB ,
28                                SALOME_NamingService* ptrNamingService ,
29                                const char * InitName ,
30                                const SUPERV::ListOfStrings & anInitPythonFunction ,
31                                const char * MoreName ,
32                                const SUPERV::ListOfStrings & aMorePythonFunction ,
33                                const char * NextName ,
34                                const SUPERV::ListOfStrings & aNextPythonFunction ,
35                                const char *NodeName ,
36                                const SUPERV::KindOfNode akind ,
37                                const SUPERV::SDate NodeFirstCreation ,
38                                const SUPERV::SDate NodeLastModification  ,
39                                const char * NodeEditorRelease ,
40                                const char * NodeAuthor ,
41                                const char * NodeComment ,
42                                const bool   GeneratedName ,
43                                const long   X ,
44                                const long   Y ,
45                                int * Graph_prof_debug ,
46                                ofstream * Graph_fdebug ) :
47   GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , InitName , anInitPythonFunction ,
48                                  NodeName , akind , NodeFirstCreation ,
49                                  NodeLastModification  , NodeEditorRelease ,
50                                  NodeAuthor , NodeComment , GeneratedName ,
51                                  X , Y , Graph_prof_debug , Graph_fdebug ) {
52
53   cdebug_in << "GraphBase::LoopNode::LoopNode "  << this 
54             << "' _Name " << (void *) Name() << " '" << Name() << " _Comment "
55             << (void *) Comment() << " "  << Comment() << " " 
56             << " KindOfNode " << Kind() << " InitName " << InitName
57             << " MoreName " << MoreName << " NextName " << NextName
58             << " ServiceName " << ServiceName() << " In("
59             << ServiceInParameter().length()
60             << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
61
62   _MyPyMoreMethod = NULL ;
63   _MyPyNextMethod = NULL ;
64
65   cdebug << "GraphBase::LoopNode::LoopNode SetMorePythonFunction " << MoreName << " " ;
66   if ( aMorePythonFunction.length() ) {
67     cdebug << aMorePythonFunction[0] ;
68   }
69   cdebug << endl ;
70   SetMorePythonFunction( MoreName , aMorePythonFunction ) ;
71   cdebug << "GraphBase::LoopNode::LoopNode SetNextPythonFunction " << NextName << " " ;
72   if ( aNextPythonFunction.length() ) {
73     cdebug << aNextPythonFunction[0] ;
74   }
75   cdebug << endl ;
76   SetNextPythonFunction( NextName , aNextPythonFunction ) ;
77
78   cdebug_out << "GraphBase::LoopNode::LoopNode" << endl;
79 }
80
81 GraphBase::LoopNode::~LoopNode() {
82   cdebug << "GraphBase::Node::~Node "  << this 
83          << " _Name " << (void *) Name() << " " << Name() << " _Comment "
84          << (void *) Comment() << " "  << Comment() << " "  << endl ;
85 //  if ( _ComponentName != NULLSTRING )
86 //    delete [] _ComponentName ;
87 //  delete [] _Name ;
88 //  delete [] _EditorRelease ;
89 //  if ( _Author != NULLSTRING )
90 //    delete [] _Author ;
91 //  if ( _Computer != FACTORYSERVER )
92 //    delete [] _Computer;
93 //  if ( Comment() != NULLSTRING )
94 //    delete [] Comment();
95 }
96
97 //bool GraphBase::LoopNode::SaveXML( ostream &f , char *Tabs ,
98 bool GraphBase::LoopNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
99                                    int XCoordinate , int YCoordinate ) {
100   GraphBase::ListOfPythonFunctions aPythonFunction ;
101   aPythonFunction.resize( 3 ) ;
102   aPythonFunction[0] = PythonFunction() ;
103   aPythonFunction[1] = MorePythonFunction() ;
104   aPythonFunction[2] = NextPythonFunction() ;
105   GraphBase::ListOfFuncName aFuncNames ; 
106   aFuncNames.resize( 3 ) ;
107 //JR 24.02.2005 Memory Leak  aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
108   aFuncNames[0] = string( PyFuncName() ) ;
109 //JR 24.02.2005 Memory Leak  aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ;
110   aFuncNames[1] = string( PyMoreName() ) ;
111 //JR 24.02.2005 Memory Leak  aFuncNames[2] = CORBA::string_dup( PyNextName() ) ;
112   aFuncNames[2] = string( PyNextName() ) ;
113   char * CoupledName = "" ;
114   if ( CoupledNode() ) {
115     CoupledName = CoupledNode()->Name() ;
116   }
117 //  return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" ,
118   return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" ,
119                                             CoupledName ,
120                                             aFuncNames , aPythonFunction ,
121                                             XCoordinate , YCoordinate ) ;
122 }
123
124 bool GraphBase::LoopNode::SavePY( ostream &f , const char * aGraphName ,
125                                   int XCoordinate , int YCoordinate ) {
126   GraphBase::ListOfPythonFunctions aPythonFunction ;
127   aPythonFunction.resize( 3 ) ;
128   aPythonFunction[0] = PythonFunction() ;
129   aPythonFunction[1] = MorePythonFunction() ;
130   aPythonFunction[2] = NextPythonFunction() ;
131   GraphBase::ListOfFuncName aFuncNames ; 
132   aFuncNames.resize( 3 ) ;
133 //JR 24.02.2005 Memory Leak  aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
134   aFuncNames[0] = string( PyFuncName() ) ;
135 //JR 24.02.2005 Memory Leak  aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ;
136   aFuncNames[1] = string( PyMoreName() ) ;
137 //JR 24.02.2005 Memory Leak  aFuncNames[2] = CORBA::string_dup( PyNextName() ) ;
138   aFuncNames[2] = string( PyNextName() ) ;
139   return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" ,
140                                            CoupledNode() ,
141                                            aFuncNames , aPythonFunction ,
142                                            XCoordinate , YCoordinate ) ;
143 }
144