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 ostream * 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 ostream * 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 cdebug_in << "GraphBase::InLineNode::Node " << this
63 << (void *) Name() << " '" << Name() << " _Comment "
64 << (void *) Comment() << " " << Comment() << " "
65 << " KindOfNode " << Kind()
66 << " ServiceName " << ServiceName() << " In("
67 << ServiceInParameter().length()
68 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
70 cdebug_out << "GraphBase::InLineNode::Node" << endl;
73 GraphBase::InLineNode::InLineNode( CORBA::ORB_ptr ORB ,
74 SALOME_NamingService* ptrNamingService ,
75 const char * FuncName ,
76 const SUPERV::ListOfStrings & aPythonFunction ,
77 const char *NodeName ,
78 const SUPERV::KindOfNode akind ,
79 const SUPERV::SDate NodeFirstCreation ,
80 const SUPERV::SDate NodeLastModification ,
81 const char * NodeEditorRelease ,
82 const char * NodeAuthor ,
83 const char * NodeComment ,
84 const bool GeneratedName ,
87 int * Graph_prof_debug ,
88 ostream * Graph_fdebug ) :
89 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService ,
90 SALOME_ModuleCatalog::Service() ,
91 NodeName , akind , NodeFirstCreation ,
92 NodeLastModification , NodeEditorRelease ,
93 NodeAuthor , NodeComment , GeneratedName ,
95 Graph_prof_debug , Graph_fdebug ) {
97 cdebug_in << "GraphBase::InLineNode::Node " << this
99 << (void *) Name() << " '" << Name() << " _Comment "
100 << (void *) Comment() << " " << Comment() << " "
101 << " KindOfNode " << Kind() << " FuncName " << FuncName
102 << " ServiceName " << ServiceName() << " In("
103 << ServiceInParameter().length()
104 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
106 SetPythonFunction( FuncName , aPythonFunction ) ;
107 SALOME_ModuleCatalog::Service aNodeService ;
108 aNodeService.ServiceName = NodeName ;
110 SetService( aNodeService ) ;
111 cdebug_out << "GraphBase::InLineNode::Node" << endl;
114 GraphBase::InLineNode::~InLineNode() {
115 cdebug << "GraphBase::InLineNode::~Node " << this
117 << (void *) Name() << " " << Name() << " _Comment "
118 << (void *) Comment() << " " << Comment() << " " << endl ;
119 // if ( _ComponentName != NULLSTRING )
120 // delete [] _ComponentName ;
122 // delete [] _EditorRelease ;
123 // if ( _Author != NULLSTRING )
124 // delete [] _Author ;
125 // if ( _Computer != FACTORYSERVER )
126 // delete [] _Computer;
127 // if ( _Comment != NULLSTRING )
128 // delete [] _Comment;
131 void GraphBase::InLineNode::SetPythonFunction( const char * FuncName ,
132 const SUPERV::ListOfStrings & aPythonFunction ) {
134 cdebug << "GraphBase::InLineNode::PythonFunction length " << aPythonFunction.length()
136 _FuncName = my_strdup( FuncName ) ;
137 if ( ( aPythonFunction.length() == 0 ) ||
138 ( aPythonFunction.length() == 1 && strlen( aPythonFunction[ 0 ] ) == 0 ) ) {
139 _PythonFunction.length( 0 ) ;
142 _PythonFunction.length( aPythonFunction.length() ) ;
143 for ( i = 0 ; i < aPythonFunction.length() ; i++ ) {
144 cdebug << aPythonFunction[ i ] << endl ;
145 _PythonFunction[ i ] = CORBA::string_dup( aPythonFunction[ i ] ) ;
150 //bool GraphBase::InLineNode::SaveXML( ostream &f , char *Tabs ,
151 bool GraphBase::InLineNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
152 int XCoordinate , int YCoordinate ) const {
153 GraphBase::ListOfFuncName aFuncNames ;
154 GraphBase::ListOfPythonFunctions aPythonFunction ;
155 if ( PyFuncName() ) {
156 aFuncNames.resize( 1 ) ;
157 aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
158 aPythonFunction.resize( 1 ) ;
159 aPythonFunction[0] = PythonFunction() ;
161 // return GraphBase::ComputingNode::SaveXML( f , Tabs , "" , "" , "" , "" ,
162 return GraphBase::ComputingNode::SaveXML( Graph , info , "" , "" , "" , "" ,
163 aFuncNames , aPythonFunction ,
164 XCoordinate , YCoordinate ) ;
167 bool GraphBase::InLineNode::SavePY(ostream &f , const char * aGraphName ,
168 int XCoordinate , int YCoordinate ) const {
169 GraphBase::ListOfFuncName aFuncNames ;
170 GraphBase::ListOfPythonFunctions aPythonFunction ;
171 if ( PyFuncName() ) {
172 aFuncNames.resize( 1 ) ;
173 aFuncNames[0] = CORBA::string_dup( PyFuncName() ) ;
174 aPythonFunction.resize( 1 ) ;
175 aPythonFunction[0] = PythonFunction() ;
177 return GraphBase::ComputingNode::SavePY( f , aGraphName , "" , "" , "" , NULL ,
178 aFuncNames , aPythonFunction ,
179 XCoordinate , YCoordinate ) ;