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_FactoryNode.cxx
8 // Author : Jean Rahuel, CEA
16 #include "DataFlowBase_FactoryNode.hxx"
18 static void InitFields( char * &_ComponentName ,
19 char * &_InterfaceName ,
21 _ComponentName = NULLSTRING ;
22 _InterfaceName = NULLSTRING ;
24 _Computer = FACTORYSERVER ;
27 GraphBase::FactoryNode::FactoryNode() :
28 GraphBase::ComputingNode::ComputingNode() {
30 InitFields( _ComponentName ,
33 _Container = Engines::Container::_nil() ;
34 _ObjComponent = Engines::Component::_nil() ;
35 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
37 << (void *) _ComponentName << " " << _ComponentName << " _Name "
38 << (void *) Name() << " " << Name() << " _Computer "
39 << (void *) _Computer << " " << _Computer << " _Comment "
40 << (void *) Comment() << " " << Comment() << " " << endl ;
44 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
45 SALOME_NamingService* ptrNamingService ,
46 const char * aDataFlowName ,
47 int * Graph_prof_debug ,
48 ofstream * Graph_fdebug ) :
49 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aDataFlowName ,
50 Graph_prof_debug , Graph_fdebug ) {
52 InitFields( _ComponentName ,
56 _Container = Engines::Container::_nil() ;
57 _ObjComponent = Engines::Component::_nil() ;
59 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
61 << (void *) _ComponentName << " '" << _ComponentName
62 << "' _InterfaceName "
63 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
64 << (void *) Name() << " '" << Name() << "' _Computer "
65 << (void *) _Computer << " " << _Computer << " _Comment "
66 << (void *) Comment() << " " << Comment() << " " << endl ;
69 GraphBase::FactoryNode::FactoryNode( CORBA::ORB_ptr ORB ,
70 SALOME_NamingService * ptrNamingService ,
71 const SALOME_ModuleCatalog::Service& aService ,
72 const char * ComponentName ,
73 const char * InterfaceName ,
74 const char * NodeName ,
75 const SUPERV::KindOfNode akind ,
76 const SUPERV::SDate NodeFirstCreation ,
77 const SUPERV::SDate NodeLastModification ,
78 const char * NodeEditorRelease ,
79 const char * NodeAuthor ,
80 const char * NodeComputer ,
81 const char * NodeComment ,
82 const bool GeneratedName ,
85 int * Graph_prof_debug ,
86 ofstream * Graph_fdebug ) :
87 GraphBase::ComputingNode::ComputingNode( ORB , ptrNamingService , aService ,
89 NodeFirstCreation , NodeLastModification ,
90 NodeEditorRelease , NodeAuthor , NodeComment ,
91 GeneratedName , X , Y ,
92 Graph_prof_debug , Graph_fdebug ) {
94 _Container = Engines::Container::_nil() ;
95 _ObjComponent = Engines::Component::_nil() ;
97 _ComponentName = new char[strlen(ComponentName)+1];
98 strcpy(_ComponentName , ComponentName ) ;
100 _InterfaceName = new char[strlen(InterfaceName)+1];
101 strcpy(_InterfaceName , InterfaceName ) ;
103 if ( NodeComputer != NULLSTRING) {
104 _Computer = new char[ strlen( NodeComputer ) + 1 ] ;
105 strcpy( _Computer , NodeComputer ) ;
108 _Computer = FACTORYSERVER ;
111 cdebug_in << "GraphBase::FactoryNode::FactoryNode( '" << aService.ServiceName << "','"
112 << _ComponentName << "','" << Name() << "'," << akind << ",'" << _Computer << "'" << endl;
114 cdebug << "GraphBase::FactoryNode::FactoryNode " << this
115 << " _ComponentName "
116 << (void *) _ComponentName << " '" << _ComponentName
117 << "' _InterfaceName "
118 << (void *) _InterfaceName << " '" << _InterfaceName << "' _Name "
119 << (void *) Name() << " '" << Name() << "' _Computer "
120 << (void *) _Computer << " " << _Computer << " _Comment "
121 << (void *) Comment() << " '" << Comment() << " "
122 << "' KindOfNode " << Kind()
123 << " ServiceName " << ServiceName() << " In(" << ServiceInParameter().length()
124 << ") Out(" << ServiceOutParameter().length() << ")" << endl ;
126 cdebug_out << "GraphBase::FactoryNode::FactoryNode" << endl;
129 GraphBase::FactoryNode::~FactoryNode() {
130 cdebug << "GraphBase::Node::~Node " << this
132 << (void *) _ComponentName << " " << _ComponentName << " _Name "
133 << (void *) Name() << " " << Name() << " _Computer "
134 << (void *) _Computer << " " << _Computer << " _Comment "
135 << (void *) Comment() << " " << Comment() << " " << endl ;
136 // if ( _ComponentName != NULLSTRING )
137 // delete [] _ComponentName ;
139 // delete [] _EditorRelease ;
140 // if ( _Author != NULLSTRING )
141 // delete [] _Author ;
142 // if ( _Computer != FACTORYSERVER )
143 // delete [] _Computer;
144 // if ( _Comment != NULLSTRING )
145 // delete [] _Comment;
148 bool GraphBase::FactoryNode::ComponentName(const char * aComponentName) {
149 if ( _ComponentName && _ComponentName != NULLSTRING )
150 delete [] _ComponentName ;
151 _ComponentName = new char[strlen(aComponentName)+1] ;
152 strcpy( _ComponentName , aComponentName ) ;
156 bool GraphBase::FactoryNode::InterfaceName(const char * anInterfaceName) {
157 if ( _InterfaceName && _InterfaceName != NULLSTRING )
158 delete [] _InterfaceName ;
159 _InterfaceName = new char[strlen(anInterfaceName)+1] ;
160 strcpy( _InterfaceName , anInterfaceName ) ;
164 bool GraphBase::FactoryNode::Computer(const char *c) {
165 cdebug_in << "GraphBase::FactoryNode::Computer" << endl;
166 if ( _Computer != FACTORYSERVER )
167 delete [] _Computer ;
168 _Computer = my_strdup(c);
169 cdebug_in << "GraphBase::FactoryNode::Computer('" << _Computer << "')" << endl;
170 cdebug_out << "GraphBase::FactoryNode::Computer" << endl;
174 //bool GraphBase::FactoryNode::SaveXML( ostream &f , char *Tabs ,
175 bool GraphBase::FactoryNode::SaveXML( QDomDocument & Graph , QDomElement & info ,
176 int XCoordinate , int YCoordinate ) const {
177 GraphBase::ListOfFuncName aFuncNames ;
178 GraphBase::ListOfPythonFunctions aVoidList ;
179 // return GraphBase::ComputingNode::SaveXML( f , Tabs , ComponentName() ,
180 return GraphBase::ComputingNode::SaveXML( Graph , info , ComponentName() ,
181 InterfaceName() , Computer() , "" ,
182 aFuncNames , aVoidList ,
183 XCoordinate , YCoordinate ) ;
186 bool GraphBase::FactoryNode::SavePY(ostream &f , const char * aGraphName ,
187 int XCoordinate , int YCoordinate ) const {
188 GraphBase::ListOfFuncName aFuncNames ;
189 GraphBase::ListOfPythonFunctions aVoidList ;
190 return GraphBase::ComputingNode::SavePY( f , aGraphName , ComponentName() ,
191 InterfaceName() , Computer() , NULL ,
192 aFuncNames , aVoidList ,
193 XCoordinate , YCoordinate ) ;