1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File : DataFlowBase_GOTONode.cxx
23 // Author : Jean Rahuel, CEA
30 #include "DataFlowBase_GOTONode.hxx"
32 GraphBase::GOTONode::GOTONode() :
33 GraphBase::InLineNode::InLineNode() {
36 _CoupledNodeName = NULL ;
37 cdebug << "GraphBase::GOTONode::GOTONode " << this
38 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
39 << (void *) Comment() << " " << Comment() << " " << endl ;
43 GraphBase::GOTONode::GOTONode( CORBA::ORB_ptr ORB ,
44 SALOME_NamingService* ptrNamingService ,
45 const char *DataFlowName ,
46 const SUPERV::KindOfNode DataFlowkind ,
47 int * Graph_prof_debug ,
48 ofstream * Graph_fdebug ) :
49 GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , DataFlowName , DataFlowkind , Graph_prof_debug , Graph_fdebug ) {
52 _CoupledNodeName = NULL ;
53 cdebug << "GraphBase::GOTONode::GOTONode " << this
54 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
55 << (void *) Comment() << " " << Comment() << " " << endl ;
59 GraphBase::GOTONode::GOTONode( CORBA::ORB_ptr ORB ,
60 SALOME_NamingService* ptrNamingService ,
61 const char *FuncName ,
62 const SUPERV::ListOfStrings & aPythonFunction ,
63 const char *NodeName ,
64 const SUPERV::KindOfNode akind ,
65 const SUPERV::SDate NodeFirstCreation ,
66 const SUPERV::SDate NodeLastModification ,
67 const char * NodeEditorRelease ,
68 const char * NodeAuthor ,
69 const char * NodeComment ,
70 const bool GeneratedName ,
73 int * Graph_prof_debug ,
74 ofstream * Graph_fdebug ) :
75 GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , FuncName , aPythonFunction ,
76 NodeName , akind , NodeFirstCreation ,
77 NodeLastModification , NodeEditorRelease ,
78 NodeAuthor , NodeComment , GeneratedName ,
79 X , Y , Graph_prof_debug , Graph_fdebug ) {
82 _CoupledNodeName = NULL ;
83 cdebug_in << "GraphBase::GOTONode::GOTONode " << this
84 << "' _Name " << (void *) Name() << " '" << Name() << " _Comment "
85 << (void *) Comment() << " " << Comment() << " "
86 << " KindOfNode " << Kind() << " FuncName " << FuncName
87 << " ServiceName " << ServiceName() << " In("
88 << ServiceInParameter().length()
89 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
91 cdebug_out << "GraphBase::GOTONode::GOTONode" << endl;
94 GraphBase::GOTONode::~GOTONode() {
95 cdebug << "GraphBase::GOTONode::~GOTONode " << this
96 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
97 << (void *) Comment() << " " << Comment() << " " << endl ;
98 // if ( _ComponentName != NULLSTRING )
99 // delete [] _ComponentName ;
101 // delete [] _EditorRelease ;
102 // if ( _Author != NULLSTRING )
103 // delete [] _Author ;
104 // if ( _Computer != FACTORYSERVER )
105 // delete [] _Computer;
106 // if ( _Comment != NULLSTRING )
107 // delete [] _Comment;
110 #define CoupledNodeTrace 0
111 void GraphBase::GOTONode::CoupledNode( GraphBase::InLineNode * aCoupledNode ) {
113 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode( " ;
115 if ( aCoupledNode ) {
116 CoupledNodeName( aCoupledNode->Name() ) ;
118 cdebug << aCoupledNode->Name() ;
127 cdebug << " )" << endl ;
129 _CoupledNode = aCoupledNode ;
132 const GraphBase::InLineNode * GraphBase::GOTONode::CoupledNode() const {
134 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ;
135 if ( _CoupledNode ) {
136 cdebug << _CoupledNode->Name() ;
143 return _CoupledNode ;
146 GraphBase::InLineNode * GraphBase::GOTONode::CoupledNode() {
148 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ;
149 if ( _CoupledNode ) {
150 cdebug << _CoupledNode->Name() ;
157 return _CoupledNode ;
160 void GraphBase::GOTONode::CoupledNodeName( const char * aCoupledNodeName ) {
161 if ( _CoupledNodeName ) {
162 delete [] _CoupledNodeName ;
164 _CoupledNodeName = new char [ strlen( aCoupledNodeName ) + 1 ] ;
165 strcpy( _CoupledNodeName , aCoupledNodeName ) ;
167 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> "
168 << (void * ) _CoupledNodeName << " = " << _CoupledNodeName << endl ;
171 char * GraphBase::GOTONode::CoupledNodeName() const {
173 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> " ;
174 if ( _CoupledNodeName ) {
175 cdebug << (void * ) _CoupledNodeName << " = " << _CoupledNodeName << endl ;
178 cdebug << "NULL" << endl ;
181 //JR 17.02.2005 Memory Leak return my_strdup( _CoupledNodeName ) ;
182 return _CoupledNodeName ;
185 //bool GraphBase::GOTONode::SaveXML( ostream &f , char *Tabs ,
186 bool GraphBase::GOTONode::SaveXML( QDomDocument & Graph , QDomElement & info ,
187 int XCoordinate , int YCoordinate ) const {
188 GraphBase::ListOfFuncName aFuncNames ;
189 GraphBase::ListOfPythonFunctions aPythonFunction ;
190 if ( PyFuncName() ) {
191 aFuncNames.resize( 1 ) ;
192 //JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
193 aFuncNames[0] = string( PyFuncName() ) ;
194 aPythonFunction.resize( 1 ) ;
195 aPythonFunction[0] = PythonFunction() ;
197 char * CoupledName = "" ;
198 if ( CoupledNode() ) {
199 CoupledName = CoupledNode()->Name() ;
201 // return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" ,
202 return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" ,
204 aFuncNames , aPythonFunction ,
205 XCoordinate , YCoordinate ) ;
208 bool GraphBase::GOTONode::SavePY( ostream &f , const char * aGraphName ,
209 int XCoordinate , int YCoordinate ) const {
210 GraphBase::ListOfFuncName aFuncNames ;
211 GraphBase::ListOfPythonFunctions aPythonFunction ;
212 if ( PyFuncName() ) {
213 aFuncNames.resize( 1 ) ;
214 //JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
215 aFuncNames[0] = string( PyFuncName() ) ;
216 aPythonFunction.resize( 1 ) ;
217 aPythonFunction[0] = PythonFunction() ;
219 return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" ,
221 aFuncNames , aPythonFunction ,
222 XCoordinate , YCoordinate ) ;