]> SALOME platform Git repositories - modules/superv.git/blob - src/GraphBase/DataFlowBase_LoopNode.cxx
Salome HOME
a53abe70643e0a98720276e6efbbe2cf2c08c349
[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  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
6 //  This library is free software; you can redistribute it and/or 
7 //  modify it under the terms of the GNU Lesser General Public 
8 //  License as published by the Free Software Foundation; either 
9 //  version 2.1 of the License. 
10 // 
11 //  This library is distributed in the hope that it will be useful, 
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of 
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
14 //  Lesser General Public License for more details. 
15 // 
16 //  You should have received a copy of the GNU Lesser General Public 
17 //  License along with this library; if not, write to the Free Software 
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
19 // 
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 //  File   : DataFlowBase_LoopNode.cxx
23 //  Author : Jean Rahuel, CEA
24 //  Module : SUPERV
25
26 using namespace std;
27 //#include <sstream>
28 //#include <iostream>
29
30 #include "DataFlowBase_LoopNode.hxx"
31
32 GraphBase::LoopNode::LoopNode() :
33   GraphBase::GOTONode::GOTONode() {
34
35   cdebug << "GraphBase::LoopNode::LoopNode "  << this 
36          << " _Name " << (void *) Name() << " " << Name() << " _Comment "
37          << (void *) Comment() << " "  << Comment() << " "  << endl ;
38
39 }
40
41 GraphBase::LoopNode::LoopNode( CORBA::ORB_ptr ORB ,
42                                SALOME_NamingService* ptrNamingService ,
43                                const char * InitName ,
44                                const SUPERV::ListOfStrings & anInitPythonFunction ,
45                                const char * MoreName ,
46                                const SUPERV::ListOfStrings & aMorePythonFunction ,
47                                const char * NextName ,
48                                const SUPERV::ListOfStrings & aNextPythonFunction ,
49                                const char *NodeName ,
50                                const SUPERV::KindOfNode akind ,
51                                const SUPERV::SDate NodeFirstCreation ,
52                                const SUPERV::SDate NodeLastModification  ,
53                                const char * NodeEditorRelease ,
54                                const char * NodeAuthor ,
55                                const char * NodeComment ,
56                                const bool   GeneratedName ,
57                                const long   X ,
58                                const long   Y ,
59                                int * Graph_prof_debug ,
60                                ofstream * Graph_fdebug ) :
61   GraphBase::GOTONode::GOTONode( ORB , ptrNamingService , InitName , anInitPythonFunction ,
62                                  NodeName , akind , NodeFirstCreation ,
63                                  NodeLastModification  , NodeEditorRelease ,
64                                  NodeAuthor , NodeComment , GeneratedName ,
65                                  X , Y , Graph_prof_debug , Graph_fdebug ) {
66
67   cdebug_in << "GraphBase::LoopNode::LoopNode "  << this 
68             << "' _Name " << (void *) Name() << " '" << Name() << " _Comment "
69             << (void *) Comment() << " "  << Comment() << " " 
70             << " KindOfNode " << Kind() << " InitName " << InitName
71             << " MoreName " << MoreName << " NextName " << NextName
72             << " ServiceName " << ServiceName() << " In("
73             << ServiceInParameter().length()
74             << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
75
76   _MyPyMoreMethod = NULL ;
77   _MyPyNextMethod = NULL ;
78
79   cdebug << "GraphBase::LoopNode::LoopNode SetMorePythonFunction " << MoreName << " " ;
80   if ( aMorePythonFunction.length() ) {
81     cdebug << aMorePythonFunction[0] ;
82   }
83   cdebug << endl ;
84   SetMorePythonFunction( MoreName , aMorePythonFunction ) ;
85   cdebug << "GraphBase::LoopNode::LoopNode SetNextPythonFunction " << NextName << " " ;
86   if ( aNextPythonFunction.length() ) {
87     cdebug << aNextPythonFunction[0] ;
88   }
89   cdebug << endl ;
90   SetNextPythonFunction( NextName , aNextPythonFunction ) ;
91
92   cdebug_out << "GraphBase::LoopNode::LoopNode" << endl;
93 }
94
95 GraphBase::LoopNode::~LoopNode() {
96   cdebug << "GraphBase::Node::~Node "  << this 
97          << " _Name " << (void *) Name() << " " << Name() << " _Comment "
98          << (void *) Comment() << " "  << Comment() << " "  << endl ;
99 //  if ( _ComponentName != NULLSTRING )
100 //    delete [] _ComponentName ;
101 //  delete [] _Name ;
102 //  delete [] _EditorRelease ;
103 //  if ( _Author != NULLSTRING )
104 //    delete [] _Author ;
105 //  if ( _Computer != FACTORYSERVER )
106 //    delete [] _Computer;
107 //  if ( Comment() != NULLSTRING )
108 //    delete [] Comment();
109 }
110
111 //bool GraphBase::LoopNode::SaveXML( ostream &f , char *Tabs ,
112 bool GraphBase::LoopNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
113                                    int XCoordinate , int YCoordinate ) {
114   GraphBase::ListOfPythonFunctions aPythonFunction ;
115   aPythonFunction.resize( 3 ) ;
116   aPythonFunction[0] = PythonFunction() ;
117   aPythonFunction[1] = MorePythonFunction() ;
118   aPythonFunction[2] = NextPythonFunction() ;
119   GraphBase::ListOfFuncName aFuncNames ; 
120   aFuncNames.resize( 3 ) ;
121 //JR 24.02.2005 Memory Leak  aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
122   aFuncNames[0] = string( PyFuncName() ) ;
123 //JR 24.02.2005 Memory Leak  aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ;
124   aFuncNames[1] = string( PyMoreName() ) ;
125 //JR 24.02.2005 Memory Leak  aFuncNames[2] = CORBA::string_dup( PyNextName() ) ;
126   aFuncNames[2] = string( PyNextName() ) ;
127   char * CoupledName = "" ;
128   if ( CoupledNode() ) {
129     CoupledName = CoupledNode()->Name() ;
130   }
131 //  return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" ,
132   return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" ,
133                                             CoupledName ,
134                                             aFuncNames , aPythonFunction ,
135                                             XCoordinate , YCoordinate ) ;
136 }
137
138 bool GraphBase::LoopNode::SavePY( ostream &f , const char * aGraphName ,
139                                   int XCoordinate , int YCoordinate ) {
140   GraphBase::ListOfPythonFunctions aPythonFunction ;
141   aPythonFunction.resize( 3 ) ;
142   aPythonFunction[0] = PythonFunction() ;
143   aPythonFunction[1] = MorePythonFunction() ;
144   aPythonFunction[2] = NextPythonFunction() ;
145   GraphBase::ListOfFuncName aFuncNames ; 
146   aFuncNames.resize( 3 ) ;
147 //JR 24.02.2005 Memory Leak  aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
148   aFuncNames[0] = string( PyFuncName() ) ;
149 //JR 24.02.2005 Memory Leak  aFuncNames[1] = CORBA::string_dup( PyMoreName() ) ;
150   aFuncNames[1] = string( PyMoreName() ) ;
151 //JR 24.02.2005 Memory Leak  aFuncNames[2] = CORBA::string_dup( PyNextName() ) ;
152   aFuncNames[2] = string( PyNextName() ) ;
153   return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" ,
154                                            CoupledNode() ,
155                                            aFuncNames , aPythonFunction ,
156                                            XCoordinate , YCoordinate ) ;
157 }
158