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_InLineNode.cxx
8 // Author : Jean Rahuel, CEA
16 #include "DataFlowBase_InLineNode.hxx"
18 GraphBase::InLineNode::InLineNode() :
19 GraphBase::ComputingNode::ComputingNode() {
21 _PythonFunction = SUPERV::ListOfStrings() ;
22 _MyPyRunMethod = NULL ;
25 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
26 SALOME_NamingService* ptrNamingService ,
27 const char * aDataFlowName ,
28 const SUPERV::KindOfNode DataFlowkind ,
29 int * Graph_prof_debug ,
30 ofstream * Graph_fdebug ) :
31 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName , DataFlowkind ,
32 Graph_prof_debug , Graph_fdebug ) {
34 _PythonFunction = SUPERV::ListOfStrings() ;
35 _MyPyRunMethod = NULL ;
36 cdebug << "GraphBase::InLineNode::Node " << this
38 << (void *) Name() << " '" << Name() << " _Comment "
39 << (void *) Comment() << " " << Comment() << endl ;
42 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
43 SALOME_NamingService* ptrNamingService ,
44 const SALOME_ModuleCatalog::Service& NodeService ,
45 const char *NodeName ,
46 const SUPERV::KindOfNode akind ,
47 const SUPERV::SDate NodeFirstCreation ,
48 const SUPERV::SDate NodeLastModification ,
49 const char * NodeEditorRelease ,
50 const char * NodeAuthor ,
51 const char * NodeComment ,
52 const bool GeneratedName ,
55 int * Graph_prof_debug ,
56 ofstream * Graph_fdebug ) :
57 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
59 NodeName , akind , NodeFirstCreation ,
60 NodeLastModification ,
62 NodeAuthor , NodeComment , GeneratedName ,
64 Graph_prof_debug , Graph_fdebug ) {
66 _PythonFunction = SUPERV::ListOfStrings() ;
67 _MyPyRunMethod = NULL ;
68 cdebug_in << "GraphBase::InLineNode::Node " << this
70 << (void *) Name() << " '" << Name() << " _Comment "
71 << (void *) Comment() << " " << Comment() << " "
72 << " KindOfNode " << Kind()
73 << " ServiceName " << ServiceName() << " In("
74 << ServiceInParameter().length()
75 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
77 cdebug_out << "GraphBase::InLineNode::Node" << endl;
80 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
81 SALOME_NamingService* ptrNamingService ,
82 const char * FuncName ,
83 const SUPERV::ListOfStrings & aPythonFunction ,
84 const char *NodeName ,
85 const SUPERV::KindOfNode akind ,
86 const SUPERV::SDate NodeFirstCreation ,
87 const SUPERV::SDate NodeLastModification ,
88 const char * NodeEditorRelease ,
89 const char * NodeAuthor ,
90 const char * NodeComment ,
91 const bool GeneratedName ,
94 int * Graph_prof_debug ,
95 ofstream * Graph_fdebug ) :
96 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
97 SALOME_ModuleCatalog::Service() ,
98 NodeName , akind , NodeFirstCreation ,
99 NodeLastModification , NodeEditorRelease ,
100 NodeAuthor , NodeComment , GeneratedName ,
102 Graph_prof_debug , Graph_fdebug ) {
104 cdebug_in << "GraphBase::InLineNode::Node " << this
106 << (void *) Name() << " '" << Name() << " _Comment "
107 << (void *) Comment() << " " << Comment() << " "
108 << " KindOfNode " << Kind() << " FuncName " << FuncName
109 << " ServiceName " << ServiceName() << " In("
110 << ServiceInParameter().length()
111 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
114 SetPythonFunction( FuncName , aPythonFunction ) ;
115 _MyPyRunMethod = NULL ;
116 SALOME_ModuleCatalog::Service aNodeService ;
117 aNodeService.ServiceName = NodeName ;
119 SetService( aNodeService ) ;
120 cdebug_out << "GraphBase::InLineNode::Node" << endl;
123 GraphBase::InLineNode::~InLineNode() {
124 cdebug << "GraphBase::InLineNode::~Node " << this
126 << (void *) Name() << " " << Name() << " _Comment "
127 << (void *) Comment() << " " << Comment() << " " << endl ;
128 // if ( _ComponentName != NULLSTRING )
129 // delete [] _ComponentName ;
131 // delete [] _EditorRelease ;
132 // if ( _Author != NULLSTRING )
133 // delete [] _Author ;
134 // if ( _Computer != FACTORYSERVER )
135 // delete [] _Computer;
136 // if ( _Comment != NULLSTRING )
137 // delete [] _Comment;
140 void GraphBase::InLineNode::SetPythonFunction( const char * FuncName ,
141 const SUPERV::ListOfStrings & aPythonFunction ) {
143 cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length() ;
144 if ( aPythonFunction.length() == 1 ) {
145 cdebug << " aPythonFunction[ 0 ] '" << aPythonFunction[ 0 ] << "'" ;
147 cdebug << " FuncName " << FuncName << endl ;
148 _FuncName = my_strblkdup( FuncName ) ;
149 cdebug << "GraphBase::InLineNode::SetPythonFunction FuncName '" << FuncName << "' --> '"
150 << _FuncName << "'" << endl ;
151 if ( ( aPythonFunction.length() == 0 ) ||
152 ( aPythonFunction.length() == 1 && strlen( aPythonFunction[ 0 ] ) == 0 ) ) {
153 _PythonFunction.length( 0 ) ;
156 _PythonFunction.length( aPythonFunction.length() ) ;
157 for ( i = 0 ; i < (int ) aPythonFunction.length() ; i++ ) {
158 cdebug << aPythonFunction[ i ] << endl ;
159 _PythonFunction[ i ] = CORBA::string_dup( aPythonFunction[ i ] ) ;
164 //bool GraphBase::InLineNode::SaveXML( ostream &f , char *Tabs ,
165 bool GraphBase::InLineNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
166 int XCoordinate , int YCoordinate ) const {
167 GraphBase::ListOfFuncName aFuncNames ;
168 GraphBase::ListOfPythonFunctions aPythonFunction ;
169 if ( PyFuncName() ) {
170 aFuncNames.resize( 1 ) ;
171 aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
172 aPythonFunction.resize( 1 ) ;
173 aPythonFunction[0] = PythonFunction() ;
175 // return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" , "" ,
176 return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" , "" ,
177 aFuncNames , aPythonFunction ,
178 XCoordinate , YCoordinate ) ;
181 bool GraphBase::InLineNode::SavePY(ostream &f , const char * aGraphName ,
182 int XCoordinate , int YCoordinate ) const {
183 GraphBase::ListOfFuncName aFuncNames ;
184 GraphBase::ListOfPythonFunctions aPythonFunction ;
185 if ( PyFuncName() ) {
186 aFuncNames.resize( 1 ) ;
187 aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
188 aPythonFunction.resize( 1 ) ;
189 aPythonFunction[0] = PythonFunction() ;
191 return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" , NULL ,
192 aFuncNames , aPythonFunction ,
193 XCoordinate , YCoordinate ) ;