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() {
20 _PythonFunction = SUPERV::ListOfStrings() ;
23 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
24 SALOME_NamingService* ptrNamingService ,
25 const char * aDataFlowName ,
26 int * Graph_prof_debug ,
27 ofstream * Graph_fdebug ) :
28 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
29 Graph_prof_debug , Graph_fdebug ) {
30 _PythonFunction = SUPERV::ListOfStrings() ;
31 cdebug << "GraphBase::InLineNode::Node " << this
33 << (void *) Name() << " '" << Name() << " _Comment "
34 << (void *) Comment() << " " << Comment() << " " << endl ;
37 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
38 SALOME_NamingService* ptrNamingService ,
39 const SALOME_ModuleCatalog::Service& NodeService ,
40 const char *NodeName ,
41 const SUPERV::KindOfNode akind ,
42 const SUPERV::SDate NodeFirstCreation ,
43 const SUPERV::SDate NodeLastModification ,
44 const char * NodeEditorRelease ,
45 const char * NodeAuthor ,
46 const char * NodeComment ,
47 const bool GeneratedName ,
50 int * Graph_prof_debug ,
51 ofstream * Graph_fdebug ) :
52 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
54 NodeName , akind , NodeFirstCreation ,
55 NodeLastModification ,
57 NodeAuthor , NodeComment , GeneratedName ,
59 Graph_prof_debug , Graph_fdebug ) {
60 _PythonFunction = SUPERV::ListOfStrings() ;
61 _MyPyRunMethod = NULL ;
62 cdebug_in << "GraphBase::InLineNode::Node " << this
64 << (void *) Name() << " '" << Name() << " _Comment "
65 << (void *) Comment() << " " << Comment() << " "
66 << " KindOfNode " << Kind()
67 << " ServiceName " << ServiceName() << " In("
68 << ServiceInParameter().length()
69 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
71 cdebug_out << "GraphBase::InLineNode::Node" << endl;
74 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
75 SALOME_NamingService* ptrNamingService ,
76 const char * FuncName ,
77 const SUPERV::ListOfStrings & aPythonFunction ,
78 const char *NodeName ,
79 const SUPERV::KindOfNode akind ,
80 const SUPERV::SDate NodeFirstCreation ,
81 const SUPERV::SDate NodeLastModification ,
82 const char * NodeEditorRelease ,
83 const char * NodeAuthor ,
84 const char * NodeComment ,
85 const bool GeneratedName ,
88 int * Graph_prof_debug ,
89 ofstream * Graph_fdebug ) :
90 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
91 SALOME_ModuleCatalog::Service() ,
92 NodeName , akind , NodeFirstCreation ,
93 NodeLastModification , NodeEditorRelease ,
94 NodeAuthor , NodeComment , GeneratedName ,
96 Graph_prof_debug , Graph_fdebug ) {
98 cdebug_in << "GraphBase::InLineNode::Node " << this
100 << (void *) Name() << " '" << Name() << " _Comment "
101 << (void *) Comment() << " " << Comment() << " "
102 << " KindOfNode " << Kind() << " FuncName " << FuncName
103 << " ServiceName " << ServiceName() << " In("
104 << ServiceInParameter().length()
105 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
107 _MyPyRunMethod = NULL ;
108 SetPythonFunction( FuncName , aPythonFunction ) ;
109 SALOME_ModuleCatalog::Service aNodeService ;
110 aNodeService.ServiceName = NodeName ;
112 SetService( aNodeService ) ;
113 cdebug_out << "GraphBase::InLineNode::Node" << endl;
116 GraphBase::InLineNode::~InLineNode() {
117 cdebug << "GraphBase::InLineNode::~Node " << this
119 << (void *) Name() << " " << Name() << " _Comment "
120 << (void *) Comment() << " " << Comment() << " " << endl ;
121 // if ( _ComponentName != NULLSTRING )
122 // delete [] _ComponentName ;
124 // delete [] _EditorRelease ;
125 // if ( _Author != NULLSTRING )
126 // delete [] _Author ;
127 // if ( _Computer != FACTORYSERVER )
128 // delete [] _Computer;
129 // if ( _Comment != NULLSTRING )
130 // delete [] _Comment;
133 void GraphBase::InLineNode::SetPythonFunction( const char * FuncName ,
134 const SUPERV::ListOfStrings & aPythonFunction ) {
136 cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length() ;
137 if ( aPythonFunction.length() == 1 ) {
138 cdebug << " aPythonFunction[ 0 ] '" << aPythonFunction[ 0 ] << "'" ;
140 cdebug << " FuncName " << FuncName << endl ;
141 _FuncName = my_strblkdup( FuncName ) ;
142 cdebug << "GraphBase::InLineNode::SetPythonFunction FuncName '" << FuncName << "' --> '"
143 << _FuncName << "'" << endl ;
144 if ( ( aPythonFunction.length() == 0 ) ||
145 ( aPythonFunction.length() == 1 && strlen( aPythonFunction[ 0 ] ) == 0 ) ) {
146 _PythonFunction.length( 0 ) ;
149 _PythonFunction.length( aPythonFunction.length() ) ;
150 for ( i = 0 ; i < (int ) aPythonFunction.length() ; i++ ) {
151 cdebug << aPythonFunction[ i ] << endl ;
152 _PythonFunction[ i ] = CORBA::string_dup( aPythonFunction[ i ] ) ;
157 //bool GraphBase::InLineNode::SaveXML( ostream &f , char *Tabs ,
158 bool GraphBase::InLineNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
159 int XCoordinate , int YCoordinate ) const {
160 GraphBase::ListOfFuncName aFuncNames ;
161 GraphBase::ListOfPythonFunctions aPythonFunction ;
162 if ( PyFuncName() ) {
163 aFuncNames.resize( 1 ) ;
164 aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
165 aPythonFunction.resize( 1 ) ;
166 aPythonFunction[0] = PythonFunction() ;
168 // return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" , "" ,
169 return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" , "" ,
170 aFuncNames , aPythonFunction ,
171 XCoordinate , YCoordinate ) ;
174 bool GraphBase::InLineNode::SavePY(ostream &f , const char * aGraphName ,
175 int XCoordinate , int YCoordinate ) const {
176 GraphBase::ListOfFuncName aFuncNames ;
177 GraphBase::ListOfPythonFunctions aPythonFunction ;
178 if ( PyFuncName() ) {
179 aFuncNames.resize( 1 ) ;
180 aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
181 aPythonFunction.resize( 1 ) ;
182 aPythonFunction[0] = PythonFunction() ;
184 return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" , NULL ,
185 aFuncNames , aPythonFunction ,
186 XCoordinate , YCoordinate ) ;