1 // SUPERV GraphBase : contains fondamental classes for Services, Input Ports, Output Ports Links and Nodes.
3 // Copyright (C) 2003 CEA/DEN, EDF R&D
7 // File : DataFlowBase_GOTONode.cxx
8 // Author : Jean Rahuel, CEA
16 #include "DataFlowBase_GOTONode.hxx"
18 GraphBase::GOTONode::GOTONode() :
19 GraphBase::InLineNode::InLineNode() {
22 _CoupledNodeName = NULL ;
23 cdebug << "GraphBase::GOTONode::GOTONode " << this
24 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
25 << (void *) Comment() << " " << Comment() << " " << endl ;
29 GraphBase::GOTONode::GOTONode( CORBA::ORB_ptr ORB ,
30 SALOME_NamingService* ptrNamingService ,
31 const char *DataFlowName ,
32 const SUPERV::KindOfNode DataFlowkind ,
33 int * Graph_prof_debug ,
34 ofstream * Graph_fdebug ) :
35 GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , DataFlowName , DataFlowkind , Graph_prof_debug , Graph_fdebug ) {
38 _CoupledNodeName = NULL ;
39 cdebug << "GraphBase::GOTONode::GOTONode " << this
40 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
41 << (void *) Comment() << " " << Comment() << " " << endl ;
45 GraphBase::GOTONode::GOTONode( CORBA::ORB_ptr ORB ,
46 SALOME_NamingService* ptrNamingService ,
47 const char *FuncName ,
48 const SUPERV::ListOfStrings & aPythonFunction ,
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 ,
59 int * Graph_prof_debug ,
60 ofstream * Graph_fdebug ) :
61 GraphBase::InLineNode::InLineNode( ORB , ptrNamingService , FuncName , aPythonFunction ,
62 NodeName , akind , NodeFirstCreation ,
63 NodeLastModification , NodeEditorRelease ,
64 NodeAuthor , NodeComment , GeneratedName ,
65 X , Y , Graph_prof_debug , Graph_fdebug ) {
68 _CoupledNodeName = NULL ;
69 cdebug_in << "GraphBase::GOTONode::GOTONode " << this
70 << "' _Name " << (void *) Name() << " '" << Name() << " _Comment "
71 << (void *) Comment() << " " << Comment() << " "
72 << " KindOfNode " << Kind() << " FuncName " << FuncName
73 << " ServiceName " << ServiceName() << " In("
74 << ServiceInParameter().length()
75 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
77 cdebug_out << "GraphBase::GOTONode::GOTONode" << endl;
80 GraphBase::GOTONode::~GOTONode() {
81 cdebug << "GraphBase::GOTONode::~GOTONode " << this
82 << " _Name " << (void *) Name() << " " << Name() << " _Comment "
83 << (void *) Comment() << " " << Comment() << " " << endl ;
84 // if ( _ComponentName != NULLSTRING )
85 // delete [] _ComponentName ;
87 // delete [] _EditorRelease ;
88 // if ( _Author != NULLSTRING )
89 // delete [] _Author ;
90 // if ( _Computer != FACTORYSERVER )
91 // delete [] _Computer;
92 // if ( _Comment != NULLSTRING )
93 // delete [] _Comment;
96 void GraphBase::GOTONode::CoupledNode( GraphBase::InLineNode * aCoupledNode ) {
97 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode( " ;
99 CoupledNodeName( aCoupledNode->Name() ) ;
100 cdebug << aCoupledNode->Name() ;
105 cdebug << " )" << endl ;
106 _CoupledNode = aCoupledNode ;
109 const GraphBase::InLineNode * GraphBase::GOTONode::CoupledNode() const {
110 // cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ;
111 // if ( _CoupledNode ) {
112 // cdebug << _CoupledNode->Name() ;
115 // cdebug << "NULL" ;
118 return _CoupledNode ;
121 GraphBase::InLineNode * GraphBase::GOTONode::CoupledNode() {
122 // cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNode() --> " ;
123 // if ( _CoupledNode ) {
124 // cdebug << _CoupledNode->Name() ;
127 // cdebug << "NULL" ;
130 return _CoupledNode ;
133 void GraphBase::GOTONode::CoupledNodeName( const char * aCoupledNodeName ) {
134 if ( _CoupledNodeName ) {
135 delete [] _CoupledNodeName ;
137 _CoupledNodeName = new char [ strlen( aCoupledNodeName ) + 1 ] ;
138 strcpy( _CoupledNodeName , aCoupledNodeName ) ;
139 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> "
140 << (void * ) _CoupledNodeName << " = " << _CoupledNodeName << endl ;
142 char * GraphBase::GOTONode::CoupledNodeName() const {
143 cdebug << this << " " << Name() << " GraphBase::GOTONode::CoupledNodeName() --> " ;
144 if ( _CoupledNodeName ) {
145 cdebug << (void * ) _CoupledNodeName << " = " << _CoupledNodeName ;
150 //JR 17.02.2005 Memory Leak return my_strdup( _CoupledNodeName ) ;
151 return _CoupledNodeName ;
154 //bool GraphBase::GOTONode::SaveXML( ostream &f , char *Tabs ,
155 bool GraphBase::GOTONode::SaveXML( QDomDocument & Graph , QDomElement & info ,
156 int XCoordinate , int YCoordinate ) const {
157 GraphBase::ListOfFuncName aFuncNames ;
158 GraphBase::ListOfPythonFunctions aPythonFunction ;
159 if ( PyFuncName() ) {
160 aFuncNames.resize( 1 ) ;
161 //JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
162 aFuncNames[0] = string( PyFuncName() ) ;
163 aPythonFunction.resize( 1 ) ;
164 aPythonFunction[0] = PythonFunction() ;
166 char * CoupledName = "" ;
167 if ( CoupledNode() ) {
168 CoupledName = CoupledNode()->Name() ;
170 // return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" ,
171 return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" ,
173 aFuncNames , aPythonFunction ,
174 XCoordinate , YCoordinate ) ;
177 bool GraphBase::GOTONode::SavePY( ostream &f , const char * aGraphName ,
178 int XCoordinate , int YCoordinate ) const {
179 GraphBase::ListOfFuncName aFuncNames ;
180 GraphBase::ListOfPythonFunctions aPythonFunction ;
181 if ( PyFuncName() ) {
182 aFuncNames.resize( 1 ) ;
183 //JR 24.02.2005 Memory Leak aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
184 aFuncNames[0] = string( PyFuncName() ) ;
185 aPythonFunction.resize( 1 ) ;
186 aPythonFunction[0] = PythonFunction() ;
188 return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" ,
190 aFuncNames , aPythonFunction ,
191 XCoordinate , YCoordinate ) ;